Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dashboard UI refactor #121

Merged
merged 54 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
520aa4d
refactor: move files into cards directory
lucas-louis Jan 24, 2023
b63a0ca
fix: update padding for small buttons
lucas-louis Jan 24, 2023
a22cd09
fix: fix import path
lucas-louis Jan 24, 2023
10132bb
refactor: split dashboard page into multiple pages
lucas-louis Jan 24, 2023
464e738
feat: improve the tab menu
lucas-louis Jan 24, 2023
c4a06e9
feat: add profile badge
lucas-louis Jan 24, 2023
aa87d25
tests: update id for the navigation bar
lucas-louis Jan 24, 2023
3a0e9fc
build: add boring-avatars dependency
lucas-louis Jan 24, 2023
aac1696
fix: remove undefined account type
lucas-louis Jan 24, 2023
591c7d9
feat: update file size & created date display
lucas-louis Jan 27, 2023
0cbf63f
fix: clean the list before loading to avoid duplicate files
lucas-louis Feb 17, 2023
88c778c
feat: add utils functions to format date & file size
lucas-louis Feb 17, 2023
e3c9c50
feat: update button theme & add created date
lucas-louis Feb 17, 2023
2850b73
chore: udpdate name of the card to make it more generic
lucas-louis Feb 17, 2023
635d65b
feat: add content to contact page
lucas-louis Feb 17, 2023
dc12028
fix: close the popover when the file is deleted
lucas-louis Feb 17, 2023
d5137d9
fix: update content of the button
lucas-louis Feb 17, 2023
d743621
fix: close the modal when the file is deleted
lucas-louis Feb 17, 2023
af2ce75
feat: add/ update the cards to have the same style
lucas-louis Feb 17, 2023
cae8219
feat: add sub routes management for navbar
lucas-louis Feb 17, 2023
fd25544
fix: update padding
lucas-louis Feb 17, 2023
d545cd5
chore: clean useless code & remove redirection when no user exist
lucas-louis Feb 17, 2023
b471581
lint: lint the code
lucas-louis Feb 17, 2023
74bc7de
feat: store the size of the file in the message
lucas-louis Feb 17, 2023
27aec6d
feat: add content to program page
lucas-louis Feb 17, 2023
4ee4dd5
feat: add content to shared page
lucas-louis Feb 17, 2023
4d85b01
feat: update params of createdAt & size for contact & program types
lucas-louis Feb 17, 2023
6dad455
fix: remove popover for "New" button
lucas-louis Feb 17, 2023
c3766e2
feat: add redirection when the title is clicked
lucas-louis Feb 17, 2023
d4f0505
feat: add contact options popover, drawer & content
lucas-louis Feb 17, 2023
75bd2cb
feat: add program options popover, drawer & content
lucas-louis Feb 17, 2023
3ed335b
feat: add label badge component used in each pages
lucas-louis Feb 17, 2023
5c62f29
lint: lint the code
lucas-louis Feb 17, 2023
70c1e28
fix: typo of the button
lucas-louis Feb 17, 2023
89a1045
chore: remove useless/ out of dated files
lucas-louis Feb 18, 2023
fd1698f
fix: add default program size
lucas-louis Feb 18, 2023
964949b
fix: update config for cypress tests
lucas-louis Feb 18, 2023
c4848ae
feat: add implementation of the trash page
lucas-louis Feb 18, 2023
775be97
feat: add label page name for each pages
lucas-louis Feb 18, 2023
29bbacb
feat: update default variant button
lucas-louis Feb 24, 2023
d342972
fix: move the popover outside of the card to avoid nested popover open
lucas-louis Feb 24, 2023
28ac146
feat: add border size variant
lucas-louis Feb 24, 2023
b909c42
fix: profile badge into navigation
lucas-louis Feb 24, 2023
8f77f4d
feat: add account page & content
lucas-louis Feb 24, 2023
38d5441
fix: use node 16 version into cypress github action
lucas-louis Feb 24, 2023
3e08464
feat: update modal UI
lucas-louis Mar 2, 2023
961209f
feat: update button style with new UI
lucas-louis Mar 2, 2023
ac8f45a
feat: add id to close button component
lucas-louis Mar 2, 2023
8f68179
fix: cypress tests with new UI
lucas-louis Mar 2, 2023
ba7d9ae
fix: lint the code
lucas-louis Mar 2, 2023
84b3548
fix: update component path
lucas-louis Mar 2, 2023
766baa2
chore: remove old unused code
lucas-louis Mar 2, 2023
3b76cf0
Merge branch 'dev' into feat/dashboard-UI-refactor
lucas-louis Mar 2, 2023
f1d2a9a
fix: removing duplicate import
lucas-louis Mar 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/end-to-end-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn

- name: Create env file
run: |
touch .env
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/front/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Good Upload file modal front in Dashboard', () => {
});

it('Good name for close button', () => {
cy.get('#ipc-modal-close-button').should('contain', 'Close');
cy.get('#ipc-modal-close-button').should('have.length', 1);
});
});

Expand All @@ -85,11 +85,11 @@ describe('Good Deploy program modal front in Dashboard', () => {
});

it('Good name for upload a file button', () => {
cy.get('#ipc-dashboard-deploy-program-modal-button').should('contain', 'Deploy program');
cy.get('#ipc-dashboard-deploy-program-modal-button').should('contain', 'Deploy a program');
});

it('Good name for close button', () => {
cy.get('#ipc-modal-close-button').should('contain', 'Close');
cy.get('#ipc-modal-close-button').should('have.length', 1);
});
});

Expand All @@ -116,6 +116,6 @@ describe('Good Create folder modal front in Dashboard', () => {
});

it('Good name for close button', () => {
cy.get('#ipc-modal-close-button').should('contain', 'Close');
cy.get('#ipc-modal-close-button').should('have.length', 1);
});
});
2 changes: 1 addition & 1 deletion cypress/e2e/front/landing.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Good front for Landing', () => {
});

it ('Good text', () => {
cy.get('#ipc-landing-navbar-name').should('contain', 'Inter Planetary Cloud');
cy.get('#ipc-landing-navigation-name').should('contain', 'Inter Planetary Cloud');
cy.get("#ipc-landing-headline").should('contain', 'The first distributed cloud unsealing your data.');
cy.get("#ipc-landing-subHeadline").should('contain', 'Build on top of Aleph, the next generation network of distributed big data applications.');
cy.get("#ipc-landing-services-title").should('contain', 'Inter Planetary Cloud offers two services');
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/front/login.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Login with credentials Button for Login', () => {
});

it('Good URL redirect for login button', () => {
cy.get('#ipc-login-credentials-button').click().url().should('eq', `${Cypress.config().baseUrl}/dashboard`);
cy.get('#ipc-login-credentials-button').click().url().should('eq', `${Cypress.config().baseUrl}/drive`);
});
});

Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/front/signup.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Good Modal front for Signup', () => {
});

it('Good number of buttons', () => {
cy.get('button').should('have.length', 4);
cy.get('button').should('have.length', 5);
});

it('Good number of text-area', () => {
Expand All @@ -47,7 +47,7 @@ describe('Good Modal front for Signup', () => {
});

it('Good name for close button', () => {
cy.get('#ipc-modal-close-button').should('contain', 'Close');
cy.get('#ipc-modal-close-button').should('have.length', 1);
});
});

Expand All @@ -68,7 +68,7 @@ describe('Signup with credentials Button for Signup', () => {
});

it('Good URL redirect for close button', () => {
cy.get('#ipc-modal-close-button').click().url().should('eq', `${Cypress.config().baseUrl}/dashboard`);
cy.get('#ipc-modal-close-button').click().url().should('eq', `${Cypress.config().baseUrl}/drive`);
});
});

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@emotion/styled": "^11.10.5",
"aleph-sdk-ts": "^3.2.0",
"axios": "^0.27.2",
"boring-avatars": "^1.7.0",
"crypto-js": "^4.1.1",
"eth-crypto": "^2.4.0",
"ethers": "^5.7.2",
Expand Down
16 changes: 16 additions & 0 deletions pages/drive/account.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { VStack } from '@chakra-ui/react';

import Navigation from 'components/navigation/Navigation';
import LabelBadge from "components/LabelBadge";
import AccountCard from 'components/account/AccountCard';

const Account = (): JSX.Element => (
<Navigation>
<VStack w="100%" spacing="48px" align="start">
<LabelBadge label="Account" />
<AccountCard />
</VStack>
</Navigation>
);

export default Account;
26 changes: 26 additions & 0 deletions pages/drive/contacts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { HStack, VStack } from '@chakra-ui/react';

import Navigation from 'components/navigation/Navigation';
import DriveCards from 'components/cards/DriveCards';
import LabelBadge from 'components/LabelBadge';
import AddContact from 'components/contact/AddContact';

import { useDriveContext } from 'contexts/drive';

const Contacts = (): JSX.Element => {
const { contacts } = useDriveContext();

return (
<Navigation>
<VStack w="100%" spacing="48px" align="start">
<HStack spacing="48px">
<LabelBadge label="Contacts" />
<AddContact />
</HStack>
<DriveCards contacts={contacts} />
</VStack>
</Navigation>
);
};

export default Contacts;
46 changes: 17 additions & 29 deletions pages/dashboard.tsx → pages/drive/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';

import { Box, HStack, useColorMode, useToast, VStack } from '@chakra-ui/react';
import { useEffect } from 'react';
import { useColorMode, useToast, VStack } from '@chakra-ui/react';

import { useUserContext } from 'contexts/user';

import DisplayCards from 'components/DisplayCards';
import { ResponsiveBar } from 'components/navbar/ResponsiveBar';
import { useConfigContext } from 'contexts/config';
import { useDriveContext } from 'contexts/drive';

import DriveCards from 'components/cards/DriveCards';
import Navigation from 'components/navigation/Navigation';
import LabelBadge from 'components/LabelBadge';

const Dashboard = (): JSX.Element => {
const toast = useToast({ duration: 2000, isClosable: true });
const router = useRouter();
const { user } = useUserContext();
const { config, setConfig } = useConfigContext();
const { setConfig } = useConfigContext();
const { colorMode, toggleColorMode } = useColorMode();

const { sharedFiles, setFiles, setFolders, setContacts, setPrograms, setSharedFiles } = useDriveContext();
const [selectedTab, setSelectedTab] = useState(0);
const { path, folders, files, setFiles, setFolders, setContacts, setPrograms, setSharedFiles } = useDriveContext();

useEffect(() => {
(async () => {
if (!user) {
router.push('/');
} else {
if (user) {
await loadContact();
await loadUserContents();
}
Expand Down Expand Up @@ -57,22 +52,15 @@ const Dashboard = (): JSX.Element => {
};

return (
<HStack minH="100vh" minW="100vw" align="start" bg={config?.theme ?? 'white'}>
<ResponsiveBar setSelectedTab={setSelectedTab} selectedTab={selectedTab} configTheme={config?.theme ?? 'white'} />
<VStack w="100%" m="32px !important">
<Box w="100%">
<VStack w="100%" id="test" spacing="16px" mt={{ base: '64px', lg: '0px' }}>
{/* TODO: clear DisplayCardsParams */}
<DisplayCards
sharedFiles={sharedFiles}
index={selectedTab}
isRedeployLoading={false}
onOpenRedeployProgram={() => {}}
/>
</VStack>
</Box>
<Navigation>
<VStack w="100%" spacing="48px" align="start">
<LabelBadge label="My drive" />
<DriveCards
files={files.filter((elem) => elem.path === path && !elem.deletedAt)}
folders={folders.filter((elem) => elem.path === path)}
/>
</VStack>
</HStack>
</Navigation>
);
};

Expand Down
22 changes: 22 additions & 0 deletions pages/drive/programs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { VStack } from '@chakra-ui/react';

import Navigation from 'components/navigation/Navigation';
import DriveCards from 'components/cards/DriveCards';
import LabelBadge from 'components/LabelBadge';

import { useDriveContext } from 'contexts/drive';

const Programs = (): JSX.Element => {
const { programs } = useDriveContext();

return (
<Navigation>
<VStack w="100%" spacing="48px" align="start">
<LabelBadge label="My programs" />
<DriveCards programs={programs} />
</VStack>
</Navigation>
);
};

export default Programs;
22 changes: 22 additions & 0 deletions pages/drive/shared.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { VStack } from '@chakra-ui/react';

import DriveCards from 'components/cards/DriveCards';
import Navigation from 'components/navigation/Navigation';
import LabelBadge from 'components/LabelBadge';

import { useDriveContext } from 'contexts/drive';

const Shared = (): JSX.Element => {
const { sharedFiles } = useDriveContext();

return (
<Navigation>
<VStack w="100%" spacing="48px" align="start">
<LabelBadge label="Share with me" />
<DriveCards files={sharedFiles.filter((elem) => !elem.deletedAt)} />
</VStack>
</Navigation>
);
};

export default Shared;
29 changes: 29 additions & 0 deletions pages/drive/trash.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { HStack, VStack } from '@chakra-ui/react';

import DriveCards from 'components/cards/DriveCards';
import DeleteBin from 'components/file/DeleteBin';
import Navigation from 'components/navigation/Navigation';
import LabelBadge from 'components/LabelBadge';

import { useDriveContext } from 'contexts/drive';

const Trash = (): JSX.Element => {
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);

return (
<Navigation>
<VStack w="100%" spacing="48px" align="start">
<HStack spacing="48px">
<LabelBadge label="Trash" />
<DeleteBin files={deletedFiles} folders={deletedFolders} concernedFiles={sharedFiles} />
</HStack>
<DriveCards files={deletedFiles} folders={deletedFolders} />
</VStack>
</Navigation>
);
};

export default Trash;
10 changes: 5 additions & 5 deletions pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const Login = (): JSX.Element => {
if (login.user) {
toast({ title: login.message, status: 'success' });
setUser(login.user);
router.push('/dashboard');
await login.user.drive.autoDelete()
router.push('/drive');
await login.user.drive.autoDelete();
} else {
toast({ title: login.message, status: 'error' });
}
Expand All @@ -47,12 +47,12 @@ const Login = (): JSX.Element => {
if (login.user) {
toast({ title: login.message, status: 'success' });
setUser(login.user);
router.push('/dashboard');
await login.user.drive.autoDelete()
router.push('/drive');
await login.user.drive.autoDelete();
} else {
toast({ title: login.message, status: 'error' });
}
}
};

return (
<AuthPage
Expand Down
17 changes: 12 additions & 5 deletions pages/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Link from 'next/link';
import { useRouter } from 'next/router';
import { useState } from 'react';

import { Button, Text, Textarea, useDisclosure, useToast, VStack } from '@chakra-ui/react';
import { HStack, Text, Textarea, useDisclosure, useToast, VStack } from '@chakra-ui/react';

import { useAuthContext } from 'contexts/auth';
import { useUserContext } from 'contexts/user';
Expand All @@ -15,6 +15,7 @@ import Modal from 'components/Modal';
import OutlineButton from 'components/OutlineButton';

import colors from 'theme/foundations/colors';
import Button from 'components/Button';

const Signup = (): JSX.Element => {
const auth = useAuthContext();
Expand Down Expand Up @@ -53,7 +54,7 @@ const Signup = (): JSX.Element => {
toast({ title: signupResult.message, status: 'success' });
setUser(signupResult.user);
setConfig(signupResult.user?.config);
router.push('/dashboard');
router.push('/drive');
};

const onClick = () => {
Expand Down Expand Up @@ -89,9 +90,15 @@ const Signup = (): JSX.Element => {
onClose={closeModal}
title="Your Mnemonics"
CTA={
<Button variant="inline" onClick={onClick} w="100%" mb="16px" id="ipc-signup-copy-mnemonics-button">
Copy my mnemonics
</Button>
<HStack w="100%" justify="space-between">
<Button variant="primary" size="lg" onClick={onClick} id="ipc-signup-copy-mnemonics-button">
Copy my mnemonics
</Button>

<Button variant="secondary" size="lg" onClick={closeModal} id="ipc-signup-go-to-dashboard-button">
Go to my dashboard
</Button>
</HStack>
}
>
<Textarea
Expand Down
31 changes: 0 additions & 31 deletions src/components/ContactCard.tsx

This file was deleted.

Loading