mirror of
https://github.com/tiennm99/thptqg.git
synced 2026-10-16 00:15:34 +00:00
refactor(web): rebuild the frontend on SvelteKit, TypeScript and Tailwind
The app was a single-entry React SPA: one index.html that the assembler copied to every dataset path, with a hand-rolled router resolving the dataset from window.location and the title patched in at runtime because one file had to serve every route. SvelteKit prerenders a real page per route instead. The entry generator in routes/[dataset]/+page.ts reads the same datasets.json the assembler does, so the set of pages and the set of databases cannot drift apart, and each dataset page ships its own <title> and description. Everything framework-free moved across unchanged in behaviour and became typed: the admission blocks, subject list, query classifier and SQL presets. `Student` now mirrors the 22-column table, so a mistyped column name fails the build rather than rendering blank. Tailwind replaces the stylesheet. Theme tokens are CSS variables, which keeps dark mode a single block of overrides rather than a `dark:` variant on every class. The score tiers stay hand-written CSS: the class is chosen at runtime from a score, and no utility generator can see that. Adds the tests the frontend never had, over the three modules where a silent wrong answer is possible — most importantly that toAscii here folds exactly as ToAscii does in the parser, which is what makes accent-insensitive search find anything. The assembler stops copying index.html per dataset and checks that the build prerendered each one instead. The database presence, raw-artifact and idempotence guards are untouched. Verified: 25 tests, ESLint and svelte-check clean, and a full `assemble site` producing /thptqg/, /thptqg/2016/, /thptqg/2017/ and 404.html with absolute asset URLs. Not verified in a browser — this machine has none.
This commit is contained in:
1 parent
e2112fdb38
commit
3fd137a233
49 files changed
+4432
-3112
No files matched your search
+1
-1
@@ -41,7 +41,7 @@ reader independently verifiable against a hash oracle.
|
||||
|
||||
- `ToAscii` strips combining marks in the literal range U+0300–U+036F rather
|
||||
than by Unicode category. That covers every Vietnamese diacritic and must
|
||||
stay identical to `toAscii` in `web/src/App.jsx`, or accent-insensitive
|
||||
stay identical to `toAscii` in `web/src/lib/to-ascii.ts`, or accent-insensitive
|
||||
search misses rows.
|
||||
- Gender is normalised to `Nam`/`Nữ`; the Cần Thơ files write `0`/`1` instead
|
||||
and are translated. Anything else becomes NULL.
|
||||
|
||||
Reference in new issue
Block a user