Skip to main content

UI and Design Parity: Desktop vs ehr-web

Version: 1.1 Date: 2026-04-18 Companion: ../../common/THEME.md (canonical theme source — all surfaces), SPEC.md, REGIONAL_PROFILE.md, FRONTEND_BERRY_TEMPLATE_REFERENCE.md

Canonical theme source: ../../common/THEME.md is the single source of truth for tokens, theming, admin-configurable per-tenant overrides, motion, and RTL across desktop, web, and mobile. This document translates the common theme rules into desktop-specific guidance and tracks parity with ehr-web. Any discrepancy between this file and the common theme doc is resolved in favour of the common doc.


1. Goals

  • Visual and interaction consistency between the Electron desktop client and apps/ehr-web, both built on the single base theme (../../common/THEME.md).
  • Compliance with the Berry (CodedThemes) template obligation for product portals (see docs/widget/BERRY_TEMPLATE_REQUIREMENT.md), layered on top of the token system.
  • Reuse of shared packages already consumed by ehr-web: @ghasi/design-tokens, @ghasi/theme-runtime, @ghasi/design-system, @ghasi/widgets, @ghasi/access-client-browser, @ghasi/auth-client, @ghasi/ui-config-client-browser (where applicable to desktop).

2. Stack alignment

Defined in full in ../../common/THEME.md §3. Desktop-specific notes:

LayerRequirement
Component foundationMUI (major version aligned with ehr-web package.json) — foundation and complex components (DataGrid, Autocomplete, DatePicker, dialogs, dense tables).
Styling primaryTailwind CSS — utility classes for layout, spacing, simple colour and typography. MUI Preflight conflict avoided per ../../common/THEME.md §6.3 and §7.2 (Preflight disabled; MUI CssBaseline is the reset).
Styling escape hatchMUI sx / styled (Emotion) — only for complex or dynamic cases Tailwind cannot express cleanly.
Tokens & theming@ghasi/design-tokens + @ghasi/theme-runtime — generates MUI theme, Tailwind preset, CSS variables, and Motion tokens from one source. Per-tenant overrides per ../../common/THEME.md §5.
Icons@ghasi/icons-react (shared with web) — built from the shared SVG source with RTL-mirror metadata per ../../common/THEME.md §11.
AnimationMotion (motion.dev) — consumes duration and easing tokens from @ghasi/design-tokens/build/motion-tokens. Shared presets (fadeIn, slideInFromStart, scaleIn, cardHover, toastEnter) per ../../common/THEME.md §8.3. Reduced-motion honoured automatically.
Formsreact-hook-form + zod preferred; formik + yup permitted where web feature already uses it.
i18nreact-intl + shared message catalogs from @ghasi/i18n.
RTLTheme direction + stylis-plugin-rtl + Tailwind logical utilities (ps-*, pe-*, start-*, end-*). ESLint rule blocks physical left/right utilities.

3. Theme parity strategy

Approach A is adopted. Theme construction lives in shared workspace packages consumed by both ehr-web and ehr-desktop (and the future public-health / government web surfaces and the mobile app where applicable):

  • @ghasi/design-tokens — tokens + generated artefacts (MUI theme, Tailwind preset, CSS variables, Motion tokens). See ../../common/THEME.md §13.
  • @ghasi/theme-runtimeThemeProvider, useTenantTheme, tenant override application, motion presets.

Legacy ehr-web construction under apps/ehr-web/src/themes/ is migrated to the shared packages; any residual local palette/typography files are considered historical and must not fork.

Desktop MUST:

  • Use CssVarsProvider from MUI with cssVarPrefix: '' matching ehr-web so CSS variable names are identical across web + desktop.
  • Consume CSS variables for all colour / radius / spacing references so tenant overrides swap live without app restart (see ../../common/THEME.md §5.6).
  • Apply the tenant's density preference (compact / comfortable / spacious) from the resolved theme — Berry-style dense clinical layouts map to compact.
  • Respect the locked token surface per ../../common/THEME.md §5.2 — status colours, focus ring, spacing scale, and motion tokens are not tenant-overridable.

4. Localization, RTL, and mixed-direction content

Authority: REGIONAL_PROFILE.md, MODULE_SHARED_STANDARDS.md §4. Goal: identical visual and semantic behavior to apps/ehr-web for the same locale + direction — no desktop-specific regressions.

4.1 Layout and direction

CheckRequirement
ThemeMUI direction matches ltr / rtl; use same ThemeProvider / StyledEngineProvider ordering as ehr-web.
DocumentRoot dir and lang updated when user or tenant changes locale.
NavigationDrawer vs side nav, start/end edge alignment (use logical CSS / MUI props; avoid hard-coded left/right except where mirrored by RTL plugin).
IconsMirror directional icons (e.g. back, chevrons) in RTL; do not mirror symmetric or semantic icons (e.g. warning, clinical) without design review.

4.2 Typography and data

CheckRequirement
Mixed-directionMRNs, codes, mixed Latin/Arabic strings: <bdi>, dir="auto", or Unicode isolates per MODULE_SHARED_STANDARDS.md.
TablesHorizontal scroll and sticky columns behave correctly in RTL (first column alignment, action columns).
DataGrid / dense tablesVerify MUI X DataGrid RTL support with same major version as web.

4.3 Dates, numbers, calendars

CheckRequirement
Formattingdayjs + locale plugins; currency and units per regional profile.
Pickers@mui/x-date-pickers with locale props; Hijri/Gregorian display rules per REGIONAL_PROFILE.md.

4.4 Electron-specific

CheckRequirement
Native menusLocalized File / Edit / View strings aligned with TR-DSK-073 (TECHNICAL_REQUIREMENTS.md).
ShellWindow title bar may reflect OS; in-app chrome must still honor RTL.

4.5 Verification

  • Visual: side-by-side screenshots (web vs desktop) for at least en and one RTL locale on the shell + one chart surface.
  • Automated: see TR-DSK-075 / TR-DSK-063 in TECHNICAL_REQUIREMENTS.md.

5. Design system and Cursor rules


6. Offline and sync UX patterns

Aligned with offline-first/SPEC.md and SPEC.md:

PatternRequirement
Global statusPersistent bar or shell indicator: offline / reconnecting / syncing / idle / error.
Per-record stateBadges for “Pending sync”, “Conflict”, “Synced” on lists and detail headers where applicable.
ConflictModal or side panel with plain-language explanation, server code, and actions (refresh, merge, defer) per module.
Queue depthOptional “N items pending” in shell for power users; avoid alarmist copy for normal operation.
Online-onlyDisabled control + tooltip or inline help (“Requires internet”) — consistent string keys with web where shared.

7. Accessibility and clinical safety

  • Maintain focus order, keyboard navigation, and contrast consistent with MUI defaults and Berry overrides.
  • Never rely on color alone for sync/error states; pair with icon + text.
  • High-density clinical screens: follow ehr-web patterns for scroll regions (simplebar-react if used on web for comparable shells).

8. Scheduling UI and notifications (parity)

When the scheduling module is licensed (see FR-DSK-015 and FR-DSK-016 in SPEC.md):

TopicRequirement
Rich UICalendar views, agenda, resource/slot grids, filters — reuse Berry + MUI patterns from ehr-web and @ghasi/widgets where applicable; same density and card patterns as other clinical modules.
RTLTimeline and calendar horizontal axis MUST mirror correctly (start of day at the logical start edge).
NotificationsUse OS Notification API from main when user grants permission; fallback to in-app toast/snackbar; respect Do Not Disturb where OS exposes it.
OfflineShow cached appointments and clearly label stale data; queue booking intents per module offline rules — never imply a confirmed slot without server confirmation.

Module spec: specs/modules/scheduling/SPEC.md.


9. Platform-specific allowances

Small divergences are acceptable when they improve desktop UX:

  • Native menus (File, Edit, View) in main process.
  • Window chrome and title bar (OS-specific).
  • Keyboard shortcuts may include desktop conventions (Ctrl/Cmd+W) where they do not conflict with clinical safety.

Document any intentional deviation in the desktop app README.