Skip to content

Commit bb66b3b

Browse files
committed
feat(user-files): enhance file browser UI and functionality
* Add back navigation to user files page * Improve file browser layout with new header * Update file display logic for better user experience * Introduce CSS styles for new header component
1 parent 1044065 commit bb66b3b

3 files changed

Lines changed: 42 additions & 12 deletions

File tree

apps/web/app/[locale]/dashboard/administration/users/[userName]/UserFiles.tsx

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
2-
import { Alert, Text, Title } from "@mantine/core";
3-
import { IconFileOff } from "@tabler/icons-react";
2+
import { ActionIcon, Alert, Text, Title } from "@mantine/core";
3+
import { IconArrowLeft, IconFileOff } from "@tabler/icons-react";
4+
import Link from "next/link";
45

56
import { FileManager } from "@/components/FileManager/FileManager";
67
import { useUserFileTree } from "@/hooks/administration/useUserFileTree";
@@ -14,12 +15,7 @@ interface Props {
1415
export function UserFiles({ userName }: Props) {
1516
const { data } = useUserFileTree(userName);
1617

17-
if (
18-
!data ||
19-
data === "unauthenticated" ||
20-
data === "unauthorized" ||
21-
!data[0].path
22-
) {
18+
if (!data || data === "unauthenticated" || data === "unauthorized") {
2319
return (
2420
<div className={classes.noFilesContainer}>
2521
<IconFileOff size={96} />
@@ -31,8 +27,20 @@ export function UserFiles({ userName }: Props) {
3127
return (
3228
<div className={classes.fileBrowserContainer}>
3329
<div className={classes.fileBrowserSideContainer}>
34-
<Title order={2}>File Browser</Title>
35-
<Text>Viewing files of {userName}</Text>
30+
<div className={classes.fileBrowserSideHeader}>
31+
<Link href="/dashboard/administration/users">
32+
<ActionIcon variant="subtle" aria-label="Settings">
33+
<IconArrowLeft
34+
style={{ width: "70%", height: "70%" }}
35+
stroke={1.5}
36+
/>
37+
</ActionIcon>
38+
</Link>
39+
<Title order={2}>File Browser</Title>
40+
</div>
41+
<Text>
42+
Viewing files of <strong>{userName}</strong>
43+
</Text>
3644
<Alert
3745
className={classes.infoContainer}
3846
variant="light"
@@ -65,7 +73,14 @@ export function UserFiles({ userName }: Props) {
6573
</Text>
6674
</Alert>
6775
</div>
68-
<FileManager files={data} />
76+
{!data[0].path ? (
77+
<div className={classes.noFilesContainer}>
78+
<IconFileOff size={96} />
79+
<Title>No Files Found</Title>
80+
</div>
81+
) : (
82+
<FileManager files={data} />
83+
)}
6984
</div>
7085
);
7186
}

apps/web/app/[locale]/dashboard/administration/users/[userName]/page.module.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
padding: var(--mantine-spacing-md);
2626
}
2727

28+
.fileBrowserSideHeader {
29+
display: flex;
30+
align-items: center;
31+
flex-direction: row;
32+
gap: var(--mantine-spacing-xs);
33+
}
34+
2835
.infoContainer {
2936
text-align: justify;
3037
}
@@ -34,7 +41,7 @@
3441
flex-direction: column;
3542
justify-content: center;
3643
align-items: center;
37-
height: 100%;
44+
flex: 1;
3845
gap: var(--mantine-spacing-md);
3946
}
4047

apps/web/app/[locale]/dashboard/administration/users/[userName]/page.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ interface Props {
88
params: Promise<{ userName: string }>;
99
}
1010

11+
export async function generateMetadata({ params }: Props) {
12+
const userName = (await params).userName;
13+
14+
return {
15+
title: `Files - ${userName}`,
16+
};
17+
}
18+
1119
export default async function Page({ params }: Props) {
1220
const userName = (await params).userName;
1321

0 commit comments

Comments
 (0)