Skip to content

Commit 3e8dae7

Browse files
wesbillmanPinky
andauthored
fix(desktop): simplify sign out settings row (#1903)
Signed-off-by: Wes <[email protected]> Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
1 parent b612804 commit 3e8dae7

4 files changed

Lines changed: 41 additions & 43 deletions

File tree

‎desktop/scripts/check-px-text.mjs‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ const rules = [
1919
},
2020
];
2121

22-
// Decorative / chrome exceptions: `relativePath:lineNumber`. The avatar emoji
23-
// glyphs are fixed display sizes sized to their avatar box (not readable
24-
// message text), so they are exempted from the readable-text px rule.
22+
// Decorative / chrome exceptions: `relativePath:matchedLiteral`. The avatar
23+
// emoji glyphs are fixed display sizes sized to their avatar box (not readable
24+
// message text), so they are exempted from the readable-text px rule. Matching
25+
// the literal keeps these exceptions stable when unrelated edits move lines.
2526
const overrides = new Set([
26-
"src/features/settings/ui/ProfileSettingsCard.tsx:712",
27-
"src/features/onboarding/ui/AvatarStep.tsx:95",
28-
"src/features/agents/ui/AgentCreationPreview.tsx:666",
29-
"src/features/agents/ui/AgentCreationPreview.tsx:747",
27+
"src/features/settings/ui/ProfileSettingsCard.tsx:text-[6rem]",
28+
"src/features/onboarding/ui/AvatarStep.tsx:text-[6rem]",
29+
"src/features/agents/ui/AgentCreationPreview.tsx:text-[4rem]",
30+
"src/features/agents/ui/AgentCreationPreview.tsx:text-[6rem]",
3031
]);
3132

3233
await runPxTextCheck({

‎desktop/src/features/settings/ui/ProfileSettingsCard.tsx‎

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
parseEmojiAvatarDataUrl,
3232
} from "@/features/profile/ui/ProfileAvatarEditor";
3333
import { cn } from "@/shared/lib/cn";
34+
import { Button } from "@/shared/ui/button";
3435
import { Input } from "@/shared/ui/input";
3536
import { Spinner } from "@/shared/ui/spinner";
3637
import { Textarea } from "@/shared/ui/textarea";
@@ -954,36 +955,31 @@ export function ProfileSettingsCard({
954955
</div>
955956
</div>
956957

957-
<div className="mt-8" data-testid="settings-signout">
958-
<SettingsSectionHeader
959-
title="Sign out"
960-
description="Removes your identity key and all local app data from this device. Back up your private key (nsec) before proceeding — this cannot be undone."
961-
/>
962-
<div className="overflow-hidden rounded-xl border border-destructive/20 bg-background/70 shadow-xs">
963-
<div className="flex items-center justify-between gap-4 px-4 py-3">
964-
<div className="min-w-0 space-y-1">
965-
<p className="text-sm font-medium">Clear data and sign out</p>
966-
<p className="text-sm text-muted-foreground">
967-
Wipes the keychain, agent settings, and app cache, then
968-
relaunches Buzz into first-run setup.
969-
</p>
970-
</div>
971-
<button
972-
className="inline-flex shrink-0 items-center gap-1.5 rounded-full border border-destructive/30 bg-destructive/5 px-3 py-1.5 text-sm font-medium text-destructive transition-colors hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
973-
data-testid="signout-open-dialog"
974-
disabled={isSignOutPending}
975-
onClick={() => setIsSignOutOpen(true)}
976-
type="button"
977-
>
978-
{isSignOutPending ? (
979-
<Spinner
980-
aria-label="Signing out"
981-
className="h-4 w-4 border-2"
982-
/>
983-
) : null}
984-
{isSignOutPending ? "Signing out…" : "Sign Out"}
985-
</button>
958+
<div
959+
className="mt-8 border-t border-border/60 pb-6 pt-5"
960+
data-testid="settings-signout"
961+
>
962+
<div className="flex items-center justify-between gap-4 px-1">
963+
<div className="min-w-0 space-y-1">
964+
<h2 className="text-sm font-medium">Sign out</h2>
965+
<p className="text-sm text-muted-foreground">
966+
Removes your identity key and all local app data from this device.
967+
Back up your private key (nsec) first — this cannot be undone.
968+
</p>
986969
</div>
970+
<Button
971+
className="shrink-0"
972+
data-testid="signout-open-dialog"
973+
disabled={isSignOutPending}
974+
onClick={() => setIsSignOutOpen(true)}
975+
type="button"
976+
variant="destructive"
977+
>
978+
{isSignOutPending ? (
979+
<Spinner aria-label="Signing out" className="h-4 w-4 border-2" />
980+
) : null}
981+
{isSignOutPending ? "Signing out…" : "Sign Out"}
982+
</Button>
987983
</div>
988984
<AlertDialog
989985
onOpenChange={(open) => {

‎lefthook.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pre-push:
2222
commands:
2323
rust-tests:
2424
run: just test-unit
25+
desktop-check:
26+
run: just desktop-check
2527
desktop-test:
2628
run: just desktop-test
2729
desktop-tauri-test:

‎scripts/check-px-text-core.mjs‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function walkFiles(directory) {
5050
* @param {string} options.projectRoot Absolute path the rule roots resolve against.
5151
* @param {Array<{root: string, extensions: Set<string>}>} options.rules Where to scan.
5252
* @param {string} options.label Human label for the failure header.
53-
* @param {Set<string>} [options.overrides] Allowlisted "relativePath:lineNumber" entries.
53+
* @param {Set<string>} [options.overrides] Allowlisted "relativePath:matchedLiteral" entries.
5454
* @param {string} options.scriptPath Path mentioned in the failure hint.
5555
*/
5656
export async function runPxTextCheck({
@@ -94,16 +94,15 @@ export async function runPxTextCheck({
9494
const lines = content.split(/\r?\n/);
9595
lines.forEach((line, index) => {
9696
const lineNumber = index + 1;
97-
const key = `${relativePath}:${lineNumber}`;
98-
if (overrides.has(key)) {
99-
return;
100-
}
10197
const matches = [
10298
...(line.match(TEXT_ARBITRARY_RE) ?? []),
10399
...(line.match(FONT_SIZE_PX_RE) ?? []),
104100
];
105101
for (const match of matches) {
106-
violations.push({ relativePath, lineNumber, match });
102+
const key = `${relativePath}:${match}`;
103+
if (!overrides.has(key)) {
104+
violations.push({ relativePath, lineNumber, match });
105+
}
107106
}
108107
});
109108
}
@@ -119,7 +118,7 @@ export async function runPxTextCheck({
119118
"tokens) so the text scales with Cmd +/- zoom and stays on one scale. " +
120119
"If this size is " +
121120
"genuinely decorative/chrome (not readable message text), add a " +
122-
`narrowly scoped \`relativePath:lineNumber\` exception in \`${scriptPath}\`.`,
121+
`narrowly scoped \`relativePath:matchedLiteral\` exception in \`${scriptPath}\`.`,
123122
);
124123
process.exit(1);
125124
}

0 commit comments

Comments
 (0)