Signed in create rule clear

This commit is contained in:
adilallo
2026-04-29 07:34:40 -06:00
parent 048dceced9
commit 815de2fdfd
10 changed files with 95 additions and 46 deletions
+12
View File
@@ -22,6 +22,8 @@ import {
} from "../create/utils/flowSteps";
import type { CreateFlowStep } from "../create/types";
import { clearAnonymousCreateFlowStorage } from "../create/utils/anonymousDraftStorage";
import { clearCoreValueDetailsLocalStorage } from "../create/utils/coreValueDetailsLocalStorage";
import { prepareFreshCreateFlowEntry } from "../create/utils/prepareFreshCreateFlowEntry";
import { useMediaQuery } from "../../hooks/useMediaQuery";
import {
ProfilePageSignedOutView,
@@ -245,9 +247,18 @@ export default function ProfilePageClient() {
const handleContinueDraft = useCallback(() => {
if (draft == null || !draft.hasDraft) return;
const step = resolveContinueStepState(draft.state);
clearAnonymousCreateFlowStorage();
clearCoreValueDetailsLocalStorage();
router.push(`/create/${step}`);
}, [draft, router]);
const handleStartNewCustomRule = useCallback(() => {
void (async () => {
await prepareFreshCreateFlowEntry();
router.push("/create");
})();
}, [router]);
const handleRequestDeleteDraft = useCallback(() => {
setActionError(null);
setDraftDeleteOpen(true);
@@ -360,6 +371,7 @@ export default function ProfilePageClient() {
}}
onCloseDeleteAccount={() => setAccountDeleteOpen(false)}
onConfirmDeleteAccount={handleConfirmDeleteAccount}
onStartNewCustomRule={handleStartNewCustomRule}
/>
);
}
@@ -72,6 +72,8 @@ export type ProfilePageViewProps = {
onDismissProfileSuccess: () => void;
onDismissActionError: () => void;
onDismissRulesError: () => void;
/** Clears local + server draft (when sync) then routes to `/create` — same fresh start as marketing “Create rule”. */
onStartNewCustomRule: () => void;
};
/**
@@ -199,6 +201,7 @@ export function ProfilePageView({
onDismissProfileSuccess,
onDismissActionError,
onDismissRulesError,
onStartNewCustomRule,
}: ProfilePageViewProps) {
const t = useTranslation("pages.profile");
const tLogin = useTranslation("pages.login");
@@ -213,7 +216,7 @@ export function ProfilePageView({
id: "create-custom",
title: t("optionCreateCustom"),
description: "",
href: "/create",
onClick: onStartNewCustomRule,
leadingIcon: "edit",
showDescription: false,
},
@@ -251,7 +254,7 @@ export function ProfilePageView({
showDescription: false,
},
];
}, [t, onSignOut, onOpenDeleteAccount, onOpenEmailChange]);
}, [t, onSignOut, onOpenDeleteAccount, onOpenEmailChange, onStartNewCustomRule]);
const ruleCardShellClass =
"w-full !max-w-full cursor-default !gap-3 !rounded-[12px] shadow-[0_0_48px_rgba(0,0,0,0.1)] lg:!rounded-[24px] lg:shadow-[0_0_24px_rgba(0,0,0,0.1)]";