refactor(dashboard): rethink settings, split out subreddits and accounts

The settings page had accumulated five tabs whose names no longer matched
their contents, three different save models, and the whole subreddit
configuration buried under a tab named after a checkbox.

Structure:
- Subreddits becomes its own page: a list showing each community's mode,
  tone, computed share of polling, and live sent/reply stats, with one
  subreddit edited at a time in a drawer.
- Accounts becomes its own page. It is session lifecycle, not config.
- Settings collapses to one scrolling page: Safety, Pacing (Monitoring and
  Rate limits merged), Targeting, Notifications, Advanced.
- The sidebar is grouped, having gone from 9 to 11 destinations.

Saving:
- Every section owns its own draft, validation, risk gate and save via
  useConfigCard, submitting only the keys it owns. A syntax error in the
  advanced JSON can no longer block a rate-limit change, and enabling an
  autonomous policy is its own deliberate commit.
- UnsavedChangesProvider restores the leave-page guard across cards that no
  longer share a draft.

Subreddit editing:
- Errors are keyed by field name instead of array index, removing the
  defensive invalidation that existed because row indices shifted on add
  and remove. Confirming an autonomous mode can no longer be attributed to
  the wrong row.
- Weight is shown as the share it actually produces, live while editing.
- Bulk actions cover start/pause polling, tone, policy and removal, because
  production runs 30-40 subreddits and per-row editing does not scale.
  Bulk policy changes name every subreddit turning autonomous, and
  normalise the hybrid mode's turn budget, which has no form to catch it.

Physique targeting moves into its own Targeting card. It sends only
reddit.physiqueTargeting, which the config route applies independently, so
it cannot clobber the pacing card's fields. Turning screening on now warns
that it will reduce how many posts qualify.

Also surfaces the effective sending rate, since the hourly limit and the
minimum delay both throttle and only the binding one matters.

Legacy ?section= links redirect or resolve to anchors.

Fixes found while verifying in a browser: a radio-card rule was shrinking
nested number inputs; .share-preview had no styles; the throughput readout
reported a rate from a blank field; and the reconcile logic warned about a
server change whenever a sibling card saved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Jamie BruntonandClaude Opus 5 committed 2026-08-11 09:07:31 +01:00
1 parent 11b6300113
commit c43e534cf1
36 files changed
+4414 -1632

No files matched your search

+18 -13
View File
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { NavLink, Outlet } from 'react-router-dom';
import { navigationItems } from './navigation.js';
import { navigationGroups, navigationItemsByGroup } from './navigation.js';
import { ShellStatusPanel } from './shell-status-panel.js';
import { NotificationBell, NotificationProvider, NotificationViewport } from './notifications.js';
@@ -20,18 +20,23 @@ export function AppShell() {
<NotificationBell />
</div>
<nav aria-label="Primary navigation" id="primary-navigation">
{navigationItems.map((item) => (
<NavLink
aria-label={item.label}
className={({ isActive }) => (isActive ? 'nav-link is-active' : 'nav-link')}
end={item.path === '/'}
key={item.path}
onClick={() => setIsNavigationOpen(false)}
to={item.path}
>
<span>{item.label}</span>
<small>{item.description}</small>
</NavLink>
{navigationGroups.map((group) => (
<div className="nav-group" key={group}>
<span className="nav-group-label">{group}</span>
{navigationItemsByGroup(group).map((item) => (
<NavLink
aria-label={item.label}
className={({ isActive }) => (isActive ? 'nav-link is-active' : 'nav-link')}
end={item.path === '/'}
key={item.path}
onClick={() => setIsNavigationOpen(false)}
to={item.path}
>
<span>{item.label}</span>
<small>{item.description}</small>
</NavLink>
))}
</div>
))}
</nav>
<ShellStatusPanel />
+21 -9
View File
@@ -2,16 +2,28 @@ export interface NavigationItem {
label: string;
path: string;
description: string;
group: NavigationGroup;
}
export type NavigationGroup = 'Monitor' | 'Content' | 'Analyse' | 'Configure';
/** Render order for the sidebar's group headings. */
export const navigationGroups: readonly NavigationGroup[] = ['Monitor', 'Content', 'Analyse', 'Configure'];
export const navigationItems: readonly NavigationItem[] = [
{ label: 'Overview', path: '/', description: 'System health and current activity' },
{ label: 'Needs attention', path: '/attention', description: 'Handoffs, failures, and account risks' },
{ label: 'Outreach funnel', path: '/outreach', description: 'Active posts moving toward delivery' },
{ label: 'Conversations', path: '/conversations', description: 'Inbox and message history' },
{ label: 'Media', path: '/media', description: 'Private media and sync controls' },
{ label: 'Exchange library', path: '/media-library', description: 'Images the bot may send when asked' },
{ label: 'Performance', path: '/performance', description: 'Response and strategy trends' },
{ label: 'Operations', path: '/operations', description: 'Jobs, events, and diagnostics' },
{ label: 'Settings', path: '/settings', description: 'Runtime and access configuration' },
{ label: 'Overview', path: '/', description: 'System health and current activity', group: 'Monitor' },
{ label: 'Needs attention', path: '/attention', description: 'Handoffs, failures, and account risks', group: 'Monitor' },
{ label: 'Outreach funnel', path: '/outreach', description: 'Active posts moving toward delivery', group: 'Monitor' },
{ label: 'Conversations', path: '/conversations', description: 'Inbox and message history', group: 'Monitor' },
{ label: 'Media', path: '/media', description: 'Private media and sync controls', group: 'Content' },
{ label: 'Exchange library', path: '/media-library', description: 'Images the bot may send when asked', group: 'Content' },
{ label: 'Performance', path: '/performance', description: 'Response and strategy trends', group: 'Analyse' },
{ label: 'Operations', path: '/operations', description: 'Jobs, events, and diagnostics', group: 'Analyse' },
{ label: 'Subreddits', path: '/subreddits', description: 'Where the bot posts and how it talks', group: 'Configure' },
{ label: 'Accounts', path: '/accounts', description: 'Reddit sessions and access', group: 'Configure' },
{ label: 'Settings', path: '/settings', description: 'Pacing, safety, and notifications', group: 'Configure' },
];
export function navigationItemsByGroup(group: NavigationGroup): readonly NavigationItem[] {
return navigationItems.filter((item) => item.group === group);
}
+1 -1
View File
@@ -158,7 +158,7 @@ export function notificationForEvent(event: DashboardEvent): NotificationDraft |
? `Signed in as u/${event.payload.username}.`
: `Session status changed to ${event.payload.status}.`),
tone: event.payload.status === 'authenticated' ? 'success' : 'error',
href: '/settings',
href: '/accounts',
};
case 'conversation.updated':
case 'sync.started':
+4
View File
@@ -10,6 +10,8 @@ import { RouteErrorPage } from './route-error-page.js';
import { AttentionPage } from '../features/attention/attention-page.js';
import { OutreachPage } from '../features/outreach/outreach-page.js';
import { MediaLibraryPage } from '../features/media-library/media-library-page.js';
import { SubredditsPage } from '../features/subreddits/subreddits-page.js';
import { AccountsPage } from '../features/accounts/accounts-page.js';
export function createDashboardRoutes(): RouteObject[] {
return [
@@ -27,6 +29,8 @@ export function createDashboardRoutes(): RouteObject[] {
{ path: 'media-library', element: <MediaLibraryPage /> },
{ path: 'performance', element: <PerformancePage /> },
{ path: 'operations', element: <OperationsPage /> },
{ path: 'subreddits', element: <SubredditsPage /> },
{ path: 'accounts', element: <AccountsPage /> },
{ path: 'settings', element: <SettingsRoute /> },
],
},