svelte-ui-standards
Coding standards and UI guidelines for the PolyFlup Svelte dashboard.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Svelte & Frontend Standards
Formatting (Biome)
- Indentation: 2 spaces (enforced by biome.json)
- Style: Space indent, recommended rules enabled
- Ignore CSS files from formatting
File Structure
- Components in
ui/src/lib/components/ - UI components in
ui/src/lib/components/ui/ - Each component exports from
index.ts - Stores in
ui/src/lib/stores/
Naming
-
Components:
PascalCase.svelte(e.g.,App.svelte) -
Utilities:
camelCase.js(e.g.,theme.js) - CSS classes: Tailwind utility classes
Svelte Patterns
- Use reactive declarations:
$: winRate = ... - Prefer
{#snippet}for chart tooltips (Svelte 5 syntax) - Use
onMountfor initialization and intervals - Clean up intervals in return function
- Store pattern for global state (e.g., theme store)
Component Library Stack
- shadcn-svelte: Accessible UI components with customizable styling
- Lucide Icons: Modern icon set (Activity, TrendingUp, Award, etc.)
- LayerChart: D3-based charting library (AreaChart, BarChart)
- d3-scale: Scaling functions for charts (scaleBand, etc.)
Theme System
- Dark/Light mode toggle with persistent storage
- Uses CSS variables for theming (
var(--color-chart-1), etc.) - Theme store pattern:
theme.init(),theme.toggle(),$theme - Tailwind dark mode classes:
dark:bg-slate-900
API Integration
-
Endpoint:
http://${hostname}:3001/api/stats - Polling: Every 5 seconds for real-time updates
- Error Handling: Display error banner on connection failure
- Loading States: Show loading indicator while fetching initial data
Data Visualization
- Equity Curve: AreaChart with cumulative PnL (last 50 trades)
- Asset Breakdown: BarChart with per-symbol PnL
-
Color Coding:
- BTC:
rgb(255, 153, 0)(orange) - ETH:
rgb(99, 127, 235)(blue) - SOL:
rgb(153, 69, 255)(purple) - XRP:
rgb(2, 140, 255)(cyan)
- BTC:
- Conditional Colors: Green for profits, red for losses
Table Display
- Recent trades table with live streaming data
- Columns: ID, Time (UTC), Market, Side, Edge, Price, PnL, Status
- Status badges: LIVE (amber), STOP LOSS (destructive), TAKE PROFIT (emerald), REVERSED (outline), SETTLED (secondary)
- Side badges with emojis: 📈 UP (default), 📉 DOWN (destructive)
Stats Cards
- Grid layout: 1 col mobile, 2 cols tablet, 4 cols desktop
- Key metrics: Total PnL, Win Rate, Stop Losses, Take Profits
- Conditional colors: emerald-600 for positive, rose-600 for negative
- Uppercase tracking labels with icons
- Arrow indicators: ArrowUpRight (positive), ArrowDownRight (negative)
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-26
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!