Skip to content

refactor(frontend): replace the isRepoCard boolean with a card category - #464

Merged
martin-mfg merged 2 commits into
stats-organization:light-dark-themesfrom
marcalexiei:card-category
Aug 9, 2026
Merged

refactor(frontend): replace the isRepoCard boolean with a card category#464
martin-mfg merged 2 commits into
stats-organization:light-dark-themesfrom
marcalexiei:card-category

Conversation

@marcalexiei

@marcalexiei marcalexiei commented Aug 9, 2026

Copy link
Copy Markdown

Two places independently hardcoded the same "is this a repo or gist card?" check:

  • Home.tsx: which theme variant to default to
  • Customize.tsx: whether to offer "Show Owner?"

Both now derive it from one map in models/CardType.ts:

export const CardCategory = { REPO: "repo", USER: "user" } as const;

export const CATEGORY_BY_CARD_TYPE: Record<CardType, CardCategory> = { ... };

A new card type won't compile until it's categorised, instead of silently falling into the non-repo branch like the boolean did.
It also leaves room for another category, if we ever need one that changes the data a card requires.

Also:

  • ThemeStage takes category instead of isRepoCard.
  • getDefaultTheme / onThemeChange use core's ThemeName instead of string.

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@marcalexiei is attempting to deploy a commit to the martin-mfg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@martin-mfg
martin-mfg merged commit c7b6e66 into stats-organization:light-dark-themes Aug 9, 2026
0 of 2 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.

2 participants