Open a finished Rule from its Profile card, and drop it from the browser on Log out.
This commit is contained in:
1 parent
db1599123b
commit
942c7cc9de
17 files changed
+280
-14
No files matched your search
@@ -23,7 +23,9 @@ import {
|
||||
downloadStoredRuleAsPdf,
|
||||
} from "../../../lib/create/ruleExport";
|
||||
import {
|
||||
clearLastPublishedRule,
|
||||
finishedAtIso,
|
||||
readLastPublishedRule,
|
||||
writeLastPublishedRule,
|
||||
type StoredLastPublishedRule,
|
||||
} from "../../../lib/create/lastPublishedRule";
|
||||
@@ -36,6 +38,7 @@ import {
|
||||
} from "../create/utils/flowSteps";
|
||||
import type { CreateFlowStep } from "../create/types";
|
||||
import { clearAnonymousCreateFlowStorage } from "../create/utils/anonymousDraftStorage";
|
||||
import { clearBrowserRuleData } from "../create/utils/clearBrowserRuleData";
|
||||
import { clearCoreValueDetailsLocalStorage } from "../create/utils/coreValueDetailsLocalStorage";
|
||||
import { prepareFreshCreateFlowEntrySync } from "../create/utils/prepareFreshCreateFlowEntry";
|
||||
import { createFlowStepPath } from "../create/utils/createFlowPaths";
|
||||
@@ -203,6 +206,7 @@ export default function ProfilePageClient() {
|
||||
const handleSignOut = useCallback(async () => {
|
||||
setActionError(null);
|
||||
await logout();
|
||||
clearBrowserRuleData();
|
||||
setUser(null);
|
||||
setRules([]);
|
||||
setDraft(null);
|
||||
@@ -228,6 +232,8 @@ export default function ProfilePageClient() {
|
||||
const res = await deletePublishedRule(id);
|
||||
setRuleDeleteBusy(false);
|
||||
if (res.ok === true) {
|
||||
const stored = readLastPublishedRule();
|
||||
if (stored?.id === id) clearLastPublishedRule();
|
||||
setRuleDeleteTargetId(null);
|
||||
void load();
|
||||
return;
|
||||
@@ -392,6 +398,7 @@ export default function ProfilePageClient() {
|
||||
const res = await deleteAccount();
|
||||
setAccountDeleteBusy(false);
|
||||
if (res.ok) {
|
||||
clearBrowserRuleData();
|
||||
setAccountDeleteOpen(false);
|
||||
setUser(null);
|
||||
setRules([]);
|
||||
|
||||
@@ -14,6 +14,7 @@ import Alert from "../../../components/modals/Alert";
|
||||
import HeaderLockup from "../../../components/type/HeaderLockup";
|
||||
import { useTranslation } from "../../../contexts/MessagesContext";
|
||||
import type { CreateFlowState } from "../../create/types";
|
||||
import { createCompletedPath } from "../../create/utils/createFlowPaths";
|
||||
import type {
|
||||
MyPublishedRule,
|
||||
ServerDraftForProfile,
|
||||
@@ -399,6 +400,8 @@ export function ProfilePageView({
|
||||
description={rule.summary ?? undefined}
|
||||
expanded
|
||||
size={ruleCardSize}
|
||||
href={createCompletedPath({ ruleId: rule.id })}
|
||||
ariaLabel={rule.title}
|
||||
hasBottomLinks
|
||||
bottomStatusLabel={t("finishedBadge")}
|
||||
bottomLinks={[
|
||||
@@ -422,7 +425,7 @@ export function ProfilePageView({
|
||||
rule.title,
|
||||
)}
|
||||
backgroundColor="bg-[var(--color-surface-invert-brand-teal)]"
|
||||
className={ownedRuleCardShellClass}
|
||||
className={ruleCardShellClass}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -449,7 +452,8 @@ export function ProfilePageView({
|
||||
description={rule.summary ?? undefined}
|
||||
expanded
|
||||
size={ruleCardSize}
|
||||
href={`/invite/${encodeURIComponent(rule.id)}`}
|
||||
href={`/rules/${encodeURIComponent(rule.id)}`}
|
||||
ariaLabel={rule.title}
|
||||
communityInitials={communityInitialsFromTitle(
|
||||
rule.title,
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user