Skip to content

Commit 27936ba

Browse files
committed
feat: add delete option inside repo detail view via three-dot menu
Three-dot menu in top-right of repo detail header (next to repo name). Click '...' -> 'Delete repository' -> confirmation dialog -> DELETE API. Delete is now available in TWO places: 1. Repo card grid (hover card -> three dots) 2. Inside repo detail view (top-right header) Both use same confirmation dialog and same handleDeleteRepo handler. After delete, navigates back to repo list automatically.
1 parent 9ca8913 commit 27936ba

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

frontend/src/components/dashboard/DashboardHome.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ export function DashboardHome() {
257257
onTabChange={setActiveTab}
258258
onBack={() => { setSelectedRepo(null); setActiveTab('overview') }}
259259
onReindex={handleReindex}
260+
onDelete={() => handleDeleteRepo(selectedRepo)}
260261
/>
261262
)}
262263
</AnimatePresence>

frontend/src/components/dashboard/RepoDetailView.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Single repo detail view with tabs (Overview, Search, Dependencies, etc.)
22
// Receives repo data and callbacks from DashboardHome
33

4+
import { useState } from 'react'
45
import { motion } from 'framer-motion'
56
import {
67
LayoutDashboard,
@@ -11,7 +12,24 @@ import {
1112
ArrowLeft,
1213
FolderGit2,
1314
ExternalLink,
15+
MoreVertical,
16+
Trash2,
1417
} from 'lucide-react'
18+
import {
19+
DropdownMenu,
20+
DropdownMenuContent,
21+
DropdownMenuItem,
22+
DropdownMenuTrigger,
23+
} from '@/components/ui/dropdown-menu'
24+
import {
25+
Dialog,
26+
DialogContent,
27+
DialogDescription,
28+
DialogFooter,
29+
DialogHeader,
30+
DialogTitle,
31+
} from '@/components/ui/dialog'
32+
import { Button } from '@/components/ui/button'
1533
import { SearchPanel } from '../SearchPanel'
1634
import { DependencyGraph } from '../DependencyGraph'
1735
import { RepoOverview } from '../RepoOverview'
@@ -36,6 +54,7 @@ interface RepoDetailViewProps {
3654
onTabChange: (tab: RepoTab) => void
3755
onBack: () => void
3856
onReindex: () => void
57+
onDelete?: () => void
3958
}
4059

4160
export function RepoDetailView({
@@ -46,7 +65,9 @@ export function RepoDetailView({
4665
onTabChange,
4766
onBack,
4867
onReindex,
68+
onDelete,
4969
}: RepoDetailViewProps) {
70+
const [showDeleteDialog, setShowDeleteDialog] = useState(false)
5071
return (
5172
<motion.div
5273
key="repo-detail"
@@ -82,7 +103,45 @@ export function RepoDetailView({
82103
</a>
83104
</div>
84105
</div>
106+
{onDelete && (
107+
<DropdownMenu>
108+
<DropdownMenuTrigger asChild>
109+
<button className="w-8 h-8 flex items-center justify-center rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors">
110+
<MoreVertical className="w-4 h-4" />
111+
</button>
112+
</DropdownMenuTrigger>
113+
<DropdownMenuContent align="end">
114+
<DropdownMenuItem
115+
onClick={() => setShowDeleteDialog(true)}
116+
className="text-destructive focus:text-destructive"
117+
>
118+
<Trash2 className="w-3.5 h-3.5 mr-2" />
119+
Delete repository
120+
</DropdownMenuItem>
121+
</DropdownMenuContent>
122+
</DropdownMenu>
123+
)}
85124
</div>
125+
126+
<Dialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>
127+
<DialogContent>
128+
<DialogHeader>
129+
<DialogTitle>Delete repository</DialogTitle>
130+
<DialogDescription>
131+
This will permanently remove <strong>{repo.name}</strong> and all its indexed data. This action cannot be undone.
132+
</DialogDescription>
133+
</DialogHeader>
134+
<DialogFooter className="gap-2">
135+
<Button variant="outline" onClick={() => setShowDeleteDialog(false)}>Cancel</Button>
136+
<Button
137+
variant="destructive"
138+
onClick={() => { setShowDeleteDialog(false); onDelete?.() }}
139+
>
140+
Delete
141+
</Button>
142+
</DialogFooter>
143+
</DialogContent>
144+
</Dialog>
86145
</div>
87146

88147
{/* tab bar */}

0 commit comments

Comments
 (0)