Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/fumadocs/content/docs/next/run/models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ An instance saved with the former `Local model with Ollama` option shows as `Ope

`Save` in Settings, or `Save and continue` on the setup screen, tests the model before it stores anything. For categorisation, it asks about one sample merchant. For the assistant, it sends one short chat message. The messages, and `Save anyway`, are the ones in [Connection test results](/docs/run/email#connection-test-results).

On the setup screen's `Categories` step, `Test connection` runs the same test without saving. The test asks about one merchant.

The server picks up a saved model when it restarts. In Settings, press `Apply now`, as [Apply a saved change](/docs/run/email#apply-a-saved-change) describes. On the setup screen, `Finish setup` restarts it.

To stop using a model, press `Change`, then `Turn off`, then `Apply now`. [What each model does](#what-each-model-does) says what changes without it.
Expand Down
2 changes: 2 additions & 0 deletions apps/fumadocs/content/docs/next/use/account.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The first time you sign in, Freenary asks two questions:
1. **Your tax residency.** Pick every country you pay tax in. It sets the banks you can connect. Countries other than France carry a `Limited support` badge.
2. **Your bank.** Connect at least one: `Finish` stays disabled until you do. If your instance can't link banks yet, the step shows `Bank linking is unavailable` and you can't finish until the operator sets up a bank provider.

On a wide screen, sample cards beside the form show what Freenary tracks: your balance, what you spent this month and your top categories.

<Callout type="warn">

No screen changes your tax residency later, so pick every country before you go on.
Expand Down
3 changes: 2 additions & 1 deletion apps/web/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1479,5 +1479,6 @@
"ui_toggle_sidebar": "Toggle sidebar",
"update_banner_dismiss": "Dismiss the notice for v{version}",
"update_banner_new_tab": "(opens in a new tab)",
"update_banner_title": "Freenary v{version} is available"
"update_banner_title": "Freenary v{version} is available",
"wizard_step_done": "{step} (done)"
}
3 changes: 2 additions & 1 deletion apps/web/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1488,5 +1488,6 @@
"ui_toggle_sidebar": "Afficher ou masquer la barre latérale",
"update_banner_dismiss": "Masquer l’avis pour la v{version}",
"update_banner_new_tab": "(s’ouvre dans un nouvel onglet)",
"update_banner_title": "Freenary v{version} est disponible"
"update_banner_title": "Freenary v{version} est disponible",
"wizard_step_done": "{step} (terminé)"
}
Binary file modified apps/web/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/web/src/features/instance-integration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
variantLabel,
} from "./model/labels";
export type { SaveOutcome } from "./model/outcome";
export { initialChoiceOf } from "./model/variant-choice";
export { useInstanceIntegration } from "./model/use-instance-integration";
export { EnvironmentSummary } from "./ui/environment-summary";
export { ProviderStep } from "./ui/provider-step";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RiCheckLine, RiServerLine } from "@remixicon/react";

import { m } from "@/paraglide/messages.js";
import { remixIcon } from "@/shared/lib/remix-icon";
import { WizardStepHeader } from "@/shared/ui/wizard-step-header";
import { WizardStepHeader } from "@/shared/ui/wizard";

import {
environmentDocsUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { cn } from "@freenary/ui/lib/utils";
import { useId } from "react";

import { m } from "@/paraglide/messages.js";
import { WizardStepHeader } from "@/shared/ui/wizard-step-header";
import { WizardStepHeader } from "@/shared/ui/wizard";

import {
integrationDescription,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { ComponentType } from "react";
import { useState } from "react";

import { m } from "@/paraglide/messages.js";
import { WizardStepHeader } from "@/shared/ui/wizard-step-header";
import { WizardStepHeader } from "@/shared/ui/wizard";

import {
credentialStepsOf,
Expand Down Expand Up @@ -51,9 +51,12 @@ const VARIANT_GUIDES: Readonly<Record<string, VariantGuide>> = {
"subq-snap": { Note: NoGuideNote, Steps: SubqSnapGuide },
};

type CredentialAction = "save" | "test";

interface ProviderCredentialsProps {
isBusy: boolean;
onBack: () => void;
onCheck?: (values: Record<string, string>) => void;
onEdit: () => void;
onSave: (values: Record<string, string>, checkFirst: boolean) => void;
outcome: SaveOutcome | undefined;
Expand Down Expand Up @@ -82,6 +85,7 @@ const problemsOf = (
const SingleScreenCredentials = ({
isBusy,
onBack,
onCheck,
onEdit,
onSave,
outcome,
Expand All @@ -91,6 +95,7 @@ const SingleScreenCredentials = ({
const ArrowLeftIcon = useIcon("arrow-left");
const [values, setValues] = useState(() => filledValuesOf(variant.fields));
const [problems, setProblems] = useState<Record<string, FieldProblem>>({});
const [lastAction, setLastAction] = useState<CredentialAction>("save");

const provider = variantLabel(variant.id);
const guideUrl = variantGuideUrl(variant.id);
Expand All @@ -102,16 +107,20 @@ const SingleScreenCredentials = ({
const optional = editable.filter((field) => !field.required);
const checkFailed = outcome?.outcome === PROBE_FAILED;

const save = (checkFirst: boolean) => {
const submit = (action: CredentialAction, run: () => void) => {
const found = problemsOf(editable, values);

setProblems(found);

if (Object.keys(found).length === 0) {
onSave(values, checkFirst);
setLastAction(action);
run();
}
};

const save = (checkFirst: boolean) =>
submit("save", () => onSave(values, checkFirst));

const renderField = (field: SetupFieldDescriptor) => {
const problem = problems[field.key];

Expand Down Expand Up @@ -192,7 +201,18 @@ const SingleScreenCredentials = ({
>
{m.setup_back()}
</Button>
<div className="flex items-center gap-2">
<div className="flex flex-wrap items-center justify-end gap-2">
{onCheck === undefined ? null : (
<Button
disabled={isBusy && lastAction !== "test"}
loading={isBusy && lastAction === "test"}
onClick={() => submit("test", () => onCheck(values))}
type="button"
variant="ghost"
>
{m.setup_test_connection()}
</Button>
)}
{checkFailed ? (
<Button
disabled={isBusy}
Expand All @@ -203,7 +223,12 @@ const SingleScreenCredentials = ({
{m.setup_save_anyway()}
</Button>
) : null}
<Button loading={isBusy} onClick={() => save(true)} type="button">
<Button
disabled={isBusy && lastAction !== "save"}
loading={isBusy && lastAction === "save"}
onClick={() => save(true)}
type="button"
>
{SAVE_LABELS[wording]()}
</Button>
</div>
Expand All @@ -212,11 +237,14 @@ const SingleScreenCredentials = ({
);
};

export const ProviderCredentials = (props: ProviderCredentialsProps) => {
export const ProviderCredentials = ({
onCheck,
...props
}: ProviderCredentialsProps) => {
const steps = credentialStepsOf(props.variant.id, props.variant.fields);

return steps === null ? (
<SingleScreenCredentials {...props} />
<SingleScreenCredentials {...props} onCheck={onCheck} />
) : (
<CredentialSequence {...props} steps={steps} />
);
Expand Down
21 changes: 19 additions & 2 deletions apps/web/src/features/instance-integration/ui/provider-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ export interface SetupIntegrationDescriptor {
}

interface ProviderStepProps {
chosen?: string;
descriptor: SetupIntegrationDescriptor;
isBusy: boolean;
isFirstStep: boolean;
onBack: () => void;
onCheck?: (variantId: string, values: Record<string, string>) => void;
onChoose?: (variantId: string) => void;
onEdit: () => void;
onSave: (
variantId: string,
Expand All @@ -43,20 +46,29 @@ interface ProviderStepProps {
}

export const ProviderStep = ({
chosen: controlledChoice,
descriptor,
isBusy,
isFirstStep,
onBack,
onCheck,
onChoose,
onEdit,
onSave,
onSkip,
outcome,
wording = "setup",
}: ProviderStepProps) => {
const [chosen, setChosen] = useState(() => initialChoiceOf(descriptor));
const [ownChoice, setOwnChoice] = useState(() => initialChoiceOf(descriptor));
const [isConfiguring, setIsConfiguring] = useState(false);
const chosen = controlledChoice ?? ownChoice;
const variant = descriptor.variants.find((entry) => entry.id === chosen);

const choose = (variantId: string) => {
setOwnChoice(variantId);
onChoose?.(variantId);
};

if (isConfiguring && variant !== undefined) {
return (
<ProviderCredentials
Expand All @@ -65,6 +77,11 @@ export const ProviderStep = ({
onEdit();
setIsConfiguring(false);
}}
onCheck={
onCheck === undefined
? undefined
: (values) => onCheck(chosen, values)
}
onEdit={onEdit}
onSave={(values, checkFirst) => onSave(chosen, values, checkFirst)}
outcome={outcome}
Expand All @@ -81,7 +98,7 @@ export const ProviderStep = ({
isBusy={isBusy}
isFirstStep={isFirstStep}
onBack={onBack}
onChoose={setChosen}
onChoose={choose}
onContinue={() => setIsConfiguring(true)}
onSkip={offersSkipButton(descriptor, wording === "setup") ? onSkip : null}
wording={wording}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/onboarding/ui/bank-connection-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@/features/bank-connection";
import type { BankInstitution, BankLinking } from "@/features/bank-connection";
import { m } from "@/paraglide/messages.js";
import { WizardStepHeader } from "@/shared/ui/wizard-step-header";
import { WizardStepHeader } from "@/shared/ui/wizard";

interface BankConnectionStepProps {
bankLinking: BankLinking;
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/pages/onboarding/ui/country-selection-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
isFullySupportedCountry,
} from "@/shared/lib/countries";
import { remixIcon } from "@/shared/lib/remix-icon";
import { WizardStepHeader } from "@/shared/ui/wizard-step-header";
import { WizardStepHeader } from "@/shared/ui/wizard";

interface CountrySelectionStepProps {
onContinue: () => void;
Expand Down Expand Up @@ -102,7 +102,7 @@ export const CountrySelectionStep = ({
</ComboboxList>
</ComboboxContent>
</Combobox>
<p className="text-muted-foreground text-center text-xs">
<p className="text-muted-foreground text-xs">
{m.onboarding_contribute_prompt()}{" "}
<a
className="text-primary underline underline-offset-2"
Expand Down
9 changes: 6 additions & 3 deletions apps/web/src/pages/onboarding/ui/onboarding-page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useQuery } from "@tanstack/react-query";
import { keepPreviousData, useQuery } from "@tanstack/react-query";

import { AuthGate } from "@/features/auth-gate";
import { useBankLinking } from "@/features/bank-connection";
Expand All @@ -16,21 +16,24 @@ const OnboardingContent = () => {
orpc.bankConnection.listInstitutions.queryOptions({
enabled: wizard.taxCountries.length > 0 && bankLinking === "available",
input: { countries: wizard.taxCountries },
placeholderData: keepPreviousData,
})
);

const connectionsQuery = useQuery(
orpc.bankConnection.listConnections.queryOptions()
);

const connections = connectionsQuery.data?.connections ?? [];

return (
<OnboardingWizard
bankLinking={bankLinking}
banks={banksQuery.data?.banks ?? []}
connectedCount={connectionsQuery.data?.connections.length ?? 0}
connectedCount={connections.length}
direction={wizard.direction}
isBanksError={banksQuery.isError}
isBanksPending={banksQuery.isPending}
isBanksPending={banksQuery.isPending || banksQuery.isPlaceholderData}
isCompleting={wizard.isCompleting}
isPending={bankLinking === "pending"}
onBack={wizard.handleBack}
Expand Down
17 changes: 3 additions & 14 deletions apps/web/src/pages/onboarding/ui/onboarding-wizard-skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,10 @@ export const OnboardingWizardSkeleton = () => {
<div aria-busy="true">
<output className="sr-only">{m.onboarding_loading()}</output>
<div aria-hidden="true" className="flex flex-col gap-8">
<div className="flex items-center justify-center gap-3">
<div className="flex items-center gap-2.5">
<Skeleton className="size-7 rounded-full" />
<Skeleton className="h-4 w-14" />
</div>
<Skeleton className="h-px w-8 sm:w-12" />
<div className="flex items-center gap-2.5">
<Skeleton className="size-7 rounded-full" />
<Skeleton className="h-4 w-24" />
</div>
</div>

<div className="flex flex-col gap-2">
<Skeleton className="mx-auto h-6 w-48" />
<Skeleton className="mx-auto h-4 w-72" />
<Skeleton className="h-7 w-48" />
<Skeleton className="h-7 w-full" />
<Skeleton className="h-7 w-56" />
</div>

<Skeleton className={cn(control, "w-full rounded-md")} />
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/pages/onboarding/ui/onboarding-wizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { Button } from "@freenary/ui/components/button";

import type { BankInstitution, BankLinking } from "@/features/bank-connection";
import { m } from "@/paraglide/messages.js";
import { WizardShell } from "@/shared/ui/wizard-shell";
import { WizardStepper } from "@/shared/ui/wizard-stepper";
import { WizardShell, WizardStepper } from "@/shared/ui/wizard";

import { BankConnectionStep } from "./bank-connection-step";
import { CountrySelectionStep } from "./country-selection-step";
Expand Down Expand Up @@ -54,6 +53,7 @@ export const OnboardingWizard = ({
<WizardShell
direction={direction}
isPending={isPending}
layout="centered"
skeleton={<OnboardingWizardSkeleton />}
stepKey={String(step)}
stepper={
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/pages/setup/model/use-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { orpc } from "@/shared/api";
import { authClient } from "@/shared/auth";

import { FINISH_STEP, setupStepsOf } from "./setup-steps";
import { useStepCelebration } from "./use-step-celebration";

export const useSetup = () => {
const queryClient = useQueryClient();
Expand Down Expand Up @@ -39,6 +40,7 @@ export const useSetup = () => {

const [chosenStep, setChosenStep] = useState<string | null>(null);
const [direction, setDirection] = useState<1 | -1>(1);
const { celebrate, celebrated } = useStepCelebration();

const status = useQuery(orpc.instance.status.queryOptions());
const isOperator = status.data?.isOperator ?? false;
Expand All @@ -63,6 +65,7 @@ export const useSetup = () => {

const goTo = (next: string, heading: 1 | -1) => {
instanceIntegration.complete.reset();
celebrate(heading === 1 ? stepId : null);
setDirection(heading);
setChosenStep(next);
};
Expand Down Expand Up @@ -97,6 +100,7 @@ export const useSetup = () => {
};

return {
celebrated,
check: instanceIntegration.check,
complete: instanceIntegration.complete,
completionFailure,
Expand Down
19 changes: 19 additions & 0 deletions apps/web/src/pages/setup/model/use-step-celebration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useEffect, useState } from "react";

const CELEBRATION_MS = 2600;

export const useStepCelebration = () => {
const [celebrated, setCelebrated] = useState<string | null>(null);

useEffect(() => {
if (celebrated === null) {
return;
}

const timer = window.setTimeout(() => setCelebrated(null), CELEBRATION_MS);

return () => window.clearTimeout(timer);
}, [celebrated]);

return { celebrate: setCelebrated, celebrated };
};
Loading
Loading