I'll create a comprehensive Forex trading journal analytics dashboard. Let me first explore the project structure to understand the setup.
Let me examine the key configuration files and current source.
I now understand the setup: React 19, Vite 7, Tailwind CSS v4 (via @tailwindcss/vite), single-file build output, and a cn utility. I'll build a bespoke dashboard with custom SVG charts (for full control over the modern aesthetic and to keep the bundle lean), a seeded realistic dataset, live filtering, and class-based dark mode.
Let me start with the foundational files: HTML, CSS (with dark-mode variant + chart tokens + animations), formatting utils, and types.
Now the dataset: a constants file (pairs, sessions, strategies, chart colors) and a seeded realistic trade generator spanning ~6 months.
Let me fix the unused type imports in the data generator.
Now the analytics engine — KPIs, equity curve, drawdown, and groupings derived from any set of trades.
Now utility hooks (element measuring for responsive SVG, theme management) and reusable UI primitives.
Reusable filter controls — a segmented toggle and a styled native select (robust, accessible, fully responsive).
Now the chart path utilities and the chart components. Starting with the path helpers and the small Sparkline used in KPI cards.
Let me add the line-draw keyframe to the CSS, then build the interactive LineChart (equity curve).
Now the interactive area/line chart with crosshair, hover dot, and tooltip:
Now the BarChart (daily P&L) with positive/negative coloring and smooth grow/morph transitions:
Let me fix the tooltip vertical anchoring for negative bars (the math was off).
Now the DonutChart with animated arcs, hover highlighting, center readout, and an interactive legend:
The charts are in place. Now a shared icon set, then the layout pieces. Starting with icons and the header.
Now the header with brand, live indicator, and dark-mode toggle:
Now the filtering logic module and the live filter bar.
Now the FilterBar with presets, custom dates, and segment dropdowns:
Now the KPI summary cards with trend indicators and sparklines:
I need to fix a double-sign bug in the delta labels (formatCurrency already prefixes positives). Let me correct both.
Now the chart cards. First the equity curve card with an Equity/Drawdown toggle:
The currency-pair distribution donut card:
The daily P&L bar chart card:
The session performance card with custom animated horizontal bars:
Now the sortable, filterable, paginated trades table:
Now the main App that wires state, derived analytics, and layout together.
The structure is complete. Let me make one small refinement to the direction control width, then build to catch any errors.
Build succeeds. Let me refine a few visual details: make sparklines fill their card width, fix the ambient gradient layering (it was being hidden behind the opaque background), and improve a label.
Now fix the ambient gradient layering in App and the EquityCurve stat label.
Let me sync the area fill animation with the line redraw, then rebuild.
Let me handle the Profit Factor edge case (can be Infinity when there are no losses) to avoid "Infinity" text in the trend chip.
Let me rebuild to confirm, then do a final review of the main layout.
Let me verify the final App structure is well-formed.
I spotted a coordinate bug in the LineChart hover handler — the capture rect's bounding box already starts at the left padding, so I'm double-subtracting it. Let me fix the index calculation.
Let me rebuild to confirm everything is clean.
The build is clean and the dashboard is complete. Here's a summary of what I built:
Apex FX — Forex Trading Journal Analytics Dashboard
A fully interactive, responsive analytics dashboard built with React 19, Vite, and Tailwind CSS v4, using custom hand-built SVG charts (no chart library) for a bespoke look and a lean bundle.
Architecture
src/data/ — Seeded deterministic data generator producing ~6 months of realistic trades (weighted currency pairs, per-strategy win rates/edges, R-multiples, sessions, realistic entry/exit prices & pip math). Plus constants (pairs, sessions, strategies, color palettes).
src/lib/ — analytics.ts (KPI computation, equity curve, drawdown, daily P&L, group-by pair/session/strategy, cumulative metric sparklines) and filters.ts (date-range presets, custom ranges, previous-period logic for trend deltas).
src/components/charts/ — Reusable LineChart (animated draw-in, crosshair + hover tooltip), BarChart (grow/morph transitions, pos/neg gradients, tooltips), DonutChart (animated arcs, hover highlight, center readout, interactive legend), and Sparkline.
src/components/ — Header (brand + animated dark-mode toggle + live indicator), FilterBar, KpiCards, and the four chart cards + TradesTable.
Features delivered
- 6 KPI cards (Net P&L, Win Rate, Profit Factor, Total Trades, Avg R:R, Max Drawdown) each with a trend chip comparing against the prior equal-length period and a live sparkline.
- Mix of charts: equity/drawdown line chart, daily-P&L bar chart, currency-pair donut, and session-performance horizontal bars — all with hover tooltips and smooth CSS/SVG transitions.
- Sortable, filterable, paginated trade ledger with search, Win/Loss filter, column sorting, and configurable page size.
- Live filters: date presets (7D/30D/90D/YTD/All), custom date pickers, and segment dropdowns (pair, session, strategy, direction) that recompute every view via memoized derived state.
- Dark mode (class-based, persisted to localStorage, respects system preference) with theme-aware chart tokens.
- Fully responsive — ResizeObserver-driven SVG charts, adaptive grids, and a mobile-optimized table.
Everything compiles cleanly with npm run build.
Files built: index.html, src/index.css, src/utils/format.ts, src/data/types.ts, src/data/constants.ts, src/data/sampleData.ts, src/lib/analytics.ts, src/hooks/useElementWidth.ts, src/hooks/useTheme.ts, src/components/ui/Card.tsx, src/components/ui/Segmented.tsx, src/components/ui/SelectField.tsx, src/components/charts/path.ts, src/components/charts/Sparkline.tsx, src/components/charts/LineChart.tsx, src/components/charts/BarChart.tsx, src/components/charts/DonutChart.tsx, src/components/ui/icons.tsx, src/components/Header.tsx, src/lib/filters.ts, src/components/FilterBar.tsx, src/components/KpiCards.tsx, src/components/EquityCurveCard.tsx, src/components/PairDonutCard.tsx, src/components/DailyPnlCard.tsx, src/components/SessionBarsCard.tsx, src/components/TradesTable.tsx, src/App.tsx