Fix DB seed, console error, dark mode, mobile navigation#96
Conversation
abereanone
commented
May 21, 2026
- Added npm run seed to populate the data easier in the local db.
- console error fixed on header
- added dark mode
- mobile navigation was not auto-closing the menu after click.
Renamed add-rejection-reason-to-submissions to run after the user_submissions table is created. Made performance index migration safe when the codex schema does not exist locally. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reads exicon.csv and lexicon.csv, extracts tags from entry text, and inserts into the entries and entry_tags tables. Added as npm run seed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Made Header a client component with controlled Sheet state so clicking a nav link closes the drawer. Added a visually hidden SheetTitle to satisfy the Radix Dialog accessibility requirement. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds light/dark/system theme switching via next-themes, persisted to localStorage. Toggle button appears in both desktop nav and mobile header. Also centers the footer text and removes a stray space in the tagline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
👷 Deploy request for f3-the-codex-demo pending review.Visit the deploys page to approve it
|
|
@victorSauceda - not sure if you saw this but if you or someone can review that would be great. This is my first PR so if there is some other way I should tag things, let me know. Floppy Disk (The Union) |
|
@abereanone First PR ever in your life? Or you're an actual coder who knows what you're doing and this is your first PR on this repo? |
|
I have been a coder for over 30 years and 28 professionally. But I've never worked anywhere where I've used git, so doing a PR in git is new to me. |
|
Do I need to run npm run format? |
There was a problem hiding this comment.
Pull request overview
This PR improves local developer workflow and UI behavior by adding a CSV-based DB seed script, introducing dark mode support via next-themes, fixing a header console/hydration issue, and ensuring the mobile navigation sheet closes after selecting a link.
Changes:
- Add
npm run seed(scripts/import-csv.ts) to importexicon.csv/lexicon.csvinto Postgres. - Add dark mode support using
next-themesand a theme toggle in the header (desktop + mobile). - Fix mobile navigation behavior by controlling the Sheet open state and closing on link click.
Reviewed changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/layout/Header.tsx | Adds theme toggle, controls mobile Sheet state, and closes menu on nav click. |
| src/components/layout/Footer.tsx | Minor layout class tweak and punctuation fix. |
| src/app/layout.tsx | Wraps app content with next-themes ThemeProvider for dark mode support. |
| scripts/import-csv.ts | New seed/import script to populate entries and entry-tag relationships from CSV files. |
| package.json | Adds seed script and next-themes dependency. |
| package-lock.json | Locks next-themes dependency. |
| migrations/1762262413053_add-performance-indexes.cjs | Guards index creation by schema/table existence. |
| migrations/1747064560000_add-rejection-reason-to-submissions.cjs | Adds rejection_reason and admin_notes columns to user_submissions. |
| .gitignore | Adds launchClaude.bat to ignored files. |
Comments suppressed due to low confidence (3)
src/components/layout/Header.tsx:59
- Same hydration-risk pattern as the desktop toggle:
resolvedThememay beundefinedon initial render, potentially causing hydration mismatch when the icon changes immediately after mount. Consider a sharedThemeToggleButtoncomponent that handles the mounted check once and reuse it here.
<Button
variant="ghost"
size="icon"
onClick={() => setTheme(resolvedTheme === "dark" ? "light" : "dark")}
aria-label="Toggle theme"
>
{resolvedTheme === "dark" ? <Sun className="h-5 w-5" /> : <Moon className="h-5 w-5" />}
</Button>
scripts/import-csv.ts:146
- The Exicon CSV's
Tagscolumn appears to be pipe-delimited and can contain multi-word tags (e.g.warmup|Full Body). Splitting with/[,\s]+/will break multi-word tags and won't split on|, so most tag lookups will fail and entries will be seeded without tags. Consider splitting on|(and optionally,) while preserving multi-word tags, and normalizing values (e.g.warmup->Warm-Up) before looking up IDs.
const csvTags = tagsCol
? tagsCol.split(/[,\s]+/).filter((t) => t.length > 0)
: [];
const allTagNames = [...new Set([...endTags, ...csvTags])];
scripts/import-csv.ts:166
inserted++is incremented even when theINSERT ... ON CONFLICT DO NOTHINGdoes not actually insert (e.g., duplicate titles like "Absolution" inexicon.csv). This makes the finalinserted/failedlog misleading. Consider using... DO NOTHING RETURNING idand incrementing only whenrowCount > 0(or trackskippedseparately).
try {
await client.query(
`INSERT INTO entries (id, title, definition, type, aliases)
VALUES ($1, $2, $3, 'exicon', '[]')
ON CONFLICT (id) DO NOTHING`,
[id, title.trim(), definition],
);
for (const tagName of allTagNames) {
const tagId = tagMap.get(tagName);
if (tagId) {
await client.query(
`INSERT INTO entry_tags (entry_id, tag_id) VALUES ($1, $2) ON CONFLICT DO NOTHING`,
[id, tagId],
);
}
}
inserted++;
} catch (err) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi, I got notification of the build error and fixed it. I ran it locally and tested, and then I ran a build locally and no more lint error. |