OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, set personalized alerts, and explore detailed company insights — built openly, for everyone, forever free.
feat(ui): redesign the app in the dashboard-craft language
ravixalgorithm74cc4307b917
diff --git a/app/(auth)/layout.tsx b/app/(auth)/layout.tsxindex 3501fc9..89dff50 100644--- a/app/(auth)/layout.tsx+++ b/app/(auth)/layout.tsx@@ -1,20 +1,20 @@import Link from "next/link";import React from "react";import Image from "next/image";-import {headers} from "next/headers";import {redirect} from "next/navigation";-import {auth} from "@/lib/better-auth/auth";+import {getSession} from "@/lib/better-auth/auth";+import ProductPreview from "@/components/landing/ProductPreview";const Layout = async ({ children }: { children : React.ReactNode }) => {- const session = await auth.api.getSession({headers: await headers()});+ const session = await getSession();- if (session?.user) redirect('/')+ if (session?.user) redirect('/dashboard')return (<main className="auth-layout"><section className="auth-left-section scrollbar-hide-default"><Link href="/" className="auth-logo flex items-center gap-2">- <Image src="/assets/images/logo.png" alt="Openstock" width={200} height={50}/>+ <Image src="/assets/images/logo.png" alt="OpenStock" width={140} height={35} priority /></Link><div className="pb-6 lg:pb-8 flex-1">@@ -38,8 +38,10 @@ const Layout = async ({ children }: { children : React.ReactNode }) => {</div></div></div>- <div className="flex-1 relative">- <Image src="/assets/images/dashboard.png" alt="Dashboard Preview" width={1440} height={1150} className="auth-dashboard-preview absolute top-0" />+ <div className="relative flex-1" aria-hidden>+ <div className="auth-dashboard-preview absolute top-0">+ <ProductPreview />+ </div></div></section>diff --git a/app/(auth)/sign-in/page.tsx b/app/(auth)/sign-in/page.tsxindex 1514cf9..1302ed1 100644--- a/app/(auth)/sign-in/page.tsx+++ b/app/(auth)/sign-in/page.tsx@@ -9,6 +9,7 @@ import { toast } from "sonner";import Link from "next/link";import { useRouter } from "next/navigation";import OpenDevSocietyBranding from "@/components/OpenDevSocietyBranding";+import SocialAuthButtons from "@/components/forms/SocialAuthButtons";import React from "react";const SignIn = () => {@@ -29,7 +30,7 @@ const SignIn = () => {try {const result = await signInWithEmail(data);if (result.success) {- router.push('/');+ router.push('/dashboard');return;}toast.error('Sign in failed', {@@ -45,7 +46,10 @@ const SignIn = () => {return (<>- <h1 className="form-title">Welcome back</h1>+ <h1 className="form-title mb-2">Welcome back</h1>+ <p className="mb-8 text-faint">Sign in to your watchlist and alerts.</p>++ <SocialAuthButtons /><form onSubmit={handleSubmit(onSubmit)} className="space-y-5"><InputField@@ -57,7 +61,7 @@ const SignIn = () => {validation={{required: 'Email is required',pattern: {- value: /^[\w-.]+@([\w-]+\.)+[\w-]{2,}$/,+ value: /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,message: 'Please enter a valid email address'}}}@@ -85,15 +89,6 @@ const SignIn = () => {<FooterLink text="Don't have an account?" linkText="Create an account" href="/sign-up" /><OpenDevSocietyBranding outerClassName="mt-10 flex justify-center" />- <div className="mt-5 flex justify-center">- <a href="https://peerlist.io/ravixalgorithm/project/openstock" target="_blank" rel="noreferrer">- <img- src="https://peerlist.io/api/v1/projects/embed/PRJH8OED7MBL9MGB9HRMKAKLM66KNN?showUpvote=true&theme=light"- alt="OpenStock"- style={{ width: 'auto', height: '72px' }}- />- </a>- </div></form></>);diff --git a/app/(auth)/sign-up/page.tsx b/app/(auth)/sign-up/page.tsxindex a3a9e32..10b7308 100644--- a/app/(auth)/sign-up/page.tsx+++ b/app/(auth)/sign-up/page.tsx@@ -3,7 +3,7 @@import { useForm } from "react-hook-form";import { Button } from "@/components/ui/button";import InputField from "@/components/forms/InputField";-import SelectField from "@/components/forms/SelectField";+import ChoiceChips from "@/components/forms/ChoiceChips";import PasswordRequirements from "@/components/forms/PasswordRequirements";import { INVESTMENT_GOALS, PASSWORD_VALIDATION, PREFERRED_INDUSTRIES, RISK_TOLERANCE_OPTIONS } from "@/lib/constants";import { CountrySelectField } from "@/components/forms/CountrySelectField";@@ -12,6 +12,7 @@ import { signUpWithEmail } from "@/lib/actions/auth.actions";import { useRouter } from "next/navigation";import { toast } from "sonner";import OpenDevSocietyBranding from "@/components/OpenDevSocietyBranding";+import SocialAuthButtons from "@/components/forms/SocialAuthButtons";import React from "react";const SignUp = () => {@@ -41,7 +42,7 @@ const SignUp = () => {try {const result = await signUpWithEmail(data);if (result.success) {- router.push('/');+ router.push('/dashboard');return;}toast.error('Sign up failed', {@@ -57,98 +58,74 @@ const SignUp = () => {return (<>- <h1 className="form-title">Sign Up & Personalize</h1>+ <h1 className="form-title mb-2">Create your account</h1>+ <p className="mb-8 text-faint">Free and open source. No card needed.</p>- <form onSubmit={handleSubmit(onSubmit)} className="space-y-5">- <InputField- name="fullName"- label="Full Name"- placeholder="Enter full name"- register={register}- error={errors.fullName}- validation={{ required: 'Full name is required', minLength: 2 }}- />+ <SocialAuthButtons />- <InputField- name="email"- label="Email"- placeholder="[email protected]"- register={register}- error={errors.email}- validation={{- required: 'Email is required',- pattern: {- value: /^[\w-.]+@([\w-]+\.)+[\w-]{2,}$/,- message: 'Please enter a valid email address'- }- }}- />-- <InputField- name="password"- label="Password"- placeholder="Enter a strong password"- type="password"- register={register}- error={errors.password}- validation={PASSWORD_VALIDATION}- />- <PasswordRequirements password={passwordValue ?? ''} />-- <CountrySelectField- name="country"- label="Country"- control={control}- error={errors.country}- required- />-- <SelectField- name="investmentGoals"- label="Investment Goals"- placeholder="Select your investment goal"- options={INVESTMENT_GOALS}- control={control}- error={errors.investmentGoals}- required- />-- <SelectField- name="riskTolerance"- label="Risk Tolerance"- placeholder="Select your risk level"- options={RISK_TOLERANCE_OPTIONS}- control={control}- error={errors.riskTolerance}- required- />-- <SelectField- name="preferredIndustry"- label="Preferred Industry"- placeholder="Select your preferred industry"- options={PREFERRED_INDUSTRIES}- control={control}- error={errors.preferredIndustry}- required- />-- <Button type="submit" disabled={isSubmitting} className="yellow-btn w-full mt-5">- {isSubmitting ? 'Creating Account' : 'Start Your Investing Journey'}- </Button>+ <form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-8">+ <section className="flex flex-col gap-4" aria-label="Account">+ <InputField+ name="fullName"+ label="Full name"+ placeholder="Your name"+ register={register}+ error={errors.fullName}+ validation={{ required: 'Full name is required', minLength: 2 }}+ />+ <InputField+ name="email"+ label="Email"+ placeholder="[email protected]"+ register={register}+ error={errors.email}+ validation={{+ required: 'Email is required',+ pattern: {+ value: /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,+ message: 'Please enter a valid email address'+ }+ }}+ />+ <div className="flex flex-col gap-2">+ <InputField+ name="password"+ label="Password"+ placeholder="At least 8 characters"+ type="password"+ register={register}+ error={errors.password}+ validation={PASSWORD_VALIDATION}+ />+ <PasswordRequirements password={passwordValue ?? ''} />+ </div>+ </section>- <FooterLink text="Already have an account?" linkText="Sign in" href="/sign-in" />+ <section className="flex flex-col gap-5 border-t border-line pt-6" aria-labelledby="personalize">+ <div>+ <p id="personalize" className="kicker text-brand-ink">Personalize</p>+ <p className="mt-1 text-[13px] text-faint">Used to tailor your welcome email.</p>+ </div>+ <CountrySelectField+ name="country"+ label="Country"+ control={control}+ error={errors.country}+ required+ />+ <ChoiceChips name="investmentGoals" label="Investment goal" options={INVESTMENT_GOALS} control={control} />+ <ChoiceChips name="riskTolerance" label="Risk tolerance" options={RISK_TOLERANCE_OPTIONS} control={control} />+ <ChoiceChips name="preferredIndustry" label="Preferred industry" options={PREFERRED_INDUSTRIES} control={control} />+ </section>- <OpenDevSocietyBranding outerClassName="mt-10 flex justify-center" />- <div className="mt-5 flex justify-center">- <a href="https://peerlist.io/ravixalgorithm/project/openstock" target="_blank" rel="noreferrer">- <img- src="https://peerlist.io/api/v1/projects/embed/PRJH8OED7MBL9MGB9HRMKAKLM66KNN?showUpvote=true&theme=light"- alt="OpenStock"- style={{ width: 'auto', height: '72px' }}- />- </a>+ <div className="flex flex-col gap-4">+ <Button type="submit" disabled={isSubmitting} className="yellow-btn w-full">+ {isSubmitting ? 'Creating account' : 'Create account'}+ </Button>+ <FooterLink text="Already have an account?" linkText="Sign in" href="/sign-in" /></div>++ <OpenDevSocietyBranding outerClassName="flex justify-center" /></form></>)diff --git a/app/(root)/layout.tsx b/app/(root)/layout.tsxindex 677100c..c75d18b 100644--- a/app/(root)/layout.tsx+++ b/app/(root)/layout.tsx@@ -1,13 +1,12 @@-import Header from "@/components/Header";-import { auth } from "@/lib/better-auth/auth";-import { headers } from "next/headers";+import { getSession } from "@/lib/better-auth/auth";import { redirect } from "next/navigation";-import Footer from "@/components/Footer";+import AppShell from "@/components/shell/AppShell";import DonatePopup from "@/components/DonatePopup";-import SirayBanner from "@/components/SirayBanner";+import { searchStocks } from "@/lib/actions/finnhub.actions";+import { getUserWatchlist } from "@/lib/actions/watchlist.actions";const Layout = async ({ children }: { children: React.ReactNode }) => {- const session = await auth.api.getSession({ headers: await headers() });+ const session = await getSession();if (!session?.user) redirect('/sign-in');@@ -17,18 +16,22 @@ const Layout = async ({ children }: { children: React.ReactNode }) => {email: session.user.email,}- return (- <main className="min-h-screen text-gray-400">- <SirayBanner />- <Header user={user} />+ const [initialStocks, watchlist] = await Promise.all([+ searchStocks(),+ getUserWatchlist(user.id),+ ]);- <div className="container py-10">+ return (+ <>+ <AppShell+ user={user}+ watchlist={watchlist.map(({ symbol, company }: { symbol: string; company: string }) => ({ symbol, company }))}+ initialStocks={initialStocks}+ >{children}- </div>-- <Footer />+ </AppShell><DonatePopup />- </main>+ </>)}-export default Layout\ No newline at end of file+export default Layoutdiff --git a/app/(root)/loading.tsx b/app/(root)/loading.tsxnew file mode 100644index 0000000..bcd8f11--- /dev/null+++ b/app/(root)/loading.tsx@@ -0,0 +1,21 @@+// Shown inside the workspace while a page renders, so navigation never feels frozen.+export default function Loading() {+ return (+ <div className="flex flex-col gap-3" aria-busy="true" aria-label="Loading">+ <div className="flex flex-col gap-2 px-1 pt-1">+ <span className="h-7 w-48 animate-pulse rounded-lg bg-hover" />+ <span className="h-4 w-72 animate-pulse rounded-md bg-hover/70" />+ </div>+ <section className="hatch">+ <div className="bento">+ {[0, 1, 2, 3].map((i) => (+ <div key={i} className="bento-tile h-[124px]"><span className="h-full animate-pulse rounded-lg bg-hover/60" /></div>+ ))}+ </div>+ </section>+ <section className="hatch">+ <div className="card h-[420px] animate-pulse" />+ </section>+ </div>+ );+}diff --git a/app/(root)/stocks/[symbol]/page.tsx b/app/(root)/stocks/[symbol]/page.tsxindex 2bf4884..3c750cd 100644--- a/app/(root)/stocks/[symbol]/page.tsx+++ b/app/(root)/stocks/[symbol]/page.tsx@@ -1,95 +1,80 @@+import { Suspense } from "react";import TradingViewWidget from "@/components/TradingViewWidget";-import WatchlistButton from "@/components/WatchlistButton";+import StockHeader, { StockHeaderSkeleton } from "@/components/stocks/StockHeader";import StockSentimentCard from "@/components/stocks/StockSentimentCard";+import Panel from "@/components/Panel";import {- SYMBOL_INFO_WIDGET_CONFIG,CANDLE_CHART_WIDGET_CONFIG,- BASELINE_WIDGET_CONFIG,TECHNICAL_ANALYSIS_WIDGET_CONFIG,COMPANY_PROFILE_WIDGET_CONFIG,COMPANY_FINANCIALS_WIDGET_CONFIG,} from "@/lib/constants";--import { auth } from '@/lib/better-auth/auth';-import { headers } from 'next/headers';-import { isStockInWatchlist } from '@/lib/actions/watchlist.actions';import { getStockSentimentInsights } from '@/lib/actions/adanos.actions';import { formatSymbolForTradingView } from '@/lib/utils';+const scriptUrl = `https://s3.tradingview.com/external-embedding/embed-widget-`;++async function Sentiment({ symbol }: { symbol: string }) {+ const insight = await getStockSentimentInsights(symbol);+ if (!insight) return null;+ return (+ <Panel title="Sentiment" sub="Reddit, X.com, news and Polymarket">+ <StockSentimentCard insight={insight} />+ </Panel>+ );+}++// Charts come straight from TradingView (live, no quota); only the header waits on Finnhub, and it streams.export default async function StockDetails({ params }: StockDetailsPageProps) {- const { symbol } = await params;+ const { symbol: rawSymbol } = await params;+ const symbol = decodeURIComponent(rawSymbol).toUpperCase();const tvSymbol = formatSymbolForTradingView(symbol);- const scriptUrl = `https://s3.tradingview.com/external-embedding/embed-widget-`;-- const session = await auth.api.getSession({- headers: await headers()- });- const userId = session?.user?.id;- const [isInWatchlist, sentimentInsights] = await Promise.all([- userId ? isStockInWatchlist(userId, symbol) : Promise.resolve(false),- getStockSentimentInsights(symbol),- ]);return (- <div className="flex min-h-screen p-4 md:p-6 lg:p-8">- <section className="grid grid-cols-1 md:grid-cols-2 gap-8 w-full">- {/* Left column */}- <div className="flex flex-col gap-6">- <TradingViewWidget- scriptUrl={`${scriptUrl}symbol-info.js`}- config={SYMBOL_INFO_WIDGET_CONFIG(tvSymbol)}- height={170}- />-- <TradingViewWidget- scriptUrl={`${scriptUrl}advanced-chart.js`}- config={CANDLE_CHART_WIDGET_CONFIG(tvSymbol)}- className="custom-chart"- height={600}- allowExpand={true}- />+ <>+ <Suspense fallback={<StockHeaderSkeleton />}>+ <StockHeader symbol={symbol} />+ </Suspense>- <TradingViewWidget- scriptUrl={`${scriptUrl}advanced-chart.js`}- config={BASELINE_WIDGET_CONFIG(tvSymbol)}- className="custom-chart"- height={600}- allowExpand={true}- />+ <div className="grid gap-3 xl:grid-cols-[minmax(0,1fr)_minmax(320px,400px)]">+ <div className="flex min-w-0 flex-col gap-3">+ <Panel title="Chart" sub="Live from TradingView · switch interval and style in the chart">+ <TradingViewWidget+ scriptUrl={`${scriptUrl}advanced-chart.js`}+ config={CANDLE_CHART_WIDGET_CONFIG(tvSymbol)}+ height={560}+ allowExpand+ />+ </Panel>+ <Panel title="Financials" sub="Income statement, balance sheet and ratios">+ <TradingViewWidget+ scriptUrl={`${scriptUrl}financials.js`}+ config={COMPANY_FINANCIALS_WIDGET_CONFIG(tvSymbol)}+ height={500}+ />+ </Panel></div>- {/* Right column */}- <div className="flex flex-col gap-6">- <div className="flex items-center justify-between">- <WatchlistButton- symbol={symbol.toUpperCase()}- company={symbol.toUpperCase()}- isInWatchlist={isInWatchlist}- userId={userId}+ <div className="flex min-w-0 flex-col gap-3">+ <Panel title="Technicals" sub="Oscillators and moving averages, 1h">+ <TradingViewWidget+ scriptUrl={`${scriptUrl}technical-analysis.js`}+ config={TECHNICAL_ANALYSIS_WIDGET_CONFIG(tvSymbol)}+ height={400}/>- </div>-- <StockSentimentCard insight={sentimentInsights} />-- <TradingViewWidget- scriptUrl={`${scriptUrl}technical-analysis.js`}- config={TECHNICAL_ANALYSIS_WIDGET_CONFIG(tvSymbol)}- height={400}- />-- <TradingViewWidget- scriptUrl={`${scriptUrl}company-profile.js`}- config={COMPANY_PROFILE_WIDGET_CONFIG(tvSymbol)}- height={440}- />-- <TradingViewWidget- scriptUrl={`${scriptUrl}financials.js`}- config={COMPANY_FINANCIALS_WIDGET_CONFIG(tvSymbol)}- height={800}- />+ </Panel>+ <Suspense fallback={null}>+ <Sentiment symbol={symbol} />+ </Suspense>+ <Panel title="Profile" sub="What the company does">+ <TradingViewWidget+ scriptUrl={`${scriptUrl}symbol-profile.js`}+ config={COMPANY_PROFILE_WIDGET_CONFIG(tvSymbol)}+ height={440}+ />+ </Panel></div>- </section>- </div>+ </div>+ </>);}diff --git a/app/(root)/watchlist/page.tsx b/app/(root)/watchlist/page.tsxindex c1ffdb2..58872b9 100644--- a/app/(root)/watchlist/page.tsx+++ b/app/(root)/watchlist/page.tsx@@ -1,72 +1,73 @@-import React, { Suspense } from 'react';-import { auth } from '@/lib/better-auth/auth';-import { headers } from 'next/headers';-import { redirect } from 'next/navigation';+import { Suspense } from 'react';+import { Plus } from 'lucide-react';+import { requireUserId } from '@/lib/better-auth/auth';import { getUserWatchlist } from '@/lib/actions/watchlist.actions';import { getUserAlerts } from '@/lib/actions/alert.actions';-import { getNews } from '@/lib/actions/finnhub.actions';-import WatchlistManager from '@/components/watchlist/WatchlistManager';+import { getNews, getWatchlistData } from '@/lib/actions/finnhub.actions';+import WatchlistTable from '@/components/watchlist/WatchlistTable';import AlertsPanel from '@/components/watchlist/AlertsPanel';-import NewsGrid from '@/components/watchlist/NewsGrid';-import SearchCommand from '@/components/SearchCommand';-import { Loader2 } from 'lucide-react';+import NewsList from '@/components/watchlist/NewsList';+import Panel from '@/components/Panel';+import DataFreshness from '@/components/DataFreshness';+import { SearchButton } from '@/components/SearchCommand';-export default async function WatchlistPage() {- const session = await auth.api.getSession({- headers: await headers()- });-- if (!session) {- redirect('/sign-in');- }-- const userId = session.user.id;+const RowsSkeleton = ({ rows = 4 }: { rows?: number }) => (+ <div className="row-list" aria-busy="true">+ {Array.from({ length: rows }, (_, i) => (+ <div key={i} className="flex items-center gap-3 px-3.5 py-3.5">+ <span className="size-8 animate-pulse rounded-full bg-hover" />+ <span className="h-3.5 flex-1 animate-pulse rounded-md bg-hover" />+ <span className="h-3.5 w-20 animate-pulse rounded-md bg-hover" />+ </div>+ ))}+ </div>+);- // Parallel data fetching- const [watchlistItems, alerts, news] = await Promise.all([- getUserWatchlist(userId),- getUserAlerts(userId),- getNews() // Initial news fetch- ]);+async function Symbols({ symbols }: { symbols: string[] }) {+ return <WatchlistTable initialRows={await getWatchlistData(symbols)} />;+}- const watchlistSymbols = watchlistItems.map((item: any) => item.symbol);+async function News({ symbols }: { symbols: string[] }) {+ return <NewsList news={await getNews(symbols).catch(() => [] as MarketNewsArticle[])} />;+}- // Fallback news if watchlist has items- const relevantNews = watchlistSymbols.length > 0 ? await getNews(watchlistSymbols) : news;+// DB reads render first; everything from Finnhub streams in behind skeletons.+export default async function WatchlistPage() {+ const userId = await requireUserId();+ const [items, alerts] = await Promise.all([getUserWatchlist(userId), getUserAlerts(userId)]);+ const symbols: string[] = items.map((item: { symbol: string }) => item.symbol);+ const activeAlerts = alerts.filter((a: { triggered?: boolean }) => !a.triggered).length;return (- <div className="min-h-screen bg-black text-gray-100 p-6 md:p-8">- {/* Header */}- <div className="flex flex-col md:flex-row md:items-center justify-between mb-8 gap-4">+ <>+ <header className="page-head"><div>- <h1 className="text-3xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-white to-gray-500">- Watchlist- </h1>- <p className="text-gray-500 mt-1">Track your favorite stocks and manage alerts.</p>- </div>- <div className="flex items-center space-x-4">- <SearchCommand renderAs="button" label="Add Stock" initialStocks={[]} />+ <h1 className="page-title">Watchlist</h1>+ <p className="page-sub num flex flex-wrap items-center gap-x-2">+ {symbols.length} {symbols.length === 1 ? 'symbol' : 'symbols'} <span aria-hidden>·</span> <DataFreshness />+ </p></div>- </div>+ <SearchButton className="btn btn-primary"><Plus /> Add symbol</SearchButton>+ </header>- <div className="grid grid-cols-1 lg:grid-cols-4 gap-8">- {/* Main Content - Watchlist Table */}- <div className="lg:col-span-3 space-y-8">- <div className="space-y-6">- <WatchlistManager initialItems={watchlistItems} userId={userId} />- </div>-- {/* News Section */}- <Suspense fallback={<div className="flex justify-center p-12"><Loader2 className="animate-spin text-gray-500" /></div>}>- <NewsGrid news={relevantNews || []} />- </Suspense>+ <div className="grid gap-3 xl:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]">+ <div className="flex min-w-0 flex-col gap-3">+ <Panel title="Symbols" sub="Click a row for charts, technicals and financials">+ <Suspense fallback={<RowsSkeleton rows={Math.max(1, Math.min(symbols.length, 6))} />}>+ <Symbols symbols={symbols} />+ </Suspense>+ </Panel>+ <Panel title="News" sub={symbols.length ? 'Latest stories for the symbols you watch' : 'General market news'}>+ <Suspense fallback={<RowsSkeleton />}>+ <News symbols={symbols} />+ </Suspense>+ </Panel></div>- {/* Sidebar - Alerts */}- <div className="lg:col-span-1">+ <Panel title="Alerts" sub={`${activeAlerts} active · checked every 5 minutes`} className="self-start"><AlertsPanel alerts={alerts} />- </div>+ </Panel></div>- </div>+ </>);}diff --git a/app/globals.css b/app/globals.cssindex d74c257..d020b9d 100644--- a/app/globals.css+++ b/app/globals.css@@ -3,457 +3,797 @@@custom-variant dark (&:is(.dark *));+/*+ * Design language: dashboard-craft (floated shell, dark chrome, browser tabs,+ * hatch shells, bento tiles) in a dark warm workspace.+ * Two hues carry everything: neutral hue 95 (warm) and accent hue 176 (OpenStock teal).+ * Up/down share one lightness (0.70) and chroma % so neither shouts louder.+ */+:root {+ --page: oklch(0.13 0.006 95); /* near-black behind the floated app */+ --side: oklch(0.165 0.007 95); /* sidebar + tab chrome */+ --frame: oklch(0.185 0.007 95); /* hatch shell frame (recessed) */+ --canvas: oklch(0.205 0.007 95); /* workspace; active tab = canvas */+ --card: oklch(0.235 0.008 95); /* inner card (raised) */+ --hover: oklch(0.27 0.008 95);+ --line: oklch(0.29 0.008 95);+ --line-strong: oklch(0.36 0.01 95);+ --text: oklch(0.95 0.006 95);+ --muted: oklch(0.74 0.012 95);+ --faint: oklch(0.62 0.012 95);++ --brand: oklch(0.80 0.13 176); /* fills + icons */+ --brand-strong: oklch(0.72 0.12 176);+ --brand-ink: oklch(0.85 0.12 176); /* the only brand colour allowed as text */+ --brand-soft: oklch(0.31 0.05 176); /* brand as a fill behind text */+ --on-brand: oklch(0.22 0.04 176);++ --up: oklch(0.70 0.164 150);+ --up-soft: oklch(0.30 0.055 150);+ --down: oklch(0.70 0.162 25);+ --down-soft: oklch(0.30 0.055 25);+ --warn: oklch(0.76 0.119 70);++ --tab-ease: cubic-bezier(0.32, 0.72, 0, 1);+ --ui-ease: cubic-bezier(0.2, 0, 0, 1);++ /* shadcn tokens, repointed onto the palette above */+ --radius: 0.75rem;+ --background: var(--canvas);+ --foreground: var(--text);+ --card-foreground: var(--text);+ --popover: var(--card);+ --popover-foreground: var(--text);+ --primary: var(--brand);+ --primary-foreground: var(--on-brand);+ --secondary: var(--hover);+ --secondary-foreground: var(--text);+ --muted-foreground: var(--muted);+ --accent: var(--hover);+ --accent-foreground: var(--text);+ --destructive: var(--down);+ --border: var(--line);+ --input: var(--line-strong);+ --ring: var(--brand);+}+@theme inline {+ --font-sans: var(--font-jakarta);+ --font-mono: var(--font-plex-mono);+--color-background: var(--background);--color-foreground: var(--foreground);- --font-sans: var(--font-geist-sans);- --font-mono: var(--font-geist-mono);- --color-sidebar-ring: var(--sidebar-ring);- --color-sidebar-border: var(--sidebar-border);- --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);- --color-sidebar-accent: var(--sidebar-accent);- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);- --color-sidebar-primary: var(--sidebar-primary);- --color-sidebar-foreground: var(--sidebar-foreground);- --color-sidebar: var(--sidebar);- --color-chart-5: var(--chart-5);- --color-chart-4: var(--chart-4);- --color-chart-3: var(--chart-3);- --color-chart-2: var(--chart-2);- --color-chart-1: var(--chart-1);- --color-ring: var(--ring);- --color-input: var(--input);- --color-border: var(--border);- --color-destructive: var(--destructive);- --color-accent-foreground: var(--accent-foreground);- --color-accent: var(--accent);- --color-muted-foreground: var(--muted-foreground);- --color-muted: var(--muted);- --color-secondary-foreground: var(--secondary-foreground);- --color-secondary: var(--secondary);- --color-primary-foreground: var(--primary-foreground);- --color-primary: var(--primary);- --color-popover-foreground: var(--popover-foreground);- --color-popover: var(--popover);- --color-card-foreground: var(--card-foreground);--color-card: var(--card);+ --color-card-foreground: var(--card-foreground);+ --color-popover: var(--popover);+ --color-popover-foreground: var(--popover-foreground);+ --color-primary: var(--primary);+ --color-primary-foreground: var(--primary-foreground);+ --color-secondary: var(--secondary);+ --color-secondary-foreground: var(--secondary-foreground);+ --color-muted: var(--hover);+ --color-muted-foreground: var(--muted-foreground);+ --color-accent: var(--accent);+ --color-accent-foreground: var(--accent-foreground);+ --color-destructive: var(--destructive);+ --color-border: var(--border);+ --color-input: var(--input);+ --color-ring: var(--ring);++ --color-page: var(--page);+ --color-side: var(--side);+ --color-frame: var(--frame);+ --color-canvas: var(--canvas);+ --color-hover: var(--hover);+ --color-line: var(--line);+ --color-line-strong: var(--line-strong);+ --color-faint: var(--faint);+ --color-brand: var(--brand);+ --color-brand-strong: var(--brand-strong);+ --color-brand-ink: var(--brand-ink);+ --color-brand-soft: var(--brand-soft);+ --color-on-brand: var(--on-brand);+ --color-up: var(--up);+ --color-up-soft: var(--up-soft);+ --color-down: var(--down);+ --color-down-soft: var(--down-soft);+ --color-warn: var(--warn);+--radius-sm: calc(var(--radius) - 4px);--radius-md: calc(var(--radius) - 2px);--radius-lg: var(--radius);--radius-xl: calc(var(--radius) + 4px);}-:root {- --radius: 0.625rem;- --background: oklch(1 0 0);- --foreground: oklch(0.129 0.042 264.695);- --card: oklch(1 0 0);- --card-foreground: oklch(0.129 0.042 264.695);- --popover: oklch(1 0 0);- --popover-foreground: oklch(0.129 0.042 264.695);- --primary: oklch(0.208 0.042 265.755);- --primary-foreground: oklch(0.984 0.003 247.858);- --secondary: oklch(0.968 0.007 247.896);- --secondary-foreground: oklch(0.208 0.042 265.755);- --muted: oklch(0.968 0.007 247.896);- --muted-foreground: oklch(0.554 0.046 257.417);- --accent: oklch(0.968 0.007 247.896);- --accent-foreground: oklch(0.208 0.042 265.755);- --destructive: oklch(0.577 0.245 27.325);- --border: oklch(0.929 0.013 255.508);- --input: oklch(0.929 0.013 255.508);- --ring: oklch(0.704 0.04 256.788);- --chart-1: oklch(0.646 0.222 41.116);- --chart-2: oklch(0.6 0.118 184.704);- --chart-3: oklch(0.398 0.07 227.392);- --chart-4: oklch(0.828 0.189 84.429);- --chart-5: oklch(0.769 0.188 70.08);- --sidebar: oklch(0.984 0.003 247.858);- --sidebar-foreground: oklch(0.129 0.042 264.695);- --sidebar-primary: oklch(0.208 0.042 265.755);- --sidebar-primary-foreground: oklch(0.984 0.003 247.858);- --sidebar-accent: oklch(0.968 0.007 247.896);- --sidebar-accent-foreground: oklch(0.208 0.042 265.755);- --sidebar-border: oklch(0.929 0.013 255.508);- --sidebar-ring: oklch(0.704 0.04 256.788);-}+/* Legacy utility scales, repointed so older pages (about, help, terms, api-docs)+ pick up the warm palette without a rewrite. */+@theme {+ --color-gray-50: oklch(0.97 0.004 95);+ --color-gray-100: oklch(0.95 0.006 95);+ --color-gray-200: oklch(0.90 0.007 95);+ --color-gray-300: oklch(0.83 0.009 95);+ --color-gray-400: oklch(0.80 0.01 95);+ --color-gray-500: oklch(0.66 0.012 95);+ --color-gray-600: oklch(0.36 0.01 95);+ --color-gray-700: oklch(0.27 0.008 95);+ --color-gray-800: oklch(0.205 0.007 95);+ --color-gray-900: oklch(0.13 0.006 95);+ --color-gray-950: oklch(0.10 0.005 95);-.dark {- --background: oklch(0.129 0.042 264.695);- --foreground: oklch(0.984 0.003 247.858);- --card: oklch(0.208 0.042 265.755);- --card-foreground: oklch(0.984 0.003 247.858);- --popover: oklch(0.208 0.042 265.755);- --popover-foreground: oklch(0.984 0.003 247.858);- --primary: oklch(0.929 0.013 255.508);- --primary-foreground: oklch(0.208 0.042 265.755);- --secondary: oklch(0.279 0.041 260.031);- --secondary-foreground: oklch(0.984 0.003 247.858);- --muted: oklch(0.279 0.041 260.031);- --muted-foreground: oklch(0.704 0.04 256.788);- --accent: oklch(0.279 0.041 260.031);- --accent-foreground: oklch(0.984 0.003 247.858);- --destructive: oklch(0.704 0.191 22.216);- --border: oklch(1 0 0 / 10%);- --input: oklch(1 0 0 / 15%);- --ring: oklch(0.551 0.027 264.364);- --chart-1: oklch(0.488 0.243 264.376);- --chart-2: oklch(0.696 0.17 162.48);- --chart-3: oklch(0.769 0.188 70.08);- --chart-4: oklch(0.627 0.265 303.9);- --chart-5: oklch(0.645 0.246 16.439);- --sidebar: oklch(0.208 0.042 265.755);- --sidebar-foreground: oklch(0.984 0.003 247.858);- --sidebar-primary: oklch(0.488 0.243 264.376);- --sidebar-primary-foreground: oklch(0.984 0.003 247.858);- --sidebar-accent: oklch(0.279 0.041 260.031);- --sidebar-accent-foreground: oklch(0.984 0.003 247.858);- --sidebar-border: oklch(1 0 0 / 10%);- --sidebar-ring: oklch(0.551 0.027 264.364);-}+ --color-teal-300: oklch(0.88 0.10 176);+ --color-teal-400: oklch(0.85 0.12 176);+ --color-teal-500: oklch(0.80 0.13 176);+ --color-teal-600: oklch(0.72 0.12 176);+ --color-teal-700: oklch(0.58 0.10 176);+ --color-teal-800: oklch(0.42 0.07 176);+ --color-teal-900: oklch(0.31 0.05 176);-/* === CUSTOM COLOR THEME === */-@theme {- /* Extended Gray Scale */- --color-gray-900: #050505;- --color-gray-800: #141414;- --color-gray-700: #212328;- --color-gray-600: #30333A;- --color-gray-500: #9095A1;- --color-gray-400: #CCDADC;-- /* Vibrant Colors */- --color-blue-600: #5862FF;- --color-yellow-400: #FDD458;- --color-yellow-500: #E8BA40;- --color-teal-400: #0FEDBE;- --color-red-500: #FF495B;- --color-orange-500: #FF8243;- --color-purple-500: #D13BFF;+ --color-green-400: oklch(0.74 0.16 150);+ --color-green-500: oklch(0.70 0.164 150);+ --color-red-400: oklch(0.74 0.15 25);+ --color-red-500: oklch(0.70 0.162 25);}@layer base {* {@apply border-border outline-ring/50;}+ html {+ font-size: 14px;+ }body {- @apply bg-gray-900 text-foreground;+ background: var(--page);+ color: var(--text);+ line-height: 1.45;+ -webkit-font-smoothing: antialiased;+ -moz-osx-font-smoothing: grayscale;+ }+ h1, h2, h3 {+ text-wrap: balance;+ letter-spacing: -0.02em;+ }+ p {+ text-wrap: pretty;}}-@layer utilities {- .container {- @apply mx-auto max-w-screen-2xl px-4 md:px-6 lg:px-8;+@media (prefers-reduced-motion: reduce) {+ *, *::before, *::after {+ animation-duration: 0.01ms !important;+ animation-iteration-count: 1 !important;+ transition-duration: 0.01ms !important;+ scroll-behavior: auto !important;}- .yellow-btn {- @apply h-12 cursor-pointer bg-gradient-to-b from-teal-400 to-teal-500 hover:from-teal-500 hover:to-teal-400 text-gray-800 font-medium text-base rounded-lg shadow-lg disabled:opacity-50;+}++/* Component classes live in a layer so Tailwind utilities (lg:hidden, h-8, ...) can override them. */+@layer components {+ /* ============ Shell ============ */++ .shell {+ display: grid;+ grid-template-columns: 248px minmax(0, 1fr);+ height: 100dvh;+ overflow: hidden;+ background: var(--page);+ }+ .shell > * { min-width: 0; min-height: 0; }++ .shell-container {+ height: 100%;+ padding: 10px 10px 10px 0;+ overflow: hidden;}- .home-wrapper {- @apply text-gray-400 flex-col gap-4 md:gap-10 items-center sm:items-start;++ .app {+ display: grid;+ grid-template-columns: minmax(0, 1fr); /* implicit auto column would grow to content and overflow */+ grid-template-rows: auto minmax(0, 1fr);+ height: 100%;+ overflow: hidden;+ border-radius: 16px;+ background: var(--side);+ box-shadow: 0 0 0 1px oklch(1 0 0 / 0.04), 0 12px 40px oklch(0 0 0 / 0.45);}- .home-section {- @apply w-full gap-8 grid-cols-1 md:grid-cols-2 xl:grid-cols-3;++ .workspace {+ min-width: 0;+ min-height: 0;+ overflow-y: auto;+ overscroll-behavior: contain;+ background: var(--canvas);+ border-radius: 12px 12px 0 0;+ transition: border-top-left-radius 180ms var(--tab-ease);+ scrollbar-width: thin;+ scrollbar-color: var(--line-strong) transparent;+ }+ .workspace.is-first-tab { border-top-left-radius: 0; }++ .workspace-inner {+ display: flex;+ flex-direction: column;+ gap: 12px;+ padding: 16px;+ max-width: 1680px;}- .header {- @apply z-50 w-full h-[70px] bg-gray-800;++ @media (max-width: 1023px) {+ .shell { grid-template-columns: minmax(0, 1fr); }+ .shell-container { padding: 0; }+ .app { border-radius: 0; }+ .workspace-inner { padding: 12px; }}- .header-wrapper {- @apply flex justify-between items-center px-6 py-4 text-gray-500;++ /* ============ Sidebar ============ */++ .sidebar {+ display: flex;+ flex-direction: column;+ gap: 14px;+ height: 100%;+ padding: 18px 12px 12px;+ overflow-y: auto;+ background: var(--page);+ color: var(--muted);+ scrollbar-width: none;+ }++ .side-label {+ padding: 0 10px;+ font-size: 11px;+ font-weight: 700;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ color: var(--faint);+ }++ .side-item {+ display: flex;+ align-items: center;+ gap: 10px;+ height: 34px;+ padding: 0 10px;+ border-radius: 9px;+ font-weight: 600;+ color: var(--muted);+ transition: background-color 150ms var(--ui-ease), color 150ms var(--ui-ease), transform 150ms var(--ui-ease);+ }+ .side-item:hover { background: oklch(1 0 0 / 0.06); color: var(--text); }+ .side-item:active { transform: scale(0.97); }+ .side-item.is-active { background: oklch(1 0 0 / 0.08); color: var(--text); }+ .side-item svg { flex: none; width: 17px; height: 17px; }++ .side-cta {+ display: flex;+ align-items: center;+ gap: 8px;+ height: 40px;+ padding: 0 12px;+ border-radius: 11px;+ font-weight: 700;+ color: var(--on-brand);+ background: var(--brand);+ box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.35), 0 6px 18px oklch(0.8 0.13 176 / 0.18);+ transition: background-color 150ms var(--ui-ease), transform 150ms var(--ui-ease);+ }+ .side-cta:hover { background: var(--brand-ink); }+ .side-cta:active { transform: scale(0.96); }++ .kbd {+ display: inline-flex;+ align-items: center;+ height: 20px;+ padding: 0 6px;+ border-radius: 6px;+ font-family: var(--font-plex-mono), ui-monospace, monospace;+ font-size: 11px;+ font-weight: 600;+ }++ /* ============ Tab bar (browser-style chrome) ============ */++ .tabbar {+ position: relative;+ display: flex;+ align-items: flex-end;+ gap: 4px;+ min-width: 0;+ padding: 6px 10px 0 8px;+ background: var(--side);+ user-select: none;+ }++ .tabs {+ position: relative;+ display: flex;+ align-items: flex-end;+ gap: 2px;+ min-width: 0;+ overflow-x: auto;+ scrollbar-width: none;+ }++ .tab {+ position: relative;+ z-index: 1;+ display: flex;+ align-items: center;+ gap: 8px;+ flex: 0 1 auto;+ min-width: 112px;+ max-width: 200px;+ height: 36px;+ padding: 0 10px 2px 14px;+ color: oklch(1 0 0 / 0.55);+ font-weight: 600;+ white-space: nowrap;+ transition: color 150ms var(--ui-ease);+ }+ .tab::before {+ content: "";+ position: absolute;+ inset: 4px 4px 6px;+ z-index: -1;+ border-radius: 8px;+ background: transparent;+ transition: background-color 150ms var(--ui-ease);+ }+ .tab:hover { color: oklch(1 0 0 / 0.8); }+ .tab:hover:not(.is-active)::before { background: oklch(1 0 0 / 0.07); }+ .tab.is-active { color: var(--text); }+ .tab-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }+ .tab svg { flex: none; width: 15px; height: 15px; }++ .tab-close {+ display: grid;+ place-items: center;+ flex: none;+ width: 20px;+ height: 20px;+ border-radius: 6px;+ color: inherit;+ opacity: 0.6;+ transition: background-color 150ms var(--ui-ease), opacity 150ms var(--ui-ease);+ }+ .tab-close:hover { opacity: 1; background: oklch(1 0 0 / 0.1); }+ .tab-close svg { width: 13px; height: 13px; }++ .tab-glider {+ position: absolute;+ left: 0;+ bottom: 0;+ z-index: 0;+ height: 36px;+ opacity: 0;+ pointer-events: none;+ transition: transform 240ms var(--tab-ease), width 240ms var(--tab-ease);+ }+ .tab-glider.is-ready { opacity: 1; }+ .tab-glider-body {+ position: absolute;+ top: 0;+ bottom: 0;+ left: 11px;+ right: 11px;+ border-radius: 12px 12px 0 0;+ background: var(--canvas);+ }+ .tab-glider-curve {+ position: absolute;+ bottom: 0;+ width: 12px;+ height: 12px;+ fill: var(--canvas);+ }+ .tab-glider-curve.is-left { left: 0; }+ .tab-glider-curve.is-right { right: 0; transform: scaleX(-1); }++ .chrome-btn {+ display: grid;+ place-items: center;+ flex: none;+ width: 30px;+ height: 30px;+ margin-bottom: 3px;+ border-radius: 8px;+ color: oklch(1 0 0 / 0.55);+ transition: background-color 150ms var(--ui-ease), color 150ms var(--ui-ease), transform 150ms var(--ui-ease);+ }+ .chrome-btn:hover { background: oklch(1 0 0 / 0.1); color: var(--text); }+ .chrome-btn:active { transform: scale(0.94); }+ .chrome-btn svg { width: 17px; height: 17px; }++ /* ============ Hatch shells ============ */++ .hatch {+ --shell-pad: 3px;+ --inner-r: 14px;+ display: flex;+ flex-direction: column;+ min-width: 0;+ padding: var(--shell-pad);+ border-radius: calc(var(--inner-r) + var(--shell-pad));+ background:+ repeating-linear-gradient(-45deg, oklch(0.4 0.01 95 / 0.22) 0 1px, transparent 1px 5px),+ var(--frame);+ box-shadow: 0 0 0 1px oklch(1 0 0 / 0.035), 0 6px 18px oklch(0 0 0 / 0.22);+ }++ .card {+ min-width: 0;+ border-radius: 14px;+ background: var(--card);+ box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.05), 0 0 0 1px oklch(0 0 0 / 0.25);+ }++ .section-head {+ display: flex;+ align-items: flex-end;+ justify-content: space-between;+ gap: 12px;+ padding: 10px 12px 9px;+ }+ .section-title {+ font-size: 15px;+ font-weight: 700;+ letter-spacing: -0.02em;+ color: var(--text);+ }+ .section-sub {+ margin-top: 1px;+ font-size: 12.5px;+ color: var(--faint);+ }++ .page-head {+ display: flex;+ flex-wrap: wrap;+ align-items: flex-end;+ justify-content: space-between;+ gap: 12px;+ padding: 4px 4px 2px;+ }+ .page-title {+ font-size: 24px;+ font-weight: 700;+ letter-spacing: -0.04em;+ color: var(--text);+ }+ .page-sub {+ margin-top: 2px;+ color: var(--faint);+ }++ .kicker {+ font-size: 11px;+ font-weight: 700;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ color: var(--faint);+ }++ /* ============ Bento tiles ============ */++ .bento {+ display: grid;+ grid-template-columns: repeat(12, minmax(0, 1fr));+ gap: 3px;+ }+ .bento-tile {+ grid-column: span 3;+ display: flex;+ flex-direction: column;+ gap: 12px;+ min-width: 0;+ padding: 14px 14px 12px;+ border-radius: 14px;+ background: var(--card);+ box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.05);+ }+ @media (max-width: 1023px) { .bento-tile { grid-column: span 6; } }++ .bento-head {+ display: flex;+ align-items: center;+ gap: 8px;+ min-width: 0;+ font-size: 13.5px;+ font-weight: 600;+ color: var(--muted);+ }+ .bento-ico {+ display: grid;+ place-items: center;+ flex: none;+ width: 28px;+ height: 28px;+ border-radius: 999px;+ background: oklch(1 0 0 / 0.06);+ color: var(--muted);+ }+ .bento-ico svg { width: 15px; height: 15px; }+ .bento-value {+ font-size: 28px;+ font-weight: 700;+ line-height: 1;+ letter-spacing: -0.04em;+ color: var(--text);+ font-variant-numeric: tabular-nums;+ text-wrap: balance;+ }+ .bento-value small {+ font-size: 0.62em;+ font-weight: 600;+ letter-spacing: -0.02em;+ color: var(--muted);+ }+ .bento-foot {+ display: flex;+ align-items: center;+ gap: 8px;+ min-width: 0;+ font-size: 12.5px;+ color: var(--faint);+ }++ /* ============ Pills, buttons, numbers ============ */++ .num { font-variant-numeric: tabular-nums; }+ .mono { font-family: var(--font-plex-mono), ui-monospace, monospace; }++ .pill {+ display: inline-flex;+ align-items: center;+ gap: 3px;+ flex: none;+ height: 22px;+ padding: 0 8px;+ border-radius: 999px;+ font-size: 12px;+ font-weight: 700;+ font-variant-numeric: tabular-nums;+ background: oklch(1 0 0 / 0.06);+ color: var(--muted);+ }+ .pill svg { width: 12px; height: 12px; }+ .pill.is-up { background: var(--up-soft); color: var(--up); }+ .pill.is-down { background: var(--down-soft); color: var(--down); }+ .pill.is-brand { background: var(--brand-soft); color: var(--brand-ink); }++ .btn {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 7px;+ height: 36px;+ padding: 0 14px;+ border-radius: 10px;+ font-weight: 700;+ white-space: nowrap;+ cursor: pointer;+ transition: background-color 150ms var(--ui-ease), color 150ms var(--ui-ease), transform 150ms var(--ui-ease), box-shadow 150ms var(--ui-ease);+ }+ .btn:active:not(:disabled) { transform: scale(0.96); }+ .btn:disabled { opacity: 0.55; cursor: not-allowed; }+ .btn svg { width: 16px; height: 16px; flex: none; }+ .btn-primary {+ color: var(--on-brand);+ background: var(--brand);+ box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.35), 0 6px 18px oklch(0.8 0.13 176 / 0.16);+ }+ .btn-primary:hover:not(:disabled) { background: var(--brand-ink); }+ .btn-ghost {+ color: var(--muted);+ box-shadow: inset 0 0 0 1px var(--line);+ }+ .btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }+ .btn-ghost.is-on { color: var(--brand-ink); box-shadow: inset 0 0 0 1px oklch(0.8 0.13 176 / 0.35); background: var(--brand-soft); }++ .icon-btn {+ display: grid;+ place-items: center;+ flex: none;+ width: 32px;+ height: 32px;+ border-radius: 9px;+ color: var(--faint);+ transition: background-color 150ms var(--ui-ease), color 150ms var(--ui-ease), transform 150ms var(--ui-ease);+ }+ .icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }+ .icon-btn:active:not(:disabled) { transform: scale(0.94); }+ .icon-btn:disabled { opacity: 0.5; }+ .icon-btn svg { width: 16px; height: 16px; }+ .icon-btn.is-danger:hover:not(:disabled) { color: var(--down); }+ .icon-btn.is-on { color: var(--brand-ink); }++ /* ============ Tables & rows ============ */++ .data-table {+ width: 100%;+ border-collapse: separate;+ border-spacing: 0;+ font-variant-numeric: tabular-nums;+ }+ .data-table th {+ position: sticky;+ top: 0;+ z-index: 1;+ height: 38px;+ padding: 0 14px;+ background: var(--card);+ border-bottom: 1px solid var(--line);+ font-size: 11px;+ font-weight: 700;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ text-align: left;+ color: var(--faint);+ white-space: nowrap;+ }+ .data-table td {+ height: 58px;+ padding: 0 14px;+ border-bottom: 1px solid oklch(1 0 0 / 0.04);+ white-space: nowrap;+ }+ .data-table tbody tr:nth-child(odd) td { background: oklch(1 0 0 / 0.012); }+ .data-table tbody tr { transition: background-color 150ms var(--ui-ease); }+ .data-table tbody tr:hover td { background: oklch(1 0 0 / 0.035); }+ .data-table tbody tr:last-child td { border-bottom: 0; }+ .data-table .is-num { text-align: right; }++ .row-list > * + * { border-top: 1px solid oklch(1 0 0 / 0.05); }++ .logo-well {+ display: grid;+ place-items: center;+ flex: none;+ width: 34px;+ height: 34px;+ overflow: hidden;+ border-radius: 999px;+ background: oklch(0.96 0.004 95);+ color: var(--on-brand);+ font-weight: 700;+ font-size: 13px;+ }+ .logo-well.is-empty { background: var(--hover); color: var(--muted); }++ .empty-state {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 6px;+ padding: 36px 20px;+ text-align: center;+ color: var(--faint);+ }+ .empty-state .empty-icon {+ display: grid;+ place-items: center;+ width: 44px;+ height: 44px;+ margin-bottom: 6px;+ border-radius: 999px;+ background: oklch(1 0 0 / 0.05);+ color: var(--muted);+ }+ .empty-state h3 { font-size: 15px; font-weight: 700; color: var(--text); }++ /* ============ TradingView embeds ============ */++ .tv-frame {+ position: relative;+ overflow: hidden;+ border-radius: 14px;+ background: var(--card);+ }+ .tradingview-widget-container,+ .tradingview-widget-container__widget,+ .tradingview-widget-container iframe {+ width: 100% !important;+ background: transparent !important;+ }+ .tradingview-widget-copyright {+ padding: 6px 0;+ font-size: 11px;+ text-align: center;+ color: var(--faint);+ }+ .tradingview-widget-copyright a { color: var(--muted); }+}++/* ============ Auth + forms (class names kept for existing forms) ============ */++@layer utilities {+ .yellow-btn {+ @apply h-12 cursor-pointer rounded-[11px] bg-brand text-on-brand font-bold text-base disabled:opacity-50 hover:bg-brand-ink active:scale-[0.97] transition-[background-color,transform] duration-150;+ box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.35), 0 6px 18px oklch(0.8 0.13 176 / 0.16);}.auth-layout {- @apply flex flex-col justify-between lg:flex-row h-screen bg-gray-900 relative overflow-hidden;+ @apply flex flex-col justify-between lg:flex-row h-dvh bg-page relative overflow-hidden;}.auth-logo {@apply pt-6 lg:pt-8 mb-8 lg:mb-12;}.auth-left-section {- @apply w-full lg:w-[45%] lg:h-screen px-6 lg:px-16 flex flex-col overflow-y-auto;+ @apply w-full lg:w-[45%] lg:h-dvh px-6 lg:px-16 flex flex-col overflow-y-auto;}.auth-right-section {- @apply w-full max-lg:border-t max-lg:border-gray-600 lg:w-[55%] lg:h-screen bg-gray-800 px-6 py-4 md:p-6 lg:py-12 lg:px-18 flex flex-col justify-start;+ @apply w-full max-lg:border-t max-lg:border-line lg:w-[55%] lg:h-[calc(100dvh-20px)] lg:m-[10px] lg:rounded-2xl bg-side px-6 py-4 md:p-6 lg:py-12 lg:px-16 flex flex-col justify-start overflow-hidden;}.auth-blockquote {- @apply text-sm md:text-xl lg:text-2xl font-medium text-gray-400 mb-1 md:mb-6 lg:mb-8;+ @apply text-sm md:text-xl lg:text-2xl font-semibold tracking-tight text-foreground mb-1 md:mb-6 lg:mb-8;}.auth-testimonial-author {- @apply text-xs md:text-lg font-bold text-gray-400 not-italic;+ @apply text-xs md:text-base font-bold text-muted-foreground not-italic;}.auth-dashboard-preview {- @apply border-6 border-gray-800 left-0 hidden w-[1024px] h-auto max-w-none lg:block rounded-xl shadow-2xl;+ @apply left-0 hidden w-[1024px] max-w-none lg:block pointer-events-none select-none;}.form-title {- @apply text-4xl font-bold text-gray-400 mb-10;+ @apply text-3xl font-bold tracking-[-0.04em] text-foreground mb-8;}.form-label {- @apply text-sm font-medium text-gray-400;+ @apply text-[12px] font-bold uppercase tracking-[0.06em] text-faint;}.form-input {- @apply h-12 px-3 py-3 text-white text-base placeholder:text-gray-600 border-gray-600 rounded-lg focus:!border-teal-500 focus:ring-0 ;+ @apply h-12 px-3 py-3 text-foreground text-base bg-card placeholder:text-faint border-line rounded-[11px] focus:!border-brand focus-visible:ring-0;}.select-trigger {- @apply w-full !h-12 px-3 py-3 text-base border-gray-600 bg-gray-800 text-white rounded-lg focus:!border-teal-500 focus:ring-0;+ @apply w-full !h-12 px-3 py-3 text-base border-line bg-card text-foreground rounded-[11px] focus:!border-brand focus-visible:ring-0;}.country-select-trigger {- @apply h-12 px-3 py-3 text-base w-full justify-between font-normal border-gray-600 bg-gray-800 text-gray-400 rounded-lg focus:!border-teal-500 focus:ring-0;+ @apply h-12 px-3 py-3 text-base w-full justify-between font-normal border-line bg-card text-foreground rounded-[11px] hover:bg-hover focus:!border-brand;}.country-select-input {- @apply !bg-gray-800 text-gray-400 border-0 border-b border-gray-600 rounded-none focus:ring-0 placeholder:text-gray-500;+ @apply !bg-card text-foreground border-0 border-b border-line rounded-none focus:ring-0 placeholder:text-faint;}.country-select-empty {- @apply text-gray-500 py-6 text-center !bg-gray-800;+ @apply text-faint py-6 text-center !bg-card;}.country-select-item {- @apply text-white cursor-pointer px-3 py-2 rounded-sm bg-gray-800 hover:!bg-gray-600;+ @apply text-foreground cursor-pointer px-3 py-2 rounded-md bg-card hover:!bg-hover;}.footer-link {- @apply text-gray-400 font-medium hover:text-teal-400 hover:underline transition-colors;- }- .search-text {- @apply cursor-pointer hover:text-teal-500;- }- .search-btn {- @apply cursor-pointer px-4 py-2 w-fit flex items-center gap-2 text-sm md:text-base bg-teal-500 hover:bg-teal-500 text-black font-medium rounded;+ @apply text-muted-foreground font-semibold hover:text-brand-ink transition-colors;}++ /* Search palette */.search-dialog {- @apply !bg-gray-800 lg:min-w-[800px] border-gray-600 fixed top-10 left-1/2 -translate-x-1/2 translate-y-10;+ @apply !bg-card lg:min-w-[720px] border-line fixed top-10 left-1/2 -translate-x-1/2 translate-y-10 rounded-2xl overflow-hidden;+ box-shadow: 0 0 0 4px var(--frame), 0 24px 60px oklch(0 0 0 / 0.55);}.search-field {- @apply !bg-gray-800 border-b border-gray-600 relative;+ @apply !bg-card border-b border-line relative;+ }+ .search-input {+ @apply !bg-card border-0 text-foreground placeholder:text-faint focus:ring-0 text-base h-14 pr-10;+ }+ .search-loader {+ @apply absolute right-12 top-1/2 -translate-y-1/2 h-4 w-4 text-faint animate-spin;}.search-list {- @apply !bg-gray-800 max-h-[400px];+ @apply !bg-card max-h-[420px] p-1.5;}.search-list-indicator {- @apply px-5 py-2+ @apply px-5 py-8 text-center text-faint;}.search-list-empty {- @apply py-6 !bg-transparent text-center text-gray-500;- }- .search-input {- @apply !bg-gray-800 border-0 text-gray-400 placeholder:text-gray-500 focus:ring-0 text-base h-14 pr-10;- }- .search-loader {- @apply absolute right-12 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-500 animate-spin;+ @apply py-8 !bg-transparent text-center text-faint;}.search-count {- @apply py-2 px-4 text-sm font-medium text-gray-400 bg-gray-700 border-b border-gray-700;+ @apply px-3 pt-2 pb-1.5 text-[11px] font-bold uppercase tracking-[0.06em] text-faint;}.search-item {- @apply rounded-none my-3 px-1 w-full data-[selected=true]:bg-gray-600;+ @apply w-full;}.search-item-link {- @apply px-2 w-full cursor-pointer border-b border-gray-600 last:border-b-0 transition-colors flex items-center gap-3;+ @apply px-3 h-12 w-full cursor-pointer rounded-[10px] transition-colors flex items-center gap-3 hover:bg-hover focus-visible:bg-hover outline-none;}.search-item-name {- @apply font-medium text-base text-gray-400;- }- .nav-list {- @apply flex flex-col sm:flex-row p-2 gap-3 sm:gap-10 font-medium;- }- .stock-details-container {- @apply w-full grid-cols-1 gap-6 xl:grid-cols-3 space-y-6 sm:space-y-8;- }- .watchlist-btn {- @apply bg-teal-500 text-base hover:bg-teal-500 text-gray-900 w-full rounded h-11 font-semibold cursor-pointer;- }- .watchlist-remove {- @apply bg-red-500! hover:bg-red-500! text-gray-900!- }- .watchlist-empty-container {- @apply container gap-8 flex-col items-center md:mt-10 p-6 text-center;- }- .watchlist-empty {- @apply flex flex-col items-center justify-center text-center;- }- .watchlist-star {- @apply h-16 w-16 text-gray-500 mb-4;- }- .empty-title {- @apply text-xl font-semibold text-gray-400 mb-2;- }- .empty-description {- @apply text-gray-500 mb-6 max-w-md;- }- .watchlist-container {- @apply flex flex-col-reverse lg:grid lg:grid-cols-3 gap-8;- }- .watchlist {- @apply lg:col-span-2 space-y-8;- }- .watchlist-alerts {- @apply items-start gap-6 h-full flex-col w-full lg:col-span-1;- }- .watchlist-icon-btn {- @apply w-fit cursor-pointer hover:bg-transparent! text-gray-400 hover:text-teal-500;- }- .watchlist-icon-added {- @apply !text-teal-500 hover:!text-teal-600;- }- .watchlist-icon {- @apply w-8 h-8 rounded-full flex items-center justify-center bg-gray-700/50;- }- .trash-icon {- @apply h-4 w-4 text-gray-400 hover:text-red-400;- }- .star-icon {- @apply h-4 w-4;- }- .watchlist-title {- @apply text-xl md:text-2xl font-bold text-gray-100;- }- .watchlist-table {- @apply !relative overflow-hidden !w-full bg-gray-800 border !border-gray-600 !rounded-lg;- }- .table-header-row {- @apply text-gray-400 font-medium bg-gray-700 border-b border-gray-600 hover:bg-gray-700;- }- .table-header:first-child {- @apply pl-4;- }- .table-row {- @apply border-b cursor-pointer text-gray-100 border-gray-600 hover:bg-gray-700/50 transition-colors;- }- .table-cell {- @apply font-medium text-base- }- .add-alert {- @apply flex text-sm items-center whitespace-nowrap gap-1.5 px-3 w-fit py-2 text-teal-600 border border-teal-600/20 rounded font-medium bg-transparent hover:bg-transparent cursor-pointer transition-colors;- }- .watchlist-news {- @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4;- }- .news-item {- @apply bg-gray-800 rounded-lg border w-full border-gray-600 p-4 duration-200 hover:border-gray-600 cursor-pointer;- }- .news-tag {- @apply inline-block w-fit px-2 py-1 mb-5 rounded bg-gray-600/60 text-green-500 text-sm font-mono font-medium;- }- .news-title {- @apply text-lg font-semibold text-gray-100 leading-tight mb-3 line-clamp-2;- }- .news-meta {- @apply flex items-center text-sm text-gray-500 mb-1;- }- .news-summary {- @apply text-gray-400 flex-1 text-base leading-relaxed mb-3 line-clamp-3;- }- .news-cta {- @apply text-sm align-bottom text-teal-500 hover:text-gray-400;- }- .alert-dialog {- @apply bg-gray-800 border-gray-600 text-gray-400 max-w-md;+ @apply font-semibold text-foreground truncate;}- .alert-title {- @apply text-xl font-semibold text-gray-100;- }- .alert-list {- @apply overflow-y-auto w-full max-h-[911px] rounded-lg flex border border-gray-600 flex-col gap-4 bg-gray-800 p-3 flex-1;- }- .alert-empty {- @apply px-6 py-8 text-center text-gray-500/50;- }- .alert-item {- @apply p-4 rounded-lg bg-gray-700 border border-gray-600;- }- .alert-name {- @apply mb-2 text-lg text-teal-500 font-semibold;- }- .alert-details {- @apply flex border-b pb-3 items-center justify-between gap-3 mb-2;- }- .alert-company {- @apply text-gray-400 text-base;- }- .alert-price {- @apply text-gray-100 font-bold;- }- .alert-actions {- @apply flex items-end justify-between;- }- .alert-update-btn {- @apply text-gray-400 rounded-full bg-transparent hover:bg-green-500/15 cursor-pointer;- }- .alert-delete-btn {- @apply text-gray-400 rounded-full hover:bg-red-600/15 bg-transparent cursor-pointer transition-colors;- }-}--/* Market News Component Styles */-.scrollbar-hide {- -ms-overflow-style: none;- scrollbar-width: none;-}--.scrollbar-hide::-webkit-scrollbar {- display: none;-}--/* TradingView Advanced Chart Widget Styles */-.tradingview-widget-container {- position: relative;- background-color: #141414 !important;- border-radius: 8px !important;- overflow: hidden !important;-}--.tv-embed-widget-wrapper__body {- background-color: #141414 !important;-}--.tradingview-widget-container__widget {- background-color: #141414 !important;- height: 100% !important;--}--.widget-stock-heatmap-container .screenerMapWrapper-BBVfGP0b {- overflow: hidden !important;- background: #141414 !important;- background-color: #141414 !important;-}--.canvasContainer-tyaAU8aH {- background: #141414 !important;- background-color: #141414 !important;-}--.tv-site-widget--bg_none {- background-color: transparent !important;-}--.tradingview-widget-copyright {- font-size: 11px;- color: #9ca3af;- text-align: center;- padding: 4px 0;- background-color: transparent;-}--.tradingview-widget-copyright a {- color: #60a5fa;- text-decoration: none;- transition: color 0.2s ease;-}--.tradingview-widget-copyright a:hover {- color: #93c5fd;- text-decoration: underline;-}--.tv-embed-widget-wrapper .tv-embed-widget-wrapper__body {- background: #141414 !important;- background-color: #141414 !important;-}--.tradingview-widget-container iframe {- background-color: #141414 !important;- width: 100% !important;-}--.custom-chart.tradingview-widget-container iframe {- border: 1px solid #30333A;- border-radius: 8px !important;- overflow: hidden !important;}/* Custom scrollbar that shows on hover */@@ -461,29 +801,22 @@scrollbar-width: thin;scrollbar-color: transparent transparent;}--.scrollbar-hide-default::-webkit-scrollbar {- width: 8px;-}--.scrollbar-hide-default::-webkit-scrollbar-track {- background: transparent;-}--.scrollbar-hide-default::-webkit-scrollbar-thumb {- background-color: transparent;- border-radius: 4px;- transition: background-color 0.3s ease;-}-.scrollbar-hide-default:hover {- scrollbar-color: #30333A transparent;+ scrollbar-color: var(--line-strong) transparent;}-.scrollbar-hide-default:hover::-webkit-scrollbar-thumb {- background-color: #30333A;-}+/* Live price updates: a short tint toward up/down, then back */+@keyframes flash-up { from { background-color: oklch(0.70 0.164 150 / 0.28); } to { background-color: transparent; } }+@keyframes flash-down { from { background-color: oklch(0.70 0.162 25 / 0.28); } to { background-color: transparent; } }+.flash-up, .flash-down { border-radius: 6px; animation: 900ms var(--ui-ease) both; }+.flash-up { animation-name: flash-up; }+.flash-down { animation-name: flash-down; }-.scrollbar-hide-default::-webkit-scrollbar-thumb:hover {- background-color: #9095A1;-}\ No newline at end of file+.live-dot {+ display: inline-block;+ width: 6px;+ height: 6px;+ border-radius: 999px;+ background: var(--up);+ box-shadow: 0 0 0 3px oklch(0.70 0.164 150 / 0.18);+}diff --git a/app/layout.tsx b/app/layout.tsxindex 915fc8d..190ff12 100644--- a/app/layout.tsx+++ b/app/layout.tsx@@ -1,17 +1,18 @@import type { Metadata } from "next";-import { Geist, Geist_Mono } from "next/font/google";+import { Plus_Jakarta_Sans, IBM_Plex_Mono } from "next/font/google";import { Analytics } from "@vercel/analytics/next";import {Toaster} from "@/components/ui/sonner";import "./globals.css";-const geistSans = Geist({- variable: "--font-geist-sans",+const jakarta = Plus_Jakarta_Sans({+ variable: "--font-jakarta",subsets: ["latin"],});-const geistMono = Geist_Mono({- variable: "--font-geist-mono",+const plexMono = IBM_Plex_Mono({+ variable: "--font-plex-mono",subsets: ["latin"],+ weight: ["400", "500", "600"],});export const metadata: Metadata = {@@ -27,7 +28,7 @@ export default function RootLayout({return (<html lang="en" className="dark"><body- className={`${geistSans.variable} ${geistMono.variable} antialiased`}+ className={`${jakarta.variable} ${plexMono.variable} font-sans antialiased`}>{children}<Toaster/>diff --git a/components/ChangePill.tsx b/components/ChangePill.tsxnew file mode 100644index 0000000..483d176--- /dev/null+++ b/components/ChangePill.tsx@@ -0,0 +1,16 @@+import { ArrowDownRight, ArrowUpRight } from "lucide-react";++// Direction is carried by colour and arrow, so it never relies on colour alone.+const ChangePill = ({ value }: { value?: number | null }) => {+ if (value == null || !Number.isFinite(value)) return <span className="pill">—</span>;+ if (value === 0) return <span className="pill">0.00%</span>;+ const up = value > 0;+ return (+ <span className={up ? 'pill is-up' : 'pill is-down'}>+ {up ? <ArrowUpRight /> : <ArrowDownRight />}+ {Math.abs(value).toFixed(2)}%+ </span>+ );+};++export default ChangePill;diff --git a/components/DonatePopup.tsx b/components/DonatePopup.tsxindex 860e872..80138bf 100644--- a/components/DonatePopup.tsx+++ b/components/DonatePopup.tsx@@ -8,15 +8,13 @@ import {DialogHeader,DialogTitle,} from '@/components/ui/dialog';-import { Button } from '@/components/ui/button';-import { Heart, Github } from 'lucide-react';+import Link from 'next/link';+import { Heart } from 'lucide-react';const DONATE_POPUP_KEY = 'opendevsociety-donate-popup-dismissed';const DONATE_POPUP_DELAY = 3000; // Show after 3 secondsconst DONATE_POPUP_COOLDOWN = 24 * 60 * 60 * 1000; // 24 hours in milliseconds-const GITHUB_SPONSOR_URL = 'https://github.com/sponsors/ravixalgorithm';-export default function DonatePopup() {const [open, setOpen] = useState(false);@@ -54,52 +52,32 @@ export default function DonatePopup() {localStorage.setItem(DONATE_POPUP_KEY, Date.now().toString());};- const handleDonate = () => {- window.open(GITHUB_SPONSOR_URL, '_blank', 'noopener,noreferrer');- handleDismiss();- };return (- <Dialog open={open} onOpenChange={setOpen}>- <DialogContent className="!bg-gray-800 !border-teal-600/50 text-gray-100 max-w-md mx-4 sm:mx-auto sm:w-full sm:max-w-lg">- <DialogHeader>- <div className="flex items-center gap-3 mb-2">- <div className="p-2 bg-teal-500/20 rounded-lg">- <Heart className="h-6 w-6 text-teal-400 fill-teal-400" />- </div>- <DialogTitle className="text-2xl font-bold text-gray-100">- Keep OpenStock Free- </DialogTitle>+ <Dialog open={open} onOpenChange={(next) => (next ? setOpen(true) : handleDismiss())}>+ <DialogContent className="gap-5 sm:max-w-[440px]">+ <DialogHeader className="gap-3 text-left">+ <span className="bento-ico size-11 bg-brand-soft text-brand-ink">+ <Heart className="size-5 fill-current" />+ </span>+ <div>+ <p className="kicker flex items-center gap-2 text-brand-ink"><span className="live-dot" /> Open for sponsors</p>+ <DialogTitle className="mt-1.5 text-2xl font-bold tracking-[-0.03em]">Keep OpenStock free</DialogTitle></div>- <DialogDescription className="text-gray-400 text-base leading-relaxed pt-2">- Your overwhelming love for OpenStock and Open Dev Society has helped us grow,- but we're hitting Vercel's free tier limits.- <br /><br />- Help us keep OpenStock free and accessible for everyone by supporting us on GitHub Sponsors.- Every contribution, no matter how small, makes a difference! 💙+ <DialogDescription className="text-[15px] leading-relaxed text-muted-foreground">+ Your love for OpenStock and Open Dev Society has helped us grow, and we're now hitting+ Vercel's free tier limits. Sponsor from $5 a month, give once, or talk with us about a partnership.</DialogDescription></DialogHeader>- <div className="flex flex-col sm:flex-row gap-3 mt-6">- <Button- onClick={handleDonate}- className="flex-1 bg-gradient-to-r from-teal-500 to-cyan-500 hover:from-teal-600 hover:to-cyan-600 text-white font-semibold h-11 transition-all duration-200 transform hover:scale-105"- >- <Github className="h-4 w-4 mr-2" />- Sponsor on GitHub- </Button>- <Button- onClick={handleDismiss}- variant="outline"- className="flex-1 border-teal-600/50 text-teal-400 hover:bg-teal-600/10 hover:text-teal-300 h-11 transition-all duration-200"- >- Maybe Later- </Button>+ <div className="flex flex-col gap-2 sm:flex-row">+ <Link href="/sponsor" onClick={handleDismiss} className="btn btn-primary h-11 flex-1">+ <Heart className="fill-current" /> Become a sponsor+ </Link>+ <button type="button" onClick={handleDismiss} className="btn btn-ghost h-11 flex-1">+ Maybe later+ </button></div>-- <p className="text-xs text-gray-500 text-center mt-4">- This popup won't appear again for 24 hours after dismissing- </p></DialogContent></Dialog>);diff --git a/components/Footer.tsx b/components/Footer.tsxdeleted file mode 100644index 6ff6ab1..0000000--- a/components/Footer.tsx+++ /dev/null@@ -1,118 +0,0 @@-import Link from "next/link";-import Image from "next/image";-import OpenDevSocietyBranding from "./OpenDevSocietyBranding";--const Footer = () => {- return (- <footer className="bg-gray-900 text-white border-t border-gray-800">- <div className="container mx-auto px-4 py-12">- <div className="grid grid-cols-1 md:grid-cols-3 gap-8">- {/* Brand Section */}- <div className="col-span-1 md:col-span-2">- <Link href="/" className="flex items-center gap-2 mb-4">- <Image- src="/assets/images/logo.png"- alt="OpenStock"- width={150}- height={38}- className="brightness-0 invert"- />- </Link>- <p className="text-gray-400 mb-6 max-w-md">- OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, set personalized alerts, and explore detailed company insights — built openly, for everyone, forever free.- </p>- <div className="mb-8">- <Link href="/about" className="text-teal-400 hover:text-teal-300 font-medium inline-flex items-center gap-1 group">- Learn about our mission- <span className="group-hover:translate-x-1 transition-transform">→</span>- </Link>- </div>- <div className="flex space-x-6">- <Link- href="https://github.com/Open-Dev-Society/OpenStock"- target="_blank"- rel="noopener noreferrer"- className="text-gray-400 hover:text-white transition-colors duration-200 relative group"- >- <span className="relative">- GitHub- <span className="absolute left-0 bottom-0 w-0 h-0.5 bg-white transition-all duration-300 group-hover:w-full"></span>- </span>- </Link>- <Link- href="https://www.linkedin.com/company/opendevsociety-in/"- target="_blank"- rel="noopener noreferrer"- className="text-gray-400 hover:text-blue-400 transition-colors duration-200 relative group"- >- <span className="relative">- <span className="absolute left-0 bottom-0 w-0 h-0.5 bg-blue-400 transition-all duration-300 group-hover:w-full"></span>- </span>- </Link>- <Link- href="https://discord.gg/JkJ8kfxgxB"- target="_blank"- rel="noopener noreferrer"- className="text-gray-400 hover:text-blue-600 transition-colors duration-200 relative group"- >- <span className="relative">- Discord- <span className="absolute left-0 bottom-0 w-0 h-0.5 bg-blue-600 transition-all duration-300 group-hover:w-full"></span>- </span>- </Link>- </div>- </div>-- {/* Resources */}- <div>- <h3 className="text-lg font-semibold mb-4">Resources</h3>- <ul className="space-y-2">- <li>- <Link href="/api-docs" className="text-gray-400 hover:text-white transition-colors duration-200 relative group">- <span className="relative">- API Documentation- <span className="absolute left-0 bottom-0 w-0 h-0.5 bg-white transition-all duration-300 group-hover:w-full"></span>- </span>- </Link>- </li>- <li>- <Link href="/help" className="text-gray-400 hover:text-white transition-colors duration-200 relative group">- <span className="relative">- Help Center- <span className="absolute left-0 bottom-0 w-0 h-0.5 bg-white transition-all duration-300 group-hover:w-full"></span>- </span>- </Link>- </li>- <li>- <Link href="/terms" className="text-gray-400 hover:text-white transition-colors duration-200 relative group">- <span className="relative">- Terms of Service- <span className="absolute left-0 bottom-0 w-0 h-0.5 bg-white transition-all duration-300 group-hover:w-full"></span>- </span>- </Link>- </li>- </ul>- </div>- </div>-- {/* Divider */}- <div className="border-t border-gray-800 mt-8 pt-8">- <div className="flex flex-col md:flex-row justify-between items-center">- {/* Copyright */}- <div className="text-gray-400 text-sm mb-4 md:mb-0">- © {new Date().getFullYear()} Open Dev Society. All rights reserved.- </div>-- {/* Open Dev Society Branding */}- <div className="flex items-center space-x-2">- <OpenDevSocietyBranding />- </div>- </div>- </div>- </div>- </footer>- );-};--export default Footer;diff --git a/components/Header.tsx b/components/Header.tsxdeleted file mode 100644index 5523407..0000000--- a/components/Header.tsx+++ /dev/null@@ -1,30 +0,0 @@-import Link from "next/link";-import Image from "next/image";-import NavItems from "@/components/NavItems";-import UserDropdown from "@/components/UserDropdown";-import {searchStocks} from "@/lib/actions/finnhub.actions";--const Header = async ({ user }: { user: User }) => {- const initialStocks = await searchStocks();-- return (- <header className="sticky top-0 header">- <div className="container header-wrapper">- <Link href="/" className="flex items-center justify-center gap-2">- <Image- src="/assets/images/logo.png"- alt="OpenStock"- width={200}- height={50}- />- </Link>- <nav className="hidden sm:block">- <NavItems initialStocks={initialStocks}/>- </nav>-- <UserDropdown user={user} initialStocks={initialStocks} />- </div>- </header>- )-}-export default Header\ No newline at end of filediff --git a/components/NavItems.tsx b/components/NavItems.tsxdeleted file mode 100644index df0e9da..0000000--- a/components/NavItems.tsx+++ /dev/null@@ -1,68 +0,0 @@-'use client'---import React, { createContext, useContext } from 'react'-import {NAV_ITEMS} from "@/lib/constants";-import Link from "next/link";-import {usePathname} from "next/navigation";-import SearchCommand from "@/components/SearchCommand";-import { Heart } from 'lucide-react';-import { Button } from '@/components/ui/button';--// Create context for popup state-const DonatePopupContext = createContext<{- openDonatePopup: () => void;-}>({- openDonatePopup: () => {}-});--export const useDonatePopup = () => useContext(DonatePopupContext);--const NavItems = ({initialStocks}: { initialStocks: StockWithWatchlistStatus[]}) => {- const pathname = usePathname()-- const isActive = (path: string) => {- if (path ==='/') return pathname === '/'-- return pathname.startsWith(path);- }-- const openDonatePopup = () => {- // Trigger the popup by dispatching a custom event- window.dispatchEvent(new CustomEvent('open-donate-popup'));- }-- return (- <DonatePopupContext.Provider value={{ openDonatePopup }}>- <ul className="flex flex-col sm:flex-row p-2 gap-3 sm:gap-10 font-medium">- {NAV_ITEMS.map(({href, label}) => {- if (href === '/search') return (- <li key="search-trigger">- <SearchCommand- renderAs="text"- label="Search"- initialStocks={initialStocks}- />- </li>- )- return <li key={href}>- <Link href={href} className={`hover:text-teal-500 transition-colors ${isActive(href) ? 'text-gray-100' : ''}`}>- {label}- </Link>- </li>- })}- <li key="donate">- <Button- onClick={openDonatePopup}- className="bg-gradient-to-r from-teal-500 to-cyan-500 hover:from-teal-600 hover:to-cyan-600 text-white font-semibold px-4 py-2 rounded-lg shadow-lg hover:shadow-xl transition-all duration-200 transform hover:scale-105 flex items-center gap-2 animate-pulse"- size="sm"- >- <Heart className="h-4 w-4 fill-current" />- Donate- </Button>- </li>- </ul>- </DonatePopupContext.Provider>- )-}-export default NavItemsdiff --git a/components/OpenDevSocietyBranding.tsx b/components/OpenDevSocietyBranding.tsxindex 2d1d836..0f43b9b 100644--- a/components/OpenDevSocietyBranding.tsx+++ b/components/OpenDevSocietyBranding.tsx@@ -157,7 +157,7 @@ export const OpenDevSocietyBranding: React.FC<OpenDevSocietyBrandingProps> = ({text = "Initiative by",name = "Open Dev Society",style = {},- className = "border-2 border-gray-300 px-3 py-0.5 rounded-lg",+ className = "rounded-lg px-3 py-0.5 shadow-[inset_0_0_0_1px_var(--line)]",logoSize = 40,textColor = "#fff",outerStyle = {},diff --git a/components/Panel.tsx b/components/Panel.tsxnew file mode 100644index 0000000..f623513--- /dev/null+++ b/components/Panel.tsx@@ -0,0 +1,29 @@+import React from "react";+import { cn } from "@/lib/utils";++type PanelProps = {+ title?: string;+ sub?: React.ReactNode;+ action?: React.ReactNode;+ className?: string;+ bodyClassName?: string;+ children: React.ReactNode;+};++// Concentric hatch shell: a recessed hatched frame holding one raised card.+const Panel = ({ title, sub, action, className, bodyClassName, children }: PanelProps) => (+ <section className={cn('hatch', className)}>+ {title && (+ <div className="section-head">+ <div className="min-w-0">+ <h2 className="section-title">{title}</h2>+ {sub && <p className="section-sub">{sub}</p>}+ </div>+ {action}+ </div>+ )}+ <div className={cn('card', bodyClassName)}>{children}</div>+ </section>+);++export default Panel;diff --git a/components/PriceFlash.tsx b/components/PriceFlash.tsxnew file mode 100644index 0000000..f280b61--- /dev/null+++ b/components/PriceFlash.tsx@@ -0,0 +1,23 @@+'use client';++import React, { useEffect, useRef, useState } from "react";+import { cn } from "@/lib/utils";++// Briefly tints its content up/down when `value` changes, so live updates are noticed without shouting.+const PriceFlash = ({ value, className, children }: { value?: number | null; className?: string; children: React.ReactNode }) => {+ const previous = useRef(value);+ const [direction, setDirection] = useState<'up' | 'down' | null>(null);++ useEffect(() => {+ const before = previous.current;+ previous.current = value;+ if (value == null || before == null || value === before) return;+ setDirection(value > before ? 'up' : 'down');+ const timer = setTimeout(() => setDirection(null), 900);+ return () => clearTimeout(timer);+ }, [value]);++ return <span className={cn(className, direction && `flash-${direction}`)}>{children}</span>;+};++export default PriceFlash;diff --git a/components/SearchCommand.tsx b/components/SearchCommand.tsxindex 82b4098..e9f679e 100644--- a/components/SearchCommand.tsx+++ b/components/SearchCommand.tsx@@ -2,17 +2,28 @@import { useEffect, useState } from "react"import { CommandDialog, CommandEmpty, CommandInput, CommandList } from "@/components/ui/command"-import {Button} from "@/components/ui/button";-import {Loader2, TrendingUp} from "lucide-react";+import { ArrowUpRight, Loader2 } from "lucide-react";import Link from "next/link";-import {searchStocks} from "@/lib/actions/finnhub.actions";-import {useDebounce} from "@/hooks/useDebounce";+import { searchStocks } from "@/lib/actions/finnhub.actions";+import { useDebounce } from "@/hooks/useDebounce";-export default function SearchCommand({ renderAs = 'button', label = 'Add stock', initialStocks }: SearchCommandProps) {+const OPEN_SEARCH_EVENT = 'open-search';++// Any button can open the one palette mounted in the app shell.+export const openSearch = () => window.dispatchEvent(new Event(OPEN_SEARCH_EVENT));++export const SearchButton = ({ children, className }: { children: React.ReactNode; className?: string }) => (+ <button type="button" onClick={openSearch} className={className}>{children}</button>+);++export default function SearchCommand({ initialStocks }: { initialStocks: StockWithWatchlistStatus[] }) {const [open, setOpen] = useState(false)const [searchTerm, setSearchTerm] = useState("")const [loading, setLoading] = useState(false)const [stocks, setStocks] = useState<StockWithWatchlistStatus[]>(initialStocks);+ // The palette starts closed, so render it only after hydration (avoids Radix id mismatches)+ const [mounted, setMounted] = useState(false);+ useEffect(() => setMounted(true), []);const isSearchMode = !!searchTerm.trim();const displayStocks = isSearchMode ? stocks : stocks?.slice(0, 10);@@ -24,8 +35,13 @@ export default function SearchCommand({ renderAs = 'button', label = 'Add stock'setOpen(v => !v)}}+ const onOpen = () => setOpen(true)window.addEventListener("keydown", onKeyDown)- return () => window.removeEventListener("keydown", onKeyDown)+ window.addEventListener(OPEN_SEARCH_EVENT, onOpen)+ return () => {+ window.removeEventListener("keydown", onKeyDown)+ window.removeEventListener(OPEN_SEARCH_EVENT, onOpen)+ }}, [])const handleSearch = async () => {@@ -54,64 +70,44 @@ export default function SearchCommand({ renderAs = 'button', label = 'Add stock'setStocks(initialStocks);}- return (- <>- {renderAs === 'text' ? (- <button- type="button"- onClick={() => setOpen(true)}- className="search-text"- >- {label}- </button>- ): (- <Button onClick={() => setOpen(true)} className="search-btn">- {label}- </Button>- )}- <CommandDialog open={open} onOpenChange={setOpen} className="search-dialog">- <div className="search-field">- <CommandInput value={searchTerm} onValueChange={setSearchTerm} placeholder="Search stocks..." className="search-input" />- {loading && <Loader2 className="search-loader" />}- </div>- <CommandList className="search-list">- {loading ? (- <CommandEmpty className="search-list-empty">Loading stocks...</CommandEmpty>- ) : displayStocks?.length === 0 ? (- <div className="search-list-indicator">- {isSearchMode ? 'No results found' : 'No stocks available'}- </div>- ) : (- <ul>- <div className="search-count">- {isSearchMode ? 'Search results' : 'Popular stocks'}- {` `}({displayStocks?.length || 0})- </div>- {displayStocks?.map((stock) => (- <li key={stock.symbol} className="search-item">- <Link- href={`/stocks/${stock.symbol}`}- onClick={handleSelectStock}- className="search-item-link"- >- <TrendingUp className="h-4 w-4 text-gray-500" />- <div className="flex-1">- <div className="search-item-name">- {stock.name}- </div>- <div className="text-sm text-gray-500">- {[stock.symbol, stock.exchange, stock.type].filter(Boolean).join(' | ')}- </div>- </div>+ if (!mounted) return null;- </Link>- </li>- ))}- </ul>- )- }- </CommandList>- </CommandDialog>- </>+ return (+ <CommandDialog open={open} onOpenChange={setOpen} className="search-dialog">+ <div className="search-field">+ <CommandInput value={searchTerm} onValueChange={setSearchTerm} placeholder="Search by company or symbol" className="search-input" />+ {loading && <Loader2 className="search-loader" />}+ </div>+ <CommandList className="search-list">+ {loading ? (+ <CommandEmpty className="search-list-empty">Searching</CommandEmpty>+ ) : displayStocks?.length === 0 ? (+ <div className="search-list-indicator">+ {isSearchMode ? `Nothing matches “${searchTerm.trim()}”` : 'No stocks available'}+ </div>+ ) : (+ <ul>+ <li className="search-count">+ {isSearchMode ? 'Results' : 'Popular'}+ <span className="num"> · {displayStocks?.length || 0}</span>+ </li>+ {displayStocks?.map((stock) => (+ <li key={stock.symbol} className="search-item">+ <Link+ href={`/stocks/${stock.symbol}`}+ onClick={handleSelectStock}+ className="search-item-link group"+ >+ <span className="mono w-20 shrink-0 text-[13px] font-semibold text-brand-ink truncate">{stock.symbol}</span>+ <span className="search-item-name flex-1">{stock.name}</span>+ <span className="hidden sm:block text-xs text-faint truncate max-w-40">{[stock.exchange, stock.type].filter(Boolean).join(' · ')}</span>+ <ArrowUpRight className="size-4 text-faint opacity-0 group-hover:opacity-100 transition-opacity" />+ </Link>+ </li>+ ))}+ </ul>+ )}+ </CommandList>+ </CommandDialog>)}diff --git a/components/SirayBanner.tsx b/components/SirayBanner.tsxdeleted file mode 100644index 9108c84..0000000--- a/components/SirayBanner.tsx+++ /dev/null@@ -1,40 +0,0 @@--"use client";--import { useState } from "react";-import { X } from "lucide-react";-import Link from "next/link";--export default function SirayBanner() {- const [isVisible, setIsVisible] = useState(true);-- if (!isVisible) return null;-- return (- <div className="bg-gradient-to-r from-teal-900/40 to-black border-b border-teal-900/30 px-4 py-2 relative">- <div className="max-w-7xl mx-auto flex items-center justify-between text-sm">- <div className="flex items-center gap-3">- <Link href="https://www.siray.ai/" target="_blank" className="flex items-center gap-2 hover:opacity-80 transition-opacity">- <div>- {/* Using the copied logo */}- <img src="/assets/icons/siray.svg" alt="Siray.ai Logo" className="h-7 w-auto" />- </div>- <span className="text-teal-100 font-medium tracking-wide">- • Reliably backed by <span className="text-[#20c997] font-bold">Siray.ai</span>- </span>- </Link>- <span className="hidden sm:inline text-teal-300/60 text-xs border-l border-teal-800/50 pl-3">- Ensuring 100% AI uptime for your market insights- </span>- </div>-- <button- onClick={() => setIsVisible(false)}- className="text-teal-400 hover:text-white transition-colors p-1"- >- <X size={14} />- </button>- </div>- </div>- );-}diff --git a/components/TradingViewWidget.tsx b/components/TradingViewWidget.tsxindex 51aabb4..9640ed3 100644--- a/components/TradingViewWidget.tsx+++ b/components/TradingViewWidget.tsx@@ -1,13 +1,12 @@'use client';import React, { memo, useState, useEffect } from 'react';+import { createPortal } from 'react-dom';import useTradingViewWidget from "@/hooks/useTradingViewWidget";import { cn } from "@/lib/utils";import { Maximize2, Minimize2 } from 'lucide-react';-import { Button } from '@/components/ui/button';interface TradingViewWidgetProps {- title?: string;scriptUrl: string;config: Record<string, unknown>;height?: number;@@ -15,20 +14,29 @@ interface TradingViewWidgetProps {allowExpand?: boolean;}-const TradingViewWidget = ({ title, scriptUrl, config, height = 600, className, allowExpand = false }: TradingViewWidgetProps) => {+const TradingViewWidget = ({ scriptUrl, config, height = 600, className, allowExpand = false }: TradingViewWidgetProps) => {const [isExpanded, setIsExpanded] = useState(false);const [windowHeight, setWindowHeight] = useState(0);useEffect(() => {- if (typeof window !== 'undefined') {- setWindowHeight(window.innerHeight);- const handleResize = () => setWindowHeight(window.innerHeight);- window.addEventListener('resize', handleResize);- return () => window.removeEventListener('resize', handleResize);- }+ setWindowHeight(window.innerHeight);+ const handleResize = () => setWindowHeight(window.innerHeight);+ window.addEventListener('resize', handleResize);+ return () => window.removeEventListener('resize', handleResize);}, []);- const currentHeight = isExpanded ? windowHeight : height;+ useEffect(() => {+ if (!isExpanded) return;+ const onKey = (e: KeyboardEvent) => e.key === 'Escape' && setIsExpanded(false);+ document.body.style.overflow = 'hidden';+ window.addEventListener('keydown', onKey);+ return () => {+ document.body.style.overflow = '';+ window.removeEventListener('keydown', onKey);+ };+ }, [isExpanded]);++ const currentHeight = isExpanded ? windowHeight - 24 : height;const widgetConfig = {...config,@@ -39,36 +47,28 @@ const TradingViewWidget = ({ title, scriptUrl, config, height = 600, className,const containerRef = useTradingViewWidget(scriptUrl, widgetConfig, currentHeight);- const toggleExpand = () => {- setIsExpanded(!isExpanded);- };-- return (- <div className={cn("w-full transition-all duration-300", isExpanded && "fixed inset-0 z-[9999] bg-background")}>- <div className={cn("w-full relative group", isExpanded && "h-full w-full")}>- {title && !isExpanded && <h3 className="font-semibold text-2xl text-gray-100 mb-5">{title}</h3>}-- {allowExpand && (- <Button- variant="ghost"- size="icon"- onClick={toggleExpand}- className={cn(- "absolute top-2 right-2 z-10 hover:bg-background/50 text-muted-foreground hover:text-foreground transition-all duration-200",- !isExpanded ? "opacity-0 group-hover:opacity-100" : "bg-background/20"- )}- title={isExpanded ? "Minimize" : "Click to expand"}- >- {isExpanded ? <Minimize2 className="h-6 w-6" /> : <Maximize2 className="h-6 w-6" />}- </Button>- )}+ const widget = (+ <div className={cn("tv-frame group", isExpanded && "fixed inset-3 z-50 shadow-[0_0_0_4px_var(--frame),0_24px_60px_oklch(0_0_0/0.6)]")}>+ {allowExpand && (+ <button+ type="button"+ onClick={() => setIsExpanded(!isExpanded)}+ className={cn("icon-btn absolute top-2 right-2 z-10 bg-card/80", !isExpanded && "opacity-0 group-hover:opacity-100 focus-visible:opacity-100")}+ aria-label={isExpanded ? "Exit full screen" : "Full screen"}+ title={isExpanded ? "Exit full screen (Esc)" : "Full screen"}+ >+ {isExpanded ? <Minimize2 /> : <Maximize2 />}+ </button>+ )}- <div className={cn('tradingview-widget-container', className, isExpanded && "h-full")} ref={containerRef}>- <div className="tradingview-widget-container__widget" style={{ height: currentHeight, width: "100%" }} />- </div>+ <div className={cn('tradingview-widget-container', className)} ref={containerRef} style={{ height: currentHeight }}>+ <div className="tradingview-widget-container__widget" style={{ height: currentHeight, width: "100%" }} /></div></div>);++ // Full screen escapes the shell grid instead of fighting its overflow+ return isExpanded ? createPortal(<><div className="fixed inset-0 z-50 bg-page/70 backdrop-blur-[3px]" />{widget}</>, document.body) : widget;}export default memo(TradingViewWidget);diff --git a/components/UserDropdown.tsx b/components/UserDropdown.tsxdeleted file mode 100644index 7542821..0000000--- a/components/UserDropdown.tsx+++ /dev/null@@ -1,73 +0,0 @@-'use client';--import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuLabel,- DropdownMenuSeparator,- DropdownMenuTrigger,-} from "@/components/ui/dropdown-menu"-import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"-import {useRouter} from "next/navigation";-import {Button} from "@/components/ui/button";-import {LogOut} from "lucide-react";-import NavItems from "@/components/NavItems";-import {signOut} from "@/lib/actions/auth.actions";--const UserDropdown = ({ user, initialStocks }: {user: User, initialStocks: StockWithWatchlistStatus[]}) => {- const router = useRouter();-- const handleSignOut = async () => {- await signOut();- router.push("/sign-in");- }-- return (- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button className="flex items-center gap-3 text-gray-4 hover:bg-gray-800 bg-gray-800">- <Avatar className="h-8 w-8">- <AvatarImage src="https://media.licdn.com/dms/image/v2/D560BAQGHApE1Vtq6DA/company-logo_200_200/B56ZY1OFJOGcAI-/0/1744649609317/philosopai_in_logo?e=1761782400&v=beta&t=uLNK6v7h96sXybdT42cVK0cJSZaA8KVLw8JYO5fY4oQ" />- <AvatarFallback className="bg-teal-500 text-teal-900 text-sm font-bold">- {user.name[0]}- </AvatarFallback>- </Avatar>- <div className="hidden md:flex flex-col items-start ">- <span className='text-base font-medium text-gray-400 hover:text-teal-500 '>- {user.name}- </span>- </div>- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent className="text-gray-400 bg-gray-800 relative right-5">- <DropdownMenuLabel>- <div className="flex relative items-center gap-3 py-2">- <Avatar className="h-10 w-10">- <AvatarImage src="https://media.licdn.com/dms/image/v2/D560BAQGHApE1Vtq6DA/company-logo_200_200/B56ZY1OFJOGcAI-/0/1744649609317/philosopai_in_logo?e=1761782400&v=beta&t=uLNK6v7h96sXybdT42cVK0cJSZaA8KVLw8JYO5fY4oQ" />- <AvatarFallback className="bg-teal-500 text-yellow-900 text-sm font-bold">- {user.name[0]}- </AvatarFallback>- </Avatar>- <div className="flex flex-col">- <span className='text-base font-medium text-gray-400'>- {user.name}- </span>- <span className="text-sm text-gray-500">{user.email}</span>- </div>- </div>- </DropdownMenuLabel>- <DropdownMenuSeparator className="bg-gray-600"/>- <DropdownMenuItem onClick={handleSignOut} className="text-gray-100 text-md font-medium focus:bg-transparent focus:text-teal-500 transition-colors cursor-pointer">- <LogOut className="h-4 w-4 mr-2 hidden sm:block" />- Logout- </DropdownMenuItem>- <DropdownMenuSeparator className="block sm:hidden bg-gray-600"/>- <nav className="sm:hidden">- <NavItems initialStocks={initialStocks} />- </nav>- </DropdownMenuContent>- </DropdownMenu>- )-}-export default UserDropdowndiff --git a/components/WatchlistButton.tsx b/components/WatchlistButton.tsxindex f94f48d..ceaf2b1 100644--- a/components/WatchlistButton.tsx+++ b/components/WatchlistButton.tsx@@ -1,120 +1,62 @@"use client";-import React, { useMemo, useState } from "react";-import { addToWatchlist, removeFromWatchlist } from "@/lib/actions/watchlist.actions";++import React, { useState } from "react";+import { useRouter } from "next/navigation";+import { Star } from "lucide-react";import { toast } from "sonner";+import { addToWatchlist, removeFromWatchlist } from "@/lib/actions/watchlist.actions";+import { cn } from "@/lib/utils";interface WatchlistButtonProps {symbol: string;company: string;isInWatchlist: boolean;- showTrashIcon?: boolean;- type?: "button" | "icon";- userId?: string; // Made optional for backward compat, but required for actions+ variant?: "button" | "icon";onWatchlistChange?: (symbol: string, added: boolean) => void;}-const WatchlistButton = ({- symbol,- company,- isInWatchlist,- showTrashIcon = false,- type = "button",- userId,- onWatchlistChange,-}: WatchlistButtonProps) => {- const [added, setAdded] = useState<boolean>(!!isInWatchlist);+const WatchlistButton = ({ symbol, company, isInWatchlist, variant = "button", onWatchlistChange }: WatchlistButtonProps) => {+ const router = useRouter();+ const [added, setAdded] = useState(isInWatchlist);const [loading, setLoading] = useState(false);- const label = useMemo(() => {- if (type === "icon") return added ? "" : "";- return added ? "Remove from Watchlist" : "Add to Watchlist";- }, [added, type]);-const handleClick = async (e: React.MouseEvent) => {- e.preventDefault(); // Prevent link navigation if inside a link-- if (!userId && !onWatchlistChange) {- console.error("WatchlistButton: userId or onWatchlistChange is required");- toast.error("Please sign in to modify watchlist");- return;- }+ e.preventDefault(); // may sit inside a linkconst next = !added;- setAdded(next); // Optimistic update+ setAdded(next); // optimisticsetLoading(true);-try {- if (userId) {- if (next) {- await addToWatchlist(userId, symbol, company);- toast.success(`${symbol} added to watchlist`);- } else {- await removeFromWatchlist(userId, symbol);- toast.success(`${symbol} removed from watchlist`);- }- }-- // Call external handler if provided (e.g. for UI refresh)+ if (next) await addToWatchlist(symbol, company);+ else await removeFromWatchlist(symbol);+ toast.success(next ? `${symbol} added to watchlist` : `${symbol} removed from watchlist`);onWatchlistChange?.(symbol, next);+ router.refresh(); // sidebar lists the watchlist from the layout} catch (error) {console.error("Watchlist action failed:", error);- setAdded(!next); // Revert on error- toast.error("Failed to update watchlist");+ setAdded(!next);+ toast.error("Couldn’t update your watchlist");} finally {setLoading(false);}};- if (type === "icon") {+ const label = added ? `Remove ${symbol} from watchlist` : `Add ${symbol} to watchlist`;++ if (variant === "icon") {return (- <button- type="button"- title={added ? `Remove ${symbol} from watchlist` : `Add ${symbol} to watchlist`}- aria-label={added ? `Remove ${symbol} from watchlist` : `Add ${symbol} to watchlist`}- className={`flex items-center justify-center p-2 rounded-full transition-all ${added ? "text-yellow-400 hover:bg-yellow-400/10" : "text-gray-400 hover:text-white hover:bg-white/10"} ${loading ? "opacity-50 cursor-wait" : ""}`}- onClick={handleClick}- disabled={loading}- >- <svg- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- fill={added ? "currentColor" : "none"}- stroke="currentColor"- strokeWidth="1.5"- className="w-6 h-6"- >- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.385a.563.563 0 00-.182-.557L3.04 10.385a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345l2.125-5.111z"- />- </svg>+ <button type="button" onClick={handleClick} disabled={loading} className={cn('icon-btn', added && 'is-on')} title={label} aria-label={label} aria-pressed={added}>+ <Star fill={added ? 'currentColor' : 'none'} /></button>);}return (- <button- type="button"- className={`watchlist-btn ${added ? "watchlist-remove" : ""} ${loading ? "opacity-70 cursor-wait" : ""}`}- onClick={handleClick}- disabled={loading}- >- {showTrashIcon && added ? (- <svg- xmlns="http://www.w3.org/2000/svg"- fill="none"- viewBox="0 0 24 24"- strokeWidth={1.5}- stroke="currentColor"- className="w-5 h-5 mr-2"- >- <path strokeLinecap="round" strokeLinejoin="round" d="M6 7h12M9 7V5a1 1 0 011-1h4a1 1 0 011 1v2m-7 4v6m4-6v6m4-6v6" />- </svg>- ) : null}- <span>{loading ? "Updating..." : label}</span>+ <button type="button" onClick={handleClick} disabled={loading} className={cn('btn btn-ghost', added && 'is-on')} aria-pressed={added}>+ <Star fill={added ? 'currentColor' : 'none'} />+ {added ? 'Watching' : 'Watch'}</button>);};-export default WatchlistButton;\ No newline at end of file+export default WatchlistButton;diff --git a/components/forms/ChoiceChips.tsx b/components/forms/ChoiceChips.tsxnew file mode 100644index 0000000..8d03c93--- /dev/null+++ b/components/forms/ChoiceChips.tsx@@ -0,0 +1,48 @@+'use client';++import { Controller, type Control, type FieldValues, type Path } from "react-hook-form";+import { cn } from "@/lib/utils";++type ChoiceChipsProps<T extends FieldValues> = {+ name: Path<T>;+ label: string;+ options: readonly { value: string; label: string }[];+ control: Control<T>;+};++// Single-choice pills for short option lists: every choice is visible and one tap away.+export default function ChoiceChips<T extends FieldValues>({ name, label, options, control }: ChoiceChipsProps<T>) {+ return (+ <Controller+ name={name}+ control={control}+ render={({ field }) => (+ <div className="flex flex-col gap-2">+ <span id={`${name}-label`} className="form-label">{label}</span>+ <div role="radiogroup" aria-labelledby={`${name}-label`} className="flex flex-wrap gap-1.5">+ {options.map((option) => {+ const selected = field.value === option.value;+ return (+ <button+ key={option.value}+ type="button"+ role="radio"+ aria-checked={selected}+ onClick={() => field.onChange(option.value)}+ className={cn(+ 'h-9 rounded-full px-3.5 text-[13.5px] font-semibold transition-[background-color,color,box-shadow,transform] duration-150 active:scale-[0.96]',+ selected+ ? 'bg-brand-soft text-brand-ink shadow-[inset_0_0_0_1px_oklch(0.8_0.13_176/0.45)]'+ : 'text-muted-foreground shadow-[inset_0_0_0_1px_var(--line)] hover:bg-hover hover:text-foreground',+ )}+ >+ {option.label}+ </button>+ );+ })}+ </div>+ </div>+ )}+ />+ );+}diff --git a/components/forms/CountrySelectField.tsx b/components/forms/CountrySelectField.tsxindex f5d1c92..84d5767 100644--- a/components/forms/CountrySelectField.tsx+++ b/components/forms/CountrySelectField.tsx@@ -137,8 +137,8 @@ export const CountrySelectField = ({<CountrySelect value={field.value} onChange={field.onChange} />)}/>- {error && <p className='text-sm text-red-500'>{error.message}</p>}- <p className='text-xs text-gray-500'>+ {error && <p className='text-[13px] text-down'>{error.message}</p>}+ <p className='text-[12.5px] text-faint'>Helps us show market data and news relevant to you.</p></div>diff --git a/components/forms/InputField.tsx b/components/forms/InputField.tsxindex 245dedf..6b81f8e 100644--- a/components/forms/InputField.tsx+++ b/components/forms/InputField.tsx@@ -18,7 +18,7 @@ const InputField = ({name, label, placeholder, type ="text", register, error, vaclassName={cn('form-input', {'opacity-50 cursor-not-allowed': disabled})}{...register(name, validation)}/>- {error && <p className="text-red-500">{error.message}</p>}+ {error && <p className="text-[13px] text-down">{error.message}</p>}</div>)}diff --git a/components/forms/PasswordRequirements.tsx b/components/forms/PasswordRequirements.tsxindex 5582ab4..1d08fd9 100644--- a/components/forms/PasswordRequirements.tsx+++ b/components/forms/PasswordRequirements.tsx@@ -7,7 +7,7 @@ import { Check, X } from 'lucide-react';const PasswordRequirements = ({ password }: { password: string }) => {return (- <ul className="space-y-1.5 mt-2">+ <ul className="grid grid-cols-2 gap-x-4 gap-y-1.5">{PASSWORD_RULES.map((rule) => {const passed = rule.test(password);return (diff --git a/components/forms/SelectField.tsx b/components/forms/SelectField.tsxdeleted file mode 100644index c6c1c80..0000000--- a/components/forms/SelectField.tsx+++ /dev/null@@ -1,42 +0,0 @@-import React from 'react'-import {Label} from "@/components/ui/label";-import {Controller} from "react-hook-form";-import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,-} from "@/components/ui/select"--const SelectField = ({name, label, placeholder, options, control, error, required = false}: SelectFieldProps) => {- return (- <div className="space-y-2">- <Label htmlFor={name}>{label}</Label>-- <Controller- name={name}- control={control}- rules={{- required: required ? `Please select ${label.toLowerCase()}`:false,- }}- render={({field}) => (- <Select value={field.value} onValueChange={field.onChange}>- <SelectTrigger className="select-trigger">- <SelectValue placeholder={placeholder} />- </SelectTrigger>- <SelectContent className="bg-gray-800 border-gray-600 text-white">- {options.map((option) => (- <SelectItem key={option.value} value={option.value} className="focus:bg-gray-600 focus: text-white">- {option.label}- </SelectItem>- ))}- </SelectContent>- {error && <p className="text-red-600">{error.message}</p>}- </Select>- )}- />- </div>- )-}-export default SelectFielddiff --git a/components/shell/AppShell.tsx b/components/shell/AppShell.tsxnew file mode 100644index 0000000..a1c6614--- /dev/null+++ b/components/shell/AppShell.tsx@@ -0,0 +1,56 @@+'use client';++import React, { useEffect, useRef, useState } from "react";+import { usePathname } from "next/navigation";+import Sidebar from "@/components/shell/Sidebar";+import TabBar from "@/components/shell/TabBar";+import SearchCommand from "@/components/SearchCommand";+import { cn } from "@/lib/utils";++type AppShellProps = {+ user: User;+ watchlist: { symbol: string; company: string }[];+ initialStocks: StockWithWatchlistStatus[];+ children: React.ReactNode;+};++const AppShell = ({ user, watchlist, initialStocks, children }: AppShellProps) => {+ const pathname = usePathname();+ const [navOpen, setNavOpen] = useState(false);+ const workspaceRef = useRef<HTMLElement>(null);++ // The workspace is the scroll container, so reset it on navigation+ useEffect(() => {+ setNavOpen(false);+ workspaceRef.current?.scrollTo({ top: 0 });+ }, [pathname]);++ return (+ <div className="shell">+ <div+ className={cn(+ 'min-h-0 max-lg:fixed max-lg:inset-y-0 max-lg:left-0 max-lg:z-50 max-lg:w-[272px] max-lg:transition-transform max-lg:duration-200',+ navOpen ? 'max-lg:translate-x-0' : 'max-lg:-translate-x-full',+ )}+ >+ <Sidebar user={user} watchlist={watchlist} />+ </div>+ {navOpen && (+ <div className="fixed inset-0 z-40 bg-page/60 backdrop-blur-[2px] lg:hidden" onClick={() => setNavOpen(false)} />+ )}++ <div className="shell-container">+ <div className="app">+ <TabBar onMenu={() => setNavOpen(true)} />+ <main ref={workspaceRef} className={cn('workspace', pathname === '/dashboard' && 'is-first-tab')}>+ <div className="workspace-inner">{children}</div>+ </main>+ </div>+ </div>++ <SearchCommand initialStocks={initialStocks} />+ </div>+ );+};++export default AppShell;diff --git a/components/shell/Sidebar.tsx b/components/shell/Sidebar.tsxnew file mode 100644index 0000000..a216fb7--- /dev/null+++ b/components/shell/Sidebar.tsx@@ -0,0 +1,129 @@+'use client';++import Link from "next/link";+import Image from "next/image";+import { usePathname, useRouter } from "next/navigation";+import { BookOpen, Code2, Heart, Info, LayoutDashboard, LifeBuoy, LogOut, Search, Star } from "lucide-react";+import { openSearch } from "@/components/SearchCommand";+import { signOut } from "@/lib/actions/auth.actions";+import { cn } from "@/lib/utils";+import { SIDEBAR_SPONSOR_SLOTS, sidebarSponsors } from "@/lib/sponsors";++type SidebarProps = {+ user: User;+ watchlist: { symbol: string; company: string }[];+};++const RESOURCES = [+ { href: '/help', label: 'Help', icon: LifeBuoy },+ { href: '/api-docs', label: 'API docs', icon: Code2 },+ { href: '/about', label: 'About', icon: Info },+ { href: '/terms', label: 'Terms', icon: BookOpen },+];++const Sidebar = ({ user, watchlist }: SidebarProps) => {+ const pathname = usePathname();+ const router = useRouter();+ const partners = sidebarSponsors();+ const openSlots = SIDEBAR_SPONSOR_SLOTS - partners.length;++ const handleSignOut = async () => {+ await signOut();+ router.push('/sign-in');+ };++ return (+ <aside className="sidebar">+ <Link href="/dashboard" className="px-2 pt-1 pb-2" aria-label="OpenStock dashboard">+ <Image src="/assets/images/logo.png" alt="OpenStock" width={150} height={38} priority />+ </Link>++ <button type="button" onClick={openSearch} className="side-cta">+ <Search className="size-4" strokeWidth={2.5} />+ <span className="flex-1 text-left">Search stocks</span>+ <kbd className="kbd bg-on-brand/10">⌘K</kbd>+ </button>++ <nav className="flex flex-col gap-0.5">+ <Link href="/dashboard" className={cn('side-item', pathname === '/dashboard' && 'is-active')}>+ <LayoutDashboard /> Overview+ </Link>+ <Link href="/watchlist" className={cn('side-item', pathname === '/watchlist' && 'is-active')}>+ <Star /> <span className="flex-1">Watchlist</span>+ <span className="num text-xs text-faint">{watchlist.length}</span>+ </Link>+ </nav>++ <div className="flex flex-col gap-1 min-h-0">+ <p className="side-label">Watching</p>+ {watchlist.length === 0 ? (+ <p className="px-2.5 text-[12.5px] text-faint">Star a stock to pin it here.</p>+ ) : (+ <ul className="flex flex-col gap-0.5">+ {watchlist.map(({ symbol, company }) => (+ <li key={symbol}>+ <Link+ href={`/stocks/${symbol}`}+ title={company}+ className={cn('side-item h-8 font-medium', pathname === `/stocks/${symbol}` && 'is-active')}+ >+ <span className="mono w-14 shrink-0 text-[12.5px] font-semibold text-foreground">{symbol}</span>+ {company !== symbol && <span className="truncate text-[12.5px] text-faint">{company}</span>}+ </Link>+ </li>+ ))}+ </ul>+ )}+ </div>++ <div className="mt-auto flex flex-col gap-0.5">+ {RESOURCES.map(({ href, label, icon: Icon }) => (+ <Link key={href} href={href} className={cn('side-item h-8', pathname === href && 'is-active')}>+ <Icon /> {label}+ </Link>+ ))}+ <button+ type="button"+ onClick={() => window.dispatchEvent(new CustomEvent('open-donate-popup'))}+ className="side-item h-8 text-left"+ >+ <Heart /> Support OpenStock+ </button>+ </div>++ <div className="flex flex-col gap-1.5">+ {partners.map((sponsor) => (+ <a key={sponsor.name} href={sponsor.url} target="_blank" rel="noreferrer" title={sponsor.name} className="flex h-11 items-center gap-2.5 rounded-[11px] px-3 shadow-[inset_0_0_0_1px_var(--line)] transition-colors hover:bg-white/5">+ {sponsor.logo ? <img src={sponsor.logo} alt={sponsor.name} className="h-5 w-auto max-w-[120px]" /> : <span className="truncate text-[13px] font-semibold text-muted-foreground">{sponsor.name}</span>}+ <span className="kicker ml-auto">Sponsor</span>+ </a>+ ))}+ {openSlots > 0 && (+ <Link href="/sponsor#tiers" className="group flex flex-col gap-0.5 rounded-[11px] px-3 py-2.5 shadow-[inset_0_0_0_1px_var(--line)] transition-colors hover:bg-white/5">+ <span className="kicker flex items-center gap-1.5 text-brand-ink">+ <span className="live-dot" /> {openSlots === SIDEBAR_SPONSOR_SLOTS ? 'Sponsor slots open' : `${openSlots} sponsor ${openSlots === 1 ? 'slot' : 'slots'} left`}+ </span>+ <span className="text-[12.5px] text-faint transition-colors group-hover:text-muted-foreground">Put your company in front of every OpenStock user.</span>+ </Link>+ )}+ </div>++ <div className="flex items-center gap-2.5 border-t border-line pt-3 px-1">+ <Link href="/profile" className={cn('-m-1 flex min-w-0 flex-1 items-center gap-2.5 rounded-[10px] p-1 transition-colors hover:bg-white/5', pathname === '/profile' && 'bg-white/5')}>+ <span className="grid size-8 flex-none place-items-center rounded-full bg-brand-soft text-[13px] font-bold text-brand-ink">+ {user.name?.[0]?.toUpperCase() ?? '?'}+ </span>+ <span className="min-w-0 flex-1">+ <span className="block truncate text-[13px] font-semibold text-foreground">{user.name}</span>+ <span className="block truncate text-[12px] text-faint">{user.email}</span>+ </span>+ </Link>+ <button type="button" onClick={handleSignOut} className="icon-btn" title="Sign out" aria-label="Sign out">+ <LogOut />+ </button>+ </div>+ </aside>+ );+};++export default Sidebar;diff --git a/components/shell/TabBar.tsx b/components/shell/TabBar.tsxnew file mode 100644index 0000000..607a76d--- /dev/null+++ b/components/shell/TabBar.tsx@@ -0,0 +1,126 @@+'use client';++import { useEffect, useLayoutEffect, useRef, useState } from "react";+import Link from "next/link";+import { usePathname, useRouter } from "next/navigation";+import { LayoutDashboard, Menu, Plus, Star, X } from "lucide-react";+import { openSearch } from "@/components/SearchCommand";+import { cn } from "@/lib/utils";++const PINNED = ['/dashboard', '/watchlist'];+const STORAGE_KEY = 'openstock-tabs';+const MAX_TABS = 12;++const PAGE_LABELS: Record<string, string> = {+ '/dashboard': 'Overview',+ '/watchlist': 'Watchlist',+ '/profile': 'Profile',+};++// Pages become browser-style tabs; stock pages are labelled by their symbol.+const tabLabel = (path: string) => {+ const stock = path.match(/^\/stocks\/([^/]+)$/);+ if (stock) return decodeURIComponent(stock[1]).toUpperCase();+ return PAGE_LABELS[path] ?? null;+};++const withTab = (tabs: string[], path: string) => {+ if (!tabLabel(path) || tabs.includes(path)) return tabs;+ const next = [...tabs, path];+ const extra = next.length - MAX_TABS;+ return extra > 0 ? next.filter((t, i) => PINNED.includes(t) || i >= extra + PINNED.length) : next;+};++const TabBar = ({ onMenu }: { onMenu: () => void }) => {+ const pathname = usePathname();+ const router = useRouter();+ const [tabs, setTabs] = useState(() => withTab(PINNED, pathname));+ const tabRefs = useRef(new Map<string, HTMLAnchorElement>());+ const [glider, setGlider] = useState<{ x: number; w: number } | null>(null);++ // Restore tabs from the last visit (per-browser convenience only)+ useEffect(() => {+ try {+ const saved: unknown = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]');+ if (Array.isArray(saved)) {+ setTabs((current) => saved.filter((p): p is string => typeof p === 'string').reduce(withTab, current));+ }+ } catch { /* storage unavailable */ }+ }, []);++ useEffect(() => setTabs((current) => withTab(current, pathname)), [pathname]);++ useEffect(() => {+ try { localStorage.setItem(STORAGE_KEY, JSON.stringify(tabs)); } catch { /* storage unavailable */ }+ }, [tabs]);++ useLayoutEffect(() => {+ const el = tabRefs.current.get(pathname);+ if (!el) return setGlider(null);+ setGlider({ x: el.offsetLeft - 11, w: el.offsetWidth + 22 });+ el.scrollIntoView({ block: 'nearest', inline: 'nearest' });+ }, [pathname, tabs]);++ const closeTab = (path: string) => {+ const index = tabs.indexOf(path);+ const next = tabs.filter((t) => t !== path);+ setTabs(next);+ if (path === pathname) router.push(next[Math.max(0, index - 1)] ?? '/dashboard');+ };++ return (+ <div className="tabbar">+ <button type="button" onClick={onMenu} className="chrome-btn lg:hidden" aria-label="Open menu">+ <Menu />+ </button>++ <div className="tabs pl-3 pr-3">+ <div+ className={cn('tab-glider', glider && 'is-ready')}+ style={glider ? { transform: `translateX(${glider.x}px)`, width: glider.w } : undefined}+ aria-hidden+ >+ <svg className="tab-glider-curve is-left" viewBox="0 0 12 12"><path d="M12 0v12H0c6.627 0 12-5.373 12-12z" /></svg>+ <div className="tab-glider-body" />+ <svg className="tab-glider-curve is-right" viewBox="0 0 12 12"><path d="M12 0v12H0c6.627 0 12-5.373 12-12z" /></svg>+ </div>++ {tabs.map((path) => {+ const pinned = PINNED.includes(path);+ const isStock = path.startsWith('/stocks/');+ const active = path === pathname;+ return (+ <Link+ key={path}+ href={path}+ ref={(el) => { if (el) tabRefs.current.set(path, el); else tabRefs.current.delete(path); }}+ className={cn('tab', active && 'is-active', pinned && 'pr-4')}+ aria-current={active ? 'page' : undefined}+ >+ {path === '/dashboard' && <LayoutDashboard />}+ {path === '/watchlist' && <Star />}+ <span className={cn('tab-label', isStock && 'mono text-[13px]')}>{tabLabel(path)}</span>+ {!pinned && (+ <span+ role="button"+ tabIndex={-1}+ aria-label={`Close ${tabLabel(path)}`}+ className="tab-close"+ onClick={(e) => { e.preventDefault(); e.stopPropagation(); closeTab(path); }}+ >+ <X />+ </span>+ )}+ </Link>+ );+ })}+ </div>++ <button type="button" onClick={openSearch} className="chrome-btn -ml-2" aria-label="Open a stock" title="Open a stock (⌘K)">+ <Plus />+ </button>+ </div>+ );+};++export default TabBar;diff --git a/components/stocks/StockHeader.tsx b/components/stocks/StockHeader.tsxnew file mode 100644index 0000000..c94dfd5--- /dev/null+++ b/components/stocks/StockHeader.tsx@@ -0,0 +1,118 @@+import { Bell, CalendarClock, Gauge, Landmark, MoveVertical } from "lucide-react";+import WatchlistButton from "@/components/WatchlistButton";+import CreateAlertModal from "@/components/watchlist/CreateAlertModal";+import StockLivePrice from "@/components/stocks/StockLivePrice";+import { requireUserId } from "@/lib/better-auth/auth";+import { isStockInWatchlist } from "@/lib/actions/watchlist.actions";+import { getCompanyProfile, getLiveQuotes } from "@/lib/actions/finnhub.actions";+import { formatNumber, formatPrice, formatSymbolForTradingView } from "@/lib/utils";+import { hasFinnhubQuotes } from "@/lib/markets";+import { symbolInfoConfig } from "@/lib/constants";+import TradingViewWidget from "@/components/TradingViewWidget";++// Symbols Finnhub's free plan can't price (most non-US listings) use TradingView's quote panel instead.+async function TradingViewHeader({ symbol, userId }: { symbol: string; userId: string }) {+ const isInWatchlist = await isStockInWatchlist(userId, symbol);+ const tvSymbol = formatSymbolForTradingView(symbol);+ return (+ <section className="hatch">+ <div className="card flex flex-wrap items-center justify-between gap-4 p-4">+ <div className="min-w-0">+ <h1 className="mono truncate text-xl font-bold tracking-[-0.02em]">{symbol}</h1>+ <p className="text-[12.5px] text-faint">{tvSymbol.split(':')[0]} · quote via TradingView</p>+ </div>+ <div className="flex items-center gap-2">+ <WatchlistButton symbol={symbol} company={symbol} isInWatchlist={isInWatchlist} />+ <span className="pill h-9 px-3" title="Price alerts need a quote source we can check every 5 minutes">+ <Bell /> Alerts: US stocks and crypto+ </span>+ </div>+ </div>+ <div className="card mt-[3px] p-1">+ <TradingViewWidget scriptUrl="https://s3.tradingview.com/external-embedding/embed-widget-symbol-info.js" config={symbolInfoConfig(tvSymbol)} height={180} />+ </div>+ </section>+ );+}++export default async function StockHeader({ symbol }: { symbol: string }) {+ const userId = await requireUserId();+ if (!hasFinnhubQuotes(symbol)) return <TradingViewHeader symbol={symbol} userId={userId} />;++ const [isInWatchlist, quotes, profile] = await Promise.all([+ isStockInWatchlist(userId, symbol),+ getLiveQuotes([symbol]),+ getCompanyProfile(symbol),+ ]);+ const quote = quotes[symbol];++ const currency = profile?.currency || 'USD';+ const company = profile?.name || symbol;+ const money = (value?: number) => (value ? formatPrice(value, currency) : '—');++ const stats = [+ { label: 'Open', icon: CalendarClock, value: money(quote?.o), hint: 'First trade of the session' },+ { label: 'Day range', icon: MoveVertical, value: quote?.l && quote?.h ? `${money(quote.l)} – ${money(quote.h)}` : '—', hint: 'Low to high' },+ { label: 'Prev close', icon: Gauge, value: money(quote?.pc), hint: 'Last session' },+ { label: 'Market cap', icon: Landmark, value: profile?.marketCapitalization ? formatNumber(profile.marketCapitalization) : '—', hint: currency },+ ];++ return (+ <section className="hatch">+ <div className="card flex flex-wrap items-center gap-x-6 gap-y-4 p-4">+ <div className="flex min-w-0 flex-1 basis-64 items-center gap-3">+ {profile?.logo ? (+ <span className="logo-well size-11"><img src={profile.logo} alt="" className="size-full object-contain p-1.5" /></span>+ ) : (+ <span className="logo-well is-empty size-11">{symbol[0]}</span>+ )}+ <div className="min-w-0">+ <h1 className="truncate text-xl font-bold tracking-[-0.03em]">{company}</h1>+ <p className="mono truncate text-[12.5px] text-faint">+ {[symbol, profile?.exchange, profile?.finnhubIndustry].filter(Boolean).join(' · ')}+ </p>+ </div>+ </div>++ <StockLivePrice symbol={symbol} initial={quote} currency={currency} />++ <div className="flex items-center gap-2">+ <WatchlistButton symbol={symbol} company={company} isInWatchlist={isInWatchlist} />+ <CreateAlertModal symbol={symbol} currentPrice={quote?.c} currency={currency}>+ <button type="button" className="btn btn-primary"><Bell /> Set alert</button>+ </CreateAlertModal>+ </div>+ </div>++ <div className="bento mt-[3px]">+ {stats.map(({ label, icon: Icon, value, hint }) => (+ <div key={label} className="bento-tile gap-2.5">+ <div className="bento-head"><span className="bento-ico"><Icon /></span>{label}</div>+ <p className="num truncate text-[17px] font-bold tracking-[-0.02em]">{value}</p>+ <p className="text-[12px] text-faint">{hint}</p>+ </div>+ ))}+ </div>+ </section>+ );+}++export function StockHeaderSkeleton() {+ return (+ <section className="hatch" aria-busy="true">+ <div className="card flex items-center gap-3 p-4">+ <span className="size-11 animate-pulse rounded-full bg-hover" />+ <span className="flex flex-col gap-2">+ <span className="h-5 w-48 animate-pulse rounded-md bg-hover" />+ <span className="h-3 w-32 animate-pulse rounded-md bg-hover" />+ </span>+ <span className="ml-auto h-8 w-36 animate-pulse rounded-md bg-hover" />+ </div>+ <div className="bento mt-[3px]">+ {[0, 1, 2, 3].map((i) => (+ <div key={i} className="bento-tile h-[104px]"><span className="h-full animate-pulse rounded-lg bg-hover/60" /></div>+ ))}+ </div>+ </section>+ );+}diff --git a/components/stocks/StockLivePrice.tsx b/components/stocks/StockLivePrice.tsxnew file mode 100644index 0000000..a46fe57--- /dev/null+++ b/components/stocks/StockLivePrice.tsx@@ -0,0 +1,31 @@+'use client';++import ChangePill from "@/components/ChangePill";+import DataFreshness from "@/components/DataFreshness";+import PriceFlash from "@/components/PriceFlash";+import { useLiveQuotes, type LiveQuote } from "@/hooks/useLiveQuotes";+import { formatPrice } from "@/lib/utils";++const StockLivePrice = ({ symbol, initial, currency }: { symbol: string; initial: LiveQuote | null; currency: string }) => {+ const live = useLiveQuotes([symbol]);+ const quote = live[symbol] ?? initial;++ return (+ <div className="flex items-end gap-3">+ <PriceFlash value={quote?.c} className="bento-value px-1 text-[32px]">+ {quote?.c ? formatPrice(quote.c, currency) : '—'}+ </PriceFlash>+ <div className="flex flex-col items-start gap-1 pb-0.5">+ <span className="flex items-center gap-2">+ <ChangePill value={quote?.dp} />+ <span className="num text-[12px] text-faint">+ {quote?.d != null ? `${quote.d > 0 ? '+' : ''}${quote.d.toFixed(2)}` : ''}+ </span>+ </span>+ <DataFreshness tradeTime={quote?.t} />+ </div>+ </div>+ );+};++export default StockLivePrice;diff --git a/components/stocks/StockSentimentCard.tsx b/components/stocks/StockSentimentCard.tsxindex 7b4c608..41b5cd9 100644--- a/components/stocks/StockSentimentCard.tsx+++ b/components/stocks/StockSentimentCard.tsx@@ -1,11 +1,12 @@import type { StockSentimentInsights } from '@/lib/actions/adanos.helpers';+import { cn } from '@/lib/utils';interface StockSentimentCardProps {insight: StockSentimentInsights | null;}function formatScore(value: number | null, suffix: string): string {- if (value === null) return 'N/A';+ if (value === null) return '—';return `${value.toFixed(1)}${suffix}`;}@@ -16,21 +17,17 @@ function formatCompactNumber(value: number): string {}).format(value);}-function getTrendClasses(trend: string | null): string {- if (trend === 'rising') return 'text-emerald-400';- if (trend === 'falling') return 'text-rose-400';- if (trend === 'stable') return 'text-amber-300';- return 'text-gray-400';-}+const TREND_CLASS: Record<string, string> = {+ rising: 'is-up',+ falling: 'is-down',+ stable: '',+};-function getAlignmentClasses(alignment: string): string {- if (alignment === 'Bullish alignment') return 'text-emerald-400';- if (alignment === 'Bearish alignment' || alignment === 'Wide divergence') return 'text-rose-400';- if (alignment === 'Tight alignment') return 'text-blue-300';- if (alignment === 'Mixed') return 'text-amber-300';- if (alignment === 'Single-source view') return 'text-slate-300';- if (alignment === 'No sentiment mix') return 'text-zinc-400';- return 'text-gray-300';+function getAlignmentClass(alignment: string): string {+ if (alignment === 'Bullish alignment') return 'text-up';+ if (alignment === 'Bearish alignment' || alignment === 'Wide divergence') return 'text-down';+ if (alignment === 'Mixed') return 'text-warn';+ return 'text-muted-foreground';}export default function StockSentimentCard({ insight }: StockSentimentCardProps) {@@ -38,114 +35,45 @@ export default function StockSentimentCard({ insight }: StockSentimentCardProps)return null;}+ const summary = [+ { label: 'Avg. buzz', value: formatScore(insight.averageBuzz, '/100') },+ { label: 'Bullish avg', value: formatScore(insight.bullishAverage, '%') },+ { label: 'Coverage', value: `${insight.availableSources}/4 sources` },+ ];+return (- <section className="rounded-2xl border border-gray-800 bg-gray-950/40 p-5 backdrop-blur-sm">- <div className="flex flex-col gap-5">- <div className="flex flex-col gap-3 md:flex-row md:items-start md:justify-between">- <div>- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-gray-500">- Sentiment Insights- </p>- <h2 className="mt-2 text-xl font-semibold text-white">- {insight.symbol} across social and public channels- </h2>- {insight.companyName ? (- <p className="mt-1 text-sm font-medium text-gray-300">- {insight.companyName}- </p>- ) : null}- <p className="mt-1 text-sm text-gray-400">- Structured sentiment snapshot across Reddit, X.com, news, and Polymarket.- </p>+ <div className="flex flex-col">+ <div className="grid grid-cols-3 gap-2 p-3">+ {summary.map(({ label, value }) => (+ <div key={label} className="min-w-0">+ <p className="kicker">{label}</p>+ <p className="num mt-1 truncate font-bold text-foreground">{value}</p></div>+ ))}+ </div>+ <p className="border-t border-line px-3 py-2.5 text-[12.5px] text-faint">+ Source alignment: <span className={cn('font-semibold', getAlignmentClass(insight.sourceAlignment))}>{insight.sourceAlignment}</span>+ </p>- <div className="grid grid-cols-2 gap-3 rounded-2xl border border-gray-800 bg-black/20 p-4 md:min-w-[320px]">- <div>- <p className="text-[11px] font-medium uppercase tracking-[0.2em] text-gray-500">- Avg. Buzz- </p>- <p className="mt-1 text-lg font-semibold text-white">- {formatScore(insight.averageBuzz, '/100')}+ <ul className="row-list border-t border-line">+ {insight.sources.map((source) => (+ <li key={source.source} className="grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 px-3 py-2.5">+ <div className="min-w-0">+ <p className="truncate font-semibold text-foreground">{source.label}</p>+ <p className="num truncate text-[12px] text-faint">+ {formatCompactNumber(source.metricValue)} {source.metricLabel.toLowerCase()}</p></div>- <div>- <p className="text-[11px] font-medium uppercase tracking-[0.2em] text-gray-500">- Bullish Avg- </p>- <p className="mt-1 text-lg font-semibold text-white">- {formatScore(insight.bullishAverage, '%')}- </p>+ <div className="num text-right text-[12.5px]">+ <p className="font-semibold text-foreground">{formatScore(source.buzzScore, '')}</p>+ <p className="text-faint">buzz</p></div>- <div>- <p className="text-[11px] font-medium uppercase tracking-[0.2em] text-gray-500">- Source Alignment- </p>- <p className={`mt-1 text-sm font-semibold ${getAlignmentClasses(insight.sourceAlignment)}`}>- {insight.sourceAlignment}- </p>- </div>- <div>- <p className="text-[11px] font-medium uppercase tracking-[0.2em] text-gray-500">- Coverage- </p>- <p className="mt-1 text-lg font-semibold text-white">- {insight.availableSources}/4- </p>- </div>- </div>- </div>-- <div className="grid grid-cols-1 gap-4 md:grid-cols-2">- {insight.sources.map((source) => (- <article- key={source.source}- className="rounded-xl border border-gray-800 bg-black/20 p-4"- >- <div className="flex items-center justify-between">- <h3 className="text-base font-semibold text-white">{source.label}</h3>- <span className={`text-sm font-medium capitalize ${getTrendClasses(source.trend)}`}>- {source.trend ?? 'No trend'}- </span>- </div>-- <div className="mt-4 grid grid-cols-2 gap-3">- <div className="rounded-lg border border-gray-800 bg-black/20 p-3">- <p className="text-[11px] font-medium uppercase tracking-[0.2em] text-gray-500">- Buzz- </p>- <p className="mt-2 text-xl font-semibold text-white">- {formatScore(source.buzzScore, '/100')}- </p>- </div>- <div className="rounded-lg border border-gray-800 bg-black/20 p-3">- <p className="text-[11px] font-medium uppercase tracking-[0.2em] text-gray-500">- Bullish- </p>- <p className="mt-2 text-xl font-semibold text-white">- {formatScore(source.bullishPct, '%')}- </p>- </div>- <div className="rounded-lg border border-gray-800 bg-black/20 p-3">- <p className="text-[11px] font-medium uppercase tracking-[0.2em] text-gray-500">- {source.metricLabel}- </p>- <p className="mt-2 text-xl font-semibold text-white">- {formatCompactNumber(source.metricValue)}- </p>- </div>- <div className="rounded-lg border border-gray-800 bg-black/20 p-3">- <p className="text-[11px] font-medium uppercase tracking-[0.2em] text-gray-500">- Trend- </p>- <p className={`mt-2 text-xl font-semibold capitalize ${getTrendClasses(source.trend)}`}>- {source.trend ?? 'N/A'}- </p>- </div>- </div>- </article>- ))}- </div>- </div>- </section>+ <span className={cn('pill w-[74px] justify-center capitalize', TREND_CLASS[source.trend ?? ''])}>+ {source.bullishPct !== null ? `${source.bullishPct.toFixed(0)}% bull` : (source.trend ?? 'No trend')}+ </span>+ </li>+ ))}+ </ul>+ </div>);}diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsxindex d9ccec9..0450524 100644--- a/components/ui/dialog.tsx+++ b/components/ui/dialog.tsx@@ -38,7 +38,7 @@ function DialogOverlay({<DialogPrimitive.Overlaydata-slot="dialog-overlay"className={cn(- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-page/60 backdrop-blur-[3px]",className)}{...props}@@ -60,7 +60,7 @@ function DialogContent({<DialogPrimitive.Contentdata-slot="dialog-content"className={cn(- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",+ "bg-card data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border border-line p-6 shadow-[0_0_0_4px_var(--frame),0_24px_60px_oklch(0_0_0/0.55)] duration-200 sm:max-w-lg",className)}{...props}@@ -69,7 +69,7 @@ function DialogContent({{showCloseButton && (<DialogPrimitive.Closedata-slot="dialog-close"- className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"+ className="absolute top-4 right-4 grid size-8 place-items-center rounded-full text-faint transition-[background-color,color,transform] hover:bg-hover hover:text-foreground active:scale-94 focus-visible:ring-2 focus-visible:ring-ring focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"><XIcon /><span className="sr-only">Close</span>diff --git a/components/watchlist/AlertsPanel.tsx b/components/watchlist/AlertsPanel.tsxindex 9d82743..42d9a47 100644--- a/components/watchlist/AlertsPanel.tsx+++ b/components/watchlist/AlertsPanel.tsx@@ -1,72 +1,80 @@"use client";-import React from "react";-import { Trash2, TrendingUp, Bell } from "lucide-react";-import { formatCurrency } from "@/lib/utils";+import React, { useState } from "react";+import { BellRing, Trash2 } from "lucide-react";+import { toast } from "sonner";import { deleteAlert } from "@/lib/actions/alert.actions";+import { formatPrice } from "@/lib/utils";-interface AlertsPanelProps {- alerts: any[];- onRefresh?: () => void;-}+type AlertRow = {+ _id: string;+ symbol: string;+ targetPrice: number;+ condition: 'ABOVE' | 'BELOW';+ triggered?: boolean;+ active?: boolean;+ expiresAt?: string;+};++const statusOf = (alert: AlertRow) => {+ if (alert.triggered) return { label: 'Triggered', className: 'pill is-brand' };+ if (alert.expiresAt && new Date(alert.expiresAt) < new Date()) return { label: 'Expired', className: 'pill' };+ if (alert.active === false) return { label: 'Paused', className: 'pill' };+ return { label: 'Watching', className: 'pill is-up' };+};++export default function AlertsPanel({ alerts }: { alerts: AlertRow[] }) {+ const [pendingId, setPendingId] = useState<string | null>(null);-export default function AlertsPanel({ alerts, onRefresh }: AlertsPanelProps) {- const handleDelete = async (id: string) => {- if (confirm("Are you sure you want to delete this alert?")) {- await deleteAlert(id);- if (onRefresh) onRefresh();+ const handleDelete = async (alert: AlertRow) => {+ setPendingId(alert._id);+ try {+ await deleteAlert(alert._id);+ toast.success(`Alert for ${alert.symbol} removed`);+ } catch {+ toast.error("Couldn’t remove the alert");+ } finally {+ setPendingId(null);}};- return (- <div className="bg-gray-900/30 rounded-lg border border-gray-800 p-4 h-full">- <div className="flex items-center justify-between mb-4">- <h2 className="text-lg font-semibold text-white flex items-center">- <Bell className="w-5 h-5 mr-2 text-yellow-500" />- Alerts- </h2>- {/* <button className="text-sm text-yellow-500 hover:underline">Create Alert</button> */}+ if (alerts.length === 0) {+ return (+ <div className="empty-state py-10">+ <span className="empty-icon"><BellRing className="size-5" /></span>+ <h3>No alerts yet</h3>+ <p className="max-w-60 text-[13px]">Use the bell on any row, or “Set alert” on a stock page. We email you when it fires.</p></div>+ );+ }- <div className="space-y-3">- {alerts.length === 0 ? (- <div className="text-center py-8 text-gray-500 text-sm">- No active alerts. Add one from the watchlist.- </div>- ) : (- alerts.map((alert) => (- <div key={alert._id} className="bg-gray-800/40 rounded-lg p-3 border border-gray-800 relative group">- <div className="flex justify-between items-start">- <div>- <div className="flex items-center space-x-2">- <div className="w-8 h-8 rounded bg-gray-700 flex items-center justify-center font-bold text-xs text-white">- {alert.symbol[0]}- </div>- <div>- <div className="font-bold text-white text-sm">{alert.symbol}</div>- <div className="text-xs text-gray-400">Target: {formatCurrency(alert.targetPrice)}</div>- </div>- </div>- <div className="mt-2 text-xs text-yellow-500 font-medium">- Condition: Price {alert.condition.toLowerCase()} {formatCurrency(alert.targetPrice)}- </div>- <div className="text-[10px] text-gray-500 mt-1">- Active until {new Date(new Date(alert.createdAt).getTime() + 90 * 24 * 60 * 60 * 1000).toLocaleDateString()}- </div>- </div>- <div className="flex flex-col space-y-2">- <button- onClick={() => handleDelete(alert._id)}- className="text-gray-500 hover:text-red-500 transition-colors p-1"- >- <Trash2 className="w-4 h-4" />- </button>- </div>- </div>+ return (+ <ul className="row-list">+ {alerts.map((alert) => {+ const status = statusOf(alert);+ return (+ <li key={alert._id} className="flex items-center gap-3 px-3 py-2.5">+ <div className="min-w-0 flex-1">+ <p className="mono font-semibold text-foreground">{alert.symbol}</p>+ <p className="num truncate text-[12.5px] text-faint">+ {alert.condition === 'ABOVE' ? 'Above' : 'Below'} {formatPrice(alert.targetPrice)}+ {alert.expiresAt && !alert.triggered && ` · until ${new Date(alert.expiresAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })}`}+ </p></div>- ))- )}- </div>- </div>+ <span className={status.className}>{status.label}</span>+ <button+ type="button"+ onClick={() => handleDelete(alert)}+ disabled={pendingId === alert._id}+ className="icon-btn is-danger"+ title="Remove alert"+ aria-label={`Remove alert for ${alert.symbol}`}+ >+ <Trash2 />+ </button>+ </li>+ );+ })}+ </ul>);}diff --git a/components/watchlist/CreateAlertModal.tsx b/components/watchlist/CreateAlertModal.tsxindex 81074fe..4d0ba70 100644--- a/components/watchlist/CreateAlertModal.tsx+++ b/components/watchlist/CreateAlertModal.tsx@@ -1,169 +1,116 @@"use client";import React, { useState } from "react";-import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";-import { Button } from "@/components/ui/button";-import { Label } from "@/components/ui/label";-import { Input } from "@/components/ui/input";-import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";+import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger } from "@/components/ui/dialog";import { createAlert } from "@/lib/actions/alert.actions";-import { toast } from "sonner"; // Assuming sonner is available or use existing toast+import { formatPrice } from "@/lib/utils";+import { cn } from "@/lib/utils";+import { toast } from "sonner";interface CreateAlertModalProps {- userId: string;symbol: string;- currentPrice: number;- companyName?: string; // Optional prop for better display- onAlertCreated?: () => void;+ currentPrice?: number | null;+ currency?: string;children?: React.ReactNode;- // Controlled props- open?: boolean;- onOpenChange?: (open: boolean) => void;+ onAlertCreated?: () => void;}-export default function CreateAlertModal({- userId,- symbol,- currentPrice,- companyName = "",- onAlertCreated,- children,- open: controlledOpen,- onOpenChange: setControlledOpen-}: CreateAlertModalProps) {- const [internalOpen, setInternalOpen] = useState(false);+const CONDITIONS = [+ { value: 'ABOVE', label: 'Rises above' },+ { value: 'BELOW', label: 'Falls below' },+] as const;- const isControlled = controlledOpen !== undefined;- const open = isControlled ? controlledOpen : internalOpen;- const setOpen = isControlled ? setControlledOpen : setInternalOpen;-- const [targetPrice, setTargetPrice] = useState<string>(currentPrice.toString());- const [condition, setCondition] = useState<"ABOVE" | "BELOW">("ABOVE");- const [alertName, setAlertName] = useState("");+export default function CreateAlertModal({ symbol, currentPrice, currency = 'USD', children, onAlertCreated }: CreateAlertModalProps) {+ const [open, setOpen] = useState(false);+ const [condition, setCondition] = useState<'ABOVE' | 'BELOW'>('ABOVE');+ const [targetPrice, setTargetPrice] = useState('');const [loading, setLoading] = useState(false);- // Update target price when currentPrice changes (e.g. freshly fetched)- React.useEffect(() => {- setTargetPrice(currentPrice.toString());- }, [currentPrice]);+ const target = parseFloat(targetPrice);+ const hasPrice = !!currentPrice && currentPrice > 0;+ const distance = hasPrice && Number.isFinite(target) ? ((target - currentPrice!) / currentPrice!) * 100 : null;+ const alreadyMet = distance !== null && (condition === 'ABOVE' ? distance <= 0 : distance >= 0);++ const onOpenChange = (next: boolean) => {+ setOpen(next);+ if (next) setTargetPrice(hasPrice ? currentPrice!.toFixed(2) : '');+ };const handleSubmit = async (e: React.FormEvent) => {e.preventDefault();setLoading(true);try {- await createAlert({- userId,- symbol,- targetPrice: parseFloat(targetPrice),- condition,- });- toast.success("Alert created successfully");- setOpen?.(false);- if (onAlertCreated) onAlertCreated();+ await createAlert({ symbol, targetPrice: target, condition });+ toast.success(`Alert set: ${symbol} ${condition === 'ABOVE' ? 'above' : 'below'} ${formatPrice(target, currency)}`);+ setOpen(false);+ onAlertCreated?.();} catch (error) {console.error(error);- toast.error("Failed to create alert");+ toast.error("Couldn’t create the alert");} finally {setLoading(false);}};return (- <Dialog open={open} onOpenChange={setOpen}>- {children && (- <DialogTrigger asChild>- {children}- </DialogTrigger>- )}- <DialogContent className="sm:max-w-[425px] bg-[#0A0A0A] border-gray-800 text-white shadow-2xl">- <DialogHeader>- <DialogTitle className="text-2xl font-bold tracking-tight text-white mb-2">Price Alert</DialogTitle>- </DialogHeader>- <form onSubmit={handleSubmit} className="space-y-5 py-2 relative z-10">-- {/* Alert Name */}- <div className="grid gap-2">- <Label className="text-gray-400 text-sm font-medium">Alert Name</Label>- <Input- value={alertName}- onChange={(e) => setAlertName(e.target.value)}- placeholder="e.g. Apple at Discount"- className="bg-gray-900 border-gray-700 text-white placeholder:text-gray-600 focus:border-yellow-500 focus:ring-yellow-500/20 transition-all rounded-md h-10"- />- </div>-- {/* Stock Identifier */}- <div className="grid gap-2">- <Label className="text-gray-400 text-sm font-medium">Stock identifier</Label>- <div className="relative">- <Input- disabled- value={`${companyName || symbol} (${symbol})`}- className="bg-[#1C1C1F] border-none text-gray-500 shadow-inner rounded-md h-10"- />- </div>- </div>-- {/* Alert Type */}- <div className="grid gap-2">- <Label className="text-gray-400 text-sm font-medium">Alert type</Label>- <Select disabled defaultValue="price">- <SelectTrigger className="bg-[#1C1C1F] border-gray-800 text-gray-200">- <SelectValue placeholder="Select type" />- </SelectTrigger>- <SelectContent className="bg-[#1C1C1F] border-gray-800 text-gray-200">- <SelectItem value="price">Price</SelectItem>- </SelectContent>- </Select>- </div>+ <Dialog open={open} onOpenChange={onOpenChange}>+ {children && <DialogTrigger asChild>{children}</DialogTrigger>}+ <DialogContent className="sm:max-w-[420px] gap-5">+ <div>+ <p className="kicker text-brand-ink">Price alert</p>+ <DialogTitle className="mt-1 text-xl font-bold tracking-tight mono">{symbol}</DialogTitle>+ <DialogDescription className="mt-1 text-[13px] text-faint">+ We email you when the price crosses your target. Checked every 5 minutes, expires after 90 days.+ </DialogDescription>+ </div>- {/* Condition */}- <div className="grid gap-2">- <Label className="text-gray-400 text-sm font-medium">Condition</Label>- <Select value={condition} onValueChange={(val: any) => setCondition(val)}>- <SelectTrigger className="bg-[#1C1C1F] border-gray-800 text-gray-200 hover:border-gray-700 transition-colors">- <SelectValue />- </SelectTrigger>- <SelectContent className="bg-[#1C1C1F] border-gray-800 text-gray-200">- <SelectItem value="ABOVE">Greater than {">"}</SelectItem>- <SelectItem value="BELOW">Less than {"<"}</SelectItem>- </SelectContent>- </Select>+ <form onSubmit={handleSubmit} className="flex flex-col gap-4">+ <div className="grid grid-cols-2 gap-1 rounded-[12px] bg-page p-1" role="radiogroup" aria-label="Condition">+ {CONDITIONS.map(({ value, label }) => (+ <button+ key={value}+ type="button"+ role="radio"+ aria-checked={condition === value}+ onClick={() => setCondition(value)}+ className={cn(+ 'h-9 rounded-[9px] font-semibold transition-colors',+ condition === value ? 'bg-hover text-foreground shadow-[inset_0_1px_0_oklch(1_0_0/0.06)]' : 'text-faint hover:text-foreground',+ )}+ >+ {label}+ </button>+ ))}</div>- {/* Threshold Value */}- <div className="grid gap-2">- <Label className="text-gray-400 text-sm font-medium">Threshold value</Label>- <div className="relative">- <span className="absolute left-3 top-1/2 -translate-y-1/2 text-yellow-500 font-semibold">$</span>- <Input+ <label className="flex flex-col gap-2">+ <span className="form-label">Target price</span>+ <span className="flex h-12 items-center gap-2 rounded-[11px] border border-line bg-page px-3 focus-within:border-brand">+ <span className="mono text-faint">{currency}</span>+ <inputtype="number"+ inputMode="decimal"step="0.01"+ min="0.01"+ required+ autoFocusvalue={targetPrice}onChange={(e) => setTargetPrice(e.target.value)}- placeholder="eg: 140"- className="pl-7 bg-[#1C1C1F] border-gray-800 text-white placeholder:text-gray-600 focus:border-yellow-500 focus:ring-yellow-500/20 transition-all rounded-md h-10 font-mono"+ className="num w-full bg-transparent text-lg font-semibold text-foreground outline-none"/>- </div>- </div>-- {/* Expiry Note */}- <div className="pt-1">- <p className="text-xs text-gray-500 flex items-center">- <span className="w-1.5 h-1.5 rounded-full bg-yellow-500/50 mr-2"></span>- Alert expires automatically in 90 days- </p>- </div>+ </span>+ <span className={cn('num text-[12.5px]', alreadyMet ? 'text-warn' : 'text-faint')}>+ {!hasPrice+ ? 'Current price unavailable'+ : alreadyMet+ ? `Already ${condition === 'ABOVE' ? 'above' : 'below'} this — it will fire on the next check`+ : `Now ${formatPrice(currentPrice!, currency)}${distance === null ? '' : ` · ${distance > 0 ? '+' : ''}${distance.toFixed(2)}% away`}`}+ </span>+ </label>- <div className="pt-4">- <Button- type="submit"- disabled={loading}- className="w-full bg-[#FACC15] hover:bg-[#EAB308] text-black font-bold h-11 text-base transition-all shadow-[0_0_15px_rgba(250,204,21,0.2)]"- >- {loading ? "Creating Alert..." : "Create Alert"}- </Button>- </div>+ <button type="submit" disabled={loading || !(target > 0)} className="btn btn-primary h-11">+ {loading ? 'Setting alert' : 'Set alert'}+ </button></form></DialogContent></Dialog>diff --git a/components/watchlist/NewsGrid.tsx b/components/watchlist/NewsGrid.tsxdeleted file mode 100644index fb48f76..0000000--- a/components/watchlist/NewsGrid.tsx+++ /dev/null@@ -1,53 +0,0 @@-"use client";--import React from "react";-import Image from "next/image";-import { formatDistanceToNow } from "date-fns";-import { ExternalLink } from "lucide-react";--interface NewsGridProps {- news: any[];-}--export default function NewsGrid({ news }: NewsGridProps) {- if (!news || news.length === 0) return null;-- return (- <div className="mt-8">- <h2 className="text-xl font-bold text-white mb-4">Market News</h2>- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">- {news.map((item, idx) => (- <a- key={idx}- href={item.url}- target="_blank"- rel="noopener noreferrer"- className="block bg-gray-900/30 border border-gray-800 rounded-lg overflow-hidden hover:border-gray-700 transition-colors group"- >- <div className="p-4 flex flex-col h-full">- <div className="flex items-start justify-between mb-2">- <span className={`text-[10px] font-bold px-2 py-0.5 rounded ${item.related ? "bg-blue-900/50 text-blue-300" : "bg-gray-800 text-gray-400"- }`}>- {item.related || "MARKET"}- </span>- <ExternalLink className="w-3 h-3 text-gray-600 group-hover:text-gray-400" />- </div>- <h3 className="text-sm font-semibold text-gray-200 mb-2 line-clamp-2 group-hover:text-blue-400 transition-colors">- {item.headline}- </h3>- <p className="text-xs text-gray-500 line-clamp-3 mb-4 flex-1">- {item.summary}- </p>- <div className="flex items-center justify-between text-[10px] text-gray-600 mt-auto">- <span>{item.source}</span>- <span>- {item.datetime ? formatDistanceToNow(item.datetime * 1000, { addSuffix: true }) : ''}- </span>- </div>- </div>- </a>- ))}- </div>- </div>- );-}diff --git a/components/watchlist/NewsList.tsx b/components/watchlist/NewsList.tsxnew file mode 100644index 0000000..8ae9423--- /dev/null+++ b/components/watchlist/NewsList.tsx@@ -0,0 +1,33 @@+import { formatDistanceToNow } from "date-fns";+import { ArrowUpRight, Newspaper } from "lucide-react";++export default function NewsList({ news }: { news: MarketNewsArticle[] }) {+ if (news.length === 0) {+ return (+ <div className="empty-state">+ <span className="empty-icon"><Newspaper className="size-5" /></span>+ <h3>No recent news</h3>+ <p>Nothing published in the last few days for these symbols.</p>+ </div>+ );+ }++ return (+ <ul className="row-list">+ {news.map((item) => (+ <li key={`${item.id}-${item.url}`}>+ <a href={item.url} target="_blank" rel="noopener noreferrer" className="group flex items-start gap-3 px-3 py-3 transition-colors hover:bg-hover/50">+ <span className="pill mono mt-0.5 w-16 justify-center">{item.related || 'MKT'}</span>+ <span className="min-w-0 flex-1">+ <span className="line-clamp-2 font-semibold text-foreground group-hover:text-brand-ink transition-colors">{item.headline}</span>+ <span className="mt-1 block truncate text-[12.5px] text-faint">+ {item.source}{item.datetime ? ` · ${formatDistanceToNow(item.datetime * 1000, { addSuffix: true })}` : ''}+ </span>+ </span>+ <ArrowUpRight className="mt-1 size-4 flex-none text-faint opacity-0 transition-opacity group-hover:opacity-100" />+ </a>+ </li>+ ))}+ </ul>+ );+}diff --git a/components/watchlist/TradingViewWatchlist.tsx b/components/watchlist/TradingViewWatchlist.tsxdeleted file mode 100644index 2427cc7..0000000--- a/components/watchlist/TradingViewWatchlist.tsx+++ /dev/null@@ -1,58 +0,0 @@-"use client";--import React, { useEffect, useRef, memo } from 'react';-import { formatSymbolForTradingView } from '@/lib/utils';--interface TradingViewWatchlistProps {- symbols: string[];-}--function TradingViewWatchlist({ symbols }: TradingViewWatchlistProps) {- const container = useRef<HTMLDivElement>(null);-- useEffect(() => {- if (!container.current) return;-- // Clear previous widget if any (though React key usually handles this, safety check)- container.current.innerHTML = "";-- const script = document.createElement("script");- script.src = "https://s3.tradingview.com/external-embedding/embed-widget-market-quotes.js";- script.type = "text/javascript";- script.async = true;-- // Map user symbols to TradingView format- // TradingView is smart enough to handle "AAPL", "GOOG" usually, but "NASDAQ:AAPL" is safer.- // Since we don't have exchange data easily, we'll try raw symbol.- // Ideally we'd prefix "NASDAQ:" or "NYSE:" but let's test without first.- const symbolList = symbols.map(s => ({- name: formatSymbolForTradingView(s),- displayName: s- }));-- script.innerHTML = JSON.stringify({- "width": "100%",- "height": 550,- "symbolsGroups": [- {- "name": "My Watchlist",- "symbols": symbolList- }- ],- "showSymbolLogo": true,- "isTransparent": true,- "colorTheme": "dark", // We can make this dynamic if needed- "locale": "en"- });-- container.current.appendChild(script);- }, [symbols]);-- return (- <div className="tradingview-widget-container border border-white/10 rounded-xl overflow-hidden shadow-2xl bg-black/40 backdrop-blur-md" ref={container}>- <div className="tradingview-widget-container__widget"></div>- </div>- );-}--export default memo(TradingViewWatchlist);diff --git a/components/watchlist/WatchlistManager.tsx b/components/watchlist/WatchlistManager.tsxdeleted file mode 100644index b3ac88b..0000000--- a/components/watchlist/WatchlistManager.tsx+++ /dev/null@@ -1,95 +0,0 @@-'use client';--import React, { useState, useMemo } from 'react';-import WatchlistStockChip from './WatchlistStockChip';-import TradingViewWatchlist from './TradingViewWatchlist';-import { Button } from '@/components/ui/button';-import { ArrowDownAZ, ArrowUpZA, ArrowUpDown } from 'lucide-react';-import { WatchlistItem } from '@/database/models/watchlist.model';--interface WatchlistManagerProps {- initialItems: WatchlistItem[]; // Using the DB model type directly or a simplified version- userId: string;-}--export default function WatchlistManager({ initialItems, userId }: WatchlistManagerProps) {- // Sort state: 'asc' (A-Z), 'desc' (Z-A), or null (added order/default)- const [sortOrder, setSortOrder] = useState<'asc' | 'desc' | null>(null);-- const toggleSort = () => {- if (sortOrder === null) setSortOrder('asc');- else if (sortOrder === 'asc') setSortOrder('desc');- else setSortOrder(null);- };-- const sortedItems = useMemo(() => {- if (!sortOrder) return initialItems;-- return [...initialItems].sort((a, b) => {- if (sortOrder === 'asc') {- return a.symbol.localeCompare(b.symbol);- } else {- return b.symbol.localeCompare(a.symbol);- }- });- }, [initialItems, sortOrder]);-- const watchlistSymbols = sortedItems.map((item) => item.symbol);-- return (- <div className="space-y-6">- <div className="bg-gray-900/30 rounded-xl border border-gray-800 p-4 backdrop-blur-sm">- <div className="flex items-center justify-between mb-3">- <h3 className="text-sm font-semibold text-gray-400 uppercase tracking-wider flex items-center">- <span className="mr-2">Manage Symbols</span>- <span className="text-xs bg-gray-800 text-gray-500 px-2 py-0.5 rounded-full">- {watchlistSymbols.length}- </span>- </h3>- <Button- variant="ghost"- size="sm"- onClick={toggleSort}- className="h-8 px-2 text-gray-400 hover:text-white hover:bg-white/10"- title={- sortOrder === 'asc'- ? 'Sorted A-Z'- : sortOrder === 'desc'- ? 'Sorted Z-A'- : 'Default Order'- }- >- {sortOrder === 'asc' && <ArrowDownAZ className="w-4 h-4 mr-2" />}- {sortOrder === 'desc' && <ArrowUpZA className="w-4 h-4 mr-2" />}- {sortOrder === null && <ArrowUpDown className="w-4 h-4 mr-2" />}- <span className="text-xs">- {sortOrder === 'asc'- ? 'A-Z'- : sortOrder === 'desc'- ? 'Z-A'- : 'Sort'}- </span>- </Button>- </div>-- {watchlistSymbols.length > 0 ? (- <div className="flex flex-wrap gap-2">- {sortedItems.map((item) => (- <WatchlistStockChip- key={item.symbol}- symbol={item.symbol}- userId={userId}- />- ))}- </div>- ) : (- <p className="text-sm text-gray-500 italic">No stocks in watchlist.</p>- )}- </div>-- <div className="min-h-[550px]">- <TradingViewWatchlist symbols={watchlistSymbols} />- </div>- </div>- );-}diff --git a/components/watchlist/WatchlistStockChip.tsx b/components/watchlist/WatchlistStockChip.tsxdeleted file mode 100644index fe30dfe..0000000--- a/components/watchlist/WatchlistStockChip.tsx+++ /dev/null@@ -1,77 +0,0 @@-"use client";--import React, { useState } from "react";-import { removeFromWatchlist } from "@/lib/actions/watchlist.actions";-import { getQuote } from "@/lib/actions/finnhub.actions";-import { Bell, Loader2, X } from "lucide-react";-import CreateAlertModal from "./CreateAlertModal";--interface WatchlistStockChipProps {- symbol: string;- userId: string;-}--export default function WatchlistStockChip({ symbol, userId }: WatchlistStockChipProps) {- const [price, setPrice] = useState<number>(0);- const [modalOpen, setModalOpen] = useState(false);- const [loadingPrice, setLoadingPrice] = useState(false);-- const handleBellClick = async () => {- setLoadingPrice(true);- try {- const data = await getQuote(symbol);- if (data && data.c) {- setPrice(data.c);- setModalOpen(true);- } else {- // Fallback if fetch fails- setPrice(0);- setModalOpen(true);- }- } catch (err) {- console.error(err);- setPrice(0);- setModalOpen(true);- } finally {- setLoadingPrice(false);- }- };-- const handleRemove = async () => {- await removeFromWatchlist(userId, symbol);- };-- return (- <div className="group flex items-center gap-2 px-3 py-1.5 bg-gray-800 hover:bg-gray-700/80 rounded-full border border-gray-700 transition-all">- <span className="font-semibold text-sm text-white">{symbol}</span>-- {/* Divider */}- <div className="w-px h-4 bg-gray-600 mx-1"></div>-- {/* Alert Button */}- <button- onClick={handleBellClick}- className="text-gray-400 hover:text-yellow-400 transition-colors p-0.5"- title="Create Alert"- disabled={loadingPrice}- >- {loadingPrice ? <Loader2 className="w-3.5 h-3.5 animate-spin" /> : <Bell className="w-3.5 h-3.5" />}- </button>-- {/* Remove Button */}- <form action={handleRemove}>- <button type="submit" className="text-gray-400 hover:text-red-400 transition-colors p-0.5" title="Remove">- <X className="w-3.5 h-3.5" />- </button>- </form>-- <CreateAlertModal- userId={userId}- symbol={symbol}- currentPrice={price}- open={modalOpen}- onOpenChange={setModalOpen}- />- </div>- );-}diff --git a/components/watchlist/WatchlistTable.tsx b/components/watchlist/WatchlistTable.tsxindex 0fb785b..38d7faf 100644--- a/components/watchlist/WatchlistTable.tsx+++ b/components/watchlist/WatchlistTable.tsx@@ -1,166 +1,108 @@"use client";import React, { useEffect, useState } from "react";-import Image from "next/image";import Link from "next/link";-import { ArrowUp, ArrowDown, Bell } from "lucide-react";+import { Bell, Search, Star } from "lucide-react";import CreateAlertModal from "./CreateAlertModal";import WatchlistButton from "@/components/WatchlistButton";-import { formatCurrency, formatNumber } from "@/lib/utils";-import { removeFromWatchlist } from "@/lib/actions/watchlist.actions";+import ChangePill from "@/components/ChangePill";+import PriceFlash from "@/components/PriceFlash";+import { useLiveQuotes } from "@/hooks/useLiveQuotes";+import { SearchButton } from "@/components/SearchCommand";+import { formatNumber, formatPrice } from "@/lib/utils";+import { hasFinnhubQuotes } from "@/lib/markets";+import type { getWatchlistData } from "@/lib/actions/finnhub.actions";-interface WatchlistTableProps {- data: any[];- userId: string;- onRefresh?: () => void;-}--export default function WatchlistTable({ data, userId, onRefresh }: WatchlistTableProps) {- const [stocks, setStocks] = useState(data);-- useEffect(() => {- // Initial set if prop changes- setStocks(data);- }, [data]);+type Row = Awaited<ReturnType<typeof getWatchlistData>>[number];+const SUGGESTIONS = ['AAPL', 'NVDA', 'MSFT', 'TSLA', 'AMZN'];- useEffect(() => {- if (!stocks || stocks.length === 0) return;+export default function WatchlistTable({ initialRows }: { initialRows: Row[] }) {+ const [baseRows, setBaseRows] = useState(initialRows);+ const live = useLiveQuotes(baseRows.map((r) => r.symbol));- // Poll for price updates every 15 seconds- const interval = setInterval(async () => {- try {- const symbols = stocks.map(s => s.symbol);- if (symbols.length === 0) return;+ // Server re-renders (after add/remove) replace the local copy+ useEffect(() => setBaseRows(initialRows), [initialRows]);- // Dynamic import to avoid server-action issues if directly imported in client component sometimes- const { getWatchlistData } = await import('@/lib/actions/finnhub.actions');- const updatedData = await getWatchlistData(symbols);+ const rows = baseRows.map((r) => {+ const q = live[r.symbol];+ return q?.c ? { ...r, price: q.c, change: q.d ?? r.change, changePercent: q.dp ?? r.changePercent } : r;+ });- if (updatedData && updatedData.length > 0) {- setStocks(current => {- const map = new Map(updatedData.map(item => [item.symbol, item]));- return current.map(existing => {- const fresh = map.get(existing.symbol);- if (fresh) {- return {- ...existing,- price: fresh.price,- change: fresh.change,- changePercent: fresh.changePercent,- };- }- return existing;- });- });- }- } catch (err) {- console.error("Failed to poll watchlist prices", err);- }- }, 5000);-- return () => clearInterval(interval);- }, [stocks]); // Re-create interval if list size changes-- if (!stocks || stocks.length === 0) {+ if (rows.length === 0) {return (- <div className="text-center py-12 bg-gray-900/50 rounded-lg border border-gray-800">- <h3 className="text-xl font-medium text-gray-300 mb-2">Your watchlist is empty</h3>- <p className="text-gray-500 mb-6">Add stocks to track their performance and set alerts.</p>+ <div className="empty-state">+ <span className="empty-icon"><Star className="size-5" /></span>+ <h3>Nothing on your watchlist yet</h3>+ <p className="max-w-sm">Search for a company and star it to track its price here and set alerts.</p>+ <SearchButton className="btn btn-primary mt-3"><Search /> Search stocks</SearchButton>+ <div className="mt-4 flex flex-wrap justify-center gap-1.5">+ {SUGGESTIONS.map((s) => (+ <Link key={s} href={`/stocks/${s}`} className="pill mono h-7 px-3 hover:bg-hover hover:text-foreground">{s}</Link>+ ))}+ </div></div>);}return (- <div className="overflow-hidden rounded-xl border border-white/10 bg-black/40 backdrop-blur-md shadow-xl">- <table className="w-full text-left text-sm border-collapse">- <thead className="bg-white/5 text-gray-400 font-medium border-b border-white/10">+ <div className="overflow-x-auto rounded-[14px]">+ <table className="data-table">+ <thead><tr>- <th className="px-6 py-4 font-semibold tracking-wide">Company</th>- <th className="px-6 py-4 font-semibold tracking-wide">Symbol</th>- <th className="px-6 py-4 font-semibold tracking-wide">Price</th>- <th className="px-6 py-4 font-semibold tracking-wide">Change</th>- <th className="px-6 py-4 font-semibold tracking-wide">Market Cap</th>- <th className="px-6 py-4 text-right font-semibold tracking-wide">Actions</th>+ <th>Company</th>+ <th className="is-num">Price</th>+ <th className="is-num">Today</th>+ <th className="is-num">Change</th>+ <th className="is-num">Market cap</th>+ <th className="w-[88px]"><span className="sr-only">Actions</span></th></tr></thead>- <tbody className="divide-y divide-white/10">- {stocks.map((stock: any) => {- const isPositive = stock.change >= 0;- return (- <tr key={stock.symbol} className="hover:bg-white/5 transition-colors group">- <td className="px-6 py-4">- <div className="flex items-center space-x-4">- {stock.logo ? (- <div className="w-10 h-10 relative rounded-full overflow-hidden bg-white/10 shadow-sm border border-white/5">- <Image- src={stock.logo}- alt={stock.symbol}- fill- className="object-contain p-1.5"- />- </div>- ) : (- <div className="w-10 h-10 rounded-full bg-gradient-to-br from-gray-700 to-gray-800 flex items-center justify-center text-xs font-bold text-white shadow-sm border border-white/5">- {stock.symbol[0]}- </div>- )}- <div className="flex flex-col">- <span className="font-semibold text-white text-base">{stock.name}</span>- </div>- </div>- </td>- <td className="px-6 py-4 font-medium text-gray-300">- <span className="bg-white/5 px-2.5 py-1 rounded-md text-xs font-mono border border-white/10">- {stock.symbol}+ <tbody>+ {rows.map((row) => (+ <tr key={row.symbol}>+ <td className="max-w-[320px]">+ <Link href={`/stocks/${row.symbol}`} className="group flex items-center gap-3">+ {row.logo ? (+ <span className="logo-well"><img src={row.logo} alt="" className="size-full object-contain p-1" /></span>+ ) : (+ <span className="logo-well is-empty">{row.symbol[0]}</span>+ )}+ <span className="min-w-0">+ <span className="block truncate font-semibold text-foreground group-hover:text-brand-ink transition-colors" title={row.name}>{row.name}</span>+ <span className="mono block text-[12px] text-faint">{row.symbol}</span></span>- </td>- <td className="px-6 py-4 text-white font-medium text-base tracking-tight">- {formatCurrency(stock.price)}- </td>- <td className={`px-6 py-4 font-medium`}>- <div className={`flex items-center w-fit px-2 py-1 rounded-md ${isPositive ? "bg-green-500/10 text-green-400" : "bg-red-500/10 text-red-400"}`}>- {isPositive ? <ArrowUp className="w-3.5 h-3.5 mr-1.5" /> : <ArrowDown className="w-3.5 h-3.5 mr-1.5" />}- {Math.abs(stock.changePercent).toFixed(2)}%- </div>- </td>- <td className="px-6 py-4 text-gray-400 font-medium">- {formatNumber(stock.marketCap)}- </td>- <td className="px-6 py-4 text-right">- <div className="flex items-center justify-end space-x-3 opacity-80 group-hover:opacity-100 transition-opacity">- <CreateAlertModal- userId={userId}- symbol={stock.symbol}- currentPrice={stock.price}- onAlertCreated={onRefresh}- >- <button className="p-2.5 rounded-full text-gray-400 hover:text-white hover:bg-white/10 transition-all border border-transparent hover:border-white/10" title="Add Alert">- <Bell className="w-4.5 h-4.5" />+ </Link>+ </td>+ <td className="is-num font-semibold text-foreground">+ <PriceFlash value={row.price} className="px-1">{row.price ? formatPrice(row.price, row.currency) : '—'}</PriceFlash>+ </td>+ <td className="is-num"><ChangePill value={row.price ? row.changePercent : null} /></td>+ <td className="is-num text-muted-foreground">{row.price ? `${row.change > 0 ? '+' : ''}${row.change.toFixed(2)}` : '—'}</td>+ <td className="is-num text-muted-foreground">{row.marketCap ? formatNumber(row.marketCap) : '—'}</td>+ <td>+ <div className="flex items-center justify-end gap-1">+ {hasFinnhubQuotes(row.symbol) ? (+ <CreateAlertModal symbol={row.symbol} currentPrice={row.price} currency={row.currency}>+ <button type="button" className="icon-btn" title={`Set a price alert for ${row.symbol}`} aria-label={`Set a price alert for ${row.symbol}`}>+ <Bell /></button></CreateAlertModal>-- <div className="transform scale-95 hover:scale-100 transition-transform">- <WatchlistButton- symbol={stock.symbol}- company={stock.name}- isInWatchlist={true}- type="icon"- showTrashIcon={false}- onWatchlistChange={async (sym, added) => {- if (!added) {- await removeFromWatchlist(userId, sym);- // Update local list faster than full page refresh if you want- setStocks((curr: any[]) => curr.filter((s: any) => s.symbol !== sym));- if (onRefresh) onRefresh();- }- }}- />- </div>- </div>- </td>- </tr>- );- })}+ ) : (+ <span className="icon-btn opacity-40" title="Alerts are available for US stocks and crypto"><Bell /></span>+ )}+ <WatchlistButton+ symbol={row.symbol}+ company={row.name}+ isInWatchlist+ variant="icon"+ onWatchlistChange={(sym, added) => {+ if (!added) setBaseRows((current) => current.filter((r) => r.symbol !== sym));+ }}+ />+ </div>+ </td>+ </tr>+ ))}</tbody></table></div>