From 8130c3e7e5e4a17e618b7753cb619239e6c4ca9e Mon Sep 17 00:00:00 2001 From: Avi Date: Wed, 26 Aug 2026 14:59:51 -0500 Subject: [PATCH] frontend: click a profile row on Home to select it Mirrors the Profiles screen: the whole non-active row in the Home 'Your profiles' list now selects the profile on click, guarded so the Copy/Select buttons don't double-trigger. Added a pointer cursor for non-active rows and a test for row-click selection. --- frontend/src/screens/HomeScreen.tsx | 10 ++++++++++ frontend/src/styles.css | 4 ++++ frontend/src/test/HomeScreen.test.tsx | 17 +++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/frontend/src/screens/HomeScreen.tsx b/frontend/src/screens/HomeScreen.tsx index da4a7f3..2372f1b 100644 --- a/frontend/src/screens/HomeScreen.tsx +++ b/frontend/src/screens/HomeScreen.tsx @@ -96,6 +96,16 @@ export function HomeScreen({ onNavigate, onCreateProfile }: HomeScreenProps) {
  • { + if ((event.target as HTMLElement).closest('button, a, input')) { + return; + } + void onSelect(profile.npub); + } + } > { .click(screen.getByRole('button', { name: /Create your first profile/i })); expect(onCreateProfile).toHaveBeenCalled(); }); + + it('selects a profile when its row is clicked (not just the Select button)', async () => { + const backend = createFakeBackend(); + renderHome(backend); + renderWithApp(); + + const bobRow = (await screen.findByText('Bob')).closest('.home-profile-row') as HTMLElement; + // Clicking the name (not the Select button) should select the profile. + await userEvent.setup().click(within(bobRow).getByText('Bob')); + + await waitFor(() => { + expect(within(bobRow).getByRole('button', { name: 'Selected' })).toBeInTheDocument(); + }); + // The previously active profile now offers a Select button again. + const aliceRow = screen.getByText('Alice').closest('.home-profile-row') as HTMLElement; + expect(within(aliceRow).getByRole('button', { name: 'Select' })).toBeInTheDocument(); + }); });