Skip to content

refactor: theme typing, error UX, a11y, lint config, dev hygiene - #499

Open
aldbr wants to merge 4 commits into
DIRACGrid:mainfrom
aldbr:split/5-quality-hygiene
Open

refactor: theme typing, error UX, a11y, lint config, dev hygiene#499
aldbr wants to merge 4 commits into
DIRACGrid:mainfrom
aldbr:split/5-quality-hygiene

Conversation

@aldbr

@aldbr aldbr commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Part of #494 (stack 5/5, final). Stacked on #498 — until it merges, review the last commit only (refactor:).

Quality and hygiene tail of the stack:

  • ThemeProvider: ThemeMode = "light" | "dark" union replaces string | null (casts gone); render is pure — sessionStorage writes move out of the render phase; storage now records only explicit user choices, making the follow-system-preference branch reachable; dark mode gets palette-aware focused-input colors (previously hardcoded light-mode greys/black);
  • lint config: eslint-plugin-jsx-a11y (recommended) enabled on the components package — where all the interactive UI lives (0 errors after the a11y fixes earlier in the stack); prettier-conflicting formatting rules (indent, semi, comma-dangle) removed from the app/extension configs;
  • README contributing link fixed to the real doc.

After this merges, the stack tree is identical to the original development branch — closes out #494's implementation phase.

🤖 Generated with Claude Code

@aldbr

aldbr commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Per review of #496 (force-pushed): the LoginForm skeleton loading state, error Alert, and Advanced-Options-button removal moved here from #496 (they're error-UX / a11y, not packaging). #496 now keeps only the next/image<img> swap.

@aldbr
aldbr force-pushed the split/5-quality-hygiene branch 6 times, most recently from c94b4da to 92a433f Compare July 15, 2026 06:49
aldbr and others added 4 commits July 15, 2026 09:10
…nular contexts

Split the monolithic ApplicationsContext tuple into three purpose-built
contexts (AppListContext, DashboardContext, CurrentAppContext) so
components subscribe only to the state they read, and rework the
dashboard layout around them:

- extract drag-and-drop monitoring into a useDashboardDragDrop hook and
  the context menu into a DrawerContextMenu component; DashboardDrawer
  now updates dashboard state immutably (no in-place mutation of groups)
- rewrite hooks/application.tsx around the granular contexts
  (useAppList, useDashboard, useApplicationId, useCurrentApplication)
  and drop useApplicationTitle/useApplicationType
- memoize NavigationProvider and OIDCConfigurationProvider values
- ProfileButton loses the dead About entry; ThemeToggleButton,
  Import/ExportButton, ApplicationDialog and ApplicationSelector are
  adapted to the new contexts
- contexts/index.ts now exports the granular contexts explicitly
  (ApplicationsContext is gone); Dashboard stories/tests updated
useDashboardDragDrop no longer takes userDashboard or mirrors it in a
ref. reorderSections receives the source/destination group titles from
the drop event and looks the groups up inside the setUserDashboard
functional updater, where React hands it the freshest state. This drops
the ref, its sync effect, and the userDashboard parameter, and removes
the (practically unreachable) window where a drop could read a stale
dashboard between a state commit and the ref update. The destination
index is copied into a local so the updater stays pure under StrictMode.

Draft addressing review comment C6.1 — kept as its own commit for review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…sition, context split, SWR tuning

Rework the Job Monitor stack end to end:

- split the monolithic shared/DataTable.tsx into a DataTable/ module
  (DataTable, DataTableHeader, DataTableToolbar, SplitActionButton)
  virtualized with @tanstack/react-virtual instead of react-virtuoso;
  react-virtuoso is dropped from dependencies
- extract a reusable shared/PieChart component (with stories and a11y
  legend tests) and a shared visuallyHidden helper
- decompose the SearchBar: state moves into a useSearchBarReducer,
  URL/filter synchronisation into useFilterSync, and suggestion
  fetching into useSearchSuggestions; equations gain stable ids and
  the Operators.EGUALS typo becomes Operators.EQUALS
- restructure the Job Monitor: column definitions move to
  jobColumns.tsx, per-application persistence to
  useJobMonitorPersistence, and shared state to a JobMonitorContext;
  jobDataService migrates to the services/fetcher client with SWR
  keys tuned to avoid refetch storms
- finish the fetcher migration: hooks/utils.tsx loses the legacy
  tuple-based fetcher (now services/client with named options and
  abort support), hooks/metadata.tsx and the gubbins OwnerMonitor
  consume the new client, and the package root exports the explicit
  final API surface
- jest config/setup updated for react-virtual (structured-clone
  ponyfill, layout mocks); e2e specs updated and a mobile viewport
  spec added; next.config gains a services alias for dev HMR and the
  app a test:headless script

BREAKING CHANGE: the tuple-based fetcher export is gone from
@dirac-grid/diracx-web-components/hooks; use the object-based fetcher
from @dirac-grid/diracx-web-components/services instead.
Operators.EGUALS is renamed Operators.EQUALS, and the DataTable API
changed with the module split.
Quality and hygiene follow-ups across the workspace:

- ThemeProvider: introduce a ThemeMode union with a type-guarded
  sessionStorage read, keep render pure (storage is only written on an
  explicit user toggle), memoize toggleTheme, and derive outlined-input
  border/label colors for both palette modes; Dashboard tests updated
  for the new persistence semantics
- eslint flat configs (components, app, extensions) tightened, notably
  enabling eslint-plugin-jsx-a11y; the intentional autoFocus in the
  drawer rename fields gains documented disable directives
- README refreshed
- lockfile synchronised with the final dependency set
@aldbr
aldbr force-pushed the split/5-quality-hygiene branch from 92a433f to 184c2a6 Compare July 15, 2026 07:14
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.

Quality pass: library packaging, Job Monitor performance, state correctness, test coverage

1 participant