84 lines
2.4 KiB
TypeScript
Raw Normal View History

2024-04-18 14:42:47 -04:00
import { Sandbox } from "@/lib/types"
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"
import Image from "next/image"
import Button from "../ui/customButton"
import { ChevronRight } from "lucide-react"
2024-04-30 23:34:44 -04:00
import Avatar from "../ui/avatar"
2024-05-05 00:06:10 -07:00
import Link from "next/link"
2024-04-18 14:42:47 -04:00
export default function DashboardSharedWithMe({
2024-05-01 02:49:25 -04:00
shared,
2024-04-18 14:42:47 -04:00
}: {
2024-05-01 02:49:25 -04:00
shared: {
id: string
name: string
type: "react" | "node"
author: string
sharedOn: Date
}[]
2024-04-18 14:42:47 -04:00
}) {
return (
<div className="grow p-4 flex flex-col">
<div className="text-xl font-medium mb-8">Shared With Me</div>
<div className="grow w-full">
<Table>
<TableHeader>
<TableRow className="hover:bg-background">
<TableHead>Sandbox Name</TableHead>
<TableHead>Shared By</TableHead>
2024-05-01 08:20:08 -04:00
<TableHead>Sent On</TableHead>
2024-04-18 14:42:47 -04:00
<TableHead className="text-right"></TableHead>
</TableRow>
</TableHeader>
<TableBody>
2024-05-01 02:49:25 -04:00
{shared.map((sandbox) => (
2024-04-18 14:42:47 -04:00
<TableRow>
<TableCell>
<div className="font-medium flex items-center">
<Image
alt=""
src={
sandbox.type === "react"
? "/project-icons/react.svg"
: "/project-icons/node.svg"
}
width={20}
height={20}
className="mr-2"
/>
{sandbox.name}
</div>
</TableCell>
<TableCell>
<div className="flex items-center">
2024-05-01 02:49:25 -04:00
<Avatar name={sandbox.author} className="mr-2" />
{sandbox.author}
2024-04-18 14:42:47 -04:00
</div>
</TableCell>
2024-05-01 08:20:08 -04:00
<TableCell>
{new Date(sandbox.sharedOn).toLocaleDateString()}
</TableCell>
2024-04-18 14:42:47 -04:00
<TableCell className="text-right">
2024-05-05 00:06:10 -07:00
<Link href={`/code/${sandbox.id}`}>
<Button>
Open <ChevronRight className="w-4 h-4 ml-2" />
</Button>
</Link>
2024-04-18 14:42:47 -04:00
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
</div>
)
}