Compare commits

...

2 commits

Author SHA1 Message Date
Avi
56c2a6d836 checkpoint: click profile row to select on Home 2026-08-26 15:00:07 -05:00
Avi
8130c3e7e5 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.
2026-08-26 14:59:51 -05:00
4 changed files with 44 additions and 6 deletions

View file

@ -6,12 +6,13 @@ verified green at the moment this file was written.
## Where things are ## Where things are
- Project: `/home/avi/Projects/Nostr_Keynctr` - Project: `/home/avi/Projects/Nostr_Keynctr`
- Git repo: `master` @ `98f4520` ("frontend: show active-profile picture on - Git repo: `master` @ `8130c3e` ("frontend: click a profile row on Home to
Compose and sidebar"). Before it: `f534165` (remove Profiles sidebar tab), select it"). Before it: `98f4520` (active-profile picture on Compose +
`835b0a0` (list all profiles on Home, pin dev host, widen card), `5635f79` sidebar), `f534165` (remove Profiles sidebar tab), `835b0a0` (list all
(checkpoint), `71e580f` (Trim white margins), `f29d4f9` (Checkpoint 0.45 profiles on Home, pin dev host, widen card), `5635f79` (checkpoint),
migration), `fa5ba08` (Security: upgrade nostr stack 0.40->0.45), `71e580f` (Trim white margins), `f29d4f9` (Checkpoint 0.45 migration),
`bf10ae3`, `e210f17`, `7098e75`, `e6a1efc`, `6d5063d`, `1c428a9`. `fa5ba08` (Security: upgrade nostr stack 0.40->0.45), `bf10ae3`, `e210f17`,
`7098e75`, `e6a1efc`, `6d5063d`, `1c428a9`.
- Working tree: still DIRTY with the long-standing user changes — `concept3.svg` - Working tree: still DIRTY with the long-standing user changes — `concept3.svg`
deleted, `KeynectrAppIconPossibility02.jpeg` untracked. These are NOT part deleted, `KeynectrAppIconPossibility02.jpeg` untracked. These are NOT part
of the frontend commit above and remain uncommitted. of the frontend commit above and remain uncommitted.
@ -43,6 +44,7 @@ verified green at the moment this file was written.
## Commits added most recently ## Commits added most recently
- `8130c3e` frontend: click a profile row on Home to select it
- `98f4520` frontend: show active-profile picture on Compose and sidebar - `98f4520` frontend: show active-profile picture on Compose and sidebar
- `f534165` frontend: remove redundant Profiles sidebar tab - `f534165` frontend: remove redundant Profiles sidebar tab
- `835b0a0` frontend: list all profiles on Home, pin dev host, widen profiles card - `835b0a0` frontend: list all profiles on Home, pin dev host, widen profiles card
@ -1401,6 +1403,11 @@ A stopping point you can return to if this session is closed.
Added `picture={active.picture}` to both the write and preview avatars in Added `picture={active.picture}` to both the write and preview avatars in
`ComposeScreen.tsx` and to the active-profile avatar in `Sidebar.tsx`. The `ComposeScreen.tsx` and to the active-profile avatar in `Sidebar.tsx`. The
picture now appears consistently wherever the active profile is shown. picture now appears consistently wherever the active profile is shown.
8. **Click a profile row on Home to select it.** Mirrored the Profiles screen's
clickable-row pattern: the whole non-active row in the Home "Your profiles"
list now selects the profile on click (guarded so Copy/Select buttons don't
double-fire). Added `cursor: pointer` for non-active rows. Added a test
asserting row-click selection.
### Files changed ### Files changed

View file

@ -96,6 +96,16 @@ export function HomeScreen({ onNavigate, onCreateProfile }: HomeScreenProps) {
<li <li
key={profile.npub} key={profile.npub}
className={`home-profile-row${profile.is_active ? ' is-active' : ''}`} className={`home-profile-row${profile.is_active ? ' is-active' : ''}`}
onClick={
profile.is_active
? undefined
: (event) => {
if ((event.target as HTMLElement).closest('button, a, input')) {
return;
}
void onSelect(profile.npub);
}
}
> >
<Avatar <Avatar
npub={profile.npub} npub={profile.npub}

View file

@ -1084,6 +1084,10 @@ select {
border-color: var(--token-border, rgba(0, 0, 0, 0.12)); border-color: var(--token-border, rgba(0, 0, 0, 0.12));
} }
.home-profile-row:not(.is-active) {
cursor: pointer;
}
.home-profile-row .active-profile-meta { .home-profile-row .active-profile-meta {
flex: 1; flex: 1;
min-width: 0; min-width: 0;

View file

@ -54,4 +54,21 @@ describe('HomeScreen', () => {
.click(screen.getByRole('button', { name: /Create your first profile/i })); .click(screen.getByRole('button', { name: /Create your first profile/i }));
expect(onCreateProfile).toHaveBeenCalled(); expect(onCreateProfile).toHaveBeenCalled();
}); });
it('selects a profile when its row is clicked (not just the Select button)', async () => {
const backend = createFakeBackend();
renderHome(backend);
renderWithApp(<HomeScreen onNavigate={vi.fn()} onCreateProfile={vi.fn()} />);
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();
});
}); });