Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat(desktop): create a better onboarding experience (#4495)

Elijah Potterb746572d7905
diff --git a/harper-desktop/package.json b/harper-desktop/package.json
index d7223ca54..396d8b8b5 100644
--- a/harper-desktop/package.json
+++ b/harper-desktop/package.json
@@ -16,6 +16,7 @@
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-autostart": "^2.5.1",
"@tauri-apps/plugin-opener": "^2",
+ "@tauri-apps/plugin-os": "~2.3.2",
"components": "workspace:*",
"harper-editor": "workspace:*",
"harper.js": "workspace:*"
diff --git a/harper-desktop/src/lib/settings/SettingsApp.svelte b/harper-desktop/src/lib/settings/SettingsApp.svelte
index f1e42c7da..b7e079154 100644
--- a/harper-desktop/src/lib/settings/SettingsApp.svelte
+++ b/harper-desktop/src/lib/settings/SettingsApp.svelte
@@ -14,12 +14,12 @@ import WeirpacksPage from './pages/WeirpacksPage.svelte';
import WritingPage from './pages/WritingPage.svelte';
import type { SectionId } from './settings-data';
-let active: SectionId = 'getting-started';
+let active: SectionId = 'general';
let contentEl: HTMLElement;
let isLoadingOnboarding = true;
+let onboardingCompleted = false;
const titleMap: Record<SectionId, string> = {
- 'getting-started': 'Getting Started',
general: 'General',
writing: 'Writing',
dictionary: 'Dictionary',
@@ -31,12 +31,12 @@ const titleMap: Record<SectionId, string> = {
};
onMount(() => {
- void loadInitialSection();
+ void loadOnboardingState();
});
-async function loadInitialSection() {
+async function loadOnboardingState() {
try {
- active = (await Client.getOnboardingCompleted()) ? 'general' : 'getting-started';
+ onboardingCompleted = await Client.getOnboardingCompleted();
} catch (error) {
console.error('Unable to load onboarding state.', error);
} finally {
@@ -51,32 +51,36 @@ $: if (contentEl && active) {
}
</script>
-<div class="settings-shell">
- {#if !isLoadingOnboarding}
+{#if isLoadingOnboarding}
+ <div class="settings-shell">
+ <main class="content" aria-label="Settings">
+ <p role="status">Loading settings...</p>
+ </main>
+ </div>
+{:else if !onboardingCompleted}
+ <GettingStartedPage onComplete={() => (onboardingCompleted = true)} />
+{:else}
+ <div class="settings-shell">
<SettingsSidebar bind:active />
- {/if}
- <main bind:this={contentEl} class="content" aria-label={isLoadingOnboarding ? "Settings" : title}>
- {#if isLoadingOnboarding}
- <p>Loading settings...</p>
- {:else if active === "getting-started"}
- <GettingStartedPage navigateToSection={(section) => (active = section)} />
- {:else if active === "general"}
- <GeneralPage />
- {:else if active === "writing"}
- <WritingPage />
- {:else if active === "dictionary"}
- <DictionaryPage />
- {:else if active === "shortcuts"}
- <ShortcutsPage />
- {:else if active === "rules"}
- <RulesPage />
- {:else if active === "weirpacks"}
- <WeirpacksPage />
- {:else if active === "integrations"}
- <IntegrationsPage />
- {:else if active === "about"}
- <AboutPage />
- {/if}
- </main>
-</div>
+ <main bind:this={contentEl} class="content" aria-label={title}>
+ {#if active === "general"}
+ <GeneralPage />
+ {:else if active === "writing"}
+ <WritingPage />
+ {:else if active === "dictionary"}
+ <DictionaryPage />
+ {:else if active === "shortcuts"}
+ <ShortcutsPage />
+ {:else if active === "rules"}
+ <RulesPage />
+ {:else if active === "weirpacks"}
+ <WeirpacksPage />
+ {:else if active === "integrations"}
+ <IntegrationsPage />
+ {:else if active === "about"}
+ <AboutPage />
+ {/if}
+ </main>
+ </div>
+{/if}
diff --git a/harper-desktop/src/lib/settings/SettingsSidebar.svelte b/harper-desktop/src/lib/settings/SettingsSidebar.svelte
index ad5353cfb..155b291ed 100644
--- a/harper-desktop/src/lib/settings/SettingsSidebar.svelte
+++ b/harper-desktop/src/lib/settings/SettingsSidebar.svelte
@@ -8,12 +8,10 @@ import {
KeyIcon,
PackageIcon,
QuillIcon,
- RocketIcon,
} from 'components';
import { FOOTER_NAV_ITEMS, MAIN_NAV_ITEMS, type SectionId } from './settings-data';
-const SECTION_ICONS: Record<SectionId, typeof RocketIcon> = {
- 'getting-started': RocketIcon,
+const SECTION_ICONS: Record<SectionId, typeof GearIcon> = {
general: GearIcon,
writing: QuillIcon,
dictionary: BookIcon,
@@ -25,7 +23,6 @@ const SECTION_ICONS: Record<SectionId, typeof RocketIcon> = {
};
export let active: SectionId;
-export let hasSetupAlert = false;
</script>
<nav class="sidebar" aria-label="Settings sections">
@@ -41,9 +38,6 @@ export let hasSetupAlert = false;
<svelte:component this={SECTION_ICONS[item.id]} className="settings-icon" />
</span>
<span class="label">{item.label}</span>
- {#if item.id === "getting-started" && hasSetupAlert}
- <span class="alert" aria-label="Action needed"></span>
- {/if}
</button>
{/each}
</div>
@@ -141,18 +135,4 @@ export let hasSetupAlert = false;
text-overflow: ellipsis;
white-space: nowrap;
}
-
- .alert {
- width: 7px;
- height: 7px;
- flex: 0 0 7px;
- border-radius: 999px;
- background: #d93920;
- box-shadow: 0 0 0 2px rgba(217, 57, 32, 0.18);
- }
-
- .selected .alert {
- background: #fff;
- box-shadow: none;
- }
</style>
diff --git a/harper-desktop/src/lib/settings/pages/GettingStartedPage.svelte b/harper-desktop/src/lib/settings/pages/GettingStartedPage.svelte
index 07f9fa283..034374c1e 100644
--- a/harper-desktop/src/lib/settings/pages/GettingStartedPage.svelte
+++ b/harper-desktop/src/lib/settings/pages/GettingStartedPage.svelte
@@ -1,29 +1,53 @@
<script lang="ts">
-import { Button, CheckIcon } from 'components';
+import { isTauri } from '@tauri-apps/api/core';
+import { platform } from '@tauri-apps/plugin-os';
+import { Button, SlideDeck } from 'components';
import { onMount } from 'svelte';
import { type AccessibilityPermissionStatus, Client, type Integration } from '$lib/client';
import AppIcon from '../components/AppIcon.svelte';
-import type { SectionId } from '../settings-data';
-type SetupStep = {
- id: 'accessibility' | 'integration' | 'test-drive';
+/** Slide identities determine setup gates; only the welcome and test drive need no action. */
+type OnboardingSlide = {
+ id: 'welcome' | 'accessibility' | 'integration' | 'test-drive' | 'ready';
title: string;
- desc: string;
- required: boolean;
- done: boolean;
- locked: boolean;
- actionLabel: string;
- actionVariant: 'default' | 'primary';
- action: () => void | Promise<void>;
- actionDisabled?: boolean;
+ lede: string;
};
-export let navigateToSection: (section: SectionId) => void;
-
+const allSlides: OnboardingSlide[] = [
+ {
+ id: 'welcome',
+ title: 'Welcome',
+ lede: "Before you can start writing with Harper, we need to do a little housekeeping.\n\nDon't worry, this should only take a minute.",
+ },
+ {
+ id: 'accessibility',
+ title: 'Accessibility',
+ lede: 'To be able to read and write text to your favorite text editors, you need to grant Harper the permission to do so.\n\nNone of your text will leave your device.',
+ },
+ {
+ id: 'integration',
+ title: 'Enable TextEdit',
+ lede: 'The Harper community is constantly adding support for new text editors. If we haven\'t marked a text editor as "supported" already, you can override this option yourself.\n\nLet\'s try that now. Go ahead and enable "TextEdit". Once you do, Harper will start checking your grammar in that app.',
+ },
+ {
+ id: 'test-drive',
+ title: 'Try Harper',
+ lede: 'Now that you\'ve enabled TextEdit, go ahead and open it. Write something like, "This is an test."\n\nYou should see Harper jump in to fix that mistake.',
+ },
+ {
+ id: 'ready',
+ title: 'Ready',
+ lede: "Okay! Now we're ready to go.\n\nDon't let your dreams be dreams. Write anything, anywhere and Harper will be there to catch your mistakes.",
+ },
+];
+
+export let onComplete: () => void;
+
+let step = 0;
+let isMacOS = false;
let accessibilityStatus: AccessibilityPermissionStatus | null = null;
-let accessibilityError = '';
-let isCheckingAccessibility = true;
-let isRequestingAccessibility = false;
+let setupError = '';
+let isPreparingService = true;
let hasRequestedAccessibility = false;
let integrations: Integration[] = [];
let integrationsError = '';
@@ -34,31 +58,34 @@ let testDriveError = '';
let isCompletingOnboarding = false;
let onboardingError = '';
+$: slides = allSlides.filter((slide) => slide.id !== 'accessibility' || isMacOS);
$: textEditIntegration = integrations.find((item) => item.bundle_id === 'com.apple.TextEdit');
$: isTextEditEnabled = textEditIntegration?.enabled === true;
-
-$: setupSteps = buildSetupSteps(
- accessibilityStatus,
- isCheckingAccessibility,
- isRequestingAccessibility,
- hasRequestedAccessibility,
- isTextEditEnabled,
- isLoadingIntegrations,
- isEnablingTextEdit,
- isLaunchingTextEdit,
-);
-$: requiredSetupSteps = setupSteps.filter((step) => step.required);
-$: setupCompletedCount = requiredSetupSteps.filter((step) => step.done).length;
-$: setupAllDone =
- !isCheckingAccessibility &&
- !isLoadingIntegrations &&
- requiredSetupSteps.every((step) => step.done);
+$: accessibilityReady =
+ (!isMacOS || accessibilityStatus === 'Granted') && !isPreparingService && !setupError;
+$: integrationReady =
+ isTextEditEnabled && !isLoadingIntegrations && !isEnablingTextEdit && !integrationsError;
+$: nextDisabled = !canAdvance(slides[step].id, accessibilityReady, integrationReady, isMacOS);
onMount(() => {
- void checkAccessibilityPermission();
+ // Use the native platform in Tauri; user-agent detection is only for browser previews.
+ isMacOS = isTauri() ? platform() === 'macos' : navigator.userAgent.includes('Macintosh');
+ void prepareService();
void loadIntegrations();
});
+/** Gate service startup on Welcome outside macOS, or on Accessibility on macOS; the trial is optional. */
+function canAdvance(
+ slide: OnboardingSlide['id'],
+ accessReady: boolean,
+ appReady: boolean,
+ needsPermission: boolean,
+) {
+ if (slide === 'welcome') return needsPermission || accessReady;
+ if (slide === 'accessibility') return accessReady;
+ return accessReady && appReady;
+}
+
async function loadIntegrations() {
isLoadingIntegrations = true;
integrationsError = '';
@@ -73,24 +100,17 @@ async function loadIntegrations() {
}
async function enableTextEditForSetup() {
+ if (!accessibilityReady || isLoadingIntegrations || isEnablingTextEdit) return;
isEnablingTextEdit = true;
integrationsError = '';
try {
if (textEditIntegration) {
await Client.setIntegrationEnabled('com.apple.TextEdit', true);
- integrations = integrations.map((integration) =>
- integration.bundle_id === 'com.apple.TextEdit'
- ? { ...integration, enabled: true }
- : integration,
- );
} else {
await Client.addIntegration('com.apple.TextEdit');
- integrations = [
- ...integrations,
- { bundle_id: 'com.apple.TextEdit', enabled: true, display_name: 'TextEdit' },
- ];
}
+ await loadIntegrations();
} catch (error) {
integrationsError = `Unable to enable TextEdit: ${error}`;
} finally {
@@ -99,6 +119,7 @@ async function enableTextEditForSetup() {
}
async function launchTextEditForTestDrive() {
+ if (!accessibilityReady || !integrationReady || isLaunchingTextEdit) return;
isLaunchingTextEdit = true;
testDriveError = '';
@@ -111,13 +132,15 @@ async function launchTextEditForTestDrive() {
}
}
+/** Persist completion only after mandatory setup; leave the deck only when the save succeeds. */
async function completeOnboarding() {
+ if (!accessibilityReady || !integrationReady || isCompletingOnboarding) return;
isCompletingOnboarding = true;
onboardingError = '';
try {
await Client.setOnboardingCompleted(true);
- navigateToSection('general');
+ onComplete();
} catch (error) {
onboardingError = `Unable to complete onboarding: ${error}`;
} finally {
@@ -125,302 +148,137 @@ async function completeOnboarding() {
}
}
-async function checkAccessibilityPermission() {
- isCheckingAccessibility = true;
- accessibilityError = '';
+/** Start Harper on every platform, checking or requesting Accessibility permission only on macOS. */
+async function prepareService(request = false) {
+ isPreparingService = true;
+ setupError = '';
+ accessibilityStatus = null;
try {
- accessibilityStatus = await Client.getAccessibilityPermissionStatus();
-
- if (accessibilityStatus === 'Granted') {
- await Client.startHighlighterService();
+ if (isMacOS) {
+ if (request) {
+ accessibilityStatus = await Client.requestAccessibilityPermission();
+ hasRequestedAccessibility = true;
+ } else {
+ accessibilityStatus = await Client.getAccessibilityPermissionStatus();
+ }
}
- } catch (error) {
- accessibilityError = `Unable to check Accessibility permission: ${error}`;
- } finally {
- isCheckingAccessibility = false;
- }
-}
-
-async function requestAccessibilityPermission() {
- if (hasRequestedAccessibility && accessibilityStatus === 'NotGranted') {
- await checkAccessibilityPermission();
- return;
- }
-
- isRequestingAccessibility = true;
- accessibilityError = '';
- try {
- accessibilityStatus = await Client.requestAccessibilityPermission();
- hasRequestedAccessibility = true;
-
- if (accessibilityStatus === 'Granted') {
- await Client.startHighlighterService();
+ if (
+ (!isMacOS || accessibilityStatus === 'Granted') &&
+ !(await Client.startHighlighterService())
+ ) {
+ throw new Error('The Harper service did not start. Please try again.');
}
} catch (error) {
- accessibilityError = `Unable to request Accessibility permission: ${error}`;
+ setupError = `Unable to ${isMacOS ? 'set up Accessibility' : 'start Harper'}: ${error}`;
} finally {
- isRequestingAccessibility = false;
+ isPreparingService = false;
}
}
-
-function accessibilityDescription(status: AccessibilityPermissionStatus | null) {
- if (status === 'Granted') {
- return 'Harper can access text through the macOS Accessibility system.';
- }
-
- if (status === 'Unsupported') {
- return 'Accessibility setup is only available on macOS right now.';
- }
-
- return 'Open system settings and grant Harper access to the Accessibility system.';
-}
-
-function accessibilityActionLabel(
- status: AccessibilityPermissionStatus | null,
- isChecking: boolean,
- isRequesting: boolean,
- hasRequested: boolean,
-) {
- if (isChecking) {
- return 'Checking...';
- }
-
- if (isRequesting) {
- return 'Opening...';
- }
-
- if (status === 'Granted') {
- return 'Granted';
- }
-
- if (status === 'Unsupported') {
- return 'Unsupported';
- }
-
- if (hasRequested) {
- return 'Recheck Permission';
- }
-
- return 'Open System Settings';
-}
-
-function buildSetupSteps(
- currentAccessibilityStatus: AccessibilityPermissionStatus | null,
- currentIsCheckingAccessibility: boolean,
- currentIsRequestingAccessibility: boolean,
- currentHasRequestedAccessibility: boolean,
- currentIsTextEditEnabled: boolean,
- currentIsLoadingIntegrations: boolean,
- currentIsEnablingTextEdit: boolean,
- currentIsLaunchingTextEdit: boolean,
-): SetupStep[] {
- const accessibilityDone = currentAccessibilityStatus === 'Granted';
- const accessibilityReady = accessibilityDone || currentAccessibilityStatus === 'Unsupported';
- const integrationDone = currentIsTextEditEnabled;
- const accessibilityActionDisabled =
- currentIsCheckingAccessibility ||
- currentIsRequestingAccessibility ||
- currentAccessibilityStatus === 'Granted' ||
- currentAccessibilityStatus === 'Unsupported';
-
- return [
- {
- id: 'accessibility',
- title: 'Grant Accessibility permission',
- desc: accessibilityDescription(currentAccessibilityStatus),
- required: currentAccessibilityStatus !== 'Unsupported',
- done: accessibilityDone,
- locked: false,
- actionLabel: accessibilityActionLabel(
- currentAccessibilityStatus,
- currentIsCheckingAccessibility,
- currentIsRequestingAccessibility,
- currentHasRequestedAccessibility,
- ),
- actionVariant: accessibilityReady ? 'default' : 'primary',
- action: requestAccessibilityPermission,
- actionDisabled: accessibilityActionDisabled,
- },
- {
- id: 'integration',
- title: 'Pick an app to test',
- desc: 'Start with TextEdit, then add more apps from Integrations when you are ready.',
- required: true,
- done: integrationDone,
- locked: !accessibilityReady,
- actionLabel: integrationDone ? 'Manage' : 'Browse apps',
- actionVariant: 'default',
- action: () => navigateToSection('integrations'),
- actionDisabled: currentIsLoadingIntegrations || currentIsEnablingTextEdit,
- },
- {
- id: 'test-drive',
- title: 'Take a test drive',
- desc: 'Open TextEdit, type "its not alot of fun", and watch Harper underline the mistakes.',
- required: false,
- done: false,
- locked: !accessibilityReady || !integrationDone,
- actionLabel: currentIsLaunchingTextEdit ? 'Launching...' : 'Launch TextEdit',
- actionVariant: 'primary',
- action: launchTextEditForTestDrive,
- actionDisabled: currentIsLaunchingTextEdit,
- },
- ];
-}
</script>
-<section>
- {#if setupAllDone}
- <div class="success-banner">
- <div class="big-mark green">
- <CheckIcon className="control-icon" />
- </div>
- <div class="grow">
- <h2>You're all set</h2>
- <p>
- Harper is ready to check writing in the apps you choose. You can revisit any section
- from the sidebar.
- </p>
- {#if onboardingError}
- <p>{onboardingError}</p>
- {/if}
- </div>
- <Button unstyled class="button" type="button" disabled={isCompletingOnboarding} on:click={completeOnboarding}>
- {isCompletingOnboarding ? "Continuing..." : "Continue"}
- </Button>
- </div>
- {:else}
- {#if accessibilityStatus !== "Granted"}
- <div class="warning-banner">
- <div class="big-mark amber">!</div>
- <div>
- {#if isCheckingAccessibility}
- <strong>Checking Accessibility permission</strong>
- <p>Harper needs macOS Accessibility access before it can check other apps.</p>
- {:else if accessibilityStatus === "Unsupported"}
- <strong>Accessibility setup is unavailable</strong>
- <p>Harper Desktop app checking is currently only wired for macOS.</p>
- {:else}
- <strong>Harper is not checking anything yet</strong>
- <p>Grant Accessibility permission so Harper can find text and surface suggestions.</p>
- {/if}
- </div>
- </div>
+<div class="onboarding-shell">
+ <SlideDeck
+ title={slides[step].title}
+ lede={slides[step].lede}
+ slideProgress={step / (slides.length - 1)}
+ {nextDisabled}
+ onBack={() => {
+ if (!isCompletingOnboarding) step--;
+ }}
+ onNext={() => step++}
+ >
+ {#if slides[step].id === 'welcome' && !isMacOS}
+ {#if isPreparingService}
+ <div class="onboarding-actions">
+ <p role="status">Starting Harper...</p>
+ </div>
+ {:else if setupError}
+ <div class="onboarding-actions">
+ <p role="alert">{setupError}</p>
+ <Button on:click={() => prepareService()}>Retry Starting Harper</Button>
+ </div>
+ {/if}
+ {:else if slides[step].id === 'accessibility'}
+ <div class="onboarding-actions">
+ <p role="status">
+ {#if isPreparingService}
+ Checking Accessibility access...
+ {:else if accessibilityReady}
+ Accessibility access granted. Harper is ready to check your writing.
+ {:else if accessibilityStatus === 'Unsupported'}
+ Accessibility setup is unavailable on this platform. Setup cannot continue here.
+ {:else if hasRequestedAccessibility && accessibilityStatus === 'NotGranted'}
+ Enable Harper in System Settings → Privacy &amp; Security → Accessibility, then recheck permission.
{/if}
-
- <div class="hero-copy">
- <div class="eyebrow">Getting started</div>
- <h1>Let's get Harper up and running.</h1>
- <div class="progress-row">
- <div class="progress-track">
- <div class="progress-fill" style={`width: ${(setupCompletedCount / requiredSetupSteps.length) * 100}%`}></div>
- </div>
- <span>{setupCompletedCount} of {requiredSetupSteps.length}</span>
- </div>
- </div>
+ </p>
+ {#if setupError}
+ <p role="alert">{setupError}</p>
{/if}
-
- <div class="step-list">
- {#each setupSteps as step, index}
- <div class:done={step.done} class:locked={step.locked} class="step-row">
- <div class="step-dot">
- {#if step.done}
- <CheckIcon className="control-icon" />
- {:else}
- {index + 1}
- {/if}
- </div>
- <div class="grow">
- <div class="step-heading">
- <strong>{step.title}</strong>
- {#if !step.required && !step.done}
- <span class="pill">Optional</span>
- {/if}
- </div>
- <p>{step.desc}</p>
-
- {#if step.id === "accessibility" && accessibilityError}
- <div class="detected-app">
- <div class="big-mark amber">!</div>
- <div class="grow">
- <strong>Permission check failed</strong>
- <p>{accessibilityError}</p>
- </div>
- </div>
- {:else if step.id === "accessibility" && hasRequestedAccessibility && accessibilityStatus === "NotGranted"}
- <div class="detected-app">
- <div class="app-tile" style="--app-tint: #b06a1b">A</div>
- <div class="grow">
- <strong>Waiting for macOS</strong>
- <p>After granting access in System Settings, return here and recheck permission.</p>
- </div>
- </div>
- {/if}
-
- {#if step.id === "test-drive" && testDriveError}
- <div class="detected-app">
- <div class="big-mark amber">!</div>
- <div class="grow">
- <strong>TextEdit launch failed</strong>
- <p>{testDriveError}</p>
- </div>
- </div>
- {/if}
-
- {#if step.id === "integration" && integrationsError}
- <div class="detected-app">
- <div class="big-mark amber">!</div>
- <div class="grow">
- <strong>Integration update failed</strong>
- <p>{integrationsError}</p>
- </div>
- </div>
- {:else if step.id === "integration" && accessibilityStatus === "Granted" && isLoadingIntegrations}
- <div class="detected-app">
- <AppIcon bundleId="com.apple.TextEdit" name="TextEdit" />
- <div class="grow">
- <strong>Checking TextEdit</strong>
- <p>Loading integration state...</p>
- </div>
- </div>
- {:else if step.id === "integration" && accessibilityStatus === "Granted" && isTextEditEnabled}
- <div class="detected-app">
- <AppIcon bundleId="com.apple.TextEdit" name="TextEdit" />
- <div class="grow">
- <strong>TextEdit enabled</strong>
- <p>Harper is configured to check TextEdit.</p>
- </div>
- </div>
- {:else if step.id === "integration" && accessibilityStatus === "Granted"}
- <div class="detected-app">
- <AppIcon bundleId="com.apple.TextEdit" name="TextEdit" />
- <div class="grow">
- <strong>TextEdit detected</strong>
- <p>A good starter app for trying Harper.</p>
- </div>
- <Button unstyled class="button primary" type="button" disabled={isEnablingTextEdit} on:click={enableTextEditForSetup}>
- {isEnablingTextEdit ? "Enabling..." : "Enable"}
- </Button>
- </div>
- {/if}
- </div>
- <Button
- unstyled
- class={`button ${step.actionVariant === "primary" ? "primary" : ""}`}
- type="button"
- disabled={step.locked || step.actionDisabled}
- on:click={step.action}
- >
- {step.actionLabel}
- </Button>
- </div>
- {/each}
- </div>
-
- <div class="note-strip">
- <strong>On-device by default.</strong>
- <span>Your writing stays on this Mac in this demo surface.</span>
+ <Button
+ disabled={isPreparingService || accessibilityReady || accessibilityStatus === 'Unsupported'}
+ on:click={() => prepareService(!hasRequestedAccessibility && accessibilityStatus !== 'Granted')}
+ >
+ {#if isPreparingService}
+ Checking...
+ {:else if accessibilityReady}
+ Granted
+ {:else if accessibilityStatus === 'Unsupported'}
+ Unavailable
+ {:else if hasRequestedAccessibility || accessibilityStatus === 'Granted'}
+ Recheck Permission
+ {:else}
+ Open System Settings
+ {/if}
+ </Button>
+ </div>
+ {:else if slides[step].id === 'integration'}
+ <div class="onboarding-actions">
+ <p role="status">
+ {#if isLoadingIntegrations}
+ Loading integration state...
+ {:else if isEnablingTextEdit}
+ Enabling TextEdit...
+ {:else if integrationReady}
+ TextEdit enabled. Harper will check your writing in this app.
+ {/if}
+ </p>
+ {#if integrationsError}
+ <p role="alert">{integrationsError}</p>
+ <Button color="light" disabled={isLoadingIntegrations || isEnablingTextEdit} on:click={loadIntegrations}>
+ Retry Loading Integrations
+ </Button>
+ {/if}
+ <div class="onboarding-app">
+ <Button
+ disabled={!accessibilityReady || isLoadingIntegrations || isEnablingTextEdit || isTextEditEnabled || !!integrationsError}
+ on:click={enableTextEditForSetup}
+ >
+ {isEnablingTextEdit ? 'Enabling...' : isTextEditEnabled ? 'Enabled' : 'Enable TextEdit'}
+ </Button>
+ <AppIcon bundleId="com.apple.TextEdit" name="TextEdit" />
+ <strong>TextEdit</strong>
</div>
- </section>
+ </div>
+ {:else if slides[step].id === 'test-drive'}
+ <div class="onboarding-actions">
+ {#if testDriveError}
+ <p role="alert">{testDriveError}</p>
+ {/if}
+ <Button disabled={isLaunchingTextEdit} on:click={launchTextEditForTestDrive}>
+ {isLaunchingTextEdit ? 'Launching...' : 'Launch TextEdit'}
+ </Button>
+ </div>
+ {:else if slides[step].id === 'ready'}
+ <div class="onboarding-actions">
+ {#if onboardingError}
+ <p role="alert">{onboardingError}</p>
+ {/if}
+ <Button disabled={isCompletingOnboarding || !accessibilityReady || !integrationReady} on:click={completeOnboarding}>
+ {isCompletingOnboarding ? 'Finishing...' : 'Finish'}
+ </Button>
+ </div>
+ {/if}
+ </SlideDeck>
+</div>
diff --git a/harper-desktop/src/lib/settings/settings-data.ts b/harper-desktop/src/lib/settings/settings-data.ts
index c6448eee9..5d3bf6d71 100644
--- a/harper-desktop/src/lib/settings/settings-data.ts
+++ b/harper-desktop/src/lib/settings/settings-data.ts
@@ -1,5 +1,4 @@
export type SectionId =
- | 'getting-started'
| 'general'
| 'writing'
| 'dictionary'
@@ -16,11 +15,6 @@ export interface NavItem {
}
export const MAIN_NAV_ITEMS: NavItem[] = [
- {
- id: 'getting-started',
- label: 'Getting Started',
- gradient: 'linear-gradient(180deg, #f07a3a 0%, #c94614 100%)',
- },
{
id: 'general',
label: 'General',
diff --git a/harper-desktop/src/lib/settings/settings.css b/harper-desktop/src/lib/settings/settings.css
index 821688cea..b3c71ea11 100644
--- a/harper-desktop/src/lib/settings/settings.css
+++ b/harper-desktop/src/lib/settings/settings.css
@@ -1,3 +1,11 @@
+@font-face {
+ font-family: Domine;
+ src: url("/fonts/domine/Domine.ttf") format("truetype");
+ font-style: normal;
+ font-weight: 400 700;
+ font-display: swap;
+}
+
body.settings-view {
background: #fbfaf7;
}
@@ -24,8 +32,7 @@ body.settings-view {
overflow: hidden;
background: var(--settings-bg-window);
color: var(--settings-ink);
- font-family:
- Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
+ font-family: Domine, serif;
font-size: 13px;
-webkit-font-smoothing: antialiased;
}
@@ -73,6 +80,46 @@ button {
cursor: default;
}
+.onboarding-shell {
+ --marketing-amber: #b06a1b;
+ --marketing-amber-soft: #d98b3a;
+ --marketing-ink: #1c1a16;
+ --marketing-ink-2: #4a463e;
+ font-family: Domine, serif;
+ overflow-wrap: anywhere;
+}
+
+.onboarding-shell main {
+ place-items: safe center;
+}
+
+.onboarding-shell main > div {
+ width: 100%;
+}
+
+.onboarding-shell p {
+ white-space: pre-line;
+ color: var(--marketing-ink-2);
+}
+
+.onboarding-actions {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 12px;
+ margin-top: 24px;
+}
+
+.onboarding-actions [role="alert"] {
+ color: #b42318;
+}
+
+.onboarding-app {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+}
+
.grow {
flex: 1;
min-width: 0;
diff --git a/harper-desktop/static/fonts/domine/Domine.ttf b/harper-desktop/static/fonts/domine/Domine.ttf
new file mode 100644
index 000000000..d676bdedb
Binary files /dev/null and b/harper-desktop/static/fonts/domine/Domine.ttf differ
diff --git a/packages/components/src/lib/SlideDeck.svelte b/packages/components/src/lib/SlideDeck.svelte
index 9b730198a..a4624d117 100644
--- a/packages/components/src/lib/SlideDeck.svelte
+++ b/packages/components/src/lib/SlideDeck.svelte
@@ -10,12 +10,15 @@ import Panel from './Panel.svelte';
* and controls navigation visibility. The default slot holds slide-specific
* content; the `outside` slot renders below the clipped panel. `onBack` and
* `onNext` synchronously update the parent's active slide before focus moves.
+ * `nextDisabled` blocks forward navigation through both the button and keyboard
+ * shortcuts without preventing users from going back.
*/
export let title: string;
export let lede: string;
export let slideProgress: number;
export let onBack: () => void;
export let onNext: () => void;
+export let nextDisabled = false;
let heading: HTMLElement;
@@ -26,7 +29,7 @@ onMount(() => {
/** Move within the walkthrough bounds, then focus the new heading after rendering. */
async function changeStep(direction: -1 | 1) {
- if (direction === -1 ? slideProgress <= 0 : slideProgress >= 1) return;
+ if (direction === -1 ? slideProgress <= 0 : slideProgress >= 1 || nextDisabled) return;
if (direction === -1) onBack();
else onNext();
await tick();
@@ -113,7 +116,7 @@ function handleKeydown(event: KeyboardEvent) {
</Button>
{/if}
{#if slideProgress < 1}
- <Button size="sm" color="primary" class="bg-primary-600! text-white! hover:bg-primary-700! focus:ring-primary-300! motion-reduce:transition-none" on:click={() => changeStep(1)}>
+ <Button size="sm" color="primary" class="bg-primary-600! text-white! hover:bg-primary-700! focus:ring-primary-300! motion-reduce:transition-none" disabled={nextDisabled} on:click={() => changeStep(1)}>
<span>Next</span>
<ChevronRightIcon className="size-5" />
</Button>
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 71e7073b0..5bde27dc2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -47,6 +47,9 @@ importers:
'@tauri-apps/plugin-opener':
specifier: ^2
version: 2.5.4
+ '@tauri-apps/plugin-os':
+ specifier: ~2.3.2
+ version: 2.3.2
components:
specifier: workspace:*
version: link:../packages/components
@@ -4109,6 +4112,9 @@ packages:
'@tauri-apps/[email protected]':
resolution: {integrity: sha512-1HnPkb+AmgO29HBazm4uPLKB+r7zzcTBW1d0fyYp1uP+jwtpoiNDGKMMzz58SFp49nOIrxdE3aUJtT57lfO9CQ==}
+ '@tauri-apps/[email protected]':
+ resolution: {integrity: sha512-n+nXWeuSeF9wcEsSPmRnBEGrRgOy6jjkSU+UVCOV8YUGKb2erhDOxis7IqRXiRVHhY8XMKks00BJ0OAdkpf6+A==}
+
'@tootallnate/[email protected]':
resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==}
engines: {node: '>= 10'}
@@ -16910,6 +16916,10 @@ snapshots:
dependencies:
'@tauri-apps/api': 2.11.0
+ '@tauri-apps/[email protected]':
+ dependencies:
+ '@tauri-apps/api': 2.11.0
+
'@tootallnate/[email protected]': {}
'@tootallnate/[email protected]': {}