From dd68c02cd9b31b2ef2c5dbf0edc94a65a24fd1dc Mon Sep 17 00:00:00 2001 From: Mohammed JBILOU <95973236+Molaryy@users.noreply.github.com> Date: Thu, 29 Jun 2023 19:21:51 +0200 Subject: [PATCH] feat: refactoring the compenents folder --- pages/connection.tsx | 56 +-- pages/drive/account.tsx | 20 +- pages/drive/contacts.tsx | 34 +- pages/drive/index.tsx | 108 ++--- pages/drive/programs.tsx | 28 +- pages/drive/shared.tsx | 30 +- pages/drive/trash.tsx | 38 +- pages/index.tsx | 34 +- pages/login.tsx | 200 ++++----- pages/signup.tsx | 180 ++++---- src/components/{ => Models}/Button.tsx | 0 src/components/{ => Models}/LabelBadge.tsx | 0 src/components/{ => Models}/Modal.tsx | 0 src/components/{ => Models}/Tooltip.tsx | 0 src/components/{ => Models}/cards/Card.tsx | 0 src/components/Models/cards/ContactCard.tsx | 66 +++ .../{ => Models}/cards/DriveCards.tsx | 0 src/components/Models/cards/FileCard.tsx | 87 ++++ src/components/Models/cards/FolderCard.tsx | 89 ++++ .../{ => Models}/cards/PathCard.tsx | 0 src/components/Models/cards/ProgramCard.tsx | 82 ++++ src/components/{ => Pages}/AuthPage.tsx | 0 .../dashboardPage/ContactOptions.tsx | 0 .../{ => Pages}/dashboardPage/FileOptions.tsx | 0 .../dashboardPage/FolderOptions.tsx | 0 .../dashboardPage/ProgramOptions.tsx | 0 .../Pages/landingPage/FeaturesSection.tsx | 111 +++++ .../{ => Pages}/landingPage/Footer.tsx | 0 .../Pages/landingPage/HeadingSection.tsx | 77 ++++ src/components/Pages/landingPage/NavBar.tsx | 43 ++ .../landingPage/PartnersSection.tsx | 0 .../landingPage/ServicesSection.tsx | 0 .../{ => Pages}/navigation/NavbarItem.tsx | 0 .../{ => Pages}/navigation/Navigation.tsx | 0 .../Pages/navigation/ResponsiveBar.tsx | 94 ++++ src/components/Pages/navigation/SideBar.tsx | 128 ++++++ src/components/account/AccountCard.tsx | 238 +++++----- src/components/account/ConfigCard.tsx | 172 ++++---- src/components/account/ConfigInputModal.tsx | 98 ++--- src/components/account/ConfigSelect.tsx | 62 +-- src/components/cards/ContactCard.tsx | 66 --- src/components/cards/FileCard.tsx | 87 ---- src/components/cards/FolderCard.tsx | 89 ---- src/components/cards/ProgramCard.tsx | 82 ---- .../computing/github/GithubModal.tsx | 406 +++++++++--------- .../computing/programs/ProgramModal.tsx | 202 ++++----- src/components/contact/AddContact.tsx | 154 +++---- src/components/contact/UpdateContact.tsx | 134 +++--- src/components/file/DeleteBin.tsx | 138 +++--- src/components/file/DeleteFile.tsx | 236 +++++----- src/components/file/MoveFile.tsx | 274 ++++++------ src/components/file/RenameFile.tsx | 212 ++++----- src/components/file/ShareFile.tsx | 274 ++++++------ src/components/file/UpdateContentFile.tsx | 270 ++++++------ src/components/file/UploadFile.tsx | 258 +++++------ src/components/folder/CreateFolder.tsx | 212 ++++----- src/components/folder/DeleteFolder.tsx | 190 ++++---- src/components/folder/MoveFolder.tsx | 340 +++++++-------- .../landingPage/FeaturesSection.tsx | 111 ----- src/components/landingPage/HeadingSection.tsx | 77 ---- src/components/landingPage/NavBar.tsx | 43 -- src/components/navigation/ResponsiveBar.tsx | 94 ---- src/components/navigation/SideBar.tsx | 128 ------ src/components/programs/DeleteProgram.tsx | 150 +++---- src/components/programs/RenameProgram.tsx | 200 ++++----- src/components/programs/ShareProgram.tsx | 268 ++++++------ 66 files changed, 3385 insertions(+), 3385 deletions(-) rename src/components/{ => Models}/Button.tsx (100%) rename src/components/{ => Models}/LabelBadge.tsx (100%) rename src/components/{ => Models}/Modal.tsx (100%) rename src/components/{ => Models}/Tooltip.tsx (100%) rename src/components/{ => Models}/cards/Card.tsx (100%) create mode 100644 src/components/Models/cards/ContactCard.tsx rename src/components/{ => Models}/cards/DriveCards.tsx (100%) create mode 100644 src/components/Models/cards/FileCard.tsx create mode 100644 src/components/Models/cards/FolderCard.tsx rename src/components/{ => Models}/cards/PathCard.tsx (100%) create mode 100644 src/components/Models/cards/ProgramCard.tsx rename src/components/{ => Pages}/AuthPage.tsx (100%) rename src/components/{ => Pages}/dashboardPage/ContactOptions.tsx (100%) rename src/components/{ => Pages}/dashboardPage/FileOptions.tsx (100%) rename src/components/{ => Pages}/dashboardPage/FolderOptions.tsx (100%) rename src/components/{ => Pages}/dashboardPage/ProgramOptions.tsx (100%) create mode 100644 src/components/Pages/landingPage/FeaturesSection.tsx rename src/components/{ => Pages}/landingPage/Footer.tsx (100%) create mode 100644 src/components/Pages/landingPage/HeadingSection.tsx create mode 100644 src/components/Pages/landingPage/NavBar.tsx rename src/components/{ => Pages}/landingPage/PartnersSection.tsx (100%) rename src/components/{ => Pages}/landingPage/ServicesSection.tsx (100%) rename src/components/{ => Pages}/navigation/NavbarItem.tsx (100%) rename src/components/{ => Pages}/navigation/Navigation.tsx (100%) create mode 100644 src/components/Pages/navigation/ResponsiveBar.tsx create mode 100644 src/components/Pages/navigation/SideBar.tsx delete mode 100644 src/components/cards/ContactCard.tsx delete mode 100644 src/components/cards/FileCard.tsx delete mode 100644 src/components/cards/FolderCard.tsx delete mode 100644 src/components/cards/ProgramCard.tsx delete mode 100644 src/components/landingPage/FeaturesSection.tsx delete mode 100644 src/components/landingPage/HeadingSection.tsx delete mode 100644 src/components/landingPage/NavBar.tsx delete mode 100644 src/components/navigation/ResponsiveBar.tsx delete mode 100644 src/components/navigation/SideBar.tsx diff --git a/pages/connection.tsx b/pages/connection.tsx index c13dcc3f..db384ea9 100644 --- a/pages/connection.tsx +++ b/pages/connection.tsx @@ -1,35 +1,35 @@ -import { Link, Stack, useBreakpointValue } from '@chakra-ui/react'; -import { BsRocketTakeoffFill } from 'react-icons/bs'; +import {Link, Stack, useBreakpointValue} from '@chakra-ui/react'; +import {BsRocketTakeoffFill} from 'react-icons/bs'; -import AuthPage from 'components/AuthPage'; -import Button from 'components/Button'; +import AuthPage from 'components/Pages/AuthPage'; +import Button from 'components/Models/Button'; const Connection = (): JSX.Element => { - const isMobile = useBreakpointValue({ base: true, md: false }) || false; + const isMobile = useBreakpointValue({base: true, md: false}) || false; - return ( - - - - - - - - - - - ); + return ( + + + + + + + + + + + ); }; export default Connection; diff --git a/pages/drive/account.tsx b/pages/drive/account.tsx index 27ca7aac..57a6eb21 100644 --- a/pages/drive/account.tsx +++ b/pages/drive/account.tsx @@ -1,18 +1,18 @@ -import { VStack } from '@chakra-ui/react'; +import {VStack} from '@chakra-ui/react'; import AccountCard from 'components/account/AccountCard'; import ConfigCard from 'components/account/ConfigCard'; -import LabelBadge from 'components/LabelBadge'; -import Navigation from 'components/navigation/Navigation'; +import LabelBadge from 'components/Models/LabelBadge'; +import Navigation from 'components/Pages/navigation/Navigation'; const Account = (): JSX.Element => ( - - - - - - - + + + + + + + ); export default Account; diff --git a/pages/drive/contacts.tsx b/pages/drive/contacts.tsx index fca5efe4..5156a75e 100644 --- a/pages/drive/contacts.tsx +++ b/pages/drive/contacts.tsx @@ -1,26 +1,26 @@ -import { HStack, VStack } from '@chakra-ui/react'; +import {HStack, VStack} from '@chakra-ui/react'; -import DriveCards from 'components/cards/DriveCards'; +import DriveCards from 'components/Models/cards/DriveCards'; import AddContact from 'components/contact/AddContact'; -import LabelBadge from 'components/LabelBadge'; -import Navigation from 'components/navigation/Navigation'; +import LabelBadge from 'components/Models/LabelBadge'; +import Navigation from 'components/Pages/navigation/Navigation'; -import { useDriveContext } from 'contexts/drive'; +import {useDriveContext} from 'contexts/drive'; const Contacts = (): JSX.Element => { - const { contacts } = useDriveContext(); + const {contacts} = useDriveContext(); - return ( - - - - - - - - - - ); + return ( + + + + + + + + + + ); }; export default Contacts; diff --git a/pages/drive/index.tsx b/pages/drive/index.tsx index 422f39b0..6de7a3ac 100644 --- a/pages/drive/index.tsx +++ b/pages/drive/index.tsx @@ -1,69 +1,69 @@ -import { useColorMode, useToast, VStack } from '@chakra-ui/react'; -import { useEffect } from 'react'; +import {useColorMode, useToast, VStack} from '@chakra-ui/react'; +import {useEffect} from 'react'; -import { useConfigContext } from 'contexts/config'; -import { useDriveContext } from 'contexts/drive'; -import { useUserContext } from 'contexts/user'; +import {useConfigContext} from 'contexts/config'; +import {useDriveContext} from 'contexts/drive'; +import {useUserContext} from 'contexts/user'; -import DriveCards from 'components/cards/DriveCards'; -import LabelBadge from 'components/LabelBadge'; -import Navigation from 'components/navigation/Navigation'; +import DriveCards from 'components/Models/cards/DriveCards'; +import LabelBadge from 'components/Models/LabelBadge'; +import Navigation from 'components/Pages/navigation/Navigation'; const Dashboard = (): JSX.Element => { - const toast = useToast({ duration: 2000, isClosable: true }); - const { user } = useUserContext(); - const { setConfig } = useConfigContext(); - const { colorMode, toggleColorMode } = useColorMode(); + const toast = useToast({duration: 2000, isClosable: true}); + const {user} = useUserContext(); + const {setConfig} = useConfigContext(); + const {colorMode, toggleColorMode} = useColorMode(); - const { path, folders, files, setFiles, setFolders, setContacts, setPrograms, setSharedFiles, setSharedPrograms } = - useDriveContext(); + const {path, folders, files, setFiles, setFolders, setContacts, setPrograms, setSharedFiles, setSharedPrograms} = + useDriveContext(); - useEffect(() => { - (async () => { - if (user) { - await loadContact(); - await loadUserContents(); - } - })(); - }, []); + useEffect(() => { + (async () => { + if (user) { + await loadContact(); + await loadUserContents(); + } + })(); + }, []); - const loadContact = async () => { - const load = await user.fullContact.contact.load(); + const loadContact = async () => { + const load = await user.fullContact.contact.load(); - toast({ title: load.message, status: load.success ? 'success' : 'error' }); - setContacts(user.fullContact.contact.contacts); - }; + toast({title: load.message, status: load.success ? 'success' : 'error'}); + setContacts(user.fullContact.contact.contacts); + }; - const loadUserContents = async () => { - const loadShared = await user.drive.loadShared(user.fullContact.contact.contacts); - toast({ title: loadShared.message, status: loadShared.success ? 'success' : 'error' }); - setFiles(user.drive.files); - setFolders(user.drive.folders); - setSharedFiles(user.drive.sharedFiles); - setSharedPrograms(user.drive.sharedPrograms); + const loadUserContents = async () => { + const loadShared = await user.drive.loadShared(user.fullContact.contact.contacts); + toast({title: loadShared.message, status: loadShared.success ? 'success' : 'error'}); + setFiles(user.drive.files); + setFolders(user.drive.folders); + setSharedFiles(user.drive.sharedFiles); + setSharedPrograms(user.drive.sharedPrograms); - const loadedPrograms = await user.fullContact.computing.load(); - toast({ title: loadedPrograms.message, status: loadedPrograms.success ? 'success' : 'error' }); - setPrograms(user.fullContact.computing.programs); + const loadedPrograms = await user.fullContact.computing.load(); + toast({title: loadedPrograms.message, status: loadedPrograms.success ? 'success' : 'error'}); + setPrograms(user.fullContact.computing.programs); - const loadedConfig = await user.loadConfig(); - setConfig(user.config); - if (user.config?.theme.value === 'white' && colorMode !== 'light') toggleColorMode(); - if (user.config?.theme.value === 'gray.800' && colorMode !== 'dark') toggleColorMode(); - toast({ title: loadedConfig.message, status: loadedConfig.success ? 'success' : 'error' }); - }; + const loadedConfig = await user.loadConfig(); + setConfig(user.config); + if (user.config?.theme.value === 'white' && colorMode !== 'light') toggleColorMode(); + if (user.config?.theme.value === 'gray.800' && colorMode !== 'dark') toggleColorMode(); + toast({title: loadedConfig.message, status: loadedConfig.success ? 'success' : 'error'}); + }; - return ( - - - - elem.path === path && !elem.deletedAt)} - folders={folders.filter((elem) => elem.path === path)} - /> - - - ); + return ( + + + + elem.path === path && !elem.deletedAt)} + folders={folders.filter((elem) => elem.path === path)} + /> + + + ); }; export default Dashboard; diff --git a/pages/drive/programs.tsx b/pages/drive/programs.tsx index c85ac62e..cd9a9623 100644 --- a/pages/drive/programs.tsx +++ b/pages/drive/programs.tsx @@ -1,22 +1,22 @@ -import { VStack } from '@chakra-ui/react'; +import {VStack} from '@chakra-ui/react'; -import DriveCards from 'components/cards/DriveCards'; -import LabelBadge from 'components/LabelBadge'; -import Navigation from 'components/navigation/Navigation'; +import DriveCards from 'components/Models/cards/DriveCards'; +import LabelBadge from 'components/Models/LabelBadge'; +import Navigation from 'components/Pages/navigation/Navigation'; -import { useDriveContext } from 'contexts/drive'; +import {useDriveContext} from 'contexts/drive'; const Programs = (): JSX.Element => { - const { programs } = useDriveContext(); + const {programs} = useDriveContext(); - return ( - - - - - - - ); + return ( + + + + + + + ); }; export default Programs; diff --git a/pages/drive/shared.tsx b/pages/drive/shared.tsx index 3ef2e915..89a70f69 100644 --- a/pages/drive/shared.tsx +++ b/pages/drive/shared.tsx @@ -1,23 +1,23 @@ -import { VStack } from '@chakra-ui/react'; +import {VStack} from '@chakra-ui/react'; -import DriveCards from 'components/cards/DriveCards'; -import LabelBadge from 'components/LabelBadge'; -import Navigation from 'components/navigation/Navigation'; +import DriveCards from 'components/Models/cards/DriveCards'; +import LabelBadge from 'components/Models/LabelBadge'; +import Navigation from 'components/Pages/navigation/Navigation'; -import { useDriveContext } from 'contexts/drive'; +import {useDriveContext} from 'contexts/drive'; const Shared = (): JSX.Element => { - const { sharedFiles } = useDriveContext(); - const { sharedPrograms } = useDriveContext(); + const {sharedFiles} = useDriveContext(); + const {sharedPrograms} = useDriveContext(); - return ( - - - - !elem.deletedAt)} programs={sharedPrograms} /> - - - ); + return ( + + + + !elem.deletedAt)} programs={sharedPrograms}/> + + + ); }; export default Shared; diff --git a/pages/drive/trash.tsx b/pages/drive/trash.tsx index 1dbc0e3b..37f4d72b 100644 --- a/pages/drive/trash.tsx +++ b/pages/drive/trash.tsx @@ -1,29 +1,29 @@ -import { HStack, VStack } from '@chakra-ui/react'; +import {HStack, VStack} from '@chakra-ui/react'; -import DriveCards from 'components/cards/DriveCards'; +import DriveCards from 'components/Models/cards/DriveCards'; import DeleteBin from 'components/file/DeleteBin'; -import LabelBadge from 'components/LabelBadge'; -import Navigation from 'components/navigation/Navigation'; +import LabelBadge from 'components/Models/LabelBadge'; +import Navigation from 'components/Pages/navigation/Navigation'; -import { useDriveContext } from 'contexts/drive'; +import {useDriveContext} from 'contexts/drive'; const Trash = (): JSX.Element => { - const { path, files, folders, sharedFiles } = useDriveContext(); + const {path, files, folders, sharedFiles} = useDriveContext(); - const deletedFiles = files.filter((elem) => elem.path === path && elem.deletedAt !== null); - const deletedFolders = folders.filter((elem) => elem.path === path); + const deletedFiles = files.filter((elem) => elem.path === path && elem.deletedAt !== null); + const deletedFolders = folders.filter((elem) => elem.path === path); - return ( - - - - - - - - - - ); + return ( + + + + + + + + + + ); }; export default Trash; diff --git a/pages/index.tsx b/pages/index.tsx index daf8bd32..fc113281 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,23 +1,23 @@ -import { VStack } from '@chakra-ui/react'; +import {VStack} from '@chakra-ui/react'; -import FeaturesSection from 'components/landingPage/FeaturesSection'; -import Footer from 'components/landingPage/Footer'; -import HeadingSection from 'components/landingPage/HeadingSection'; -import NavBar from 'components/landingPage/NavBar'; -import PartnersSection from 'components/landingPage/PartnersSection'; -import ServicesSection from 'components/landingPage/ServicesSection'; +import FeaturesSection from 'components/Pages/landingPage/FeaturesSection'; +import Footer from 'components/Pages/landingPage/Footer'; +import HeadingSection from 'components/Pages/landingPage/HeadingSection'; +import NavBar from 'components/Pages/landingPage/NavBar'; +import PartnersSection from 'components/Pages/landingPage/PartnersSection'; +import ServicesSection from 'components/Pages/landingPage/ServicesSection'; const Home = (): JSX.Element => ( - - - - - - - - -