import React, { useState } from 'react'; import { View, Text, Pressable } from 'react-native'; import { ThemeProvider, useT, T, Screen, Scroll, Header, NavBar, Card, Group, Row, Button, Segmented, Chip, Pill, Stat, Spark, Bars, Progress, TabBar, Tabs, Stack, Icon, Spacer, SectionTitle, alpha } from './ui/kit'; const ACCENT = '#4ADE80'; const THEME = { dark: { bg: '#07090B', card: '#111518', card2: '#1A2126', line: '#1E262B', text2: '#95A3AC', text3: '#5A6871' }, light: { bg: '#F1F5F3', card: '#FFFFFF', card2: '#E1E9E4' } }; const IDX = [{ n: 'S&P 500', v: '5,308', c: 0.6 }, { n: 'NASDAQ', v: '16,742', c: 1.1 }, { n: 'DOW', v: '39,806', c: -0.2 }, { n: 'VIX', v: '12.4', c: -3.4 }]; const ST = [ { sym: 'AAPL', name: 'Apple', px: 189.84, chg: 1.24, s: [182, 184, 183, 186, 185, 187, 188, 189, 190, 189.8], shares: 24 }, { sym: 'NVDA', name: 'NVIDIA', px: 924.79, chg: 3.6, s: [860, 870, 880, 875, 890, 905, 900, 915, 920, 924.8], shares: 4 }, { sym: 'TSLA', name: 'Tesla', px: 177.58, chg: -2.1, s: [185, 183, 184, 181, 182, 180, 179, 178, 178.5, 177.6], shares: 10 }, { sym: 'MSFT', name: 'Microsoft', px: 420.21, chg: 0.8, s: [410, 412, 415, 413, 416, 418, 417, 419, 420, 420.2], shares: 8 }, { sym: 'AMZN', name: 'Amazon', px: 184.7, chg: 0.3, s: [180, 182, 181, 183, 184, 183, 185, 184, 184.5, 184.7], shares: 12 }, { sym: 'DIS', name: 'Disney', px: 102.9, chg: -1.4, s: [108, 107, 106, 106.5, 105, 104, 104.5, 103, 103.2, 102.9], shares: 15 }, ]; const NEWS = [ { h: 'Chipmakers rally as AI demand outpaces supply forecasts', s: 'Markets · 2h', c: '#A78BFA' }, { h: 'Fed minutes point to patience on rate cuts', s: 'Economy · 4h', c: '#38BDF8' }, { h: 'Apple previews on-device models ahead of developer week', s: 'Tech · 6h', c: '#4ADE80' }, ]; const usd = (n) => '$' + n.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }); function SymbolTile({ sym, color }) { const t = useT(); return {sym}; } function WatchlistScreen({ nav }) { const t = useT(); return (
} /> {IDX.map((i) => ( {i.n} {i.v} = 0 ? t.success : t.danger, fontWeight: '700' }]}>{(i.c >= 0 ? '+' : '') + i.c}% ))} {}} /> {ST.map((s) => ( } title={s.name} subtitle={s.sym + ' · NASDAQ'} right={= 0 ? t.success : t.danger} dot={false} fill={false} stroke={2} />} value={usd(s.px)} sub2={(s.chg >= 0 ? '+' : '') + s.chg + '%'} onPress={() => nav.push('stock', { sym: s.sym })} /> ))} ); } function PortfolioScreen({ nav }) { const t = useT(); const total = ST.reduce((a, s) => a + s.px * s.shares, 0); return (
} /> {ST.slice(0, 4).map((s) => { const v = s.px * s.shares; return ( {s.sym}{Math.round((v / total) * 100)}% · {usd(v)} ); })} {ST.map((s) => } title={s.name} subtitle={s.shares + ' shares'} value={usd(s.px * s.shares)} sub2={(s.chg >= 0 ? '+' : '') + s.chg + '%'} onPress={() => nav.push('stock', { sym: s.sym })} />)} ); } function NewsScreen() { const t = useT(); return (
{NEWS.map((n, i) => ( {}}> {n.h} {n.s} ))} } title="NVIDIA" subtitle="Wed, after close" right={} /> } title="Disney" subtitle="Thu, before open" right={} /> ); } function StockDetail({ nav, params }) { const t = useT(); const s = ST.find((x) => x.sym === params.sym) || ST[0]; const [range, setRange] = useState('1M'); const up = s.chg >= 0; return ( } /> {s.name} {usd(s.px)} {(up ? '+' : '') + s.chg}%