Updated ProjectCard.tsx

This commit is contained in:
Francisco Pessano
2025-07-13 21:25:16 -03:00
committed by GitHub
parent 6e69a55d19
commit fcfac33230
3 changed files with 50 additions and 20 deletions

View File

@@ -34,7 +34,8 @@ export function ProjectCard({ project, onSeenStatusChange }: ProjectCardProps) {
return (
<div className={`bg-card rounded-lg border p-6 space-y-4 hover:shadow-lg transition-all ${seen ? 'opacity-75 bg-muted/50' : ''}`}>
{/* Author Info */}
<div className="flex items-center space-x-3">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-3">
<div className="w-10 h-10 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white font-semibold">
{project.author_name.charAt(0).toUpperCase()}
</div>
@@ -42,9 +43,28 @@ export function ProjectCard({ project, onSeenStatusChange }: ProjectCardProps) {
<p className="font-semibold text-foreground">{project.author_name}</p>
<p className="text-sm text-muted-foreground">@{project.author_screen_name}</p>
</div>
</div>
<div className="flex items-center space-x-2">
<div className="ml-auto text-xs text-muted-foreground">
{formattedDate}
</div>
{/* Seen Checkbox */}
<div className="flex items-center space-x-2">
<input
type="checkbox"
id={`seen-${project.id}`}
className="w-4 h-4 rounded border-border bg-background"
checked={seen}
onChange={toggleSeen}
/>
<label
htmlFor={`seen-${project.id}`}
className="text-sm text-muted-foreground cursor-pointer"
>
Seen
</label>
</div>
</div>
</div>
{/* Project Media */}
@@ -97,22 +117,6 @@ export function ProjectCard({ project, onSeenStatusChange }: ProjectCardProps) {
</div>
{/* Seen Checkbox */}
<div className="flex items-center space-x-2">
<input
type="checkbox"
id={`seen-${project.id}`}
className="w-4 h-4 rounded border-border bg-background"
checked={seen}
onChange={toggleSeen}
/>
<label
htmlFor={`seen-${project.id}`}
className="text-sm text-muted-foreground cursor-pointer"
>
Seen
</label>
</div>
</div>
{/* Engagement Stats */}

View File

@@ -228,6 +228,32 @@ export function ProjectsTable({ projects, title, showUrlColumn = true, onSeenSta
</div>
),
size: 120,
}),
columnHelper.accessor('category', {
header: ({ column }) => (
<Button
variant="ghost"
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
className="h-auto p-0 font-semibold hover:bg-transparent justify-start w-full"
>
Category
{column.getIsSorted() === 'asc' ? (
<ArrowUp className="ml-2 h-4 w-4" />
) : column.getIsSorted() === 'desc' ? (
<ArrowDown className="ml-2 h-4 w-4" />
) : (
<ArrowUpDown className="ml-2 h-4 w-4" />
)}
</Button>
),
cell: ({ row }) => (
<div className="w-full">
<span className="inline-block px-2 py-1 text-xs font-medium bg-secondary text-secondary-foreground rounded-full">
{row.original.category || 'Uncategorized'}
</span>
</div>
),
size: 120,
})
], [showUrlColumn, seenProjects]);

View File

@@ -109,7 +109,7 @@ export function ProjectsView({ projects }: ProjectsViewProps) {
</div>
{/* Content */}
<Tabs defaultValue="unseen-with-urls" className="space-y-6">
<Tabs defaultValue="with-urls" className="space-y-6">
<TabsList className="grid w-full grid-cols-4">
<TabsTrigger value="with-urls">
Unseen w/ URLs ({unseenWithUrls.length})
@@ -125,7 +125,7 @@ export function ProjectsView({ projects }: ProjectsViewProps) {
</TabsTrigger>
</TabsList>
<TabsContent value="unseen-with-urls" className="space-y-6">
<TabsContent value="with-urls" className="space-y-6">
{viewMode === 'table' ? (
<ProjectsTable
projects={unseenWithUrls}
@@ -142,7 +142,7 @@ export function ProjectsView({ projects }: ProjectsViewProps) {
)}
</TabsContent>
<TabsContent value="unseen-without-urls" className="space-y-6">
<TabsContent value="without-urls" className="space-y-6">
{viewMode === 'table' ? (
<ProjectsTable
projects={unseenWithoutUrls}