Skip to content

Commit 5238881

Browse files
donjor-agent[bot]donjor
authored andcommitted
fix(web): compose bookmark rows from shared primitives (#1798)
## Problem Bookmark rows duplicated discovery-row and removal-button styling. Review findings: #1795 ui-consistency-1 and ui-consistency-2. ## Change Use DiscoveryListRow with a sibling ghost-muted icon Button, keeping navigation and removal as separate keyboard targets. Reserve trailing space so removal does not cover the label; reveal removal on hover and focus-within. #1795 ui-consistency-3 was already fixed in 4f4b326; no holds. Visible differences: shared button sizing and focus treatment, more trailing label space, removal visible while either control has focus. ## Scope and approval Host-approved, issue-free cleanup limited to browser bookmarks. The review-only backfill PR remains untouched. No shared primitive or upstream-owned file changes. ## Verification - [x] Changed-file lint: exit 0 - [x] Web typecheck: exit 0 - [x] fork:ci: exit 0; 776 tests passed - [x] Host browser grounding: see Evidence No tests changed; no dev server or browser launched, as directed. Host owns before/after evidence, keyboard verification, hover/focus-within reveal, and label/hit-area separation. Model: GPT-6.1 Sol; harness: Pi. ## Evidence Web client, dark, 1280x800, seeded dev data: `hyprws` vs all five fix branches merged. - Shows: rest, row hover, remove-button focus - Long label truncates before the `X` - `X` shows on hover and keyboard focus ![1798 before and after](https://github.com/user-attachments/assets/f6091ea4-f32a-4c90-93e6-660f3e027ebf) ## Fork trailers Fork-Domain: browser-bookmarks Fork-Tier: qol Fork-Upstreamable: no Co-authored-by: donjor <[email protected]>
1 parent 012cb09 commit 5238881

2 files changed

Lines changed: 22 additions & 26 deletions

File tree

‎apps/web/src/components/preview/PreviewBookmarkCard.tsx‎

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type { ScopedThreadRef } from "@t3tools/contracts";
22
import { X } from "lucide-react";
33

44
import type { BrowserBookmarkEntry, BrowserBookmarkScope } from "~/browserBookmarkStore";
5+
import { Button } from "~/components/ui/button";
6+
import { DiscoveryListRow } from "~/components/ui/discovery-list";
57

68
import { PreviewFaviconIcon } from "./PreviewFaviconIcon";
79

@@ -19,29 +21,23 @@ export function PreviewBookmarkCard({ threadRef, entry, scope, onOpen, onRemove
1921
const label = `${parsed.host}${path}${parsed.search}${parsed.hash}`;
2022
return (
2123
<div className="group relative flex w-full items-center">
22-
<button
23-
type="button"
24+
<DiscoveryListRow
2425
onClick={onOpen}
25-
className="flex w-full items-center gap-3 px-3 py-3 pr-10 text-left hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
26-
>
27-
<PreviewFaviconIcon threadRef={threadRef} url={entry.url} />
28-
<div className="flex min-w-0 flex-1 flex-col">
29-
<span className="truncate text-sm font-medium text-foreground">
30-
{entry.title ?? label}
31-
</span>
32-
{entry.title ? (
33-
<span className="truncate text-xs text-muted-foreground">{label}</span>
34-
) : null}
35-
</div>
36-
</button>
37-
<button
38-
type="button"
39-
aria-label={`Remove ${label} from ${scope} bookmarks`}
40-
onClick={onRemove}
41-
className="absolute right-3 rounded p-1 text-muted-foreground opacity-0 hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset group-hover:opacity-100"
42-
>
43-
<X className="size-3.5" />
44-
</button>
26+
icon={<PreviewFaviconIcon threadRef={threadRef} url={entry.url} />}
27+
title={entry.title ?? label}
28+
description={entry.title ? label : null}
29+
action={<span aria-hidden="true" className="w-8 shrink-0" />}
30+
/>
31+
<div className="absolute right-3 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100">
32+
<Button
33+
variant="ghost-muted"
34+
size="icon-xs"
35+
aria-label={`Remove ${label} from ${scope} bookmarks`}
36+
onClick={onRemove}
37+
>
38+
<X className="size-3.5" />
39+
</Button>
40+
</div>
4541
</div>
4642
);
4743
}

‎apps/web/src/components/preview/PreviewEmptyState.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function PreviewEmptyState({
6666
<Folder className="size-4 shrink-0" />
6767
<h2 className="font-medium">Project bookmarks</h2>
6868
</div>
69-
<div className="flex flex-col divide-y divide-border/60 overflow-hidden rounded-xl border border-border/70 bg-background">
69+
<DiscoveryList>
7070
{project.map((entry) => (
7171
<PreviewBookmarkCard
7272
key={entry.url}
@@ -77,7 +77,7 @@ export function PreviewEmptyState({
7777
onRemove={() => onRemoveBookmark("project", entry.url)}
7878
/>
7979
))}
80-
</div>
80+
</DiscoveryList>
8181
</div>
8282
) : null}
8383
{global.length > 0 ? (
@@ -86,7 +86,7 @@ export function PreviewEmptyState({
8686
<Globe2 className="size-4 shrink-0" />
8787
<h2 className="font-medium">Global bookmarks</h2>
8888
</div>
89-
<div className="flex flex-col divide-y divide-border/60 overflow-hidden rounded-xl border border-border/70 bg-background">
89+
<DiscoveryList>
9090
{global.map((entry) => (
9191
<PreviewBookmarkCard
9292
key={entry.url}
@@ -97,7 +97,7 @@ export function PreviewEmptyState({
9797
onRemove={() => onRemoveBookmark("global", entry.url)}
9898
/>
9999
))}
100-
</div>
100+
</DiscoveryList>
101101
</div>
102102
) : null}
103103
{recents.length > 0 ? (

0 commit comments

Comments
 (0)