Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
docs: record the Intent UI charts, the rolling metric values and the new chart rule
spacesdrive30d713f2627f
diff --git a/docs/architecture/data-flows/ANALYTICS.md b/docs/architecture/data-flows/ANALYTICS.mdindex a7ca68f..30f2325 100644--- a/docs/architecture/data-flows/ANALYTICS.md+++ b/docs/architecture/data-flows/ANALYTICS.md@@ -321,11 +321,13 @@ These rules come from the UI/UX guide (issue #132) and apply to every analyticsthe exact value on hover and for screen readers; `fmtNum` drops a trailing `.0` and moves to the next unit whenrounding would show 1000 of the smaller one. Pages lead with four to six headline tiles; supporting figures go inone `MetricDetails` list, each derived score explained in a line, and no figure repeats across tabs.-- **Charts.** Every chart has a one-sentence summary of what it shows and a Show table toggle with the same- numbers (`ChartFigure`, used by `ChartPanel`, `MetricAreaChart` and `RankingBarChart`). Rankings of separate- things (accounts, categories, videos, tags) are horizontal bars, not lines. One chart has one unit; a second- measure goes in the tooltip and table. Platform hues (`PLATFORM_META.series`) mean the platform on every page;- Instagram content types and categories use other series.+- **Charts.** The charts keep the types, series, titles and layout they had before #132 and are drawn with Intent+ UI's area and bar charts (ADR-048), with `DonutChart` for parts of a whole. Each chart is a figure with a+ screen-reader name and a hidden description computed from its data (`trendSummary`, `rankingSummary`,+ `monthlySummary`); there is no visible summary line or table. Tooltips show exact values (`ExactTooltip`) and the+ axis shows rounded ones. A legend appears where a chart has more than one series. Platform hues+ (`PLATFORM_META.series`) mean the platform on every page; Instagram content types and categories use other+ series. The big value of a metric tile rolls to its new value (`RollingNumber`) and keeps its exact value.- **Libraries.** Search (debounced), filters, sort, layout and page live in the address (`useLibraryParams`), soBack, refresh and shared links keep the view. Every library uses the same controls: `SearchField`, an accountselect, `FilterChips` for ranges and types, `SortSelect` (also in grid layout), `ActiveFilters` with the resultdiff --git a/docs/architecture/frontend/DESIGN_SYSTEM.md b/docs/architecture/frontend/DESIGN_SYSTEM.mdindex b13c21e..e0e4519 100644--- a/docs/architecture/frontend/DESIGN_SYSTEM.md+++ b/docs/architecture/frontend/DESIGN_SYSTEM.md@@ -32,7 +32,7 @@ Shared components live in `frontend/src/components/`. Reach for these before wri|---|---|| `PageHeader` | The one title block per page: optional back link, eyebrow, avatar media, description and actions || `SurfaceBox` | Any grouped content. Optional title row with `subheader` and `secondary` actions. The title is an `h2` (pass `headingLevel="h3"` inside a section), and a `Table` inside takes its accessible name from it |-| `MetricBox` | A single metric: icon, label, tabular value, one line of context. `highlight` marks the page's lead metric, `period` states the time frame, and `upIsGood` colours a trend by whether it is good (read aloud as "Up 12%"). Icons come from `lib/metricIcons.ts`, one meaning each |+| `MetricBox` | A single metric: icon, label, tabular value, one line of context. `highlight` marks the page's lead metric, `period` states the time frame, and `upIsGood` colours a trend by whether it is good (read aloud as "Up 12%"). A number, a formatted string or a `Num` as the value rolls with `RollingNumber` when it changes. Icons come from `lib/metricIcons.ts`, one meaning each || `MetricDetails` | The secondary figures of a page as a compact list, so the tile row keeps a few headline numbers || `SectionHeader` | A heading between groups of boxes || `ListRow`, `RankNumber` | Dense clickable rows and mono rank numbers |@@ -44,9 +44,14 @@ Shared components live in `frontend/src/components/`. Reach for these before wri| `FailedSourcesAlert` | Names the accounts that did not load, with Retry, above the results that did || `Pager` | Previous and next with a count || `MediaCard`, `MediaChip` | Thumbnail cards for videos, Shorts and Instagram media |-| `ChartPanel`, `ChartFigure` | A titled Recharts container with an empty state, a one-line summary and a Show table toggle; the plot is named for screen readers |-| `RankingBarChart` | Horizontal bars for rankings (accounts, categories, tracked items), never a line |-| `MetricAreaChart` | A single-series area chart |+| `ChartPanel` | The titled card around a chart, with an empty state and an optional `description`: the chart's takeaway in words, read by screen readers in place of the plot (`trendSummary`, `rankingSummary` and `pointsOf` in `lib/chart.ts` write it from the data) |+| `ChartFigure` | The figure inside `ChartPanel`, `MetricAreaChart` and `AudienceChart`: the chart's screen-reader name and its hidden description |+| `AreaChart`, `BarChart`, `LineChart` (`components/ui`) | Intent UI's Recharts charts (ADR-048): pass `data`, the category `dataKey`, a `config` of series with labels and `SERIES` or `PLATFORM_META` colours, `containerHeight`, `valueFormatter={fmtNum}` for the axis, and `legend={false}` for a single series; the legend highlights one series when pressed |+| `ExactTooltip` | Intent's tooltip with every value in full (`tooltip={<ExactTooltip />}`); `format` for rates, `labelOf` when one series mixes kinds |+| `DonutChart` | Parts of a whole as a ring inside Intent's chart frame, with the exact tooltip and a legend |+| `MetricAreaChart` | A single-series Intent area chart with its own screen-reader name and description |+| `StackedBars` | A card of counts per day or week broken into parts, with a view switch; not used yet, since no page receives counts per period split into parts |+| `RollingNumber` | A formatted number whose digits roll like an odometer when it changes; screen readers get the text. Used through `MetricBox` and the Overview metric tabs (`RollingValueContext` makes a `Num` inside a tile roll) || `ChoiceCard` | Large selectable cards in creation flows || `DetailPanel`, `FieldRow` | The settings side panel of a working surface, and label plus hint plus control plus error rows. `FieldRow` wires `hint` and `error` to its control (`aria-describedby`, `aria-invalid`), marks `optional` fields, and renders a `fieldset` with `group`. A control that is not its direct child takes the ids from `fieldHintId` and `fieldErrorId` in `lib/fieldIds.ts` || `ConfirmDialog` | Confirmation for removing an account and deleting everything. Pass `hold`: the button confirms by holding it or by pressing it twice, and Escape disarms it. `busyLabel` names the action in progress ("Removing") |@@ -86,7 +91,7 @@ The interface follows the UI/UX Design Intelligence system: the Laws of UX, WCAG- One primary (default) button per view. An empty state's action replaces the header action, it does not repeat it.- Every data view designs loading, empty, error, partial failure and stale states, and says how old cached data is. Refreshing keeps the data on screen with a progress bar; skeletons are only for the first load.- Metric tiles say what period they cover, show the exact value behind a rounded one, and colour a change by whether it is good, with the direction in words for screen readers.-- Charts have a one-line summary and a table of the same data; a chart never mixes two units on one axis; rankings are horizontal bars; platform colours mean platforms only.+- Charts are built from Intent UI's components in `components/ui` (ADR-048); each has a screen-reader name and description, tooltips show exact values, and platform colours mean platforms only.- Field errors appear under the field and keep the input; buttons stay enabled and explain what is missing when pressed; leaving a form with unsaved work asks first.- Help text and descriptions are short, in the user's words, and next to the thing they explain.- Dialogs become full-width bottom sheets below `sm`. Link-styled buttons are always underlined, and a link that opens a new tab says so to screen readers.diff --git a/docs/architecture/frontend/FEATURES.md b/docs/architecture/frontend/FEATURES.mdindex 3640975..9cfdc71 100644--- a/docs/architecture/frontend/FEATURES.md+++ b/docs/architecture/frontend/FEATURES.md@@ -6,8 +6,9 @@frontend/src/├── components/│ ├── SurfaceBox.tsx, MetricBox.tsx, PageHeader.tsx, ... <- Shared components, see DESIGN_SYSTEM.md-│ ├── MetricAreaChart.tsx <- Shared Recharts area chart for single-metric comparisons-│ ├── ChartPanel.tsx <- Titled chart container with an empty state+│ ├── MetricAreaChart.tsx <- Shared Intent UI area chart for single-metric comparisons+│ ├── ChartPanel.tsx, ChartFigure.tsx <- Titled chart container with an empty state; the chart's screen-reader name and description+│ ├── ExactTooltip.tsx, DonutChart.tsx <- Intent's tooltip with exact values; a ring for parts of a whole│ ├── ImageLightbox.tsx <- Thumbnail that opens the full image in a Dialog│ ├── AccountSelect.tsx <- Instagram account picker with avatars (Publish, Automations)│ ├── RowAction.tsx <- Icon button with a tooltip for table and list rows (Tracked content, Automations)@@ -136,21 +137,25 @@ the word "score".## Shared Chart Components-Every chart sits in a `ChartFigure`: the plot, a one-sentence summary under it, and a Show table toggle with the-same numbers. Use the shared components instead of hand-rolling a Recharts chart:+Charts are drawn with Intent UI's components in `components/ui` (`AreaChart`, `BarChart`, `LineChart`; ADR-048)+inside the shared pieces below. Each chart is a figure with a screen-reader name and a hidden description of its+data; nothing extra is shown on screen.| Component | Use it for ||---|---|-| `ChartPanel` | A titled box around any Recharts chart; pass `summary` and `table` (`{ caption, columns, rows }`). A string title also names the focusable plot |-| `MetricAreaChart` | One value over time (months, weeks); writes its own summary and table |-| `RankingBarChart` | Separate things ranked by one number (accounts, categories, videos, tags): horizontal bars, largest first, an optional `kind` per bar for mixed units |+| `ChartPanel` | A titled box around an Intent chart; pass the same `height` as the chart's `containerHeight` and a `description`. A string title names the figure |+| `MetricAreaChart` | One value across months, weeks or items; names itself and writes its own description unless given one |+| `DonutChart` | Parts of a whole as a ring, with the exact tooltip and a legend |+| `ExactTooltip` | The tooltip for every chart: `tooltip={<ExactTooltip />}` shows values in full |```tsx-<RankingBarChart rows={[{ name: 'Origami', value: 420 }]} label="Views" title="Views by category" color={CATEGORY_SERIES} />+<ChartPanel title="Uploads by month" height={240} description={trendSummary(pointsOf(rows, 'month', 'uploads'), fmtNumFull, 'uploads')}>+ <BarChart data={rows} dataKey="month" config={{ uploads: { label: 'Uploads', color: SERIES.neutral } }} containerHeight={240} legend={false} tooltip={<ExactTooltip />} />+</ChartPanel>```-`lib/chart.ts` has `trendSummary` and `rankingSummary` for the sentence. Each `MetricAreaChart` generates its own-gradient id via `useId()`, so multiple charts on one page never collide.+`lib/chart.ts` has `pointsOf`, `trendSummary` and `rankingSummary` for the description. Intent's charts take+`data` as plain records, so rows typed by an interface are spread first (`rows.map(row => ({ ...row }))`).## Shared Library Pieces@@ -232,7 +237,7 @@ Each page manages its own loading/data/error state. Pages do not write to `AppCo| Reddit Posts (global) | `/reddit-posts` | Combined post explorer across all Reddit accounts with account and subreddit filters || Reddit Posts (per account) | `/reddit-posts/:id` | Searchable and sortable post list for a single Reddit account || Tracked Content | `/tracked-content` | Monitor Reddit posts and YouTube videos; add by URL, assign categories, bulk edit, per-row refresh |-| Tracked Category | `/tracked-content/category/:name` | Detailed per-category analytics; YouTube section (views, likes, comments, bar chart, table) and Reddit section (score, ratio, comments, bar chart, table) rendered separately |+| Tracked Category | `/tracked-content/category/:name` | Detailed per-category analytics; YouTube section (views, likes, comments, area chart, table) and Reddit section (karma, ratio, comments, area chart, table) rendered separately || Video Explorer | `/videos/:id` | YouTube video library with search and sort || Publish | `/publish` (`/upload` redirects) | Publish or schedule to Instagram, bulk upload, and the scheduled post queue || Automations | `/automations` | Keyword rules that answer Instagram comments with a private reply, a public reply under the comment or both, account pause and comment events, counts and the activity of both replies with separate retries (`docs/architecture/data-flows/AUTOMATION.md`) |diff --git a/docs/guidelines/UI_UX.md b/docs/guidelines/UI_UX.mdindex d37994c..43112d3 100644--- a/docs/guidelines/UI_UX.md+++ b/docs/guidelines/UI_UX.md@@ -91,7 +91,7 @@ Don't cite these as rules: "7 plus or minus 2" as a menu limit, the 400 ms figur- Each element answers a question someone asks. The top row holds the few figures that matter, each with its period and a comparison, colouring a change by whether it is good.- Rounded figures offer the exact value (`Num`); relative times offer the date (`RelativeTime`).-- Charts have a one-line summary and a table of the same data, and never put two units on one axis.+- Charts are built from Intent UI's components in `components/ui` (ADR-048); each has a screen-reader name and description, tooltips show exact values, and platform colours mean platforms only.- Libraries share one toolbar: search, filters shown as removable chips with Clear all, sort, a result count, and a no-results state that repeats the query.- A part that failed says so above the parts that loaded, with Retry.