Skip to content

Commit

Permalink
Feat: Add tabs to the files page so that the user will be able to swi…
Browse files Browse the repository at this point in the history
…tch from uploading files to downloading.
  • Loading branch information
liel-almog committed Feb 20, 2024
1 parent f788ec0 commit 6b72665
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 22 deletions.
11 changes: 11 additions & 0 deletions frontend/src/components/DownloadFiles/DownloadFiles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import classes from "./download-files.module.scss";

export interface DownloadFilesProps {}

export const DownloadFiles = () => {
return (
<section className={classes.container}>
<h2>הורדת קבצים</h2>
</section>
);
};
15 changes: 15 additions & 0 deletions frontend/src/components/DownloadFiles/download-files.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.container {
border-radius: var(--ant-border-radius);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1rem;
padding: 1.5rem;
max-height: 100%;

h2 {
font-size: 2rem;
font-weight: 500;
}
}
1 change: 1 addition & 0 deletions frontend/src/components/DownloadFiles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './DownloadFiles';
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const UploadFiles = () => {
<Dragger
customRequest={handleCustomRequest}
className={clsx(classes.uploadingSection)}
maxCount={7}
// maxCount={7}
multiple
listType="picture"
>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
.ant-upload-drag {
background-color: white;
border: 2px dashed var(--ant-color-border);
padding-inline: 3rem;
padding-inline: 2rem;
padding-block: 2rem;
max-width: fit-content;
}

.ant-upload-list {
Expand Down
29 changes: 29 additions & 0 deletions frontend/src/pages/FilesManager/FilesManager.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Tabs } from "antd";
import classes from "./files-manager.module.scss";
import { UploadFiles } from "../../components/UploadFiles";
import { DownloadFiles } from "../../components/DownloadFiles";

export interface FilesManagerProps {}

export const FilesManager = () => {
return (
<div className={classes.container}>
<Tabs
className={classes.tabs}
centered
items={[
{
key: "1",
label: "העלאת קבצים",
children: <UploadFiles />,
},
{
key: "2",
label: "הורדת קבצים",
children: <DownloadFiles />,
},
]}
/>
</div>
);
};
27 changes: 27 additions & 0 deletions frontend/src/pages/FilesManager/files-manager.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.container {
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
width: 100%;

.tabs {
height: 100%;
}

:global {
.ant-tabs-tabpane {
height: 100%;
max-height: 100%;
}

.ant-tabs-content {
height: 100%;
max-height: 100%;
}

.ant-upload-list-item-name {
max-width: 60ch;
}
}
}
1 change: 1 addition & 0 deletions frontend/src/pages/FilesManager/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './FilesManager';
10 changes: 3 additions & 7 deletions frontend/src/router/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import {
Navigate,
RouterProvider,
createBrowserRouter,
} from "react-router-dom";
import { Navigate, RouterProvider, createBrowserRouter } from "react-router-dom";
import { BaseErrorBoundary } from "../components/common/BaseErrorBoundary";
import { useAuthContext } from "../context/AuthContext/useAuthProvider";
import { Home } from "../pages/Home";
import { LoginForm } from "../pages/Login";
import { SignupForm } from "../pages/Signup";
import { UploadFiles } from "../pages/UploadFiles";
import { FilesManager } from "../pages/FilesManager";

const authenticatedRouter = createBrowserRouter([
{
Expand All @@ -18,7 +14,7 @@ const authenticatedRouter = createBrowserRouter([
children: [
{
path: "/",
element: <UploadFiles />,
element: <FilesManager />,
index: true,
},
],
Expand Down
13 changes: 0 additions & 13 deletions frontend/src/utils/zod/errorMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,6 @@ export const customValidation = {
uuId: stringSchema.uuid(),
text: z.string().trim().regex(validRegex, errorMessages.text),
longText: textAreaSchema.regex(validRegex, errorMessages.text),
// ObjectId: z.preprocess(
// (arg) => {
// if (ObjectId.isValid(arg as any)) {
// // We know that arg is a valid ObjectId
// return new ObjectId(arg as any);
// } else {
// // throw new Error("Not a valid ObjectId");
// return undefined;
// }
// },
// z.instanceof(ObjectId),
// { invalid_type_error: errorMessages.mongoId }
// ),
} as const;

const CustomErrorMap: z.ZodErrorMap = (error, ctx) => {
Expand Down
5 changes: 5 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw=
github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
Expand All @@ -26,4 +30,5 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+y
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=

0 comments on commit 6b72665

Please sign in to comment.