From 7acb52abb98191e92e733792f673c71245af22d6 Mon Sep 17 00:00:00 2001 From: 0xWeakSheep Date: Wed, 25 Mar 2026 20:20:45 +0800 Subject: [PATCH 1/2] docs: clarify local setup and validation scripts --- README.md | 33 ++++++++++++++++++++++++++++++--- package.json | 5 ++++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 200bd81..3fe37bc 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Real-time [Polymarket](https://polymarket.com) prediction market visualization d ### Prerequisites -- Node.js 18+ +- Node.js 20+ - npm ### Setup @@ -41,9 +41,12 @@ cd PolyWorld # Install dependencies npm install +# Generate Fumadocs collections +npm run docs:gen + # Configure environment variables cp .env.example .env -# Edit .env with your API keys +# Edit .env with your API keys / optional data source credentials # Start dev server npm run dev @@ -59,8 +62,28 @@ Open [http://localhost:3000](http://localhost:3000). | `AI_API_KEY` | Yes | Anthropic API key (for summaries, news matching, sentiment) | | `AI_FALLBACK_BASE_URL` | No | Fallback API base URL | | `AI_FALLBACK_API_KEY` | No | Fallback API key (used if primary fails) | +| `DATA_DIR` | No | Directory for runtime data and SQLite files | +| `DB_PATH` | No | SQLite database path | +| `POLYGON_RPC_URLS` | No | Comma-separated server-side Polygon RPC endpoints | +| `NEXT_PUBLIC_POLYGON_RPC_URL` | No | Browser-side Polygon RPC endpoint for wagmi | +| `UCDP_TOKEN` | No | Enables UCDP-backed conflict and military overlays | +| `TICKETMASTER_KEY` | No | Enables live sports overlay | +| `CLOUDFLARE_TOKEN` | No | Enables internet outages overlay | +| `ACLED_EMAIL` | No | ACLED OAuth email for protests/unrest overlay | +| `ACLED_PASSWORD` | No | ACLED OAuth password for protests/unrest overlay | + +The app works without most optional keys. Missing keys only disable the related AI or overlay features. + +### Local Verification -The app works without AI keys — summaries and sentiment will be disabled, but all market data, charts, and trading features remain functional. +After dependency install, regenerate docs collections before type-checking or building: + +```bash +npm run docs:gen +npm run lint +npm run typecheck +npm test +``` ## Project Structure @@ -77,10 +100,14 @@ src/ ## Scripts ```bash +npm run docs:gen # Generate Fumadocs collections npm run dev # Development server npm run build # Production build npm run start # Production server npm run lint # ESLint +npm run typecheck # TypeScript check +npm test # Vitest unit tests +npm run test:e2e # Playwright end-to-end tests ``` ## Acknowledgements diff --git a/package.json b/package.json index 3a51ba4..472dea9 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,12 @@ "dev": "WATCHPACK_POLLING=true next dev --webpack", "build": "next build", "start": "next start", + "docs:gen": "fumadocs-mdx", "lint": "eslint", + "typecheck": "tsc --noEmit", "test": "vitest run", - "test:watch": "vitest" + "test:watch": "vitest", + "test:e2e": "playwright test" }, "dependencies": { "@anthropic-ai/sdk": "^0.78.0", From 9a5a8ff906f6b6e00e27da544c6a82312ae02ba5 Mon Sep 17 00:00:00 2001 From: 0xWeakSheep Date: Wed, 25 Mar 2026 20:41:37 +0800 Subject: [PATCH 2/2] chore: remove unused code warnings without behavior changes --- src/app/api/health/route.ts | 2 +- src/components/MapToolbar.tsx | 2 ++ src/components/NewsPanel.tsx | 15 --------------- src/components/OrderBook.tsx | 1 - src/components/SignalPanel.tsx | 1 - src/components/TweetsPanel.tsx | 2 +- 6 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/app/api/health/route.ts b/src/app/api/health/route.ts index 2bece49..0b6fc4b 100644 --- a/src/app/api/health/route.ts +++ b/src/app/api/health/route.ts @@ -28,7 +28,7 @@ export async function GET() { } return NextResponse.json({ status: "ok", timestamp: new Date().toISOString() }); - } catch (err) { + } catch { return NextResponse.json( { status: "error", reason: "internal" }, { status: 503 } diff --git a/src/components/MapToolbar.tsx b/src/components/MapToolbar.tsx index cb98e1f..f9ff0e9 100644 --- a/src/components/MapToolbar.tsx +++ b/src/components/MapToolbar.tsx @@ -79,6 +79,8 @@ export default function MapToolbar({ activeLayers, onToggleLayer, }: MapToolbarProps) { + void onToggleFullscreen; + void isFullscreen; const { t } = useI18n(); const [categoriesOpen, setCategoriesOpen] = useState(false); const [layersOpen, setLayersOpen] = useState(false); diff --git a/src/components/NewsPanel.tsx b/src/components/NewsPanel.tsx index 263cbd3..9fd6e36 100644 --- a/src/components/NewsPanel.tsx +++ b/src/components/NewsPanel.tsx @@ -12,21 +12,6 @@ interface NewsPanelProps { onSourcesChange?: (sources: string[]) => void; } -const SOURCE_ABBREVS: Record = { - Reuters: "R", - "BBC World": "BBC", - "Al Jazeera": "AJ", - Bloomberg: "BL", - "AP News": "AP", - NPR: "NPR", - "France 24": "F24", - "DW News": "DW", - CNBC: "CNBC", - "The Guardian": "GU", - "NHK World": "NHK", - CNA: "CNA", -}; - function timeAgo(dateStr: string): string { const diff = Date.now() - new Date(dateStr).getTime(); const mins = Math.floor(diff / 60_000); diff --git a/src/components/OrderBook.tsx b/src/components/OrderBook.tsx index 0afb242..ce00cb5 100644 --- a/src/components/OrderBook.tsx +++ b/src/components/OrderBook.tsx @@ -54,7 +54,6 @@ export default function OrderBookPanel({ selectedMarket }: OrderBookPanelProps) const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [bookSide, setBookSide] = useState("YES"); - const intervalRef = useRef | null>(null); const retryCount = useRef(0); const scrollRef = useRef(null); const midRef = useRef(null); diff --git a/src/components/SignalPanel.tsx b/src/components/SignalPanel.tsx index f4c1033..3b05aa4 100644 --- a/src/components/SignalPanel.tsx +++ b/src/components/SignalPanel.tsx @@ -160,7 +160,6 @@ function SignalCard({ signal, markets, onSelectMarket, - onSelectWallet: _onSelectWallet, onOpenTrade, onTrade, }: { diff --git a/src/components/TweetsPanel.tsx b/src/components/TweetsPanel.tsx index 0f9c74e..616dbdd 100644 --- a/src/components/TweetsPanel.tsx +++ b/src/components/TweetsPanel.tsx @@ -2,7 +2,7 @@ import { useState, useEffect, useCallback, useMemo, useRef } from "react"; import type { ProcessedMarket, TweetItem } from "@/types"; -import { TWEET_SOURCES, HANDLE_ABBREVS } from "@/lib/tweetSources"; +import { TWEET_SOURCES } from "@/lib/tweetSources"; import { useVisibilityPolling } from "@/hooks/useVisibilityPolling"; import { useI18n } from "@/i18n";