Skip to content

A local-first personal finance app

[AI] redesign onboarding (#8495)

Matt Fiddamane18c8adddee6
diff --git a/packages/desktop-client/e2e/onboarding.test.ts b/packages/desktop-client/e2e/onboarding.test.ts
index 8a4db3b06c..d65f5f6ebe 100644
--- a/packages/desktop-client/e2e/onboarding.test.ts
+++ b/packages/desktop-client/e2e/onboarding.test.ts
@@ -25,15 +25,15 @@ test.describe('Onboarding', () => {
});
test('checks the page visuals', async () => {
- await expect(configurationPage.heading).toHaveText("Where's the server?");
+ await expect(page.getByText('Welcome to Actual')).toBeVisible();
await expect(page).toMatchThemeScreenshots();
- await configurationPage.clickOnNoServer();
+ await configurationPage.clickOnConnectServer();
+ await expect(configurationPage.heading).toHaveText('Connect to a server');
await expect(page).toMatchThemeScreenshots();
});
test('creates a new budget file by importing YNAB4 budget', async () => {
- await configurationPage.clickOnNoServer();
const budgetPage = await configurationPage.importBudget(
'YNAB4',
path.resolve(__dirname, 'data/ynab4-demo-budget.zip'),
@@ -51,7 +51,6 @@ test.describe('Onboarding', () => {
});
test('creates a new budget file by importing nYNAB budget', async () => {
- await configurationPage.clickOnNoServer();
const budgetPage = await configurationPage.importBudget(
'nYNAB',
path.resolve(__dirname, 'data/ynab5-demo-budget.json'),
@@ -93,7 +92,6 @@ test.describe('Onboarding', () => {
});
test('creates a new budget file by importing Actual budget', async () => {
- await configurationPage.clickOnNoServer();
const budgetPage = await configurationPage.importBudget(
'Actual',
path.resolve(__dirname, 'data/actual-demo-budget.zip'),
@@ -109,7 +107,6 @@ test.describe('Onboarding', () => {
});
test('creates a new empty budget file', async () => {
- await configurationPage.clickOnNoServer();
await configurationPage.startFresh();
const accountPage = new AccountPage(page);
@@ -119,7 +116,6 @@ test.describe('Onboarding', () => {
});
test('navigates back to start page by clicking on "no server" in an empty budget file', async () => {
- await configurationPage.clickOnNoServer();
const accountPage = await configurationPage.startFresh();
await expect(accountPage.transactionTable).toBeVisible();
@@ -127,6 +123,6 @@ test.describe('Onboarding', () => {
await navigation.clickOnNoServer();
await page.getByRole('button', { name: 'Start using a server' }).click();
- await expect(configurationPage.heading).toHaveText("Where's the server?");
+ await expect(configurationPage.heading).toHaveText('Connect to a server');
});
});
diff --git a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-1-chromium-linux.png
index fa7de0dbd1..3f84bc4708 100644
Binary files a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-1-chromium-linux.png and b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-2-chromium-linux.png
index 78b7bb3599..cf90020aa3 100644
Binary files a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-2-chromium-linux.png and b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-3-chromium-linux.png
index 0bfa91df1b..f246acf4a6 100644
Binary files a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-3-chromium-linux.png and b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-4-chromium-linux.png b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-4-chromium-linux.png
index eed731ddce..2d39764f34 100644
Binary files a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-4-chromium-linux.png and b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-4-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-5-chromium-linux.png b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-5-chromium-linux.png
index c25e5340a5..69adb2408d 100644
Binary files a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-5-chromium-linux.png and b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-5-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-6-chromium-linux.png b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-6-chromium-linux.png
index 5f608b35f8..36f737f81b 100644
Binary files a/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-6-chromium-linux.png and b/packages/desktop-client/e2e/onboarding.test.ts-snapshots/Onboarding-checks-the-page-visuals-6-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/page-models/configuration-page.ts b/packages/desktop-client/e2e/page-models/configuration-page.ts
index c475a46219..c692381cea 100644
--- a/packages/desktop-client/e2e/page-models/configuration-page.ts
+++ b/packages/desktop-client/e2e/page-models/configuration-page.ts
@@ -16,7 +16,7 @@ export class ConfigurationPage {
async createTestFile() {
await this.page
- .getByRole('button', { name: 'Create test file', exact: true })
+ .getByRole('button', { name: 'Try the demo', exact: true })
.click();
const budgetPage = new BudgetPage(this.page);
// Wait for the budget page to be fully mounted before returning so
@@ -26,12 +26,18 @@ export class ConfigurationPage {
}
async createDemoFile() {
- await this.page.getByRole('button', { name: 'View demo' }).click();
+ await this.page.getByRole('button', { name: 'Try the demo' }).click();
const budgetPage = new BudgetPage(this.page);
await budgetPage.waitFor();
return budgetPage;
}
+ async clickOnConnectServer() {
+ await this.page
+ .getByRole('button', { name: 'Connect to a sync server' })
+ .click();
+ }
+
async clickOnNoServer() {
await this.page.getByRole('button', { name: "Don't use a server" }).click();
}
@@ -43,7 +49,7 @@ export class ConfigurationPage {
}
async startFresh() {
- await this.page.getByRole('button', { name: 'Start fresh' }).click();
+ await this.page.getByRole('button', { name: 'Start budgeting' }).click();
const accountPage = new AccountPage(this.page);
await accountPage.accountName.waitFor();
diff --git a/packages/desktop-client/src/components/manager/ConfigServer.tsx b/packages/desktop-client/src/components/manager/ConfigServer.tsx
index 6a6d160555..b44787767c 100644
--- a/packages/desktop-client/src/components/manager/ConfigServer.tsx
+++ b/packages/desktop-client/src/components/manager/ConfigServer.tsx
@@ -1,6 +1,7 @@
// @ts-strict-ignore
import React, { useCallback, useEffect, useState } from 'react';
import { Trans, useTranslation } from 'react-i18next';
+import { useLocation } from 'react-router';
import { Button, ButtonWithLoading } from '@actual-app/components/button';
import { BigInput } from '@actual-app/components/input';
@@ -8,19 +9,16 @@ import { Label } from '@actual-app/components/label';
import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
-import {
- isElectron,
- isNonProductionEnvironment,
-} from '@actual-app/core/shared/environment';
+import { isElectron } from '@actual-app/core/shared/environment';
import { css } from '@emotion/css';
-import { createBudget } from '#budgetfiles/budgetfilesSlice';
import { Link } from '#components/common/Link';
+import { MobileBackButton } from '#components/mobile/MobileBackButton';
import { useServerURL, useSetServerURL } from '#components/ServerContext';
import { useGlobalPref } from '#hooks/useGlobalPref';
import { useNavigate } from '#hooks/useNavigate';
import { saveGlobalPrefs } from '#prefs/prefsSlice';
-import { useDispatch } from '#redux';
+import { useDispatch, useSelector } from '#redux';
import { loggedIn, signOut } from '#users/usersSlice';
import { Title } from './subscribe/common';
@@ -286,6 +284,8 @@ export function ConfigServer() {
const { t } = useTranslation();
const dispatch = useDispatch();
const navigate = useNavigate();
+ const location = useLocation();
+ const userData = useSelector(state => state.user.data);
const [url, setUrl] = useState('');
const currentUrl = useServerURL();
const setServerUrl = useSetServerURL();
@@ -370,12 +370,6 @@ export function ConfigServer() {
void navigate('/');
}
- async function onCreateTestFile() {
- await setServerUrl(null);
- await dispatch(createBudget({ testMode: true }));
- void navigate('/');
- }
-
const [syncServerConfig] = useGlobalPref('syncServerConfig');
const hasExternalServerConfig = !syncServerConfig?.port && !!currentUrl;
@@ -392,6 +386,20 @@ export function ConfigServer() {
return (
<View style={{ maxWidth: 500, marginTop: -30 }}>
+ {(userData || currentUrl) && (
+ <MobileBackButton
+ onPress={() =>
+ location.key !== 'default' ? navigate(-1) : navigate('/')
+ }
+ style={{
+ position: 'fixed',
+ top: 'calc(10px + env(safe-area-inset-top))',
+ left: 10,
+ margin: 0,
+ zIndex: 4000,
+ }}
+ />
+ )}
{serverConfigView === 'internal' && (
<ElectronServerConfig
onDoNotUseServer={onSkip}
@@ -400,7 +408,7 @@ export function ConfigServer() {
)}
{serverConfigView === 'external' && (
<>
- <Title text={t("Where's the server?")} />
+ <Title text={t('Connect to a server')} />
<Text
style={{
fontSize: 16,
@@ -415,12 +423,35 @@ export function ConfigServer() {
</Trans>
) : (
<Trans>
- There is no server configured. After running the server, specify
- the URL here to use the app. You can always change this later.
- We will validate that Actual is running at this URL.
+ A sync server keeps your budget up to date across all your
+ devices and unlocks features like bank syncing. It is completely
+ optional: Actual works great on just this device too.
</Trans>
)}
</Text>
+ {!currentUrl && (
+ <Text
+ style={{
+ fontSize: 16,
+ color: theme.pageTextLight,
+ lineHeight: 1.5,
+ marginTop: 10,
+ }}
+ >
+ <Trans>
+ If you already run a server, enter its URL below. Otherwise you
+ can{' '}
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/install/"
+ linkColor="purple"
+ >
+ learn how to set one up
+ </Link>{' '}
+ and connect it whenever you are ready.
+ </Trans>
+ </Text>
+ )}
{error && (
<>
<Text
@@ -481,30 +512,20 @@ export function ConfigServer() {
style={{ fontSize: 15 }}
onPress={onSubmit}
>
- <Trans>OK</Trans>
+ <Trans>Connect</Trans>
</ButtonWithLoading>
- {currentUrl && (
- <Button
- variant="bare"
- style={{ fontSize: 15, marginLeft: 10 }}
- onPress={() => navigate(-1)}
- >
- <Trans>Cancel</Trans>
- </Button>
- )}
</View>
<View
style={{
- flexDirection: 'row',
- flexFlow: 'row wrap',
- justifyContent: 'center',
- marginTop: 15,
+ alignItems: 'center',
+ gap: 15,
+ marginTop: 30,
}}
>
{currentUrl ? (
<Button
variant="bare"
- style={{ color: theme.pageTextLight }}
+ style={{ color: theme.pageTextLink }}
onPress={onSkip}
>
<Trans>Stop using a server</Trans>
@@ -514,34 +535,19 @@ export function ConfigServer() {
{!isElectron() && (
<Button
variant="bare"
- style={{
- color: theme.pageTextLight,
- margin: 5,
- marginRight: 15,
- }}
+ style={{ color: theme.pageTextLink }}
onPress={onSameDomain}
>
- <Trans>Use current domain</Trans>
+ <Trans>Use the current domain</Trans>
</Button>
)}
- <Button
- variant="bare"
- style={{ color: theme.pageTextLight, margin: 5 }}
- onPress={onSkip}
- >
- <Trans>Don't use a server</Trans>
- </Button>
-
- {isNonProductionEnvironment() && (
+ {!userData && (
<Button
- variant="primary"
- style={{ marginLeft: 15 }}
- onPress={async () => {
- await onCreateTestFile();
- void navigate('/');
- }}
+ variant="bare"
+ style={{ color: theme.pageTextLink }}
+ onPress={onSkip}
>
- <Trans>Create test file</Trans>
+ <Trans>Don't use a server</Trans>
</Button>
)}
</>
diff --git a/packages/desktop-client/src/components/manager/ManagementApp.tsx b/packages/desktop-client/src/components/manager/ManagementApp.tsx
index d9a17a21d4..463a529b48 100644
--- a/packages/desktop-client/src/components/manager/ManagementApp.tsx
+++ b/packages/desktop-client/src/components/manager/ManagementApp.tsx
@@ -209,10 +209,12 @@ export function ManagementApp() {
</View>
)}
- <Routes>
- <Route path="/config-server" element={null} />
- <Route path="/*" element={<ServerURL />} />
- </Routes>
+ {managerHasInitialized && !isLoading && (
+ <Routes>
+ <Route path="/config-server" element={null} />
+ <Route path="/*" element={<ServerURL />} />
+ </Routes>
+ )}
<Version />
</View>
);
diff --git a/packages/desktop-client/src/components/manager/ServerURL.tsx b/packages/desktop-client/src/components/manager/ServerURL.tsx
index acfe38ed9d..98f3298899 100644
--- a/packages/desktop-client/src/components/manager/ServerURL.tsx
+++ b/packages/desktop-client/src/components/manager/ServerURL.tsx
@@ -19,7 +19,7 @@ export function ServerURL() {
right: 0,
justifyContent: 'center',
flexDirection: 'row',
- marginBottom: 15,
+ marginBottom: 'calc(15px + env(safe-area-inset-bottom))',
zIndex: 5000,
}}
>
@@ -29,13 +29,11 @@ export function ServerURL() {
Using server: <strong>{url}</strong>
</Trans>
) : (
- <Trans>
- <strong>No server configured</strong>
- </Trans>
+ <Trans>Using this device only</Trans>
)}
</Text>
<Link variant="internal" to="/config-server" style={{ marginLeft: 15 }}>
- <Trans>Change</Trans>
+ {url ? <Trans>Change</Trans> : <Trans>Set up sync</Trans>}
</Link>
</View>
);
diff --git a/packages/desktop-client/src/components/manager/WelcomeScreen.tsx b/packages/desktop-client/src/components/manager/WelcomeScreen.tsx
index 91797c7394..1c9eb7ce9d 100644
--- a/packages/desktop-client/src/components/manager/WelcomeScreen.tsx
+++ b/packages/desktop-client/src/components/manager/WelcomeScreen.tsx
@@ -1,109 +1,185 @@
import React from 'react';
-import { Trans, useTranslation } from 'react-i18next';
+import { Trans } from 'react-i18next';
import { Button } from '@actual-app/components/button';
+import { useResponsive } from '@actual-app/components/hooks/useResponsive';
+import { SvgLogo } from '@actual-app/components/icons/logo';
import { Paragraph } from '@actual-app/components/paragraph';
import { styles } from '@actual-app/components/styles';
import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
+import { css, keyframes } from '@emotion/css';
import { createBudget } from '#budgetfiles/budgetfilesSlice';
import { Link } from '#components/common/Link';
+import { useServerURL } from '#components/ServerContext';
+import { useNavigate } from '#hooks/useNavigate';
import { pushModal } from '#modals/modalsSlice';
import { useDispatch } from '#redux';
+const fadeInUp = keyframes({
+ from: { opacity: 0, transform: 'translateY(12px)' },
+ to: { opacity: 1, transform: 'translateY(0)' },
+});
+
+function entrance(delay: number) {
+ return css({
+ opacity: 0,
+ animationName: fadeInUp,
+ animationDuration: '500ms',
+ animationTimingFunction: 'ease-out',
+ animationFillMode: 'forwards',
+ animationDelay: `${delay}ms`,
+ '@media (prefers-reduced-motion: reduce)': {
+ animationName: 'none',
+ opacity: 1,
+ },
+ });
+}
+
export function WelcomeScreen() {
- const { t } = useTranslation();
const dispatch = useDispatch();
+ const navigate = useNavigate();
+ const serverURL = useServerURL();
+ const { isNarrowWidth } = useResponsive();
+
+ const buttonStyle = {
+ fontSize: 15,
+ padding: '12px 15px',
+ flexShrink: 0,
+ ...(isNarrowWidth && { minHeight: styles.mobileMinHeight }),
+ };
return (
<View
style={{
- gap: 10,
- maxWidth: 500,
+ alignItems: 'center',
+ gap: isNarrowWidth ? 25 : 12,
+ width: '100%',
+ maxWidth: 480,
fontSize: 15,
- maxHeight: '100vh',
- marginBlock: 20,
+ maxHeight: '100%',
+ overflowY: 'auto',
+ paddingTop: 20,
+ // Keep the last line clear of the absolutely-positioned
+ // server bar at the bottom of the screen.
+ paddingBottom: 'calc(45px + env(safe-area-inset-bottom))',
}}
>
- <Text style={styles.veryLargeText}>{t("Let's get started!")}</Text>
- <View style={{ overflowY: 'auto' }}>
- <Paragraph>
- <Trans>
- Actual is a personal finance tool that focuses on beautiful design
- and a slick user experience.{' '}
- <strong>Editing your data should be as fast as possible.</strong> On
- top of that, we want to provide powerful tools to allow you to do
- whatever you want with your data.
- </Trans>
- </Paragraph>
- <Paragraph>
- <Trans>
- Currently, Actual implements budgeting based on a{' '}
- <Link
- variant="external"
- to="https://actualbudget.org/docs/budgeting/"
- linkColor="purple"
- >
- monthly envelope system
- </Link>
- .
- </Trans>{' '}
- <Trans>
- Consider taking our{' '}
- <Link
- variant="external"
- to="https://actualbudget.org/docs/tour/"
- linkColor="purple"
- >
- guided tour
- </Link>{' '}
- to help you get your bearings, and check out the rest of the
- documentation while you're there to learn more about advanced
- topics.
- </Trans>
- </Paragraph>
- <Paragraph style={{ color: theme.pageTextLight }}>
+ <View
+ className={entrance(0)}
+ style={{ alignItems: 'center', gap: 10, flexShrink: 0 }}
+ >
+ <SvgLogo
+ width={45}
+ height={45}
+ style={{ color: theme.pageTextPositive }}
+ />
+ <Text style={{ ...styles.veryLargeText, textAlign: 'center' }}>
+ <Trans>Welcome to Actual</Trans>
+ </Text>
+ <Text
+ style={{
+ color: theme.pageTextLight,
+ textAlign: 'center',
+ fontStyle: 'italic',
+ }}
+ >
+ <Trans>Your finances - made simple</Trans>
+ </Text>
+ </View>
+
+ <View
+ className={entrance(150)}
+ style={{ alignItems: 'center', flexShrink: 0 }}
+ >
+ <Paragraph
+ style={{ textAlign: 'center', maxWidth: 400, marginBottom: 0 }}
+ >
<Trans>
- Get started by importing an existing budget file from Actual or
- another budgeting app, create a demo budget file, or start fresh
- with an empty budget. You can always create or import another budget
- later.
+ Actual is a super fast, privacy-focused app for managing your
+ finances. It is 100% free and open source: everything stays on your
+ device, no data is collected, and there is nothing to sign up for.
</Trans>
</Paragraph>
</View>
+
<View
+ className={entrance(300)}
style={{
- flexDirection: 'row',
- justifyContent: 'space-between',
- alignItems: 'flex-end',
+ width: '100%',
+ maxWidth: 400,
+ gap: 10,
flexShrink: 0,
+ marginTop: 10,
}}
>
<Button
+ variant="primary"
+ autoFocus={!isNarrowWidth}
+ style={buttonStyle}
+ onPress={() => dispatch(createBudget({}))}
+ >
+ <Trans>Start budgeting</Trans>
+ </Button>
+ <Button
+ style={buttonStyle}
+ onPress={() => dispatch(createBudget({ testMode: true }))}
+ >
+ <Trans>Try the demo</Trans>
+ </Button>
+ {!serverURL && (
+ <Button
+ style={buttonStyle}
+ onPress={() => navigate('/config-server')}
+ >
+ <Trans>Connect to a sync server</Trans>
+ </Button>
+ )}
+ </View>
+
+ <View
+ className={entrance(450)}
+ style={{
+ alignItems: 'center',
+ gap: isNarrowWidth ? 12 : 5,
+ flexShrink: 0,
+ marginTop: 10,
+ }}
+ >
+ <Text style={{ color: theme.pageTextLight }}>
+ <Trans>Coming from another budgeting app?</Trans>
+ </Text>
+ <Button
+ variant="bare"
+ style={{ color: theme.pageTextLink }}
onPress={() => dispatch(pushModal({ modal: { name: 'import' } }))}
>
<Trans>Import my budget</Trans>
</Button>
- <View
+ <Paragraph
style={{
- flexDirection: 'row',
- justifyContent: 'space-between',
- gap: 10,
+ color: theme.pageTextLight,
+ fontSize: 13,
+ textAlign: 'center',
+ maxWidth: 400,
+ marginTop: 10,
+ marginBottom: 0,
}}
>
- <Button onPress={() => dispatch(createBudget({ testMode: true }))}>
- <Trans>View demo</Trans>
- </Button>
- <Button
- variant="primary"
- autoFocus
- onPress={() => dispatch(createBudget({}))}
- >
- <Trans>Start fresh</Trans>
- </Button>
- </View>
+ <Trans>
+ New to budgeting? Take the{' '}
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/tour/"
+ linkColor="purple"
+ >
+ guided tour
+ </Link>{' '}
+ to learn how Actual works.
+ </Trans>
+ </Paragraph>
</View>
</View>
);
diff --git a/packages/desktop-client/src/components/manager/subscribe/common.tsx b/packages/desktop-client/src/components/manager/subscribe/common.tsx
index 0b8ac051f4..548662191d 100644
--- a/packages/desktop-client/src/components/manager/subscribe/common.tsx
+++ b/packages/desktop-client/src/components/manager/subscribe/common.tsx
@@ -4,6 +4,7 @@ import { useLocation } from 'react-router';
import { theme } from '@actual-app/components/theme';
import { send } from '@actual-app/core/platform/client/connection';
+import { isElectron } from '@actual-app/core/shared/environment';
import type { Handlers } from '@actual-app/core/types/handlers';
import {
@@ -12,6 +13,8 @@ import {
useSetServerURL,
} from '#components/ServerContext';
import { useNavigate } from '#hooks/useNavigate';
+import { useDispatch } from '#redux';
+import { loggedIn } from '#users/usersSlice';
// There are two URLs that dance with each other: `/login` and
// `/bootstrap`. Both of these URLs check the state of the the server
@@ -26,11 +29,14 @@ export function useBootstrapped(redirect = true) {
const [checked, setChecked] = useState(false);
const navigate = useNavigate();
const location = useLocation();
+ const dispatch = useDispatch();
const setServerURL = useSetServerURL();
const setMultiuserEnabled = useSetMultiuserEnabled();
const setLoginMethods = useSetLoginMethods();
useEffect(() => {
+ let isCancelled = false;
+
async function run() {
const ensure = url => {
if (location.pathname !== url) {
@@ -44,6 +50,9 @@ export function useBootstrapped(redirect = true) {
const url = await send('get-server-url');
const bootstrapped = await send('get-did-bootstrap');
+ if (isCancelled) {
+ return;
+ }
if (url == null && !bootstrapped) {
// A server hasn't been specified yet
const serverURL = window.location.origin;
@@ -52,14 +61,36 @@ export function useBootstrapped(redirect = true) {
> = await send('subscribe-needs-bootstrap', {
url: serverURL,
});
+ if (isCancelled) {
+ return;
+ }
if ('error' in result || !result.hasServer) {
console.log('error' in result && result.error);
- void navigate('/config-server');
+
+ const isTransientFailure =
+ 'error' in result && result.error === 'network-failure';
+ if (isElectron() || isTransientFailure) {
+ void navigate('/config-server');
+ return;
+ }
+
+ await setServerURL(null, { validate: false });
+ if (isCancelled) {
+ return;
+ }
+ await dispatch(loggedIn());
+ if (isCancelled) {
+ return;
+ }
+ void navigate('/');
return;
}
await setServerURL(serverURL, { validate: false });
+ if (isCancelled) {
+ return;
+ }
setMultiuserEnabled(result.multiuser);
setLoginMethods(result.availableLoginMethods);
@@ -73,6 +104,9 @@ export function useBootstrapped(redirect = true) {
const result: Awaited<
ReturnType<Handlers['subscribe-needs-bootstrap']>
> = await send('subscribe-needs-bootstrap');
+ if (isCancelled) {
+ return;
+ }
if ('error' in result) {
void navigate('/error', { state: { error: result.error } });
@@ -89,7 +123,12 @@ export function useBootstrapped(redirect = true) {
}
}
void run();
+
+ return () => {
+ isCancelled = true;
+ };
}, [
+ dispatch,
location,
navigate,
redirect,
diff --git a/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-2-linux.png b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-2-linux.png
index 6aba77183d..769e0dfc2a 100644
Binary files a/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-2-linux.png and b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-2-linux.png differ
diff --git a/upcoming-release-notes/friendly-onboarding.md b/upcoming-release-notes/friendly-onboarding.md
new file mode 100644
index 0000000000..04e1ad0581
--- /dev/null
+++ b/upcoming-release-notes/friendly-onboarding.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [matt-fidd]
+---
+
+Redesign onboarding screens