feat(desktop): reorder Profile above Identity in settings & remove duplicate NIP-05 input (#165)

This commit is contained in:
Wes
2026-03-24 11:16:06 -07:00
committed by GitHub
parent 25ed2dcc23
commit 924a8014ff
2 changed files with 23 additions and 64 deletions
@@ -70,30 +70,23 @@ export function ProfileSettingsCard({
const currentDisplayName = profile?.displayName ?? "";
const currentAvatarUrl = profile?.avatarUrl ?? "";
const currentAbout = profile?.about ?? "";
const currentNip05Handle = profile?.nip05Handle ?? "";
const [displayNameDraft, setDisplayNameDraft] = React.useState("");
const [avatarUrlDraft, setAvatarUrlDraft] = React.useState("");
const [aboutDraft, setAboutDraft] = React.useState("");
const [nip05HandleDraft, setNip05HandleDraft] = React.useState("");
React.useEffect(() => {
setDisplayNameDraft(currentDisplayName);
setAvatarUrlDraft(currentAvatarUrl);
setAboutDraft(currentAbout);
setNip05HandleDraft(currentNip05Handle);
}, [currentAbout, currentAvatarUrl, currentDisplayName, currentNip05Handle]);
}, [currentAbout, currentAvatarUrl, currentDisplayName]);
const nextDisplayName = displayNameDraft.trim();
const nextAvatarUrl = avatarUrlDraft.trim();
const nextAbout = aboutDraft.trim();
const nextNip05Handle = nip05HandleDraft.trim();
const updatePayload: {
displayName?: string;
avatarUrl?: string;
about?: string;
nip05Handle?: string;
} = {};
if (nextDisplayName.length > 0 && nextDisplayName !== currentDisplayName) {
@@ -105,9 +98,6 @@ export function ProfileSettingsCard({
if (nextAbout.length > 0 && nextAbout !== currentAbout) {
updatePayload.about = nextAbout;
}
if (nextNip05Handle !== currentNip05Handle) {
updatePayload.nip05Handle = nextNip05Handle;
}
const hasPendingClearRequest =
(currentDisplayName.length > 0 && nextDisplayName.length === 0) ||
@@ -175,26 +165,6 @@ export function ProfileSettingsCard({
</div>
) : null}
<Section
description="Your keypair is fixed for this device. Profile fields and NIP-05 are editable below."
title="Identity"
>
<div className="space-y-3">
<ReadOnlyField
label="Public key"
testId="profile-pubkey"
value={resolvedPubkey}
/>
<ReadOnlyField
label="NIP-05 handle"
testId="profile-nip05"
value={nip05Handle}
/>
</div>
</Section>
<Separator />
<Section
description="These values are stored on the relay for your current identity."
title="Profile"
@@ -231,28 +201,6 @@ export function ProfileSettingsCard({
</div>
</div>
<div className="space-y-1.5">
<label className="text-sm font-medium" htmlFor="profile-nip05">
NIP-05 handle
</label>
<div className="relative min-w-0">
<AtSign className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
className="pl-9"
data-testid="profile-nip05-input"
disabled={updateProfileMutation.isPending}
id="profile-nip05"
onChange={(event) => setNip05HandleDraft(event.target.value)}
placeholder="alice@localhost"
value={nip05HandleDraft}
/>
</div>
<p className="text-sm text-muted-foreground">
Must match this relay&apos;s domain. Leave blank to clear your
current handle.
</p>
</div>
<div className="space-y-1.5">
<label
className="text-sm font-medium"
@@ -309,6 +257,26 @@ export function ProfileSettingsCard({
) : null}
</form>
</Section>
<Separator />
<Section
description="Your keypair and NIP-05 handle are fixed for this device."
title="Identity"
>
<div className="space-y-3">
<ReadOnlyField
label="Public key"
testId="profile-pubkey"
value={resolvedPubkey}
/>
<ReadOnlyField
label="NIP-05 handle"
testId="profile-nip05"
value={nip05Handle}
/>
</div>
</Section>
</div>
</section>
);
+2 -11
View File
@@ -11,8 +11,6 @@ test("updates the relay-backed profile from settings", async ({ page }) => {
const displayName = `Tyler QA ${stamp}`;
const avatarUrl = `https://example.com/avatar-${stamp}.png`;
const about = `Coordinating relay profile setup ${stamp}`;
const nip05Handle = `tyler-${stamp}@localhost`;
await page.goto("/");
await page.getByTestId("open-settings").click();
@@ -25,7 +23,6 @@ test("updates the relay-backed profile from settings", async ({ page }) => {
await expect(page.getByTestId("profile-nip05")).toContainText("Not set");
await page.getByTestId("profile-display-name").fill(displayName);
await page.getByTestId("profile-nip05-input").fill(nip05Handle);
await page.getByTestId("profile-avatar-url").fill(avatarUrl);
await page.getByTestId("profile-about").fill(about);
await page.getByTestId("profile-save").click();
@@ -33,10 +30,7 @@ test("updates the relay-backed profile from settings", async ({ page }) => {
await expect(page.getByTestId("profile-display-name")).toHaveValue(
displayName,
);
await expect(page.getByTestId("profile-nip05")).toContainText(nip05Handle);
await expect(page.getByTestId("profile-nip05-input")).toHaveValue(
nip05Handle,
);
await expect(page.getByTestId("profile-nip05")).toContainText("Not set");
await expect(page.getByTestId("profile-avatar-url")).toHaveValue(avatarUrl);
await expect(page.getByTestId("profile-about")).toHaveValue(about);
@@ -50,10 +44,7 @@ test("updates the relay-backed profile from settings", async ({ page }) => {
await expect(page.getByTestId("profile-display-name")).toHaveValue(
displayName,
);
await expect(page.getByTestId("profile-nip05")).toContainText(nip05Handle);
await expect(page.getByTestId("profile-nip05-input")).toHaveValue(
nip05Handle,
);
await expect(page.getByTestId("profile-nip05")).toContainText("Not set");
await expect(page.getByTestId("profile-avatar-url")).toHaveValue(avatarUrl);
await expect(page.getByTestId("profile-about")).toHaveValue(about);
});