-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrive-contents.tsx
More file actions
77 lines (72 loc) · 2.41 KB
/
drive-contents.tsx
File metadata and controls
77 lines (72 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"use client";
import { SignedIn, SignedOut, SignInButton, UserButton } from "@clerk/nextjs";
import { ChevronRight } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { UploadButton } from "~/components/uploadthing";
import type { File, Folder } from "~/server/db/schema";
import { FileRow, FolderRow } from "./file-row";
export default function DriveContents(props: {
files: File[];
folders: Folder[];
parents: Folder[];
currentFolderId: number;
}) {
const navigate = useRouter();
return (
<div className="min-h-screen bg-gray-900 p-8 text-gray-100">
<div className="mx-auto max-w-6xl">
<div className="mb-6 flex items-center justify-between">
<div className="flex items-center">
<Link href="/f/1" className="mr-2 text-gray-300 hover:text-white">
My Drive
</Link>
{props.parents.map((folder) => (
<div key={folder.id} className="flex items-center">
<ChevronRight className="mx-2 text-gray-500" size={16} />
<Link
href={`/f/${folder.id}`}
className="text-gray-300 hover:text-white"
>
{folder.name}
</Link>
</div>
))}
</div>
<div>
<SignedOut>
<SignInButton />
</SignedOut>
<SignedIn>
<UserButton />
</SignedIn>
</div>
</div>
<div className="rounded-lg bg-gray-800 shadow-xl">
<div className="border-b border-gray-700 px-6 py-4">
<div className="grid grid-cols-12 gap-4 text-sm font-medium text-gray-400">
<div className="col-span-6">Name</div>
<div className="col-span-3">Type</div>
<div className="col-span-3">Size</div>
</div>
</div>
<ul>
{props.folders.map((folder) => (
<FolderRow key={folder.id} folder={folder} />
))}
{props.files.map((file) => (
<FileRow key={file.id} file={file} />
))}
</ul>
</div>
<UploadButton
endpoint="driveUploader"
input={{ folderId: props.currentFolderId }}
onClientUploadComplete={() => {
navigate.refresh();
}}
/>
</div>
</div>
);
}