Skip to content

Fix DB seed, console error, dark mode, mobile navigation#96

Merged
taterhead247 merged 7 commits into
F3-Nation:mainfrom
abereanone:main
May 23, 2026
Merged

Fix DB seed, console error, dark mode, mobile navigation#96
taterhead247 merged 7 commits into
F3-Nation:mainfrom
abereanone:main

Conversation

@abereanone

Copy link
Copy Markdown
Collaborator
  1. Added npm run seed to populate the data easier in the local db.
  2. console error fixed on header
  3. added dark mode
  4. mobile navigation was not auto-closing the menu after click.

abereanone and others added 4 commits May 21, 2026 08:05
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>
@netlify

netlify Bot commented May 21, 2026

Copy link
Copy Markdown

👷 Deploy request for f3-the-codex-demo pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 220959d

@abereanone

Copy link
Copy Markdown
Collaborator Author

@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)

@taterhead247

Copy link
Copy Markdown

@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?

@abereanone

Copy link
Copy Markdown
Collaborator Author

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.

@abereanone

Copy link
Copy Markdown
Collaborator Author

Do I need to run npm run format?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 import exicon.csv/lexicon.csv into Postgres.
  • Add dark mode support using next-themes and 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: resolvedTheme may be undefined on initial render, potentially causing hydration mismatch when the icon changes immediately after mount. Consider a shared ThemeToggleButton component 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 Tags column 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 the INSERT ... ON CONFLICT DO NOTHING does not actually insert (e.g., duplicate titles like "Absolution" in exicon.csv). This makes the final inserted/failed log misleading. Consider using ... DO NOTHING RETURNING id and incrementing only when rowCount > 0 (or track skipped separately).
      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.

Comment thread src/components/layout/Header.tsx
Comment thread scripts/import-csv.ts
Comment thread migrations/1762262413053_add-performance-indexes.cjs
@abereanone

Copy link
Copy Markdown
Collaborator Author

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.

@taterhead247 taterhead247 merged commit ca3920f into F3-Nation:main May 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants