Skip to content

Commit b6838bc

Browse files
committed
update favourite and recent cards
1 parent ae6a6cc commit b6838bc

2 files changed

Lines changed: 39 additions & 46 deletions

File tree

src/routes/Dashboard/DashboardFavoritesView.tsx

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useNavigate } from "@tanstack/react-router";
1+
import { Link } from "@tanstack/react-router";
22
import { ChevronLeft, ChevronRight, GitBranch, Play, X } from "lucide-react";
33
import { useState } from "react";
44

@@ -18,23 +18,19 @@ function getFavoriteUrl(item: FavoriteItem): string {
1818
}
1919

2020
const FavoriteCard = ({ item }: { item: FavoriteItem }) => {
21-
const navigate = useNavigate();
2221
const { removeFavorite } = useFavorites();
2322

2423
const isPipeline = item.type === "pipeline";
2524

2625
return (
27-
<div
28-
onClick={() => navigate({ to: getFavoriteUrl(item) })}
29-
className={`group relative flex flex-col gap-2 p-3 border rounded-lg cursor-pointer transition-colors ${
30-
isPipeline
31-
? "bg-violet-50/40 hover:bg-violet-50 border-violet-100"
32-
: "bg-emerald-50/40 hover:bg-emerald-50 border-emerald-100"
33-
}`}
26+
<Link
27+
to={getFavoriteUrl(item)}
28+
className="group relative flex flex-col gap-2.5 p-3 rounded-lg transition-all shadow-sm hover:shadow-md bg-card border border-border hover:border-foreground/20 no-underline"
3429
>
3530
{/* Remove button */}
3631
<button
3732
onClick={(e) => {
33+
e.preventDefault();
3834
e.stopPropagation();
3935
removeFavorite(item.type, item.id);
4036
}}
@@ -44,21 +40,23 @@ const FavoriteCard = ({ item }: { item: FavoriteItem }) => {
4440
<X className="h-3.5 w-3.5" />
4541
</button>
4642

47-
{/* Type badge */}
48-
<InlineStack gap="1" blockAlign="center">
49-
{isPipeline ? (
50-
<GitBranch className="h-3.5 w-3.5 shrink-0 text-violet-500" />
51-
) : (
52-
<Play className="h-3.5 w-3.5 shrink-0 text-emerald-500" />
53-
)}
54-
<Text
55-
size="xs"
56-
weight="semibold"
57-
className={isPipeline ? "text-violet-600" : "text-emerald-600"}
43+
{/* Type pill */}
44+
<div className="flex">
45+
<span
46+
className={`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-xs font-semibold ${
47+
isPipeline
48+
? "bg-violet-100 text-violet-700"
49+
: "bg-emerald-100 text-emerald-700"
50+
}`}
5851
>
52+
{isPipeline ? (
53+
<GitBranch className="h-3 w-3" />
54+
) : (
55+
<Play className="h-3 w-3" />
56+
)}
5957
{isPipeline ? "Pipeline" : "Run"}
60-
</Text>
61-
</InlineStack>
58+
</span>
59+
</div>
6260

6361
{/* Name */}
6462
<Text size="sm" weight="semibold" className="truncate pr-4 leading-tight">
@@ -69,7 +67,7 @@ const FavoriteCard = ({ item }: { item: FavoriteItem }) => {
6967
<Text size="xs" className="truncate text-muted-foreground font-mono">
7068
{item.id}
7169
</Text>
72-
</div>
70+
</Link>
7371
);
7472
};
7573

src/routes/Dashboard/DashboardRecentlyViewedView.tsx

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useNavigate } from "@tanstack/react-router";
1+
import { Link } from "@tanstack/react-router";
22
import { GitBranch, Play } from "lucide-react";
33

44
import { BlockStack, InlineStack } from "@/components/ui/layout";
@@ -27,34 +27,29 @@ function formatRelativeTime(viewedAt: number): string {
2727
}
2828

2929
const RecentlyViewedCard = ({ item }: { item: RecentlyViewedItem }) => {
30-
const navigate = useNavigate();
3130
const isPipeline = item.type === "pipeline";
3231

3332
return (
34-
<div
35-
onClick={() => navigate({ to: getRecentlyViewedUrl(item) })}
36-
className={`flex flex-col gap-2 p-3 border rounded-lg cursor-pointer transition-colors ${
37-
isPipeline
38-
? "bg-violet-50/40 hover:bg-violet-50 border-violet-100"
39-
: "bg-emerald-50/40 hover:bg-emerald-50 border-emerald-100"
40-
}`}
33+
<Link
34+
to={getRecentlyViewedUrl(item)}
35+
className="flex flex-col gap-2.5 p-3 rounded-lg transition-all shadow-sm hover:shadow-md bg-card border border-border hover:border-foreground/20 no-underline"
4136
>
42-
{/* Type badge */}
43-
<InlineStack gap="1" blockAlign="center" align="space-between">
44-
<InlineStack gap="1" blockAlign="center">
37+
{/* Type pill + timestamp */}
38+
<InlineStack blockAlign="center" align="space-between">
39+
<span
40+
className={`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-xs font-semibold ${
41+
isPipeline
42+
? "bg-violet-100 text-violet-700"
43+
: "bg-emerald-100 text-emerald-700"
44+
}`}
45+
>
4546
{isPipeline ? (
46-
<GitBranch className="h-3.5 w-3.5 shrink-0 text-violet-500" />
47+
<GitBranch className="h-3 w-3" />
4748
) : (
48-
<Play className="h-3.5 w-3.5 shrink-0 text-emerald-500" />
49+
<Play className="h-3 w-3" />
4950
)}
50-
<Text
51-
size="xs"
52-
weight="semibold"
53-
className={isPipeline ? "text-violet-600" : "text-emerald-600"}
54-
>
55-
{isPipeline ? "Pipeline" : "Run"}
56-
</Text>
57-
</InlineStack>
51+
{isPipeline ? "Pipeline" : "Run"}
52+
</span>
5853
<Text size="xs" className="text-muted-foreground">
5954
{formatRelativeTime(item.viewedAt)}
6055
</Text>
@@ -69,7 +64,7 @@ const RecentlyViewedCard = ({ item }: { item: RecentlyViewedItem }) => {
6964
<Text size="xs" className="truncate text-muted-foreground font-mono">
7065
{item.id}
7166
</Text>
72-
</div>
67+
</Link>
7368
);
7469
};
7570

0 commit comments

Comments
 (0)