Skip to content

Commit 315e00d

Browse files
committed
feat: add one-click analysis navigation for favorites
Implements issue #103 - enables direct navigation from favorites to analysis. Changes: - Add BarChart3 icon button to pinned repository cards that navigates to /search?repo={fullName} - Add BarChart3 icon button to favorite user cards that navigates to /search?user={username} - Use Next.js router.push for client-side navigation - Add tooltips for better UX ("View repository analysis" / "View user analytics") - Properly encode URL parameters with encodeURIComponent The new analysis button appears as the first action button in each favorite card, providing seamless one-click access to detailed analytics for both repositories and users from the Favorites section. Resolves: #103
1 parent 6a4e865 commit 315e00d

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/components/widget/FavoritesList.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
"use client";
22

33
import { useEffect, useState, useMemo } from "react";
4+
import { useRouter } from "next/navigation";
45
import { usePreferencesStore } from "@/stores/preferences";
56
import { useFavoritesStore } from "@/stores/favorites";
67
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
78
import { Button } from "@/components/ui/button";
89
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
9-
import { ChevronDown, ChevronRight, Star, GitPullRequest, User, TrendingUp, TrendingDown, Code, Filter, SortAsc, ExternalLink, Copy, GitBranch } from "lucide-react";
10+
import { ChevronDown, ChevronRight, Star, GitPullRequest, User, TrendingUp, TrendingDown, Code, Filter, SortAsc, ExternalLink, Copy, GitBranch, BarChart3 } from "lucide-react";
1011
import Link from "next/link";
1112
import Image from "next/image";
1213

1314
export function FavoritesList() {
15+
const router = useRouter();
1416
const pinnedRepos = usePreferencesStore((state) => state.pinnedRepos);
1517
const favoriteUsers = usePreferencesStore((state) => state.favoriteUsers);
1618
const categories = usePreferencesStore((state) => state.categories);
@@ -270,6 +272,15 @@ export function FavoritesList() {
270272
</div>
271273

272274
<div className="flex items-center gap-1">
275+
<Button
276+
size="sm"
277+
variant="ghost"
278+
className="h-6 px-2"
279+
onClick={() => router.push(`/search?repo=${encodeURIComponent(metrics.fullName)}`)}
280+
title="View repository analysis"
281+
>
282+
<BarChart3 className="h-3 w-3" />
283+
</Button>
273284
<Button
274285
size="sm"
275286
variant="ghost"
@@ -456,6 +467,15 @@ export function FavoritesList() {
456467
)}
457468

458469
<div className="flex items-center gap-1 mt-2">
470+
<Button
471+
size="sm"
472+
variant="ghost"
473+
className="h-6 px-2"
474+
onClick={() => router.push(`/search?user=${encodeURIComponent(metrics.username)}`)}
475+
title="View user analytics"
476+
>
477+
<BarChart3 className="h-3 w-3" />
478+
</Button>
459479
<Button
460480
size="sm"
461481
variant="ghost"

0 commit comments

Comments
 (0)