#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
Start settings tours from the editor home (#8461)
EthanHealy01298aa20e8dd7
diff --git a/frontend/editor/src/core/components/onboarding/Onboarding.tsx b/frontend/editor/src/core/components/onboarding/Onboarding.tsxindex 3e68ff92a9..197162da89 100644--- a/frontend/editor/src/core/components/onboarding/Onboarding.tsx+++ b/frontend/editor/src/core/components/onboarding/Onboarding.tsx@@ -24,7 +24,6 @@ import ToolPanelModePrompt from "@app/components/tools/ToolPanelModePrompt";import { useTourOrchestration } from "@app/contexts/TourOrchestrationContext";import { useAdminTourOrchestration } from "@app/contexts/AdminTourOrchestrationContext";import { getTourSteps } from "@app/components/onboarding/tourRegistry";-import { removeAllGlows } from "@app/components/onboarding/tourGlow";import { useFilesModalContext } from "@app/contexts/FilesModalContext";import { useServerExperience } from "@app/hooks/useServerExperience";import "@app/components/onboarding/OnboardingTour.css";@@ -162,11 +161,6 @@ export default function Onboarding() {}}, [externalTourRequested, requestedTourType, actions, clearTourRequest]);- useEffect(() => {- if (!isTourOpen) removeAllGlows();- return () => removeAllGlows();- }, [isTourOpen]);-const finishTour = useCallback(() => {setIsTourOpen(false);if (runtimeState.tourType === "admin") {diff --git a/frontend/editor/src/core/components/onboarding/OnboardingTour.css b/frontend/editor/src/core/components/onboarding/OnboardingTour.cssindex a689b9f3f4..690e5b909c 100644--- a/frontend/editor/src/core/components/onboarding/OnboardingTour.css+++ b/frontend/editor/src/core/components/onboarding/OnboardingTour.css@@ -7,39 +7,11 @@filter: drop-shadow(0 0 10px var(--mantine-primary-color-filled));}-/* Add glowing border to navigation items during admin tour */-.modal-nav-item.tour-nav-glow {- position: relative;- box-shadow:- 0 0 0 2px var(--mantine-primary-color-filled),- 0 0 15px var(--mantine-primary-color-filled),- inset 0 0 15px color-mix(in srgb, var(--c-primary) 10%, transparent);- border-radius: 8px;-}--@keyframes pulse-glow {- 0%,- 100% {- box-shadow:- 0 0 0 3px var(--mantine-primary-color-filled),- 0 0 20px var(--mantine-primary-color-filled),- inset 0 0 20px color-mix(in srgb, var(--c-primary) 10%, transparent);- }- 50% {- box-shadow:- 0 0 0 3px var(--mantine-primary-color-filled),- 0 0 30px var(--mantine-primary-color-filled),- inset 0 0 30px color-mix(in srgb, var(--c-primary) 20%, transparent);- }-}-/* RTL: mirror step indicator and controls in Reactour popovers */:root[dir="rtl"] .reactour__popover {direction: rtl;}-/* Minimal overrides retained for glow only */-:root[dir="rtl"] .reactour__badge {left: auto;right: 16px;diff --git a/frontend/editor/src/core/components/onboarding/OnboardingTour.tsx b/frontend/editor/src/core/components/onboarding/OnboardingTour.tsxindex 03059226a6..c6c6e1b339 100644--- a/frontend/editor/src/core/components/onboarding/OnboardingTour.tsx+++ b/frontend/editor/src/core/components/onboarding/OnboardingTour.tsx@@ -47,6 +47,117 @@ function TourContent({ forceOpen = false }: { forceOpen?: boolean }) {return null;}+// How long a target must hold still before the popover appears, and the+// longest a missing or ever-moving target can hold the popover back.+const SETTLE_MS = 150;+const MAX_SETTLE_MS = 1500;++function measureStep(step: StepType): DOMRect | null {+ const selectors = step.highlightedSelectors?.length+ ? step.highlightedSelectors+ : typeof step.selector === "string"+ ? [step.selector]+ : [];+ let union: DOMRect | null = null;+ for (const selector of selectors) {+ const rect = document.querySelector(selector)?.getBoundingClientRect();+ if (!rect || (rect.width === 0 && rect.height === 0)) continue;+ union = union+ ? new DOMRect(+ Math.min(union.left, rect.left),+ Math.min(union.top, rect.top),+ Math.max(union.right, rect.right) - Math.min(union.left, rect.left),+ Math.max(union.bottom, rect.bottom) - Math.min(union.top, rect.top),+ )+ : rect;+ }+ return union;+}++type TargetState = "settling" | "shown" | "missing";++const rectKey = (rect: DOMRect | null) =>+ rect+ ? `${Math.round(rect.left)},${Math.round(rect.top)},${Math.round(rect.width)},${Math.round(rect.height)}`+ : "";++/**+ * Keeps the highlight on the step's target while it moves. Reactour measures+ * once per step and again only on window resize, so a modal still sliding in,+ * a lazily mounted tool section or a target that renders a beat late leaves the+ * highlight on a stale rect, over a neighbouring control. This re-measures every frame and,+ * when the target moves, re-renders the tour (which re-queries the selector)+ * and fires a resize (which re-reads the rect of an element it already has).+ */+function TargetTracker({+ onStateChange,+}: {+ onStateChange: (state: TargetState) => void;+}) {+ const { currentStep, steps, setMeta } = useTour();+ const step = steps[currentStep];++ // Layout effect: the popover must be hidden before the new step's first paint.+ React.useLayoutEffect(() => {+ if (!step) return;+ let reported: TargetState = "settling";+ onStateChange(reported);+ const startedAt = performance.now();+ let lastKey: string | null = null;+ let stableSince = startedAt;+ let resizePending = false;+ let scrolled = false;+ let settled = false;+ let frame = 0;++ const tick = (now: number) => {+ if (resizePending) {+ resizePending = false;+ window.dispatchEvent(new Event("resize"));+ }+ const rect = measureStep(step);+ if (rect && !scrolled) {+ scrolled = true;+ const offscreen = rect.top < 0 || rect.bottom > window.innerHeight;+ if (offscreen && rect.height < window.innerHeight) {+ const first = step.highlightedSelectors?.[0] ?? step.selector;+ const target =+ typeof first === "string" ? document.querySelector(first) : first;+ target?.scrollIntoView({ block: "nearest", behavior: "instant" });+ }+ }+ const key = rectKey(rect);+ if (key !== lastKey) {+ lastKey = key;+ stableSince = now;+ setMeta?.(`${currentStep}:${key}`);+ resizePending = true;+ }+ if (+ !settled &&+ ((key && now - stableSince >= SETTLE_MS) ||+ now - startedAt >= MAX_SETTLE_MS)+ ) {+ settled = true;+ }+ const state: TargetState = !settled+ ? "settling"+ : key+ ? "shown"+ : "missing";+ if (state !== reported) {+ reported = state;+ onStateChange(state);+ }+ frame = requestAnimationFrame(tick);+ };+ frame = requestAnimationFrame(tick);+ return () => cancelAnimationFrame(frame);+ }, [step, currentStep, setMeta, onStateChange]);++ return null;+}+interface AdvanceArgs {setCurrentStep: (value: number | ((prev: number) => number)) => void;currentStep: number;@@ -80,8 +191,15 @@ export default function OnboardingTour({onClose,dimBackground = true,}: OnboardingTourProps) {+ const [targetState, setTargetState] = React.useState<TargetState>("settling");+if (!isOpen) return null;+ // The highlight glides between steps; the popover fades in place once its+ // target holds still, rather than sliding across the screen from the last step.+ const highlightTransition =+ "x 0.25s ease, y 0.25s ease, width 0.25s ease, height 0.25s ease";+return (<TourProviderkey={`${tourType}-${i18n.language}`}@@ -112,6 +230,16 @@ export default function OnboardingTour({padding: "20px",boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",maxWidth: "400px",+ opacity: targetState === "settling" ? 0 : 1,+ transition:+ targetState === "settling" ? "none" : "opacity 0.18s ease",+ // A step whose target never rendered (a section this server does not+ // offer) would otherwise be placed against a zero rect at the corner.+ ...(targetState === "missing" && {+ top: "50%",+ left: "50%",+ transform: "translate(-50%, -50%)",+ }),}),maskWrapper: (base) => ({...base,@@ -121,6 +249,15 @@ export default function OnboardingTour({maskArea: (base) => ({...base,rx: 8,+ transition: highlightTransition,+ ...(targetState === "missing" && { display: "none" }),+ }),+ // Replaces reactour's own highlightedArea style, which is what shows the+ // rect when interaction is disabled; this tour always disables it.+ highlightedArea: (base) => ({+ ...base,+ display: targetState === "missing" ? "none" : "block",+ transition: highlightTransition,}),badge: (base) => ({...base,@@ -191,6 +328,7 @@ export default function OnboardingTour({}}><TourContent forceOpen={true} />+ <TargetTracker onStateChange={setTargetState} /></TourProvider>);}diff --git a/frontend/editor/src/core/components/onboarding/adminStepsConfig.ts b/frontend/editor/src/core/components/onboarding/adminStepsConfig.tsindex 7b21e50454..341a0fa47f 100644--- a/frontend/editor/src/core/components/onboarding/adminStepsConfig.ts+++ b/frontend/editor/src/core/components/onboarding/adminStepsConfig.ts@@ -1,10 +1,7 @@import type { StepType } from "@reactour/tour";import type { TFunction } from "i18next";import {- addGlowToElements,- removeAllGlows,-} from "@app/components/onboarding/tourGlow";-import {+ besideCentered,waitForElement,waitForHighlightable,} from "@app/components/onboarding/tourUtils";@@ -33,31 +30,21 @@ interface CreateAdminStepsConfigArgs {actions: AdminStepActions;}-// Delay before applying glow so the target section has mounted after navigation.-const GLOW_DELAY_MS = 100;-/**- * Declarative spec for an admin tour step. Most steps do the same thing —- * clear existing glows, navigate to a settings section, then glow a set of nav- * items — so that behaviour is expressed as data (`section` + `glow`) and the- * runner below turns it into the reactour enter/after hooks. This replaces the- * removeGlow→navigate→setTimeout→addGlow block that was previously copy-pasted- * into every step.+ * Declarative spec for an admin tour step. Most steps open a settings section+ * and point at its nav row, so that is expressed as data (`section`) and the+ * runner below turns it into the reactour enter/after hooks.*/interface AdminStepSpec {step: AdminTourStep;selector: string;contentKey: string;contentDefault: string;- position: StepType["position"];+ position?: StepType["position"];padding?: number;highlightedSelectors?: string[];- /** Navigate to this settings section on enter (clears glows first). */+ /** Navigate to this settings section on enter. */section?: string;- /** Selectors to glow shortly after navigating to `section`. */- glow?: string[];- /** Clear glows on enter without navigating (settings-overview step). */- clearGlowOnEnter?: boolean;/** Save admin/workbench state on enter (first step). */saveStateOnEnter?: boolean;/** Open the config modal after this step (config-button step). */@@ -68,29 +55,8 @@ interface AdminStepSpec {waitForSelectorOnEnter?: boolean;}-const NAV = {- users: [- '[data-tour="admin-users-nav"]',- '[data-tour="settings-content-area"]',- ],- adminGeneral: [- '[data-tour="admin-adminGeneral-nav"]',- '[data-tour="settings-content-area"]',- ],- adminAdvanced: [- '[data-tour="admin-adminAdvanced-nav"]',- '[data-tour="settings-content-area"]',- ],- adminSecurity: [- '[data-tour="admin-adminSecurity-nav"]',- '[data-tour="settings-content-area"]',- ],- adminTools: [- '[data-tour="admin-adminAudit-nav"]',- '[data-tour="admin-adminUsage-nav"]',- '[data-tour="settings-content-area"]',- ],-} as const;+// Nav rows sit flush in a narrow rail; a wider ring overlaps their neighbours.+const NAV_PADDING = 4;const ADMIN_STEP_SPECS: AdminStepSpec[] = [{@@ -99,7 +65,7 @@ const ADMIN_STEP_SPECS: AdminStepSpec[] = [contentKey: "adminOnboarding.welcome",contentDefault:"Welcome to the <strong>Admin Tour</strong>! Let's explore the powerful enterprise features and settings available to system administrators.",- position: "right",+ padding: NAV_PADDING,saveStateOnEnter: true,},{@@ -108,7 +74,7 @@ const ADMIN_STEP_SPECS: AdminStepSpec[] = [contentKey: "adminOnboarding.configButton",contentDefault:"Open <strong>Settings</strong> to access all system configuration and administrative controls.",- position: "right",+ padding: NAV_PADDING,openConfigAfter: true,},{@@ -117,9 +83,7 @@ const ADMIN_STEP_SPECS: AdminStepSpec[] = [contentKey: "adminOnboarding.settingsOverview",contentDefault:"This is the <strong>Settings Panel</strong>. Admin settings are organised by category for easy navigation.",- position: "right",padding: 0,- clearGlowOnEnter: true,},{step: AdminTourStep.TEAMS_AND_USERS,@@ -127,10 +91,8 @@ const ADMIN_STEP_SPECS: AdminStepSpec[] = [contentKey: "adminOnboarding.teamsAndUsers",contentDefault:"Manage <strong>Teams</strong> and individual users here. You can invite new users via email, shareable links, or create custom accounts for them yourself.",- position: "right",+ padding: NAV_PADDING,section: "users",- glow: [...NAV.users],- highlightedSelectors: [...NAV.users],},{step: AdminTourStep.SYSTEM_CUSTOMIZATION,@@ -138,21 +100,17 @@ const ADMIN_STEP_SPECS: AdminStepSpec[] = [contentKey: "adminOnboarding.systemCustomization",contentDefault:"We have extensive ways to customise the UI: <strong>System Settings</strong> let you change the app name and languages, <strong>Features</strong> allows server certificate management, and <strong>Endpoints</strong> lets you enable or disable specific tools for your users.",- position: "right",+ padding: NAV_PADDING,section: "adminGeneral",- glow: [...NAV.adminGeneral],- highlightedSelectors: [...NAV.adminGeneral],},{step: AdminTourStep.DATABASE_SECTION,- selector: '[data-tour="admin-adminAdvanced-nav"]',+ selector: '[data-tour="admin-adminDatabase-nav"]',contentKey: "adminOnboarding.databaseSection",contentDefault:"For advanced production environments, we have settings to allow <strong>external database hookups</strong> so you can integrate with your existing infrastructure.",- position: "right",- section: "adminAdvanced",- glow: [...NAV.adminAdvanced],- highlightedSelectors: [...NAV.adminAdvanced],+ padding: NAV_PADDING,+ section: "adminDatabase",},{step: AdminTourStep.CONNECTIONS_SECTION,@@ -160,10 +118,8 @@ const ADMIN_STEP_SPECS: AdminStepSpec[] = [contentKey: "adminOnboarding.connectionsSection",contentDefault:"The <strong>Connections</strong> section supports various login methods including custom SSO and SAML providers like Google and GitHub, plus email integrations for notifications and communications.",- position: "right",+ padding: NAV_PADDING,section: "adminSecurity",- glow: [...NAV.adminSecurity],- highlightedSelectors: [...NAV.adminSecurity],scrollToAfter: "adminAudit",},{@@ -172,10 +128,12 @@ const ADMIN_STEP_SPECS: AdminStepSpec[] = [contentKey: "adminOnboarding.adminTools",contentDefault:"Finally, we have advanced administration tools like <strong>Auditing</strong> to track system activity and <strong>Usage Analytics</strong> to monitor how your users interact with the platform.",- position: "right",+ padding: NAV_PADDING,section: "adminAudit",- glow: [...NAV.adminTools],- highlightedSelectors: [...NAV.adminTools],+ highlightedSelectors: [+ '[data-tour="admin-adminAudit-nav"]',+ '[data-tour="admin-adminUsage-nav"]',+ ],},{step: AdminTourStep.WRAP_UP,@@ -183,7 +141,7 @@ const ADMIN_STEP_SPECS: AdminStepSpec[] = [contentKey: "adminOnboarding.wrapUp",contentDefault:"That's the admin tour! You've seen the enterprise features that make Stirling PDF a powerful, customisable solution for organisations. You can replay it anytime — just open <strong>Settings</strong> and find it here under <strong>About</strong>.",- position: "right",+ padding: NAV_PADDING,section: "about",waitForSelectorOnEnter: true,},@@ -204,7 +162,7 @@ export function createAdminStepsConfig({const step: StepType = {selector: spec.selector,content: t(spec.contentKey, spec.contentDefault),- position: spec.position,+ position: spec.position ?? besideCentered,padding: spec.padding ?? 10,};if (spec.highlightedSelectors) {@@ -212,22 +170,11 @@ export function createAdminStepsConfig({}const hasEnter =- spec.saveStateOnEnter ||- spec.clearGlowOnEnter ||- !!spec.section ||- spec.waitForSelectorOnEnter;+ spec.saveStateOnEnter || !!spec.section || spec.waitForSelectorOnEnter;if (hasEnter) {step.action = async () => {if (spec.saveStateOnEnter) saveAdminState();- if (spec.clearGlowOnEnter) removeAllGlows();- if (spec.section) {- removeAllGlows();- navigateToSection(spec.section);- if (spec.glow) {- const glow = spec.glow;- setTimeout(() => addGlowToElements(glow), GLOW_DELAY_MS);- }- }+ if (spec.section) navigateToSection(spec.section);if (spec.waitForSelectorOnEnter) {await waitForElement(spec.selector, 5000);await waitForHighlightable(spec.selector, 5000);diff --git a/frontend/editor/src/core/components/onboarding/tourGlow.ts b/frontend/editor/src/core/components/onboarding/tourGlow.tsdeleted file mode 100644index e2383734db..0000000000--- a/frontend/editor/src/core/components/onboarding/tourGlow.ts+++ /dev/null@@ -1,21 +0,0 @@-export const addGlowToElements = (selectors: string[]) => {- selectors.forEach((selector) => {- const element = document.querySelector(selector);- if (element) {- if (selector === '[data-tour="settings-content-area"]') {- element.classList.add("tour-content-glow");- } else {- element.classList.add("tour-nav-glow");- }- }- });-};--export const removeAllGlows = () => {- document- .querySelectorAll(".tour-content-glow")- .forEach((el) => el.classList.remove("tour-content-glow"));- document- .querySelectorAll(".tour-nav-glow")- .forEach((el) => el.classList.remove("tour-nav-glow"));-};diff --git a/frontend/editor/src/core/components/onboarding/tourUtils.test.ts b/frontend/editor/src/core/components/onboarding/tourUtils.test.tsindex 6709d8fc87..90a5c226b9 100644--- a/frontend/editor/src/core/components/onboarding/tourUtils.test.ts+++ b/frontend/editor/src/core/components/onboarding/tourUtils.test.ts@@ -1,5 +1,7 @@import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import {+ besideCentered,+ insideBottom,revealPickerTool,waitForElement,waitForHighlightable,@@ -88,7 +90,7 @@ describe("tourUtils", () => {expect(scrollIntoViewSpy).toHaveBeenCalledWith({block: "center",- behavior: "smooth",+ behavior: "instant",});});@@ -128,7 +130,7 @@ describe("tourUtils", () => {expect(mountedButton).not.toBeNull();expect(mountedButton?.scrollIntoView).toHaveBeenCalledWith({block: "center",- behavior: "smooth",+ behavior: "instant",});expect(scrollCount).toBeGreaterThanOrEqual(2);});@@ -139,4 +141,59 @@ describe("tourUtils", () => {).resolves.toBeUndefined();});});++ // width/height are the popover's; top/left/right/bottom are the target's.+ const placement = (target: {+ top: number;+ left: number;+ right: number;+ bottom: number;+ }) => ({+ ...target,+ width: 400,+ height: 160,+ windowWidth: 1440,+ windowHeight: 900,+ x: target.left,+ y: target.top,+ });+ const prevRect = { width: 400, height: 160 } as Parameters<+ typeof besideCentered+ >[1];++ describe("besideCentered", () => {+ it("sits left of a right-hand panel, centred on it", () => {+ const tools = placement({ top: 0, left: 1144, right: 1440, bottom: 900 });+ expect(besideCentered(tools, prevRect)).toEqual([728, 370]);+ });++ it("sits right of a left-hand nav row, clamped inside the window", () => {+ const row = placement({ top: 860, left: 56, right: 319, bottom: 892 });+ expect(besideCentered(row, prevRect)).toEqual([335, 732]);+ });++ it("falls back inside the bottom when neither side has room", () => {+ const workbench = placement({+ top: 0,+ left: 308,+ right: 1144,+ bottom: 900,+ });+ expect(besideCentered(workbench, prevRect)).toEqual(+ insideBottom(workbench, prevRect),+ );+ });+ });++ describe("insideBottom", () => {+ it("centres horizontally on the target, above its visible bottom", () => {+ const workbench = placement({+ top: 0,+ left: 308,+ right: 1144,+ bottom: 1200,+ });+ expect(insideBottom(workbench, prevRect)).toEqual([526, 716]);+ });+ });});diff --git a/frontend/editor/src/core/components/onboarding/tourUtils.ts b/frontend/editor/src/core/components/onboarding/tourUtils.tsindex 370e38107c..1edb264dbd 100644--- a/frontend/editor/src/core/components/onboarding/tourUtils.ts+++ b/frontend/editor/src/core/components/onboarding/tourUtils.ts@@ -1,3 +1,5 @@+import type { StepType } from "@reactour/tour";+/*** Waits for a CSS selector to appear in the DOM using MutationObserver.* Resolves immediately if already present; resolves after timeoutMs if it@@ -55,7 +57,7 @@ export async function revealPickerTool(const existing = document.querySelector<HTMLElement>(selector);if (existing && existing.getClientRects().length > 0) {- existing.scrollIntoView({ block: "center", behavior: "smooth" });+ existing.scrollIntoView({ block: "center", behavior: "instant" });await waitForHighlightable(selector, timeoutMs);return;}@@ -70,7 +72,7 @@ export async function revealPickerTool(for (let step = 0; step < maxSteps; step += 1) {const found = document.querySelector<HTMLElement>(selector);if (found) {- found.scrollIntoView({ block: "center", behavior: "smooth" });+ found.scrollIntoView({ block: "center", behavior: "instant" });await waitForHighlightable(selector, timeoutMs);return;}@@ -91,7 +93,7 @@ export async function revealPickerTool(const finalFound = document.querySelector<HTMLElement>(selector);if (finalFound) {- finalFound.scrollIntoView({ block: "center", behavior: "smooth" });+ finalFound.scrollIntoView({ block: "center", behavior: "instant" });}await waitForHighlightable(selector, timeoutMs);@@ -165,3 +167,43 @@ export function waitForHighlightable(mutationObserver.observe(document.body, { childList: true, subtree: true });});}++type PopoverPlacement = Extract<+ NonNullable<StepType["position"]>,+ (...args: never[]) => unknown+>;++// Reactour hands a position function the popover's own width and height, and+// the target's padded edges as top/left/right/bottom.+const POPOVER_GAP = 16;++/**+ * Places the popover inside the bottom of a target too large to sit beside, so+ * it covers the least of what the step is pointing at.+ */+export const insideBottom: PopoverPlacement = (props) => [+ Math.max(8, (props.left + props.right) / 2 - props.width / 2),+ Math.max(8, Math.min(props.bottom, props.windowHeight) - props.height - 24),+];++/**+ * Beside a tall target on whichever side has room, centred on the visible part+ * of it. Reactour's own left/right align to the target's top, which for a+ * full-height panel pins the popover to a corner of the screen.+ */+export const besideCentered: PopoverPlacement = (props, prevRect) => {+ const fitsLeft = props.left >= props.width + POPOVER_GAP;+ const fitsRight =+ props.windowWidth - props.right >= props.width + POPOVER_GAP;+ if (!fitsLeft && !fitsRight) return insideBottom(props, prevRect);+ const roomLeft = props.left;+ const roomRight = props.windowWidth - props.right;+ const x =+ fitsLeft && (roomLeft >= roomRight || !fitsRight)+ ? props.left - props.width - POPOVER_GAP+ : props.right + POPOVER_GAP;+ const visibleTop = Math.max(props.top, 0);+ const visibleBottom = Math.min(props.bottom, props.windowHeight);+ const y = (visibleTop + visibleBottom) / 2 - props.height / 2;+ return [x, Math.min(Math.max(8, y), props.windowHeight - props.height - 8)];+};diff --git a/frontend/editor/src/core/components/onboarding/userStepsConfig.ts b/frontend/editor/src/core/components/onboarding/userStepsConfig.tsindex c23f1fa5e3..8984f018da 100644--- a/frontend/editor/src/core/components/onboarding/userStepsConfig.ts+++ b/frontend/editor/src/core/components/onboarding/userStepsConfig.ts@@ -1,6 +1,8 @@import type { StepType } from "@reactour/tour";import type { TFunction } from "i18next";import {+ besideCentered,+ insideBottom,revealPickerTool,waitForElement,waitForHighlightable,@@ -69,7 +71,7 @@ export function createUserStepsConfig({"onboarding.allTools","This is the <strong>Tools</strong> panel, where you can browse and select from all available PDF tools.",),- position: "center",+ position: besideCentered,padding: 0,action: () => {saveWorkbenchState();@@ -83,7 +85,6 @@ export function createUserStepsConfig({"onboarding.selectCropTool","Let's select the <strong>Crop</strong> tool to demonstrate how to use one of the tools.",),- position: "right",padding: 0,action: async () => {await revealPickerTool('[data-tour="tool-button-crop"]');@@ -96,7 +97,7 @@ export function createUserStepsConfig({"onboarding.toolInterface","This is the <strong>Crop</strong> tool interface. As you can see, there's not much there because we haven't added any PDF files to work with yet.",),- position: "center",+ position: besideCentered,padding: 0,},[TourStep.FILES_BUTTON]: {@@ -106,20 +107,24 @@ export function createUserStepsConfig({"The <strong>Files</strong> button on the Quick Access bar allows you to upload PDFs to use the tools on.",),position: "right",- padding: 10,+ padding: 4,actionAfter: () => openFilesModal(),},[TourStep.FILE_SOURCES]: {- selector: '[data-tour="files-modal"]',+ selector: '[data-tour="file-sources"]',+ highlightedSelectors: [+ '[data-tour="file-sources"]',+ '[data-tour="files-modal"] .files-page-view-tabs',+ ],content: t("onboarding.fileSources","You can upload new files or access recent files from here. For the tour, we'll just use a sample file.",),- position: "right",- padding: 0,+ position: "bottom",+ padding: 6,action: async () => {- await waitForElement('[data-tour="files-modal"]', 5000);- await waitForHighlightable('[data-tour="files-modal"]', 5000);+ await waitForElement('[data-tour="file-sources"]', 5000);+ await waitForHighlightable('[data-tour="file-sources"]', 5000);},actionAfter: () => {loadSampleFile();@@ -132,7 +137,7 @@ export function createUserStepsConfig({"onboarding.workbench","This is the <strong>Workbench</strong> - the main area where you view and edit your PDFs.",),- position: "center",+ position: insideBottom,padding: 0,},[TourStep.ACTIVE_FILES]: {@@ -141,7 +146,7 @@ export function createUserStepsConfig({"onboarding.activeFiles","The <strong>Active Files</strong> view shows all of the PDFs you have loaded into the tool.",),- position: "center",+ position: insideBottom,padding: 0,action: () => switchToActiveFiles(),},@@ -151,8 +156,7 @@ export function createUserStepsConfig({"onboarding.fileCheckbox","Files on the workbench are selected for processing. You can select multiple files for batch operations using the left files sidebar.",),- position: "top",- padding: 10,+ padding: 6,},[TourStep.CROP_SETTINGS]: {selector: '[data-tour="crop-settings"]',@@ -160,8 +164,8 @@ export function createUserStepsConfig({"onboarding.cropSettings","Now that we've selected the file we want crop, we can configure the <strong>Crop</strong> tool to choose the area that we want to crop the PDF to.",),- position: "left",- padding: 10,+ position: besideCentered,+ padding: 6,action: () => modifyCropSettings(),},[TourStep.RUN_BUTTON]: {@@ -171,7 +175,7 @@ export function createUserStepsConfig({"Once the tool has been configured, this button allows you to run the tool on all the selected PDFs.",),position: "top",- padding: 10,+ padding: 6,actionAfter: () => executeTool(),},[TourStep.RESULTS]: {@@ -180,7 +184,7 @@ export function createUserStepsConfig({"onboarding.results","After the tool has finished running, the <strong>Review</strong> step will show a preview of the results in this panel, and allow you to undo the operation or download the file. ",),- position: "center",+ position: besideCentered,padding: 0,},[TourStep.FILE_REPLACEMENT]: {@@ -189,8 +193,7 @@ export function createUserStepsConfig({"onboarding.fileReplacement","The modified file will replace the original file in the Workbench automatically, allowing you to easily run it through more tools.",),- position: "left",- padding: 10,+ padding: 6,},[TourStep.PIN_BUTTON]: {selector: '[data-tour="file-card-pin"]',@@ -199,22 +202,21 @@ export function createUserStepsConfig({"You can use the <strong>Pin</strong> button if you'd rather your files stay active after running tools on them.",),position: "left",- padding: 10,+ padding: 4,action: () => revealFileCardHoverMenu(),actionAfter: () => pinFile(),},[TourStep.WRAP_UP]: {- selector: '[data-tour="settings-modal"]',+ selector: '[data-tour="settings-tours"]',content: t("onboarding.wrapUp","You're all set! You can replay this tour anytime — just open <strong>Settings</strong> and find it here in the <strong>Tours</strong> section under Help.",),- position: "center",- padding: 0,+ padding: 6,action: async () => {openSettingsHelpSection();- await waitForElement('[data-tour="settings-modal"]', 5000);- await waitForHighlightable('[data-tour="settings-modal"]', 5000);+ await waitForElement('[data-tour="settings-tours"]', 5000);+ await waitForHighlightable('[data-tour="settings-tours"]', 5000);},},};diff --git a/frontend/editor/src/core/components/onboarding/whatsNewStepsConfig.ts b/frontend/editor/src/core/components/onboarding/whatsNewStepsConfig.tsindex a5ba0b8c33..31e594d2d9 100644--- a/frontend/editor/src/core/components/onboarding/whatsNewStepsConfig.ts+++ b/frontend/editor/src/core/components/onboarding/whatsNewStepsConfig.ts@@ -1,6 +1,7 @@import type { StepType } from "@reactour/tour";import type { TFunction } from "i18next";import {+ besideCentered,waitForElement,waitForHighlightable,} from "@app/components/onboarding/tourUtils";@@ -53,8 +54,8 @@ export function createWhatsNewStepsConfig({"onboarding.whatsNew.quickAccess","Start at the <strong>Quick Access</strong> rail to jump between Reader, Automate, your files, and all the tours.",),- position: "right",- padding: 10,+ position: besideCentered,+ padding: 0,action: () => {saveWorkbenchState();closeFilesModal();@@ -67,7 +68,7 @@ export function createWhatsNewStepsConfig({"onboarding.whatsNew.leftPanel","The left <strong>Tools</strong> panel lists everything you can do. Browse categories or search to find a tool quickly.",),- position: "center",+ position: besideCentered,padding: 0,},[WhatsNewTourStep.FILE_UPLOAD]: {@@ -77,7 +78,7 @@ export function createWhatsNewStepsConfig({"Use the <strong>Files</strong> button to upload or pick a recent PDF. We will load a sample so you can see the workspace.",),position: "right",- padding: 10,+ padding: 4,actionAfter: async () => {openFilesModal();await waitForElement('[data-tour="file-sources"]', 5000);@@ -96,7 +97,7 @@ export function createWhatsNewStepsConfig({"The top bar lets you swap between <strong>Viewer</strong>, <strong>Page Editor</strong>, and <strong>Active Files</strong>.",),position: "bottom",- padding: 8,+ padding: 4,// Ensure the switcher has mounted before this step rendersaction: async () => {switchToViewer();@@ -111,7 +112,7 @@ export function createWhatsNewStepsConfig({"Switch to the Page Editor to reorder, rotate, or delete pages.",),position: "bottom",- padding: 8,+ padding: 4,action: async () => {switchToPageEditor();await waitForElement('[data-tour="view-switcher"]', 7000);@@ -125,7 +126,7 @@ export function createWhatsNewStepsConfig({"Use Active Files to see everything you have open and pick what to work on.",),position: "bottom",- padding: 8,+ padding: 4,action: async () => {switchToActiveFiles();await waitForElement('[data-tour="view-switcher"]', 7000);@@ -139,7 +140,7 @@ export function createWhatsNewStepsConfig({"That is what is new in V2. Open the <strong>Tours</strong> menu anytime to replay this, the Tools tour, or the Admin tour.",),position: "right",- padding: 10,+ padding: 4,},};}diff --git a/frontend/editor/src/core/components/shared/config/configSections/HelpSection.tsx b/frontend/editor/src/core/components/shared/config/configSections/HelpSection.tsxindex d039c36a70..07e8aa24c4 100644--- a/frontend/editor/src/core/components/shared/config/configSections/HelpSection.tsx+++ b/frontend/editor/src/core/components/shared/config/configSections/HelpSection.tsx@@ -22,7 +22,7 @@ const HelpSection: React.FC<HelpSectionProps> = ({};return (- <Stack gap="lg">+ <Stack gap="lg" data-tour="settings-tours"><Paper withBorder p="md" radius="md"><Stack gap="md"><Group justify="space-between" align="center">diff --git a/frontend/editor/src/core/components/shared/quickNav/QuickNavRailHost.tsx b/frontend/editor/src/core/components/shared/quickNav/QuickNavRailHost.tsxindex f86a36721f..1dfd13baa1 100644--- a/frontend/editor/src/core/components/shared/quickNav/QuickNavRailHost.tsx+++ b/frontend/editor/src/core/components/shared/quickNav/QuickNavRailHost.tsx@@ -18,7 +18,6 @@ import { PORTAL_BASENAME } from "@app/routes/portalBasename";import { HAS_PORTAL } from "@app/routes/hasPortal";import { DOCS_PATH, HAS_DOCS } from "@app/routes/docsRoute";import { stripBasePath } from "@app/constants/app";-import { rememberSettingsOrigin } from "@app/utils/settingsNavigation";import { canCreateProcessingFolders } from "@app/hooks/useProcessingFolderCreation";import { requestProcessingFolderCreation } from "@app/utils/pendingProcessingFolderCreation";import { requestProcessorSignup } from "@app/services/processorSignup";@@ -283,7 +282,6 @@ export function QuickNavRailHost() {navigate(target, { replace: true });return;}- rememberSettingsOrigin();go(target);};diff --git a/frontend/editor/src/core/pages/HomePage.tsx b/frontend/editor/src/core/pages/HomePage.tsxindex 107b35d624..48c9dd9ec5 100644--- a/frontend/editor/src/core/pages/HomePage.tsx+++ b/frontend/editor/src/core/pages/HomePage.tsx@@ -43,7 +43,6 @@ import {} from "@app/utils/homePageNavigation";import { EDITOR_BASENAME } from "@app/routes/editorBasename";import { READER_PATH } from "@app/routes/readerRoute";-import { rememberSettingsOrigin } from "@app/utils/settingsNavigation";import { HomePageExtensions } from "@app/components/home/HomePageExtensions";import { PolicyAutoRunController } from "@app/components/policies/PolicyAutoRunController";import { usePoliciesEnabled } from "@app/components/policies/usePoliciesEnabled";@@ -154,9 +153,7 @@ export default function HomePage() {}}, [location.key, processingFolderCreation.open]);- // Settings is its own page; it restores the recorded origin on Back.const openSettings = useCallback(() => {- rememberSettingsOrigin();navigate("/settings");}, [navigate]);diff --git a/frontend/editor/src/core/pages/SettingsPage.tsx b/frontend/editor/src/core/pages/SettingsPage.tsxindex db3661b06a..4fd91a850b 100644--- a/frontend/editor/src/core/pages/SettingsPage.tsx+++ b/frontend/editor/src/core/pages/SettingsPage.tsx@@ -32,7 +32,6 @@ import { EDITOR_BASENAME } from "@app/routes/editorBasename";import { READER_PATH } from "@app/routes/readerRoute";import { usePreferences } from "@app/contexts/PreferencesContext";import { stripBasePath } from "@app/constants/app";-import { takeSettingsOrigin } from "@app/utils/settingsNavigation";import { Z_INDEX_OVER_CONFIG_MODAL } from "@app/styles/zIndex";import "@app/components/shared/config/settingsSections.css";import "@app/pages/SettingsPage.css";@@ -73,10 +72,10 @@ const SettingsPageInner: React.FC = () => {const [mobilePane, setMobilePane] = useState<"nav" | "content">(() =>sectionFromPath(window.location.pathname) ? "content" : "nav",);- // Leaving restores where the user came from (the editor, the processor,- // wherever) by replacement, or the editor for a deep link with no origin.+ // Always the editor, not where settings was opened from: the Help tours+ // walk the editor's own controls, which the reader and processor don't render.const leave = useCallback(() => {- navigate(takeSettingsOrigin() ?? EDITOR_BASENAME, { replace: true });+ navigate(EDITOR_BASENAME, { replace: true });}, [navigate]);const { sections, overlay, aliases, pending } = useSettingsNav(leave);@@ -202,7 +201,7 @@ const SettingsPageInner: React.FC = () => {const fullBleed = activeItem?.fullBleed ?? false;return (- <div className="settings-page" data-tour="settings-modal">+ <div className="settings-page"><QuickNavHostBridgerequestNavigation={requestNavigation}onGoToStartupView={goToStartupView}@@ -336,7 +335,6 @@ const SettingsPageInner: React.FC = () => {<divclassName="settings-page__main modal-content"- data-tour="settings-content-area"style={isMobile && mobilePane !== "content" ? { display: "none" } : undefined}diff --git a/frontend/editor/src/core/tests/stubbed/tour-onboarding.spec.ts b/frontend/editor/src/core/tests/stubbed/tour-onboarding.spec.tsindex 005fcbf922..0b6141c325 100644--- a/frontend/editor/src/core/tests/stubbed/tour-onboarding.spec.ts+++ b/frontend/editor/src/core/tests/stubbed/tour-onboarding.spec.ts@@ -182,9 +182,10 @@ test.describe("15.6 Tour selectors - config modal", () => {});});- test("settings-content-area is present", async ({ page }) => {+ test("settings-tours is present on About", async ({ page }) => {+ await page.goto("/settings/about", { waitUntil: "domcontentloaded" });await expect(- page.locator('[data-tour="settings-content-area"]').first(),+ page.locator('[data-tour="settings-tours"]').first(),).toBeVisible({ timeout: 10_000 });});});@@ -206,7 +207,7 @@ test.describe("15.7 Tour selectors - admin modal nav items", () => {const adminNavSections = ["users","adminGeneral",- "adminAdvanced",+ "adminDatabase","adminSecurity","adminAudit","adminUsage",diff --git a/frontend/editor/src/core/utils/settingsNavigation.ts b/frontend/editor/src/core/utils/settingsNavigation.tsindex a9c2bd70c2..224892c81e 100644--- a/frontend/editor/src/core/utils/settingsNavigation.ts+++ b/frontend/editor/src/core/utils/settingsNavigation.ts@@ -1,36 +1,6 @@import { NavKey } from "@app/components/shared/config/types";import { stripBasePath, withBasePath } from "@app/constants/app";-const ORIGIN_KEY = "stirling.settingsOrigin";--/**- * Record where the user is before they go to settings, so its Back control can- * restore that URL by replacement. Recorded rather than inferred: history.go(-1)- * is dropped by WebKit under load, and an entry made by pushState carries no- * router key to tell "came from the editor" apart from "opened a deep link".- * A no-op while already in settings, so tab switches keep the original origin.- */-export function rememberSettingsOrigin(): void {- const here = stripBasePath(window.location.pathname);- if (here.startsWith("/settings")) return;- try {- window.sessionStorage.setItem(ORIGIN_KEY, here + window.location.search);- } catch {- // Private mode or storage disabled: Back falls back to the editor.- }-}--/** The origin recorded by {@link rememberSettingsOrigin}, cleared on read. */-export function takeSettingsOrigin(): string | null {- try {- const origin = window.sessionStorage.getItem(ORIGIN_KEY);- window.sessionStorage.removeItem(ORIGIN_KEY);- return origin;- } catch {- return null;- }-}-/*** Go to the settings page from outside the router — modals, services, and* contexts that must keep working where no <Router> is mounted (portal unit@@ -41,7 +11,6 @@ export function takeSettingsOrigin(): string | null {* @param anchor scroll to and highlight this control, by its slug*/export function navigateToSettings(section?: NavKey, anchor?: string) {- rememberSettingsOrigin();const hash = anchor ? `#${encodeURIComponent(anchor)}` : "";const path = `/settings${section ? `/${section}` : ""}${hash}`;window.history.pushState({}, "", withBasePath(path));diff --git a/frontend/editor/src/saas/components/onboarding/OnboardingTour.tsx b/frontend/editor/src/saas/components/onboarding/OnboardingTour.tsxindex 05d68f9dd2..44f33146b6 100644--- a/frontend/editor/src/saas/components/onboarding/OnboardingTour.tsx+++ b/frontend/editor/src/saas/components/onboarding/OnboardingTour.tsx@@ -25,7 +25,6 @@ import { useTourOrchestration } from "@app/contexts/TourOrchestrationContext";import { useAdminTourOrchestration } from "@app/contexts/AdminTourOrchestrationContext";import { useFilesModalContext } from "@app/contexts/FilesModalContext";import { dispatchTourState } from "@app/constants/events";-import { removeAllGlows } from "@app/components/onboarding/tourGlow";import "@core/components/onboarding/OnboardingTour.css";export default function OnboardingTour() {@@ -56,11 +55,6 @@ export default function OnboardingTour() {}}, [tourRequested, requestedTourType, clearTourRequest]);- useEffect(() => {- if (!isOpen) removeAllGlows();- return () => removeAllGlows();- }, [isOpen]);-const tourSteps = useMemo<StepType[]>(() =>getTourSteps(tourType, {