Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add last commit date to projects #64

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions src/components/PublicProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { use, useMemo } from "react"
import { Activity } from "react-activity-calendar"
import { ActivityCalendar } from "./ActivityCalendar"
import { Card, CardContent, CardHeader, CardTitle } from "./ui/card"
import { History } from "lucide-react"

type Props = {
project: Tables<"projects">
Expand All @@ -31,25 +32,34 @@ export function PublicProjectCard({ project, activityPromise }: Props) {
return (
<Card className="w-full max-w-fit" style={{ order }}>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Image
width={40}
height={40}
src={`https://github.com/${project.ownerLogin}.png?size=80`}
alt={project.ownerLogin}
className={`size-10 bg-gray-300 ${
project.ownerType === "User" ? "rounded-full" : "rounded-md"
}`}
/>
<a
href={`https://github.com/${project.ownerLogin}/${project.name}`}
target="_blank"
className="text-nowrap"
>
<span>{project.ownerLogin}/</span>
<wbr />
<span>{project.name}</span>
</a>
<CardTitle className="flex items-center justify-between">
<div className="flex items-center gap-2">
<Image
width={40}
height={40}
src={`https://github.com/${project.ownerLogin}.png?size=80`}
alt={project.ownerLogin}
className={`size-10 bg-gray-300 ${
project.ownerType === "User" ? "rounded-full" : "rounded-md"
}`}
/>
<a
href={`https://github.com/${project.ownerLogin}/${project.name}`}
target="_blank"
className="text-nowrap"
>
<span>{project.ownerLogin}/</span>
<wbr />
<span>{project.name}</span>
</a>
</div>

{lastCommit && (
<span className="flex items-center gap-1 text-xs font-medium">
<History className="h-4 w-4" /> Last commit:{" "}
{new Date(lastCommit).toLocaleDateString()}
</span>
)}
</CardTitle>
</CardHeader>
<CardContent>
Expand Down