Skip to content

Commit 975d727

Browse files
Copilothotlong
andcommitted
fix: address code review - use SidebarMenuAction, remove inline IIFE
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent bfba4bc commit 975d727

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

apps/console/src/components/AppSidebar.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
SidebarMenu,
2222
SidebarMenuItem,
2323
SidebarMenuButton,
24+
SidebarMenuAction,
2425
DropdownMenu,
2526
DropdownMenuTrigger,
2627
DropdownMenuContent,
@@ -183,13 +184,13 @@ export function AppSidebar({ activeAppName, onAppChange }: { activeAppName: stri
183184
<span className="truncate">{item.label}</span>
184185
</Link>
185186
</SidebarMenuButton>
186-
<button
187+
<SidebarMenuAction
188+
showOnHover
187189
onClick={(e) => { e.stopPropagation(); removeFavorite(item.id); }}
188-
className="absolute right-1 top-1/2 -translate-y-1/2 opacity-0 group-hover/menu-item:opacity-100 p-1 rounded hover:bg-accent"
189190
aria-label={`Remove ${item.label} from favorites`}
190191
>
191-
<StarOff className="h-3 w-3 text-muted-foreground" />
192-
</button>
192+
<StarOff className="h-3 w-3" />
193+
</SidebarMenuAction>
193194
</SidebarMenuItem>
194195
))}
195196
</SidebarMenu>

apps/console/src/components/SearchResultsPage.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,14 @@ export function SearchResultsPage() {
173173
</Badge>
174174
</h2>
175175
<div className="grid gap-2">
176-
{items.map(item => (
176+
{items.map(item => {
177+
const ItemIcon = TYPE_ICONS[item.type] || Database;
178+
return (
177179
<Link key={item.id} to={item.href}>
178180
<Card className="hover:bg-accent/50 transition-colors cursor-pointer">
179181
<CardContent className="flex items-center gap-3 p-3">
180182
<div className={`flex h-8 w-8 items-center justify-center rounded ${TYPE_COLORS[item.type] || ''}`}>
181-
{(() => { const I = TYPE_ICONS[item.type] || Database; return <I className="h-4 w-4" />; })()}
183+
<ItemIcon className="h-4 w-4" />
182184
</div>
183185
<div className="flex-1 min-w-0">
184186
<p className="text-sm font-medium truncate">{item.label}</p>
@@ -192,7 +194,8 @@ export function SearchResultsPage() {
192194
</CardContent>
193195
</Card>
194196
</Link>
195-
))}
197+
);
198+
})}
196199
</div>
197200
</div>
198201
);

0 commit comments

Comments
 (0)