diff options
| author | diogo464 <[email protected]> | 2025-08-11 13:40:27 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-08-11 13:40:27 +0100 |
| commit | f69ca010b80703389fffe75fc6dca907e53df74d (patch) | |
| tree | 1cf081f49b3793aae3f298ed50753841fd306424 /frontend/app/drive | |
| parent | 4af66f418b6837b6441b4e8eaf2d8ede585238b9 (diff) | |
basic file upload
Diffstat (limited to 'frontend/app/drive')
| -rw-r--r-- | frontend/app/drive/[...path]/page.tsx | 10 | ||||
| -rw-r--r-- | frontend/app/drive/page.tsx | 10 |
2 files changed, 19 insertions, 1 deletions
diff --git a/frontend/app/drive/[...path]/page.tsx b/frontend/app/drive/[...path]/page.tsx index 75a1bb1..60c2cca 100644 --- a/frontend/app/drive/[...path]/page.tsx +++ b/frontend/app/drive/[...path]/page.tsx | |||
| @@ -2,7 +2,8 @@ import { Drive_ls, Drive_basename, Drive_parent } from "@/lib/drive" | |||
| 2 | import { formatSize } from "@/lib/utils" | 2 | import { formatSize } from "@/lib/utils" |
| 3 | import Link from "next/link" | 3 | import Link from "next/link" |
| 4 | import { cookies } from 'next/headers'; | 4 | import { cookies } from 'next/headers'; |
| 5 | import { Auth_get_user } from "@/lib/auth"; | 5 | import { Auth_get_user, Auth_user_can_upload } from "@/lib/auth"; |
| 6 | import FileUpload from "@/components/FileUpload" | ||
| 6 | 7 | ||
| 7 | interface DrivePageProps { | 8 | interface DrivePageProps { |
| 8 | params: Promise<{ | 9 | params: Promise<{ |
| @@ -130,6 +131,13 @@ export default async function DrivePage({ params }: DrivePageProps) { | |||
| 130 | </table> | 131 | </table> |
| 131 | </div> | 132 | </div> |
| 132 | </div> | 133 | </div> |
| 134 | |||
| 135 | {/* File Upload Component */} | ||
| 136 | {Auth_user_can_upload(user) && ( | ||
| 137 | <FileUpload | ||
| 138 | targetPath={fullPath} | ||
| 139 | /> | ||
| 140 | )} | ||
| 133 | </div> | 141 | </div> |
| 134 | </div> | 142 | </div> |
| 135 | ) | 143 | ) |
diff --git a/frontend/app/drive/page.tsx b/frontend/app/drive/page.tsx index 218774a..5970a6a 100644 --- a/frontend/app/drive/page.tsx +++ b/frontend/app/drive/page.tsx | |||
| @@ -1,8 +1,11 @@ | |||
| 1 | import { Drive_ls, Drive_basename } from "@/lib/drive" | 1 | import { Drive_ls, Drive_basename } from "@/lib/drive" |
| 2 | import { formatSize } from "@/lib/utils" | 2 | import { formatSize } from "@/lib/utils" |
| 3 | import { Auth_get_user, Auth_user_can_upload } from "@/lib/auth" | ||
| 3 | import Link from "next/link" | 4 | import Link from "next/link" |
| 5 | import FileUpload from "@/components/FileUpload" | ||
| 4 | 6 | ||
| 5 | export default async function DrivePage() { | 7 | export default async function DrivePage() { |
| 8 | const user = await Auth_get_user() | ||
| 6 | const entries = await Drive_ls("", false) | 9 | const entries = await Drive_ls("", false) |
| 7 | 10 | ||
| 8 | // Sort entries: directories first, then files, both alphabetically | 11 | // Sort entries: directories first, then files, both alphabetically |
| @@ -88,6 +91,13 @@ export default async function DrivePage() { | |||
| 88 | </table> | 91 | </table> |
| 89 | </div> | 92 | </div> |
| 90 | </div> | 93 | </div> |
| 94 | |||
| 95 | {/* File Upload Component */} | ||
| 96 | {Auth_user_can_upload(user) && ( | ||
| 97 | <FileUpload | ||
| 98 | targetPath="" | ||
| 99 | /> | ||
| 100 | )} | ||
| 91 | </div> | 101 | </div> |
| 92 | </div> | 102 | </div> |
| 93 | ) | 103 | ) |
