Skip to content

Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.

fix(ui): use declared variants and design tokens in overlay components

spacesdrive3fd374437805
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e6dc4a..e980c15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -62,6 +62,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
+- Media chips and scrims over photos used a hex colour and `text-white`; they now use the `media-scrim` and `on-media` design tokens. The Overview metric tabs use a declared `none` variant of `TabsList`, and the mobile sidebar keeps the class and HTML attributes passed to `Sidebar` instead of dropping them
- YouTube analytics counted hidden like and comment counts as zero, which pulled averages and engagement rates down; averages and rates now use only the videos that report each count, and hidden counts sort last (see `docs/architecture/data-flows/ANALYTICS.md`). A channel with no videos now returns the same fields and formats as a full result, a Reddit profile without karma totals reports 0 instead of NaN, and date checks use `getTime()`
- Saving the scheduling repository in Settings erased the stored GitHub token and then reported `configured: false` and `patSet: false`. The unused token is no longer stored or reported: `GET /api/settings/github` returns only `repoOwner`, `repoName` and `branch`
- Refreshing or loading an account without the field its platform needs (a YouTube channel id or uploads playlist, a Reddit username) called the platform with `undefined`; it now answers with a message that says to re-add the account. Channel analytics also refuse accounts on other platforms, and the analytics response no longer carries `bannerUrl` and `isLinked`, which are not account fields
diff --git a/docs/architecture/frontend/DESIGN_SYSTEM.md b/docs/architecture/frontend/DESIGN_SYSTEM.md
index b8bb471..e8bfd7a 100644
--- a/docs/architecture/frontend/DESIGN_SYSTEM.md
+++ b/docs/architecture/frontend/DESIGN_SYSTEM.md
@@ -11,6 +11,7 @@ All tokens live in `frontend/src/index.css`: raw values on `:root` and `.dark`,
| Surfaces | `bg-surface`, `bg-surface-raised`, `bg-surface-sunken`, `bg-surface-hover`, `bg-surface-selected`, `bg-surface-wash` | Page, cards, wells, hover, selected rows, choice cards |
| Lines | `border-line`, `border-line-control`, `border-line-strong`, `border-divider` | Hairlines, control borders, text input borders (3:1), dividers inside boxes |
| Text | `text-ink`, `text-ink-muted`, `text-ink-faint`, `text-ink-inverse` | All pass WCAG AA on every surface in both themes |
+| Media overlays | `bg-media-scrim` (with an opacity such as `/75`), `from-media-scrim/80`, `text-on-media` | Chips, scrims and buttons drawn over photos and video; the same in both themes, because the image behind them does not change with the theme |
| Brand | `bg-brand`, `hover:bg-brand-hover`, `bg-brand-soft`, `text-brand-text`, `text-on-brand` | Red as text is always `text-brand-text` |
| Status | `success`, `warning`, `danger`, `info`, each with `-soft` | Errors share the brand red, so they always carry an icon and the word "Error" |
| Charts | `var(--chart-1)` to `var(--chart-5)` via `lib/chart.ts` `SERIES` | Brand series order; platforms map to series in `lib/accounts.ts` |
@@ -19,6 +20,8 @@ All tokens live in `frontend/src/index.css`: raw values on `:root` and `.dark`,
| Sizes | `h-(--control-h-sm)` 32, `h-(--control-h)` 36, `h-(--control-h-lg)` 40, `--nav-row-h` 32, `--topbar-h` 50, `--sidebar-w` 256 | |
| Motion | `duration-(--duration-fast)` 75ms, `--duration-base` 150ms, `--duration-overlay` 200ms, `animate-fold-in` 220ms | `prefers-reduced-motion` collapses all motion |
+`TabsList` has three variants: `default` (underline tabs), `segmented` (a pill control) and `none` (no list styling, for layouts such as the Overview metric tiles that style each trigger themselves).
+
Light is the `:root` default; `.dark` (set by `next-themes`, `attribute="class"`) redefines the same tokens. Users choose Light, Dark or System in Settings, the sidebar user menu, the top bar, or the command palette.
## Components
diff --git a/frontend/src/components/MediaCard.tsx b/frontend/src/components/MediaCard.tsx
index 2f3d1e0..c570e3c 100644
--- a/frontend/src/components/MediaCard.tsx
+++ b/frontend/src/components/MediaCard.tsx
@@ -14,7 +14,7 @@ export interface MediaChipProps {
export function MediaChip({ children, className }: MediaChipProps) {
return (
- <span className={cn('inline-flex items-center gap-1 rounded-pill bg-[#0C0809]/75 px-2 py-0.5 text-[0.6875rem] font-semibold text-white backdrop-blur-sm [&_svg]:size-3', className)}>
+ <span className={cn('inline-flex items-center gap-1 rounded-pill bg-media-scrim/75 px-2 py-0.5 text-[0.6875rem] font-semibold text-on-media backdrop-blur-sm [&_svg]:size-3', className)}>
{children}
</span>
);
diff --git a/frontend/src/components/ui/sidebar.tsx b/frontend/src/components/ui/sidebar.tsx
index 78cb4cc..c1b04ef 100644
--- a/frontend/src/components/ui/sidebar.tsx
+++ b/frontend/src/components/ui/sidebar.tsx
@@ -173,13 +173,13 @@ function Sidebar({
if (isMobile) {
return (
- <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
+ <Sheet open={openMobile} onOpenChange={setOpenMobile}>
<SheetContent
dir={dir}
data-sidebar="sidebar"
data-slot="sidebar"
data-mobile="true"
- className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
+ className={cn("w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", className)}
style={
{
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
@@ -190,7 +190,7 @@ function Sidebar({
<SheetTitle>Sidebar</SheetTitle>
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
</SheetHeader>
- <div className="flex h-full w-full flex-col">{children}</div>
+ <div className="flex h-full w-full flex-col" {...props}>{children}</div>
</SheetContent>
</Sheet>
);
diff --git a/frontend/src/components/ui/tabs.tsx b/frontend/src/components/ui/tabs.tsx
index 4e067c7..dd80ac6 100644
--- a/frontend/src/components/ui/tabs.tsx
+++ b/frontend/src/components/ui/tabs.tsx
@@ -26,6 +26,7 @@ const tabsListVariants = cva(
variant: {
default: "h-[2.625rem] gap-4 border-b border-line bg-transparent",
segmented: "h-(--control-h) gap-0.5 rounded-control bg-surface-sunken p-1",
+ none: "",
},
},
defaultVariants: {
diff --git a/frontend/src/features/analytics/instagram/InstagramRecentGrid.tsx b/frontend/src/features/analytics/instagram/InstagramRecentGrid.tsx
index 3050c1b..a16a3a6 100644
--- a/frontend/src/features/analytics/instagram/InstagramRecentGrid.tsx
+++ b/frontend/src/features/analytics/instagram/InstagramRecentGrid.tsx
@@ -29,7 +29,7 @@ function RecentPost({ post }: RecentPostProps) {
{post.contentType !== 'post' && (
<span className="absolute top-1 right-1"><MediaChip className="px-1.5 text-[0.625rem]">{igContentTypeMeta(post.contentType).label}</MediaChip></span>
)}
- <span className="absolute inset-x-0 bottom-0 flex justify-center gap-2 bg-gradient-to-t from-[#0C0809]/80 to-transparent pt-4 pb-1 text-[0.625rem] font-semibold text-white opacity-0 transition-opacity duration-(--duration-base) group-hover:opacity-100 group-focus-visible:opacity-100 [&_svg]:size-2.5">
+ <span className="absolute inset-x-0 bottom-0 flex justify-center gap-2 bg-gradient-to-t from-media-scrim/80 to-transparent pt-4 pb-1 text-[0.625rem] font-semibold text-on-media opacity-0 transition-opacity duration-(--duration-base) group-hover:opacity-100 group-focus-visible:opacity-100 [&_svg]:size-2.5">
<span className="flex items-center gap-0.5"><Eye />{fmtIGViews(post.viewCount)}</span>
<span className="flex items-center gap-0.5"><Heart />{fmtNum(post.likeCount)}</span>
<span className="flex items-center gap-0.5"><MessageCircle />{fmtNum(post.commentsCount)}</span>
diff --git a/frontend/src/features/analytics/overview/MetricTabsList.tsx b/frontend/src/features/analytics/overview/MetricTabsList.tsx
index 5a4acc7..90a4930 100644
--- a/frontend/src/features/analytics/overview/MetricTabsList.tsx
+++ b/frontend/src/features/analytics/overview/MetricTabsList.tsx
@@ -1,4 +1,3 @@
-import type { ComponentProps } from 'react';
import { TabsList, TabsTrigger } from '@/components/ui/tabs';
import type { MetricTab } from './overviewLabels.ts';
@@ -9,8 +8,7 @@ export interface MetricTabsListProps {
export default function MetricTabsList({ tabs }: MetricTabsListProps) {
return (
<TabsList
- // "none" is not a declared variant; cva ignores it, so the list gets no variant classes
- variant={'none' as ComponentProps<typeof TabsList>['variant']}
+ variant="none"
aria-label="Overview metrics"
className="grid w-full grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-6"
>
diff --git a/frontend/src/features/publishing/BulkFileItem.tsx b/frontend/src/features/publishing/BulkFileItem.tsx
index 5224ecb..549ad00 100644
--- a/frontend/src/features/publishing/BulkFileItem.tsx
+++ b/frontend/src/features/publishing/BulkFileItem.tsx
@@ -25,7 +25,7 @@ export default function BulkFileItem({ item, position, processing, onCaptionChan
{isVideoFile(item.file)
? <video src={item.preview} muted className="size-full object-cover" />
: <img src={item.preview} alt="" className="size-full object-cover" />}
- <span className="absolute top-0.5 left-0.5 rounded-sm bg-[#0C0809]/75 px-1 font-mono text-[0.5625rem] font-semibold text-white">{position}</span>
+ <span className="absolute top-0.5 left-0.5 rounded-sm bg-media-scrim/75 px-1 font-mono text-[0.5625rem] font-semibold text-on-media">{position}</span>
</div>
<div className="min-w-0 flex-1">
<div className="mb-1 flex items-center gap-2">
diff --git a/frontend/src/features/publishing/MediaPicker.tsx b/frontend/src/features/publishing/MediaPicker.tsx
index b3b1cc1..f0328f6 100644
--- a/frontend/src/features/publishing/MediaPicker.tsx
+++ b/frontend/src/features/publishing/MediaPicker.tsx
@@ -24,7 +24,7 @@ function MediaPreview({ file, filePreview, selectedType, onClear }: MediaPreview
<div className="flex flex-col gap-4 sm:flex-row sm:items-start">
<div className="relative w-full shrink-0 overflow-hidden rounded-control bg-surface-sunken sm:w-52">
{isVideoFile(file) ? (
- <video src={filePreview} controls muted className="max-h-72 w-full bg-black object-contain" />
+ <video src={filePreview} controls muted className="max-h-72 w-full bg-media-scrim object-contain" />
) : (
<img src={filePreview} alt="Selected media preview" className="max-h-72 w-full object-contain" />
)}
@@ -32,7 +32,7 @@ function MediaPreview({ file, filePreview, selectedType, onClear }: MediaPreview
type="button"
onClick={onClear}
aria-label="Remove file"
- className="absolute top-2 right-2 flex size-7 items-center justify-center rounded-full bg-[#0C0809]/75 text-white transition-colors hover:bg-brand"
+ className="absolute top-2 right-2 flex size-7 items-center justify-center rounded-full bg-media-scrim/75 text-on-media transition-colors hover:bg-brand"
>
<X className="size-3.5" />
</button>
diff --git a/frontend/src/index.css b/frontend/src/index.css
index c519b07..5e7bd2d 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -44,6 +44,10 @@
--ink-faint: #6A6565;
--ink-inverse: #FFFFFF;
+ /* Chips and scrims drawn over photos and video stay dark in both themes */
+ --media-scrim: #0C0809;
+ --on-media: #FFFFFF;
+
/* Brand accent */
--brand: #C11F2F;
--brand-hover: #9A1423;
@@ -247,6 +251,8 @@
--color-ink-muted: var(--ink-muted);
--color-ink-faint: var(--ink-faint);
--color-ink-inverse: var(--ink-inverse);
+ --color-media-scrim: var(--media-scrim);
+ --color-on-media: var(--on-media);
--color-brand: var(--brand);
--color-brand-hover: var(--brand-hover);
--color-brand-soft: var(--brand-soft);