#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Make processor UI mobile friendly BASIC BASIC impl (#7126)
Anthony Stirling7e76097ac184
diff --git a/frontend/editor/public/locales/en-US/translation.toml b/frontend/editor/public/locales/en-US/translation.tomlindex d1fc247e2f..d27e881f2e 100644--- a/frontend/editor/public/locales/en-US/translation.toml+++ b/frontend/editor/public/locales/en-US/translation.toml@@ -7910,6 +7910,11 @@ linkAccount = "Link Stirling account"primaryNav = "Primary navigation"switchApp = "Switch app"+[portal.shell.topbar]+closeNav = "Close navigation"+openNav = "Open navigation"+search = "Search"+[portal.sources]subtitle = "Reusable input connections that feed documents into Stirling. Configure a source once, then reference it from any number of pipelines."title = "Sources"diff --git a/frontend/editor/src/core/ui/MetricStrip.css b/frontend/editor/src/core/ui/MetricStrip.cssindex c222e61583..472fce713e 100644--- a/frontend/editor/src/core/ui/MetricStrip.css+++ b/frontend/editor/src/core/ui/MetricStrip.css@@ -9,3 +9,9 @@grid-template-columns: repeat(2, 1fr);}}++@media (max-width: 30rem) {+ .sui-metric-strip {+ grid-template-columns: 1fr;+ }+}diff --git a/frontend/editor/src/core/ui/Modal.css b/frontend/editor/src/core/ui/Modal.cssindex 7d9ef68746..a3d081b42d 100644--- a/frontend/editor/src/core/ui/Modal.css+++ b/frontend/editor/src/core/ui/Modal.css@@ -25,10 +25,22 @@flex-direction: column;width: 100%;max-height: calc(100vh - 6.5rem);+ max-height: calc(100dvh - 6.5rem); /* mobile browser chrome shrinks 100vh */overflow: hidden;animation: scaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) both;}+/* Phones: drop the tall top inset so the modal gets the vertical space */+@media (max-width: 30rem) {+ .sui-modal__backdrop {+ padding: 1rem 0.75rem;+ align-items: center;+ }+ .sui-modal {+ max-height: calc(100dvh - 2rem);+ }+}+.sui-modal--sm {max-width: 24rem;}diff --git a/frontend/editor/src/portal/components/AppShell.css b/frontend/editor/src/portal/components/AppShell.cssindex 03702966e4..a01026480a 100644--- a/frontend/editor/src/portal/components/AppShell.css+++ b/frontend/editor/src/portal/components/AppShell.css@@ -8,6 +8,7 @@.portal-shell {display: flex;height: 100vh;+ height: 100dvh; /* mobile browser chrome shrinks the viewport; dvh tracks it */overflow: hidden;background: var(--color-bg);color: var(--color-text-2);@@ -27,3 +28,43 @@overflow-y: auto;animation: fadeInUp var(--motion-enter) both;}++/* Mobile topbar — hidden on desktop, where the sidebar is always visible.+ Height matches the sidebar's logo row so the brand sits at the same level. */+.portal-shell__topbar {+ display: none;+ height: 3.1875rem;+ flex-shrink: 0;+ align-items: center;+ gap: 0.375rem;+ padding: 0 0.625rem;+ background: var(--color-sidebar-bg);+ border-bottom: 1px solid var(--color-sidebar-border);+}++.portal-shell__topbar-wordmark {+ height: 1.375rem;+ width: auto;+ display: block;+ margin-right: auto;+}++/* Scrim behind the mobile nav drawer (below SUI modals at z-index 100). */+.portal-shell__scrim {+ display: none;+ position: fixed;+ inset: 0;+ z-index: 75;+ background: rgba(15, 23, 42, 0.55);+}++@media (max-width: 48rem) {+ .portal-shell__topbar {+ display: flex;+ }+ .portal-shell__scrim {+ display: block;+ /* fadeIn keyframes come from core tokens.css */+ animation: fadeIn var(--motion-fast) both;+ }+}diff --git a/frontend/editor/src/portal/components/AppShell.stories.tsx b/frontend/editor/src/portal/components/AppShell.stories.tsxnew file mode 100644index 0000000000..1df98c3197--- /dev/null+++ b/frontend/editor/src/portal/components/AppShell.stories.tsx@@ -0,0 +1,34 @@+import type { Meta, StoryObj } from "@storybook/react-vite";+import { AppShell } from "@portal/components/AppShell";+import { Home } from "@portal/views/Home";++/**+ * The full shell (sidebar + mobile topbar/drawer + scrolling view column) with+ * the Home view inside. Resize the viewport below 48rem to exercise the mobile+ * chrome: the sidebar becomes an off-canvas drawer behind a scrim, opened from+ * the topbar hamburger.+ */+const meta: Meta<typeof AppShell> = {+ title: "Portal/Shell/AppShell",+ component: AppShell,+ parameters: { layout: "fullscreen" },+};+export default meta;+type Story = StoryObj<typeof AppShell>;++export const WithHomeView: Story = {+ render: () => (+ <AppShell>+ <Home />+ </AppShell>+ ),+};++export const Mobile: Story = {+ render: () => (+ <AppShell>+ <Home />+ </AppShell>+ ),+ globals: { viewport: { value: "mobile2", isRotated: false } },+};diff --git a/frontend/editor/src/portal/components/AppShell.tsx b/frontend/editor/src/portal/components/AppShell.tsxindex b3744d36bf..c50b4000e9 100644--- a/frontend/editor/src/portal/components/AppShell.tsx+++ b/frontend/editor/src/portal/components/AppShell.tsx@@ -1,17 +1,90 @@-import type { ReactNode } from "react";+import { useEffect, type ReactNode } from "react";+import { useTranslation } from "react-i18next";+import { useLocation } from "react-router-dom";+import { ActionIcon } from "@app/ui";import { Sidebar } from "@portal/components/Sidebar";+import { useTheme } from "@portal/contexts/ThemeContext";+import { useUI } from "@portal/contexts/UIContext";+import { MenuIcon, SearchIcon } from "@portal/components/icons";+import wordmarkLight from "@app/assets/brand/modern-logo/StirlingProcessorLogoBlackText.svg";+import wordmarkDark from "@app/assets/brand/modern-logo/StirlingProcessorLogoWhiteText.svg";import "@portal/components/AppShell.css";+/**+ * Compact header shown only under the mobile breakpoint (CSS-hidden on+ * desktop): hamburger opens the sidebar drawer, search opens the palette+ * (there's no ⌘K on a phone).+ */+function MobileTopbar() {+ const { t } = useTranslation();+ const { theme } = useTheme();+ const { mobileNavOpen, toggleMobileNav, openSearch } = useUI();+ return (+ <header className="portal-shell__topbar">+ <ActionIcon+ variant="tertiary"+ size="lg"+ aria-label={t("portal.shell.topbar.openNav")}+ aria-expanded={mobileNavOpen}+ onClick={toggleMobileNav}+ >+ <MenuIcon size={20} />+ </ActionIcon>+ <img+ className="portal-shell__topbar-wordmark"+ src={theme === "dark" ? wordmarkDark : wordmarkLight}+ alt={t("portal.shell.sidebar.brandSuffix")}+ />+ <ActionIcon+ variant="tertiary"+ size="lg"+ aria-label={t("portal.shell.topbar.search")}+ onClick={openSearch}+ >+ <SearchIcon size={19} />+ </ActionIcon>+ </header>+ );+}+/*** Two-column layout: fixed-width sidebar on the left, a scrolling main column on- * the right. The Sidebar reads its state from context, so this shell stays- * prop-free.+ * the right. Under the mobile breakpoint the sidebar becomes an off-canvas+ * drawer behind a scrim, opened from the topbar hamburger. The Sidebar reads+ * its state from context, so this shell stays prop-free.*/export function AppShell({ children }: { children: ReactNode }) {+ const { mobileNavOpen, closeMobileNav } = useUI();+ const { pathname } = useLocation();++ // Navigating (tap on a nav row, back button, deep link) always dismisses the+ // drawer. Depends on pathname only: the close fn's identity changes with any+ // UI state, and re-running on that would instantly close a just-opened drawer.+ useEffect(() => {+ closeMobileNav();+ }, [pathname]);++ useEffect(() => {+ if (!mobileNavOpen) return;+ function onKey(e: KeyboardEvent) {+ if (e.key === "Escape") closeMobileNav();+ }+ document.addEventListener("keydown", onKey);+ return () => document.removeEventListener("keydown", onKey);+ }, [mobileNavOpen, closeMobileNav]);+return (<div className="portal-shell"><Sidebar />+ {mobileNavOpen && (+ <div+ className="portal-shell__scrim"+ onClick={closeMobileNav}+ aria-hidden+ />+ )}<div className="portal-shell__main">+ <MobileTopbar /><main className="portal-shell__view">{children}</main></div></div>diff --git a/frontend/editor/src/portal/components/AssistantPanel.css b/frontend/editor/src/portal/components/AssistantPanel.cssindex e16f84f6c0..90a66f169d 100644--- a/frontend/editor/src/portal/components/AssistantPanel.css+++ b/frontend/editor/src/portal/components/AssistantPanel.css@@ -2,9 +2,10 @@position: fixed;bottom: 5.5rem;right: 1.5rem;- width: 23.75rem;+ /* Clamp to the viewport so small phones don't clip the panel off-screen */+ width: min(23.75rem, calc(100vw - 2rem));height: 32.5rem;- max-height: calc(100vh - 7rem);+ max-height: calc(100dvh - 7rem);background: var(--color-surface);border: 1px solid var(--color-border);border-radius: var(--radius-xl);diff --git a/frontend/editor/src/portal/components/NotificationsDropdown.css b/frontend/editor/src/portal/components/NotificationsDropdown.cssindex 325f8f4fb8..09bd19326d 100644--- a/frontend/editor/src/portal/components/NotificationsDropdown.css+++ b/frontend/editor/src/portal/components/NotificationsDropdown.css@@ -6,7 +6,8 @@position: absolute;top: calc(100% + 0.25rem);right: 0;- width: 22.5rem;+ /* Clamp to the viewport so a right-anchored panel fits small phones */+ width: min(22.5rem, calc(100vw - 1rem));background: var(--color-notif-bg, var(--color-surface));border: 1px solid var(--color-border);border-radius: var(--radius-md);diff --git a/frontend/editor/src/portal/components/Sidebar.css b/frontend/editor/src/portal/components/Sidebar.cssindex 935a55e722..1e0096fc4e 100644--- a/frontend/editor/src/portal/components/Sidebar.css+++ b/frontend/editor/src/portal/components/Sidebar.css@@ -1,6 +1,7 @@.portal-sidebar {width: 15rem;height: 100vh;+ height: 100dvh; /* track mobile browser chrome */background: var(--color-sidebar-bg);border-right: 1px solid var(--color-sidebar-border);display: flex;@@ -10,6 +11,43 @@top: 0;}+/* Mobile close button (shared ActionIcon) — only shown inside the drawer. */+.portal-sidebar__close {+ display: none;+ flex-shrink: 0;+}++/* Off-canvas drawer under the shell breakpoint (keep in sync with+ AppShell.css and Sidebar.tsx). Slides from the inline-start edge so RTL+ locales get the mirrored behavior for free. */+@media (max-width: 48rem) {+ .portal-sidebar {+ position: fixed;+ inset-block: 0;+ inset-inline-start: 0;+ z-index: 80; /* above the scrim (75), below SUI modals (100) */+ width: min(17rem, 85vw);+ border-right: none;+ border-inline-end: 1px solid var(--color-sidebar-border);+ transform: translateX(calc(var(--sui-dir, 1) * -100%));+ visibility: hidden;+ transition:+ transform var(--motion-fast),+ visibility var(--motion-fast);+ }+ [dir="rtl"] .portal-sidebar {+ --sui-dir: -1;+ }+ .portal-sidebar--open {+ transform: translateX(0);+ visibility: visible;+ box-shadow: 0 0.5rem 2rem rgba(15, 23, 42, 0.35);+ }+ .portal-sidebar__close {+ display: inline-flex;+ }+}+/* Logo block */.portal-sidebar__logo {height: 3.1875rem; /* 51px */diff --git a/frontend/editor/src/portal/components/Sidebar.tsx b/frontend/editor/src/portal/components/Sidebar.tsxindex 5b512a7184..4eec4dcc06 100644--- a/frontend/editor/src/portal/components/Sidebar.tsx+++ b/frontend/editor/src/portal/components/Sidebar.tsx@@ -1,4 +1,5 @@-import { NavItem } from "@app/ui";+import { useMediaQuery } from "@mantine/hooks";+import { ActionIcon, NavItem } from "@app/ui";import { AppSwitch } from "@app/components/shared/AppSwitch";import { useTranslation } from "react-i18next";import { useNavigate } from "react-router-dom";@@ -9,7 +10,7 @@ import { LinkAccountFooterItem } from "@portal/components/LinkAccountFooterItem"import { EDITOR_URL, EDITOR_IS_SAME_APP } from "@portal/auth/editorUrl";import wordmarkLight from "@app/assets/brand/modern-logo/StirlingProcessorLogoBlackText.svg";import wordmarkDark from "@app/assets/brand/modern-logo/StirlingProcessorLogoWhiteText.svg";-import { SettingsIcon } from "@portal/components/icons";+import { CloseIcon, SettingsIcon } from "@portal/components/icons";import {GROUP_PROCESSOR,GROUP_PLATFORM,@@ -23,12 +24,18 @@ const NAV_SECTIONS: NavGroup[] = [{ labelKey: "portal.nav.section.platform", entries: GROUP_PLATFORM },];+/** Must match the shell breakpoint in AppShell.css / Sidebar.css. */+const MOBILE_QUERY = "(max-width: 48rem)";+export function Sidebar() {const { activeView, setActiveView } = useView();const { theme } = useTheme();- const { openSettings } = useUI();+ const { openSettings, mobileNavOpen, closeMobileNav } = useUI();const { t } = useTranslation();const navigate = useNavigate();+ const isMobile = useMediaQuery(MOBILE_QUERY, false, {+ getInitialValueInEffect: false,+ });// Editor and portal are one SPA when the editor serves this origin's root, so// the switch stays client-side; an absolute EDITOR_URL (dev cross-app setup)@@ -50,6 +57,9 @@ export function Sidebar() {icon={entry.icon}isActive={activeView === entry.id}onClick={(id) => {+ // Route changes also close the drawer (AppShell), but re-selecting the+ // active view or opening an external tab changes no route — close here.+ closeMobileNav();if (entry.externalUrl) {window.open(entry.externalUrl, "_blank", "noopener,noreferrer");} else {@@ -62,8 +72,12 @@ export function Sidebar() {return (<aside- className="portal-sidebar"+ className={+ mobileNavOpen ? "portal-sidebar portal-sidebar--open" : "portal-sidebar"+ }aria-label={t("portal.shell.sidebar.primaryNav")}+ // Off-canvas on mobile: remove from the tab order and accessibility tree.+ inert={isMobile && !mobileNavOpen}><div className="portal-sidebar__logo"><img@@ -78,6 +92,15 @@ export function Sidebar() {theme={theme}onSwitch={goToEditor}/>++ <ActionIcon+ variant="tertiary"+ className="portal-sidebar__close"+ aria-label={t("portal.shell.topbar.closeNav")}+ onClick={closeMobileNav}+ >+ <CloseIcon size={18} />+ </ActionIcon></div><nav className="portal-sidebar__nav">diff --git a/frontend/editor/src/portal/components/icons.tsx b/frontend/editor/src/portal/components/icons.tsxindex d60f86646e..ac0eb49142 100644--- a/frontend/editor/src/portal/components/icons.tsx+++ b/frontend/editor/src/portal/components/icons.tsx@@ -132,6 +132,16 @@ export function SearchIcon(props: IconProps) {);}+export function MenuIcon(props: IconProps) {+ return (+ <Svg {...props}>+ <line x1="4" y1="7" x2="20" y2="7" />+ <line x1="4" y1="12" x2="20" y2="12" />+ <line x1="4" y1="17" x2="20" y2="17" />+ </Svg>+ );+}+export function SunIcon(props: IconProps) {return (<Svg {...props}>diff --git a/frontend/editor/src/portal/contexts/UIContext.tsx b/frontend/editor/src/portal/contexts/UIContext.tsxindex ba2ccbd344..f55c2f5ee9 100644--- a/frontend/editor/src/portal/contexts/UIContext.tsx+++ b/frontend/editor/src/portal/contexts/UIContext.tsx@@ -12,6 +12,12 @@ interface UIContextValue {closeSearch: () => void;toggleSearch: () => void;+ /** Off-canvas sidebar drawer on small screens (no-op chrome on desktop). */+ mobileNavOpen: boolean;+ openMobileNav: () => void;+ closeMobileNav: () => void;+ toggleMobileNav: () => void;+assistantOpen: boolean;openAssistant: () => void;closeAssistant: () => void;@@ -48,6 +54,7 @@ const UIContext = createContext<UIContextValue | null>(null);export function UIProvider({ children }: { children: ReactNode }) {const [searchOpen, setSearchOpen] = useState(false);+ const [mobileNavOpen, setMobileNavOpen] = useState(false);const [assistantOpen, setAssistantOpen] = useState(false);const [settingsOpen, setSettingsOpen] = useState(false);const [settingsInitialSection, setSettingsInitialSection] = useState<@@ -63,11 +70,21 @@ export function UIProvider({ children }: { children: ReactNode }) {const value = useMemo<UIContextValue>(() => ({+ // Opening any overlay (search, settings, link modal) dismisses the mobile+ // nav drawer so overlays never stack on top of it.searchOpen,- openSearch: () => setSearchOpen(true),+ openSearch: () => {+ setMobileNavOpen(false);+ setSearchOpen(true);+ },closeSearch: () => setSearchOpen(false),toggleSearch: () => setSearchOpen((o) => !o),+ mobileNavOpen,+ openMobileNav: () => setMobileNavOpen(true),+ closeMobileNav: () => setMobileNavOpen(false),+ toggleMobileNav: () => setMobileNavOpen((o) => !o),+assistantOpen,openAssistant: () => setAssistantOpen(true),closeAssistant: () => setAssistantOpen(false),@@ -76,6 +93,7 @@ export function UIProvider({ children }: { children: ReactNode }) {settingsOpen,settingsInitialSection,openSettings: (section?: string) => {+ setMobileNavOpen(false);setSettingsInitialSection(section ?? null);setSettingsOpen(true);},@@ -87,6 +105,7 @@ export function UIProvider({ children }: { children: ReactNode }) {linkModalOpen,linkModalMode,openLinkModal: (mode: "link" | "reauth" = "link") => {+ setMobileNavOpen(false);setLinkModalMode(mode);// Never stack on Settings: close it first, and remember to reopen it on// the account-link section once the login modal closes.@@ -109,6 +128,7 @@ export function UIProvider({ children }: { children: ReactNode }) {}),[searchOpen,+ mobileNavOpen,assistantOpen,settingsOpen,settingsInitialSection,diff --git a/frontend/editor/src/portal/views/EditorAdmin.css b/frontend/editor/src/portal/views/EditorAdmin.cssindex 2fda00cda5..61ef2834dd 100644--- a/frontend/editor/src/portal/views/EditorAdmin.css+++ b/frontend/editor/src/portal/views/EditorAdmin.css@@ -340,6 +340,12 @@gap: 0.875rem;}+@media (max-width: 30rem) {+ .portal-editor__token-row {+ grid-template-columns: 1fr;+ }+}+.portal-editor__panel-actions {display: flex;gap: 0.5rem;diff --git a/frontend/editor/src/portal/views/Infrastructure.css b/frontend/editor/src/portal/views/Infrastructure.cssindex bca7406359..1d98dee925 100644--- a/frontend/editor/src/portal/views/Infrastructure.css+++ b/frontend/editor/src/portal/views/Infrastructure.css@@ -104,6 +104,12 @@gap: 0.5rem 1rem;}+@media (max-width: 30rem) {+ .portal-infra__export-fields {+ grid-template-columns: 1fr;+ }+}+.portal-infra__export-error {margin: 0;font-size: 0.8125rem;@@ -192,6 +198,12 @@}}+@media (max-width: 30rem) {+ .portal-infra__metrics {+ grid-template-columns: 1fr;+ }+}+/* ── API keys ───────────────────────────────────────────────────────────── */.portal-infra__keys {display: flex;diff --git a/frontend/editor/src/portal/views/PipelineBuilder.css b/frontend/editor/src/portal/views/PipelineBuilder.cssindex cef65d6e75..c7e273eec1 100644--- a/frontend/editor/src/portal/views/PipelineBuilder.css+++ b/frontend/editor/src/portal/views/PipelineBuilder.css@@ -251,6 +251,13 @@gap: 0.625rem;}+/* Once the grid stacks (60rem), a sticky inspector would ride over content */+@media (max-width: 60rem) {+ .portal-builder__inspector-col {+ position: static;+ }+}+.portal-builder__inspector {background: var(--color-surface);border: 1px solid var(--color-border);diff --git a/frontend/editor/src/portal/views/Pipelines.css b/frontend/editor/src/portal/views/Pipelines.cssindex 7cd241074d..5c99f6a224 100644--- a/frontend/editor/src/portal/views/Pipelines.css+++ b/frontend/editor/src/portal/views/Pipelines.css@@ -12,6 +12,7 @@display: flex;align-items: flex-start;justify-content: space-between;+ flex-wrap: wrap; /* actions drop below the title on narrow screens */gap: 1rem;}diff --git a/frontend/editor/src/portal/views/Policies.css b/frontend/editor/src/portal/views/Policies.cssindex c6095dabc1..e58d5522a8 100644--- a/frontend/editor/src/portal/views/Policies.css+++ b/frontend/editor/src/portal/views/Policies.css@@ -183,6 +183,12 @@border-top: 1px solid var(--color-border-light);}+@media (max-width: 30rem) {+ .portal-policies__card-stats {+ grid-template-columns: 1fr;+ }+}+/* Wizard + detail shared chrome */.portal-policies__wizard-title {display: inline-flex;diff --git a/frontend/editor/src/portal/views/Sources.css b/frontend/editor/src/portal/views/Sources.cssindex c0e7a56bd9..c092905fe2 100644--- a/frontend/editor/src/portal/views/Sources.css+++ b/frontend/editor/src/portal/views/Sources.css@@ -12,6 +12,7 @@display: flex;align-items: flex-start;justify-content: space-between;+ flex-wrap: wrap; /* actions drop below the title on narrow screens */gap: 1rem;}@@ -196,6 +197,12 @@}}+@media (max-width: 30rem) {+ .portal-sources__stat-grid {+ grid-template-columns: 1fr;+ }+}+/* Stat tiles now use the shared <StatTile>. */.portal-sources__url {@@ -317,6 +324,14 @@padding: 0;}+/* Phones: labelled step pills don't fit side by side — stack them */+@media (max-width: 30rem) {+ .portal-sources__steps {+ flex-direction: column;+ gap: 0.375rem;+ }+}+.portal-sources__step {display: flex;align-items: center;diff --git a/frontend/editor/src/portal/views/Users.css b/frontend/editor/src/portal/views/Users.cssindex dfaa9284a6..62c72549bf 100644--- a/frontend/editor/src/portal/views/Users.css+++ b/frontend/editor/src/portal/views/Users.css@@ -226,6 +226,12 @@margin: 0.75rem 0 0.875rem;}+@media (max-width: 30rem) {+ .portal-users__access-stats {+ grid-template-columns: 1fr;+ }+}+.portal-users__toggle-rows {display: flex;flex-direction: column;