feat(v3.7.0): legal-acceptance gates + per-tab chart lazy-loading (#62)
Web: full-screen first-launch legal gate (LegalGate) blocks the app until the user accepts the current LEGAL_VERSION; persists as prefs.acceptedLegalVersion in localStorage (no cookie). Reuses LEGAL_LINKS; re-prompts on LEGAL_VERSION bump. Built on raw Radix Dialog (focus-trapped, no close-X, Esc/outside-click disabled). Desktop: Windows NSIS installer shows an EULA "I Agree" page via bundle.windows.nsis.license -> src-tauri/installer/EULA.txt. Charts: /charts split into four lazy per-tab chunks (charts/tabs/*). Each tab imports its chart components directly (index.ts barrel removed) so the bundler keeps each tab's components in its own chunk; non-default tabs' component code loads only on activation. Recharts still loads with the default Overview tab. Also: about.ts version -> 3.7.0 + Opus 4.8 credit; Privacy Policy localStorage key note (EN + VI); CHANGELOG + CLAUDE.md updates. Verified: eslint, tsc -b, knip, npm audit (0 vulns), ruff, vulture all clean; browser smoke test of gate (appear / accept / persist / version-bump re-prompt) and per-tab lazy loading (reach-tab + its charts load only on tab click). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
bf7cdf3dd2
commit
7d99881aff
18 files changed
+396
-101
No files matched your search
@@ -2,6 +2,49 @@
|
||||
|
||||
All notable changes to this project will be documented here.
|
||||
|
||||
## [3.7.0] - 2026-06-14 (Legal-acceptance gates + per-tab chart lazy-loading)
|
||||
|
||||
### Added
|
||||
|
||||
- **First-launch legal-acceptance gate** — on first visit (and in every fresh
|
||||
incognito session, since `localStorage` starts empty there) the app shows a
|
||||
full-screen, non-dismissible gate before the main UI. It links the License,
|
||||
EULA, Privacy Policy, Disclaimer, Terms of Use, Code of Conduct, and Security
|
||||
Policy (reusing `LEGAL_LINKS`), and requires ticking a checkbox to continue.
|
||||
New component [`webapp/src/components/legal-gate.tsx`](webapp/src/components/legal-gate.tsx),
|
||||
built on raw Radix Dialog primitives (focus-trapped, no close-X, Esc /
|
||||
outside-click disabled). Acceptance persists as `acceptedLegalVersion` in the
|
||||
existing `webapp.prefs` localStorage blob — **no cookie** (consistent with the
|
||||
"no cookies" privacy stance). A `LEGAL_VERSION` constant
|
||||
([`webapp/src/stores/prefs.ts`](webapp/src/stores/prefs.ts)) lets a future
|
||||
policy edit re-prompt every user with a one-line bump.
|
||||
- **Windows installer EULA page** — the Tauri NSIS `.exe` now shows an
|
||||
"I Agree" license step before installing, wired via
|
||||
`bundle.windows.nsis.license` →
|
||||
[`webapp/src-tauri/installer/EULA.txt`](webapp/src-tauri/installer/EULA.txt)
|
||||
(plain text so NSIS renders it cleanly). The in-app gate above covers
|
||||
first-run consent on macOS / Linux, whose installers have no equivalent step.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Charts route split into four lazy per-tab chunks**
|
||||
([`webapp/src/components/charts/tabs/`](webapp/src/components/charts/tabs)).
|
||||
Each tab imports its chart components directly (the `charts/index.ts` barrel
|
||||
was removed so the bundler keeps each tab's components in its own chunk).
|
||||
Result: only the default **Overview** tab's components load when `/charts`
|
||||
opens; the Reach / Quality / Discovery component code downloads on first
|
||||
click. Recharts itself (the ~380 KB `vendor-charts` chunk) still loads with
|
||||
Overview — unavoidable since the default tab renders charts — but it was
|
||||
already deferred to the lazy `/charts` route, so it never touches app startup.
|
||||
- `about.ts` version → 3.7.0 (also busts the IndexedDB catalog cache, harmless);
|
||||
Claude Code co-author credit updated to Opus 4.8.
|
||||
|
||||
### Notes
|
||||
|
||||
- Images, routes, and OpenPGP were already lazy-loaded; this release closes the
|
||||
remaining gap (charts). No Tauri version bump (`tauri.conf.json` stays
|
||||
`0.1.1`) — the NSIS license is a bundler-config addition, not a binary change.
|
||||
|
||||
## [3.6.1] - 2026-06-12 (Hotfix — desktop build vs broken `time` 0.3.48)
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -37,7 +37,8 @@ Path alias: `@/*` → `webapp/src/*`. Vite `define`s `__BUILD_DATE__` so About p
|
||||
- `src/routes/*.tsx` — one file per route; `App.tsx` wires `react-router-dom` HashRouter.
|
||||
- `src/components/data-table/*` — `DataTable` (TanStack Table + Virtual + pagination), `data-table-toolbar`, `data-table-pagination`, `faceted-filter`, `columns`. Row keys are URL-based (`getRowId: g => g.url`) so selection survives sort/filter/page changes.
|
||||
- `src/components/ui/*` — shadcn primitives (Button, Card, Input, Label, Badge, Skeleton, Separator, Tabs, Popover, Checkbox, Select, Switch, Textarea, Dialog).
|
||||
- `src/components/charts/` — chart module (one file per chart, shared `chart-card.tsx` with `ChartCard` + `PALETTE`, `index.ts` barrel). 16 charts across 4 tabs.
|
||||
- `src/components/charts/` — chart module (one file per chart, shared `chart-card.tsx` with `ChartCard` + `PALETTE`). 16 charts across 4 tabs. Each tab is a `React.lazy` default export under `charts/tabs/{overview,reach,quality,discovery}-tab.tsx`, wrapped in `<Suspense>` from `routes/charts.tsx`. **Tabs import chart components directly (no `index.ts` barrel — it was removed in v3.7.0)** so the bundler keeps each tab's components in its own chunk; a barrel re-exporting all 16 would collapse them into one shared chunk and defeat the split. Radix unmounts inactive `TabsContent`, so a non-default tab's component code downloads only on first activation. Recharts (`vendor-charts`) still loads with the default Overview tab.
|
||||
- `src/components/legal-gate.tsx` — full-screen, non-dismissible first-launch legal-acceptance gate (raw Radix Dialog, no close-X, Esc/outside-click disabled). Wraps the shell in `App.tsx`; renders instead of the shell until `prefs.acceptedLegalVersion === LEGAL_VERSION`. Reuses `LEGAL_LINKS` from `about.ts`; persists via `prefs.acceptLegal()`.
|
||||
- `src/lib/github/` — `client.ts` (Octokit factory), `data-store.ts` (TS port of `scripts/data_store.py`), `contents.ts` (single-file commits — routed through Git Data API so they can be signed), `git-data.ts` (atomic multi-file commit; optional signer for GPG), `signer.ts` (builds a `CommitSigner` from gpg store + auth + prefs), `workflow.ts` (dispatch + poll).
|
||||
- `src/lib/gpg/` — `canonicalize.ts` (pure: builds the byte string Git would hash for a commit), `sign.ts` (lazy-imports `openpgp`, exports `loadPrivateKey` / `signCommit` / `verifyDetached`), `storage.ts` (encrypted-key + metadata in localStorage).
|
||||
- `src/lib/crypto.ts` — AES-GCM 256 + PBKDF2-SHA256 100k rounds. **Uint8Array generic must be `<ArrayBuffer>`** under TS 6, not `<ArrayBufferLike>` — Web Crypto rejects the latter.
|
||||
@@ -45,7 +46,7 @@ Path alias: `@/*` → `webapp/src/*`. Vite `define`s `__BUILD_DATE__` so About p
|
||||
- `src/lib/i18n/` — minimal typed i18n. `en.ts` is the source of truth (`MessageKey = keyof typeof en`); `vi.ts` must **never** be static-imported — it stays a lazy chunk via `import('./vi')` in `index.ts` only. `t()` imperative, `useT()` reactive hook; language pref lives in the `prefs` store.
|
||||
- `src/main.tsx` — react-query cache persisted to IndexedDB via `idb-keyval` (`PersistQueryClientProvider`). Only public catalog queries (`db` / `deleted` / `count-history`) are dehydrated, never PAT-gated data. `buster = APP.version`, so bumping `about.ts` invalidates the cache. **`gcTime` must stay >= persist `maxAge`** or restored queries are garbage-collected right after hydration.
|
||||
- Error handling — `src/lib/http-error.ts` (`HttpError`), `src/components/error-page.tsx` + `route-error.tsx` + `error-boundary.tsx`. Hidden preview route `/errors/:code` (not linked from nav). `webapp/public/404.html` serves as the GitHub Pages custom 404.
|
||||
- `src/stores/` — Zustand stores: `auth` (in-memory PAT + GitHub user; idle timeout pulled from `prefs`), `theme`, `prefs` (sidebar collapsed + density + idle timeout + author override + notification settings + language), `gpg` (in-memory PrivateKey + fingerprint + uid + enabled), `undo` (20-entry FIFO of reverse ops).
|
||||
- `src/stores/` — Zustand stores: `auth` (in-memory PAT + GitHub user; idle timeout pulled from `prefs`), `theme`, `prefs` (sidebar collapsed + density + idle timeout + author override + notification settings + language + `acceptedLegalVersion` — re-prompts the legal gate when the exported `LEGAL_VERSION` constant bumps), `gpg` (in-memory PrivateKey + fingerprint + uid + enabled), `undo` (20-entry FIFO of reverse ops).
|
||||
- `src/lib/about.ts` — keep the `THIRD_PARTY` array up to date when adding npm deps; About page reads it.
|
||||
|
||||
## Editable vs read-only fields
|
||||
@@ -111,6 +112,6 @@ Fine-grained PAT scoped to **only this repo** with:
|
||||
- Don't commit a real PAT, ever. Settings page handles it client-side; CI uses `secrets.GH_TOKEN`.
|
||||
- When adding an npm dep, also add it to `webapp/src/lib/about.ts` so the About page lists it.
|
||||
|
||||
## Current state (as of v3.6.1)
|
||||
## Current state (as of v3.7.0)
|
||||
|
||||
`main` is the trunk. All feature work has merged. Tags `v3.0.0` through `v3.6.1` exist (all GPG-signed). The webapp is published at `https://poli0981.github.io/free-games-itchio-list/app/`.
|
||||
`main` is the trunk. All feature work has merged. Tags `v3.0.0` through `v3.7.0` exist (all GPG-signed). The webapp is published at `https://poli0981.github.io/free-games-itchio-list/app/`. v3.7.0 added the first-launch legal-acceptance gate, the Windows NSIS installer EULA page, and per-tab lazy-loading of the charts route.
|
||||
@@ -47,7 +47,7 @@ The Webapp persists the following items locally and never transmits them to any
|
||||
|---|---|---|---|
|
||||
| `localStorage` | `webapp.pat.encrypted` | Your GitHub PAT, encrypted with AES-GCM 256-bit. Encryption key is derived from Your passphrase via PBKDF2-SHA256 (100,000 iterations) with a per-token random salt. The plaintext PAT is **never** persisted to disk. | When You enable write access in Settings. |
|
||||
| `localStorage` | `webapp.theme` | One of `'light'`, `'dark'`, `'system'`. | When You toggle the theme. |
|
||||
| `localStorage` | `webapp.prefs` | UI preferences (sidebar collapsed, table column widths). | When You change a UI preference. |
|
||||
| `localStorage` | `webapp.prefs` | UI preferences (sidebar collapsed, density, language, notification settings, optional commit-author override) and the version of the legal terms You accepted (`acceptedLegalVersion`). | When You change a UI preference or accept the legal terms. |
|
||||
| `IndexedDB` (via `idb-keyval`) | TanStack Query cache keys | Cached copies of the public catalog JSON for fast reload and limited offline reads. | Automatic, on first fetch. |
|
||||
|
||||
You can erase all of the above at any time by:
|
||||
|
||||
@@ -49,7 +49,7 @@ Webapp lưu các mục sau cục bộ và **không bao giờ** gửi chúng tớ
|
||||
|---|---|---|---|
|
||||
| `localStorage` | `webapp.pat.encrypted` | PAT GitHub của Bạn, mã hóa AES-GCM 256-bit. Khóa mã hóa được dẫn xuất từ passphrase qua PBKDF2-SHA256 (100.000 vòng) với salt ngẫu nhiên cho mỗi token. PAT plaintext **không bao giờ** được lưu xuống đĩa. | Khi Bạn bật quyền ghi trong Settings. |
|
||||
| `localStorage` | `webapp.theme` | Một trong `'light'`, `'dark'`, `'system'`. | Khi Bạn chuyển theme. |
|
||||
| `localStorage` | `webapp.prefs` | Tùy chỉnh UI (sidebar collapsed, độ rộng cột bảng). | Khi Bạn thay đổi tùy chỉnh UI. |
|
||||
| `localStorage` | `webapp.prefs` | Tùy chỉnh UI (sidebar collapsed, mật độ, ngôn ngữ, cài đặt thông báo, ghi đè tác giả commit tùy chọn) và phiên bản điều khoản pháp lý Bạn đã chấp nhận (`acceptedLegalVersion`). | Khi Bạn thay đổi tùy chỉnh UI hoặc chấp nhận điều khoản pháp lý. |
|
||||
| `IndexedDB` (qua `idb-keyval`) | Khóa cache TanStack Query | Bản sao cache của catalog JSON công khai để tải nhanh và đọc offline có giới hạn. | Tự động, sau lần fetch đầu tiên. |
|
||||
|
||||
Bạn có thể xóa toàn bộ những gì ở trên bất kỳ lúc nào bằng cách:
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
END-USER LICENSE AGREEMENT (EULA)
|
||||
Itch.io Free Games DB - Desktop App
|
||||
Last updated: 2026-06-14
|
||||
|
||||
This EULA applies to the code and content of free-games-itchio-list -
|
||||
the JSON catalog, the Python pipeline, the React webapp, the Tauri desktop
|
||||
app, the markdown tables, and the documentation. It does NOT cover the games
|
||||
themselves, which are licensed separately by their developers via itch.io.
|
||||
|
||||
TL;DR: This project is MIT-licensed. Fork, modify, redistribute - keep the
|
||||
copyright notice, and don't blame the maintainer if it breaks. The games are
|
||||
not yours just because they are listed here.
|
||||
|
||||
1. GRANT OF LICENSE
|
||||
The Repository is licensed under the MIT License (see the LICENSE file for the
|
||||
canonical text). Subject to that license, you are granted a worldwide,
|
||||
royalty-free, non-exclusive, perpetual right to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and sell copies of the code, data, and
|
||||
documentation; to run the Webapp and Desktop App for any purpose, personal or
|
||||
commercial; and to build derivative works. Keep the copyright and license
|
||||
notice when you redistribute substantial portions. No warranty (see DISCLAIMER).
|
||||
|
||||
2. WHAT THIS LICENSE DOES NOT COVER
|
||||
- The games indexed by the catalog. Each game is the intellectual property of
|
||||
its developer and is licensed by them via itch.io. This app provides a link
|
||||
and metadata only.
|
||||
- Third-party libraries, each under its own license (see the About page).
|
||||
- itch.io trademarks, logos, and service marks.
|
||||
- Thumbnails, screenshots, descriptions, and trailers of indexed games.
|
||||
|
||||
3. ACCEPTANCE
|
||||
You accept this EULA by installing, running, or otherwise using the Desktop
|
||||
App. If you do not agree, do not install it.
|
||||
|
||||
4. RESTRICTIONS
|
||||
You agree not to use the software to host or distribute malware, phishing, or
|
||||
unlawful content; to misrepresent the origin of the software; to use the
|
||||
maintainer's name or aliases to endorse derivative works without permission;
|
||||
or to use the app's GitHub token features without proper authorization from the
|
||||
resource owners.
|
||||
|
||||
5. NO WARRANTY / LIABILITY
|
||||
The software is provided "as is", without warranty of any kind. The maintainer
|
||||
is not liable for any damages arising from its use. This is a hobby project
|
||||
drafted by a non-lawyer with AI assistance and is not legal advice.
|
||||
|
||||
6. GOVERNING LAW
|
||||
This EULA is governed by the laws of the Socialist Republic of Vietnam. The MIT
|
||||
License itself is internationally portable and interpreted as such.
|
||||
|
||||
The full, canonical policies (EULA, Privacy Policy, Terms of Use, Disclaimer)
|
||||
live in the project repository:
|
||||
https://github.com/poli0981/free-games-itchio-list
|
||||
|
||||
By choosing "I Agree" you confirm that you have read and accept these terms.
|
||||
@@ -38,6 +38,11 @@
|
||||
],
|
||||
"category": "Utility",
|
||||
"shortDescription": "Browse and edit the free Itch.io games catalog",
|
||||
"longDescription": "Desktop wrapper for the free-games-itchio-list webapp. Adds local-network scrape (no CORS) and works offline-first."
|
||||
"longDescription": "Desktop wrapper for the free-games-itchio-list webapp. Adds local-network scrape (no CORS) and works offline-first.",
|
||||
"windows": {
|
||||
"nsis": {
|
||||
"license": "installer/EULA.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
-26
@@ -1,6 +1,7 @@
|
||||
import { lazy, Suspense, useEffect, useRef } from 'react'
|
||||
import { Routes, Route, useLocation } from 'react-router-dom'
|
||||
import { Sidebar, MobileTopBar } from '@/components/sidebar'
|
||||
import { LegalGate } from '@/components/legal-gate'
|
||||
import ScrollToTop from '@/components/scroll-to-top'
|
||||
import { RouteErrorBoundary } from '@/components/error-boundary'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
@@ -50,32 +51,34 @@ export default function App() {
|
||||
useDensityEffect()
|
||||
const mainRef = useRef<HTMLElement>(null)
|
||||
return (
|
||||
<div className="flex h-[100dvh] overflow-hidden">
|
||||
<ScrollToHash />
|
||||
<Sidebar />
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<MobileTopBar />
|
||||
<main ref={mainRef} className="flex-1 overflow-y-auto">
|
||||
<RouteErrorBoundary>
|
||||
<Suspense fallback={<RouteFallback />}>
|
||||
<Routes>
|
||||
<Route path="/" element={<Dashboard />} />
|
||||
<Route path="/games" element={<Games />} />
|
||||
<Route path="/games/:slug" element={<GameDetail />} />
|
||||
<Route path="/add" element={<Add />} />
|
||||
<Route path="/charts" element={<Charts />} />
|
||||
<Route path="/workflows" element={<Workflows />} />
|
||||
<Route path="/deleted" element={<Deleted />} />
|
||||
<Route path="/settings" element={<Settings />} />
|
||||
<Route path="/about" element={<About />} />
|
||||
<Route path="/errors/:code" element={<ErrorPreview />} />
|
||||
<Route path="*" element={<NotFound />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
</RouteErrorBoundary>
|
||||
</main>
|
||||
<ScrollToTop targetRef={mainRef} />
|
||||
<LegalGate>
|
||||
<div className="flex h-[100dvh] overflow-hidden">
|
||||
<ScrollToHash />
|
||||
<Sidebar />
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<MobileTopBar />
|
||||
<main ref={mainRef} className="flex-1 overflow-y-auto">
|
||||
<RouteErrorBoundary>
|
||||
<Suspense fallback={<RouteFallback />}>
|
||||
<Routes>
|
||||
<Route path="/" element={<Dashboard />} />
|
||||
<Route path="/games" element={<Games />} />
|
||||
<Route path="/games/:slug" element={<GameDetail />} />
|
||||
<Route path="/add" element={<Add />} />
|
||||
<Route path="/charts" element={<Charts />} />
|
||||
<Route path="/workflows" element={<Workflows />} />
|
||||
<Route path="/deleted" element={<Deleted />} />
|
||||
<Route path="/settings" element={<Settings />} />
|
||||
<Route path="/about" element={<About />} />
|
||||
<Route path="/errors/:code" element={<ErrorPreview />} />
|
||||
<Route path="*" element={<NotFound />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
</RouteErrorBoundary>
|
||||
</main>
|
||||
<ScrollToTop targetRef={mainRef} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</LegalGate>
|
||||
)
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
export { GenreChart } from './genre-chart'
|
||||
export { PlatformChart } from './platform-chart'
|
||||
export { OnlineOfflineChart } from './online-offline-chart'
|
||||
export { LanguagesChart } from './languages-chart'
|
||||
export { MadeWithChart } from './made-with-chart'
|
||||
export { RatingChart } from './rating-chart'
|
||||
export { StatusChart } from './status-chart'
|
||||
export { AvgSessionChart } from './avg-session-chart'
|
||||
export { TopTagsChart } from './top-tags-chart'
|
||||
export { RecentDeletedChart } from './recent-deleted-chart'
|
||||
export { GameCountChart } from './game-count-chart'
|
||||
export { GenreTreemapChart } from './genre-treemap-chart'
|
||||
export { KpiCards } from './kpi-cards'
|
||||
export { DeletionsOverTimeChart } from './deletions-over-time-chart'
|
||||
export { DeletionReasonsChart } from './deletion-reasons-chart'
|
||||
export { TopRatedCountChart } from './top-rated-count-chart'
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { Game } from '@/types/game'
|
||||
import { GenreTreemapChart } from '@/components/charts/genre-treemap-chart'
|
||||
import { TopTagsChart } from '@/components/charts/top-tags-chart'
|
||||
|
||||
interface DiscoveryTabProps {
|
||||
games: Game[]
|
||||
}
|
||||
|
||||
export default function DiscoveryTab({ games }: DiscoveryTabProps) {
|
||||
return (
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<TopTagsChart games={games} />
|
||||
<GenreTreemapChart games={games} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import type { CountHistoryPoint, DeletedGameEntry, Game } from '@/types/game'
|
||||
import { GameCountChart } from '@/components/charts/game-count-chart'
|
||||
import { GenreChart } from '@/components/charts/genre-chart'
|
||||
import { KpiCards } from '@/components/charts/kpi-cards'
|
||||
import { MadeWithChart } from '@/components/charts/made-with-chart'
|
||||
import { OnlineOfflineChart } from '@/components/charts/online-offline-chart'
|
||||
import { StatusChart } from '@/components/charts/status-chart'
|
||||
|
||||
interface OverviewTabProps {
|
||||
games: Game[]
|
||||
deleted: DeletedGameEntry[]
|
||||
history: CountHistoryPoint[]
|
||||
}
|
||||
|
||||
export default function OverviewTab({ games, deleted, history }: OverviewTabProps) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<KpiCards games={games} deleted={deleted} />
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<GenreChart games={games} />
|
||||
<StatusChart games={games} />
|
||||
<OnlineOfflineChart games={games} />
|
||||
<MadeWithChart games={games} />
|
||||
<GameCountChart history={history} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import type { DeletedGameEntry, Game } from '@/types/game'
|
||||
import { DeletionReasonsChart } from '@/components/charts/deletion-reasons-chart'
|
||||
import { DeletionsOverTimeChart } from '@/components/charts/deletions-over-time-chart'
|
||||
import { RatingChart } from '@/components/charts/rating-chart'
|
||||
import { TopRatedCountChart } from '@/components/charts/top-rated-count-chart'
|
||||
|
||||
interface QualityTabProps {
|
||||
games: Game[]
|
||||
deleted: DeletedGameEntry[]
|
||||
}
|
||||
|
||||
export default function QualityTab({ games, deleted }: QualityTabProps) {
|
||||
return (
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<RatingChart games={games} />
|
||||
<TopRatedCountChart games={games} />
|
||||
<DeletionsOverTimeChart deleted={deleted} />
|
||||
<DeletionReasonsChart deleted={deleted} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import type { DeletedGameEntry, Game } from '@/types/game'
|
||||
import { AvgSessionChart } from '@/components/charts/avg-session-chart'
|
||||
import { LanguagesChart } from '@/components/charts/languages-chart'
|
||||
import { PlatformChart } from '@/components/charts/platform-chart'
|
||||
import { RecentDeletedChart } from '@/components/charts/recent-deleted-chart'
|
||||
|
||||
interface ReachTabProps {
|
||||
games: Game[]
|
||||
deleted: DeletedGameEntry[]
|
||||
}
|
||||
|
||||
export default function ReachTab({ games, deleted }: ReachTabProps) {
|
||||
return (
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<PlatformChart games={games} />
|
||||
<LanguagesChart games={games} />
|
||||
<AvgSessionChart games={games} />
|
||||
<RecentDeletedChart deleted={deleted} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import { useState, type ReactNode } from 'react'
|
||||
import * as DialogPrimitive from '@radix-ui/react-dialog'
|
||||
import { ExternalLink as ExternalLinkIcon } from 'lucide-react'
|
||||
import { usePrefs, LEGAL_VERSION } from '@/stores/prefs'
|
||||
import { useT } from '@/lib/i18n'
|
||||
import { LEGAL_LINKS, LEGAL_VI_INDEX_URL } from '@/lib/about'
|
||||
import { ExtLink } from '@/components/ext-link'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
|
||||
/**
|
||||
* Full-screen first-launch legal-acceptance gate. Renders INSTEAD of the app
|
||||
* shell until the user accepts the current `LEGAL_VERSION`; the sidebar and
|
||||
* routes never mount while it is up. Acceptance persists in the `webapp.prefs`
|
||||
* localStorage blob (synchronous Zustand hydration → no flash on reload).
|
||||
*
|
||||
* Built on the raw Radix Dialog primitives (not `ui/dialog.tsx`) so it has no
|
||||
* close "X" and cannot be dismissed via Esc / outside-click. Radix still
|
||||
* provides the focus trap and aria-modal labelling.
|
||||
*/
|
||||
|
||||
// Policy links + the canonical License — reuse about.ts, never hardcode URLs.
|
||||
const GATE_LINKS = LEGAL_LINKS.filter(
|
||||
(l) => l.group === 'policy' || l.name === 'License (MIT)',
|
||||
)
|
||||
|
||||
export function LegalGate({ children }: { children: ReactNode }) {
|
||||
const accepted = usePrefs((s) => s.acceptedLegalVersion)
|
||||
if (accepted === LEGAL_VERSION) return <>{children}</>
|
||||
return <LegalGateModal />
|
||||
}
|
||||
|
||||
function LegalGateModal() {
|
||||
const t = useT()
|
||||
const lang = usePrefs((s) => s.language)
|
||||
const acceptLegal = usePrefs((s) => s.acceptLegal)
|
||||
const [checked, setChecked] = useState(false)
|
||||
const [declined, setDeclined] = useState(false)
|
||||
|
||||
return (
|
||||
<DialogPrimitive.Root open>
|
||||
<DialogPrimitive.Portal>
|
||||
<DialogPrimitive.Overlay className="fixed inset-0 z-50 bg-background/95 backdrop-blur-sm" />
|
||||
<DialogPrimitive.Content
|
||||
onEscapeKeyDown={(e) => e.preventDefault()}
|
||||
onPointerDownOutside={(e) => e.preventDefault()}
|
||||
onInteractOutside={(e) => e.preventDefault()}
|
||||
className="fixed left-1/2 top-1/2 z-50 grid max-h-[90dvh] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto border bg-background p-6 shadow-lg sm:rounded-lg"
|
||||
>
|
||||
<DialogPrimitive.Title className="text-lg font-semibold leading-none tracking-tight">
|
||||
{t('legal.gate.title')}
|
||||
</DialogPrimitive.Title>
|
||||
<DialogPrimitive.Description className="text-sm text-muted-foreground">
|
||||
{t('legal.gate.intro')}
|
||||
</DialogPrimitive.Description>
|
||||
|
||||
<ul className="space-y-1.5 text-sm">
|
||||
{GATE_LINKS.map((link) => (
|
||||
<li key={link.name}>
|
||||
<ExtLink
|
||||
href={link.url}
|
||||
className="inline-flex items-center gap-1 font-medium hover:underline"
|
||||
>
|
||||
{link.name}
|
||||
<ExternalLinkIcon className="h-3 w-3 opacity-50" />
|
||||
</ExtLink>
|
||||
<span className="text-muted-foreground"> — {link.description}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{lang === 'vi' && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
<ExtLink href={LEGAL_VI_INDEX_URL} className="font-medium hover:underline">
|
||||
docs/i18n/vi/
|
||||
</ExtLink>{' '}
|
||||
— {t('legal.gate.viLink')}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<label className="flex items-start gap-2 text-sm">
|
||||
<Checkbox
|
||||
checked={checked}
|
||||
onCheckedChange={(v) => setChecked(v === true)}
|
||||
className="mt-0.5"
|
||||
/>
|
||||
<span>{t('legal.gate.checkboxLabel')}</span>
|
||||
</label>
|
||||
|
||||
{declined && (
|
||||
<p className="text-sm text-destructive" role="alert">
|
||||
{t('legal.gate.declinedMsg')}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
|
||||
<Button variant="ghost" onClick={() => setDeclined(true)}>
|
||||
{t('legal.gate.decline')}
|
||||
</Button>
|
||||
<Button disabled={!checked} onClick={() => acceptLegal()}>
|
||||
{t('legal.gate.accept')}
|
||||
</Button>
|
||||
</div>
|
||||
</DialogPrimitive.Content>
|
||||
</DialogPrimitive.Portal>
|
||||
</DialogPrimitive.Root>
|
||||
)
|
||||
}
|
||||
@@ -8,7 +8,7 @@ export interface ThirdParty {
|
||||
|
||||
export const APP = {
|
||||
name: 'Itch.io Free Games DB',
|
||||
version: '3.6.1',
|
||||
version: '3.7.0',
|
||||
repo: 'https://github.com/poli0981/free-games-itchio-list',
|
||||
license: 'MIT',
|
||||
buildDate: typeof __BUILD_DATE__ !== 'undefined' ? __BUILD_DATE__ : 'dev',
|
||||
@@ -44,8 +44,8 @@ export const AI_TOOLS: AiTool[] = [
|
||||
{
|
||||
name: 'Claude Code',
|
||||
vendor: 'Anthropic',
|
||||
model: 'Claude Opus 4.7 (1M context)',
|
||||
role: 'Newer recruit. Drove the v3.0.0 webapp + Tauri build and the v3.1.2 offline-link fix / About expansion / docs sweep. More cautious vibe — confirms before nuking anything.',
|
||||
model: 'Claude Opus 4.8 (1M context)',
|
||||
role: 'Newer recruit. Drove the v3.0.0 webapp + Tauri build, the v3.1.2 offline-link fix / About expansion / docs sweep, and the v3.7.0 legal-acceptance gate + per-tab chart lazy-loading. More cautious vibe — confirms before nuking anything.',
|
||||
url: 'https://claude.com/claude-code',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -102,7 +102,7 @@ export const en = {
|
||||
"about.bug.title": "Found a bug?",
|
||||
"about.developer.title": "Developer",
|
||||
"about.footer": "Made with the libraries above. No tracking, no analytics, no telemetry.",
|
||||
"about.legal.desc": "All policies are MD files in the repo — short, plain-language, slight humor, full on-the-record terms. Updated 2026-05-05.",
|
||||
"about.legal.desc": "All policies are MD files in the repo — short, plain-language, slight humor, full on-the-record terms. Updated 2026-06-14.",
|
||||
"about.legal.title": "Legal & policies",
|
||||
"about.legal.viNote": "— Vietnamese translations of the policies above (community-readable, English remains the controlling version for legal interpretation).",
|
||||
"about.social.desc": "DMs open on most. Replies slow (introvert max level). Pick whichever channel fits.",
|
||||
@@ -342,6 +342,13 @@ export const en = {
|
||||
"gpg.webappPassphrase": "Webapp passphrase",
|
||||
"gpg.webappPassphraseDesc": "Used to AES-GCM-encrypt the (already-decrypted) key in localStorage.",
|
||||
"gpg.webappPassphrasePlaceholder": "Same passphrase used for your PAT — min 8 chars",
|
||||
"legal.gate.accept": "Accept & continue",
|
||||
"legal.gate.checkboxLabel": "I have read and accept all the terms and policies listed above.",
|
||||
"legal.gate.decline": "Decline",
|
||||
"legal.gate.declinedMsg": "You must accept the terms to use this app. It stays locked until you do.",
|
||||
"legal.gate.intro": "By using this app you accept and agree to abide by the legal terms below. Please review them before continuing.",
|
||||
"legal.gate.title": "Before you continue",
|
||||
"legal.gate.viLink": "Vietnamese translations of the policies above",
|
||||
"settings.appearance.collapseSidebar": "Collapse sidebar",
|
||||
"settings.appearance.collapseSidebarDesc": "Mirror of the toggle in the sidebar footer.",
|
||||
"settings.appearance.density": "Density",
|
||||
|
||||
@@ -103,7 +103,7 @@ export const vi: Record<MessageKey, string> = {
|
||||
"about.bug.title": "Phát hiện bug?",
|
||||
"about.developer.title": "Nhà phát triển",
|
||||
"about.footer": "Được tạo bằng các thư viện ở trên. Không theo dõi, không analytics, không telemetry.",
|
||||
"about.legal.desc": "Tất cả chính sách là file MD trong repo — ngắn gọn, dễ hiểu, hơi hài hước, điều khoản chính thức đầy đủ. Cập nhật 2026-05-05.",
|
||||
"about.legal.desc": "Tất cả chính sách là file MD trong repo — ngắn gọn, dễ hiểu, hơi hài hước, điều khoản chính thức đầy đủ. Cập nhật 2026-06-14.",
|
||||
"about.legal.title": "Pháp lý & chính sách",
|
||||
"about.legal.viNote": "— bản dịch tiếng Việt của các chính sách trên (để cộng đồng dễ đọc; bản tiếng Anh vẫn là bản có hiệu lực khi diễn giải pháp lý).",
|
||||
"about.social.desc": "DM mở trên hầu hết các kênh. Trả lời chậm (hướng nội cấp tối đa). Chọn kênh nào tiện cho bạn.",
|
||||
@@ -343,6 +343,13 @@ export const vi: Record<MessageKey, string> = {
|
||||
"gpg.webappPassphrase": "Passphrase webapp",
|
||||
"gpg.webappPassphraseDesc": "Dùng để mã hoá AES-GCM khoá (đã giải mã sẵn) trong localStorage.",
|
||||
"gpg.webappPassphrasePlaceholder": "Cùng passphrase với PAT của bạn — tối thiểu 8 ký tự",
|
||||
"legal.gate.accept": "Chấp nhận & tiếp tục",
|
||||
"legal.gate.checkboxLabel": "Tôi đã đọc và chấp nhận toàn bộ điều khoản và chính sách liệt kê ở trên.",
|
||||
"legal.gate.decline": "Từ chối",
|
||||
"legal.gate.declinedMsg": "Bạn phải chấp nhận các điều khoản để dùng ứng dụng. Ứng dụng vẫn bị khoá cho đến khi bạn chấp nhận.",
|
||||
"legal.gate.intro": "Khi sử dụng ứng dụng này, bạn chấp nhận và đồng ý tuân thủ các điều khoản pháp lý dưới đây. Vui lòng đọc qua trước khi tiếp tục.",
|
||||
"legal.gate.title": "Trước khi tiếp tục",
|
||||
"legal.gate.viLink": "Bản dịch tiếng Việt của các chính sách ở trên",
|
||||
"settings.appearance.collapseSidebar": "Thu gọn thanh bên",
|
||||
"settings.appearance.collapseSidebarDesc": "Tương ứng với nút bật/tắt ở cuối thanh bên.",
|
||||
"settings.appearance.density": "Mật độ",
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
import { lazy, Suspense } from 'react'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import {
|
||||
AvgSessionChart,
|
||||
DeletionReasonsChart,
|
||||
DeletionsOverTimeChart,
|
||||
GameCountChart,
|
||||
GenreChart,
|
||||
GenreTreemapChart,
|
||||
KpiCards,
|
||||
LanguagesChart,
|
||||
MadeWithChart,
|
||||
OnlineOfflineChart,
|
||||
PlatformChart,
|
||||
RatingChart,
|
||||
RecentDeletedChart,
|
||||
StatusChart,
|
||||
TopRatedCountChart,
|
||||
TopTagsChart,
|
||||
} from '@/components/charts'
|
||||
import { RouteError } from '@/components/route-error'
|
||||
import { useAllGames, useCountHistory, useDeletedGames } from '@/hooks/useGames'
|
||||
import { useDocumentTitle } from '@/hooks/useDocumentTitle'
|
||||
import { useT } from '@/lib/i18n'
|
||||
|
||||
// Per-tab lazy chunks: Recharts + each tab's charts download only when the tab
|
||||
// is first activated (Radix unmounts inactive TabsContent, so the import is not
|
||||
// triggered until then).
|
||||
const OverviewTab = lazy(() => import('@/components/charts/tabs/overview-tab'))
|
||||
const ReachTab = lazy(() => import('@/components/charts/tabs/reach-tab'))
|
||||
const QualityTab = lazy(() => import('@/components/charts/tabs/quality-tab'))
|
||||
const DiscoveryTab = lazy(() => import('@/components/charts/tabs/discovery-tab'))
|
||||
|
||||
function ChartGridSkeleton({ count = 4 }: { count?: number }) {
|
||||
return (
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{Array.from({ length: count }).map((_, i) => (
|
||||
<Skeleton key={i} className="h-72" />
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function Charts() {
|
||||
const t = useT()
|
||||
useDocumentTitle(t('titles.charts'))
|
||||
@@ -34,11 +35,7 @@ export default function Charts() {
|
||||
return (
|
||||
<div className="container mx-auto p-6 space-y-4">
|
||||
<h1 className="text-3xl font-bold tracking-tight">{t('titles.charts')}</h1>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{Array.from({ length: 6 }).map((_, i) => (
|
||||
<Skeleton key={i} className="h-72" />
|
||||
))}
|
||||
</div>
|
||||
<ChartGridSkeleton count={6} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -64,39 +61,27 @@ export default function Charts() {
|
||||
</TabsList>
|
||||
|
||||
<TabsContent value="overview" className="space-y-4">
|
||||
<KpiCards games={data} deleted={deletedList} />
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<GenreChart games={data} />
|
||||
<StatusChart games={data} />
|
||||
<OnlineOfflineChart games={data} />
|
||||
<MadeWithChart games={data} />
|
||||
<GameCountChart history={historyList} />
|
||||
</div>
|
||||
<Suspense fallback={<ChartGridSkeleton count={6} />}>
|
||||
<OverviewTab games={data} deleted={deletedList} history={historyList} />
|
||||
</Suspense>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="reach">
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<PlatformChart games={data} />
|
||||
<LanguagesChart games={data} />
|
||||
<AvgSessionChart games={data} />
|
||||
<RecentDeletedChart deleted={deletedList} />
|
||||
</div>
|
||||
<Suspense fallback={<ChartGridSkeleton count={4} />}>
|
||||
<ReachTab games={data} deleted={deletedList} />
|
||||
</Suspense>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="quality">
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<RatingChart games={data} />
|
||||
<TopRatedCountChart games={data} />
|
||||
<DeletionsOverTimeChart deleted={deletedList} />
|
||||
<DeletionReasonsChart deleted={deletedList} />
|
||||
</div>
|
||||
<Suspense fallback={<ChartGridSkeleton count={4} />}>
|
||||
<QualityTab games={data} deleted={deletedList} />
|
||||
</Suspense>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="discovery">
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<TopTagsChart games={data} />
|
||||
<GenreTreemapChart games={data} />
|
||||
</div>
|
||||
<Suspense fallback={<ChartGridSkeleton count={2} />}>
|
||||
<DiscoveryTab games={data} />
|
||||
</Suspense>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,13 @@ export const IDLE_TIMEOUT_OPTIONS = [5, 15, 30, 60, 120] as const
|
||||
|
||||
export const NOTIFICATION_DURATION_OPTIONS = [2_000, 4_000, 6_000, 10_000] as const
|
||||
|
||||
/**
|
||||
* Version stamp for the legal-acceptance gate. Bump this (e.g. after editing a
|
||||
* policy in docs/) to re-prompt every user once. Kept in sync with the
|
||||
* "Updated …" date in `about.legal.desc`. Stored value !== this → gate shows.
|
||||
*/
|
||||
export const LEGAL_VERSION = '2026-06-14'
|
||||
|
||||
interface PrefsStore {
|
||||
sidebarCollapsed: boolean
|
||||
density: Density
|
||||
@@ -17,6 +24,7 @@ interface PrefsStore {
|
||||
idleTimeoutMs: number
|
||||
authorName: string
|
||||
authorEmail: string
|
||||
acceptedLegalVersion: string | null
|
||||
toggleSidebar: () => void
|
||||
setSidebarCollapsed: (v: boolean) => void
|
||||
setDensity: (d: Density) => void
|
||||
@@ -26,6 +34,7 @@ interface PrefsStore {
|
||||
setIdleTimeoutMs: (v: number) => void
|
||||
setAuthorName: (v: string) => void
|
||||
setAuthorEmail: (v: string) => void
|
||||
acceptLegal: () => void
|
||||
}
|
||||
|
||||
const DEFAULT_IDLE_MS = 30 * 60 * 1000
|
||||
@@ -41,6 +50,7 @@ export const usePrefs = create<PrefsStore>()(
|
||||
idleTimeoutMs: DEFAULT_IDLE_MS,
|
||||
authorName: '',
|
||||
authorEmail: '',
|
||||
acceptedLegalVersion: null,
|
||||
toggleSidebar: () => set((s) => ({ sidebarCollapsed: !s.sidebarCollapsed })),
|
||||
setSidebarCollapsed: (v) => set({ sidebarCollapsed: v }),
|
||||
setDensity: (d) => set({ density: d }),
|
||||
@@ -50,6 +60,7 @@ export const usePrefs = create<PrefsStore>()(
|
||||
setIdleTimeoutMs: (v) => set({ idleTimeoutMs: v }),
|
||||
setAuthorName: (v) => set({ authorName: v }),
|
||||
setAuthorEmail: (v) => set({ authorEmail: v }),
|
||||
acceptLegal: () => set({ acceptedLegalVersion: LEGAL_VERSION }),
|
||||
}),
|
||||
{ name: 'webapp.prefs' },
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user