Skip to content

Commit 4bd3dd5

Browse files
refactor: Library architecture
2 parents 54aee58 + 632b642 commit 4bd3dd5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1421
-1052
lines changed

cypress/e2e/front/landing.cy.ts

Lines changed: 64 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,64 @@
1-
describe('Good front for Landing', () => {
2-
it('Go to landing', () => {
3-
cy.visit('');
4-
});
5-
6-
it ('Good text', () => {
7-
cy.get('#ipc-landing-navigation-name').should('contain', 'Inter Planetary Cloud');
8-
cy.get("#ipc-landing-headline").should('contain', 'The first distributed cloud unsealing your data.');
9-
cy.get("#ipc-landing-subHeadline").should('contain', 'Build on top of Aleph, the next generation network of distributed big data applications.');
10-
cy.get("#ipc-landing-services-title").should('contain', 'Inter Planetary Cloud offers two services');
11-
cy.get("#ipc-landing-features-title").should('contain', 'Our Features');
12-
})
13-
14-
it('Good text for features cards', () => {
15-
cy.get("#ipc-landing-feature-upload-files").should('contain', 'Upload & Download Files');
16-
cy.get("#ipc-landing-folder-management").should('contain', 'Folder Management');
17-
cy.get("#ipc-landing-share-files").should('contain', 'Share Files');
18-
cy.get("#ipc-landing-programs").should('contain', 'Upload & Run Programs');
19-
cy.get("#ipc-landing-contact-management").should('contain', 'Contact Management');
20-
})
21-
22-
it('Good text for services cards', () => {
23-
cy.get("#ipc-landing-services-cloud-storage-title").should('contain', 'Cloud Storage');
24-
cy.get("#ipc-landing-services-cloud-storage-description").should('contain', 'A distributed personal file storage and management system platform, protecting your data.');
25-
cy.get('#ipc-landing-services-cloud-computing-title').should('contain', 'Cloud Computing');
26-
cy.get('#ipc-landing-services-cloud-computing-description').should('contain', 'A distributed personal cloud computing platform for HTTP servers.');
27-
});
28-
29-
it('Good text for start buttons', () => {
30-
cy.get("#ipc-landing-heading-start-button").should('contain', 'Start the experiment');
31-
cy.get("#ipc-landing-features-start-button").should('contain', 'Start the experiment');
32-
})
33-
34-
it('Good number of elements', () => {
35-
cy.get("button").should('have.length', 2);
36-
cy.get('img').should('have.length', 7);
37-
cy.get('svg').should('have.length', 14);
38-
cy.get('#ipc-landing-services-cloud-storage').should('have.length', 1);
39-
cy.get('#ipc-landing-services-cloud-computing').should('have.length', 1);
40-
})
41-
});
42-
43-
describe('Good redirect for Landing', () => {
44-
beforeEach(() => {
45-
cy.visit('');
46-
});
47-
48-
it('Good redirection for heading button', () => {
49-
cy.get("#ipc-landing-heading-start-button").click().url().should('eq', `${Cypress.config().baseUrl}/connection`);
50-
});
51-
52-
it('Good redirection for features button', () => {
53-
cy.get("#ipc-landing-features-start-button").click().url().should('eq', `${Cypress.config().baseUrl}/connection`);
54-
});
55-
});
1+
describe('Good front for Landing', () => {
2+
it('Go to landing', () => {
3+
cy.visit('');
4+
});
5+
6+
it('Good text', () => {
7+
cy.get('#ipc-landing-navigation-name').should('contain', 'Inter Planetary Cloud');
8+
cy.get('#ipc-landing-headline').should('contain', 'The first distributed cloud unsealing your data.');
9+
cy.get('#ipc-landing-subHeadline').should(
10+
'contain',
11+
'Build on top of Aleph, the next generation network of distributed big data applications.',
12+
);
13+
cy.get('#ipc-landing-services-title').should('contain', 'Inter Planetary Cloud offers two services');
14+
cy.get('#ipc-landing-features-title').should('contain', 'Our Features');
15+
});
16+
17+
it('Good text for features cards', () => {
18+
cy.get('#ipc-landing-feature-upload-files').should('contain', 'Upload & Download Files');
19+
cy.get('#ipc-landing-folder-management').should('contain', 'Folder Management');
20+
cy.get('#ipc-landing-share-files').should('contain', 'Share Files');
21+
cy.get('#ipc-landing-programs').should('contain', 'Upload & Run Programs');
22+
cy.get('#ipc-landing-contact-management').should('contain', 'Contact Management');
23+
});
24+
25+
it('Good text for services cards', () => {
26+
cy.get('#ipc-landing-services-cloud-storage-title').should('contain', 'Cloud Storage');
27+
cy.get('#ipc-landing-services-cloud-storage-description').should(
28+
'contain',
29+
'A distributed personal file storage and management system platform, protecting your data.',
30+
);
31+
cy.get('#ipc-landing-services-cloud-computing-title').should('contain', 'Cloud Computing');
32+
cy.get('#ipc-landing-services-cloud-computing-description').should(
33+
'contain',
34+
'A distributed personal cloud computing platform for HTTP servers.',
35+
);
36+
});
37+
38+
it('Good text for start buttons', () => {
39+
cy.get('#ipc-landing-heading-start-button').should('contain', 'Start the experiment');
40+
cy.get('#ipc-landing-features-start-button').should('contain', 'Start the experiment');
41+
});
42+
43+
it('Good number of elements', () => {
44+
cy.get('button').should('have.length', 2);
45+
cy.get('img').should('have.length', 7);
46+
cy.get('svg').should('have.length', 14);
47+
cy.get('#ipc-landing-services-cloud-storage').should('have.length', 1);
48+
cy.get('#ipc-landing-services-cloud-computing').should('have.length', 1);
49+
});
50+
});
51+
52+
describe('Good redirect for Landing', () => {
53+
beforeEach(() => {
54+
cy.visit('');
55+
});
56+
57+
it('Good redirection for heading button', () => {
58+
cy.get('#ipc-landing-heading-start-button').click().url().should('eq', `${Cypress.config().baseUrl}/connection`);
59+
});
60+
61+
it('Good redirection for features button', () => {
62+
cy.get('#ipc-landing-features-start-button').click().url().should('eq', `${Cypress.config().baseUrl}/connection`);
63+
});
64+
});

cypress/e2e/front/signup.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('Good front for Signup', () => {
2929

3030
it('Good name for go to dashboard button', () => {
3131
cy.get('#ipc-signup-go-to-dashboard-button').should('contain', 'Go to my dashboard');
32-
})
32+
});
3333
});
3434

3535
describe('Signup with credentials Button for Signup', () => {

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@babel/core": "^7.21.8",
6+
"@babel/core": "^7.22.5",
77
"@chakra-ui/icons": "^2.0.19",
8-
"@chakra-ui/react": "^2.6.1",
9-
"@chakra-ui/styled-system": "^2.9.0",
10-
"@chakra-ui/system": "^2.5.7",
11-
"@chakra-ui/theme-tools": "^2.0.16",
12-
"@emotion/react": "^11.11.0",
8+
"@chakra-ui/react": "^2.7.1",
9+
"@chakra-ui/styled-system": "^2.9.1",
10+
"@chakra-ui/system": "^2.5.8",
11+
"@chakra-ui/theme-tools": "^2.0.18",
12+
"@emotion/react": "^11.11.1",
1313
"@emotion/styled": "^11.11.0",
1414
"aleph-sdk-ts": "^3.2.0",
1515
"axios": "^1.4.0",
16-
"boring-avatars": "^1.7.0",
16+
"boring-avatars": "^1.10.1",
1717
"crypto-js": "^4.1.1",
1818
"eth-crypto": "^2.6.0",
1919
"ethers": "^5.7.2",
20-
"framer-motion": "^10.12.12",
20+
"framer-motion": "^10.12.17",
2121
"git-clone": "^0.2.0",
2222
"js-file-download": "^0.4.12",
2323
"next": "^12.3.4",
2424
"next-auth": "4.10.3",
2525
"react": "^18.2.0",
2626
"react-dom": "^18.2.0",
27-
"react-icons": "^4.8.0",
28-
"typescript": "^5.0.4",
27+
"react-icons": "^4.10.1",
28+
"typescript": "^5.1.3",
2929
"zod": "^3.21.4"
3030
},
3131
"scripts": {
@@ -54,13 +54,13 @@
5454
"@types/crypto-js": "^4.1.1",
5555
"@types/git-clone": "^0.2.0",
5656
"@types/node": "^16.18.31",
57-
"@types/react": "^18.2.6",
58-
"@types/react-dom": "^18.2.4",
59-
"@typescript-eslint/eslint-plugin": "^5.59.6",
60-
"@typescript-eslint/parser": "^5.59.6",
57+
"@types/react": "^18.2.14",
58+
"@types/react-dom": "^18.2.6",
59+
"@typescript-eslint/eslint-plugin": "^5.60.0",
60+
"@typescript-eslint/parser": "^5.60.0",
6161
"cypress": "^11.2.0",
6262
"cypress-file-upload": "^5.0.8",
63-
"eslint": "^8.40.0",
63+
"eslint": "^8.43.0",
6464
"eslint-config-airbnb": "^19.0.4",
6565
"eslint-config-airbnb-typescript": "^17.0.0",
6666
"eslint-config-prettier": "^8.8.0",

pages/_app.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const App = ({
3333
const [sharedFiles, setSharedFiles] = useState<IPCFile[]>([]);
3434
const [folders, setFolders] = useState<IPCFolder[]>([]);
3535
const [programs, setPrograms] = useState<IPCProgram[]>([]);
36+
const [sharedPrograms, setSharedPrograms] = useState<IPCProgram[]>([]);
3637
const [contacts, setContacts] = useState<IPCContact[]>([]);
3738
const [path, setPath] = useState('/');
3839
const toast = useToast();
@@ -89,6 +90,8 @@ const App = ({
8990
setSharedFiles,
9091
folders,
9192
setFolders,
93+
sharedPrograms,
94+
setSharedPrograms,
9295
programs,
9396
setPrograms,
9497
contacts,

pages/drive/index.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const Dashboard = (): JSX.Element => {
1515
const { setConfig } = useConfigContext();
1616
const { colorMode, toggleColorMode } = useColorMode();
1717

18-
const { path, folders, files, setFiles, setFolders, setContacts, setPrograms, setSharedFiles } = useDriveContext();
18+
const { path, folders, files, setFiles, setFolders, setContacts, setPrograms, setSharedFiles, setSharedPrograms } =
19+
useDriveContext();
1920

2021
useEffect(() => {
2122
(async () => {
@@ -27,22 +28,23 @@ const Dashboard = (): JSX.Element => {
2728
}, []);
2829

2930
const loadContact = async () => {
30-
const load = await user.contact.load();
31+
const load = await user.fullContact.contact.load();
3132

3233
toast({ title: load.message, status: load.success ? 'success' : 'error' });
33-
setContacts(user.contact.contacts);
34+
setContacts(user.fullContact.contact.contacts);
3435
};
3536

3637
const loadUserContents = async () => {
37-
const loadShared = await user.drive.loadShared(user.contact.contacts);
38+
const loadShared = await user.drive.loadShared(user.fullContact.contact.contacts);
3839
toast({ title: loadShared.message, status: loadShared.success ? 'success' : 'error' });
3940
setFiles(user.drive.files);
4041
setFolders(user.drive.folders);
4142
setSharedFiles(user.drive.sharedFiles);
43+
setSharedPrograms(user.drive.sharedPrograms);
4244

43-
const loadedPrograms = await user.computing.load();
45+
const loadedPrograms = await user.fullContact.computing.load();
4446
toast({ title: loadedPrograms.message, status: loadedPrograms.success ? 'success' : 'error' });
45-
setPrograms(user.computing.programs);
47+
setPrograms(user.fullContact.computing.programs);
4648

4749
const loadedConfig = await user.loadConfig();
4850
setConfig(user.config);

pages/drive/shared.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import { useDriveContext } from 'contexts/drive';
88

99
const Shared = (): JSX.Element => {
1010
const { sharedFiles } = useDriveContext();
11+
const { sharedPrograms } = useDriveContext();
1112

1213
return (
1314
<Navigation>
1415
<VStack w="100%" spacing="48px" align="start">
1516
<LabelBadge label="Share with me" />
16-
<DriveCards files={sharedFiles.filter((elem) => !elem.deletedAt)} />
17+
<DriveCards files={sharedFiles.filter((elem) => !elem.deletedAt)} programs={sharedPrograms} />
1718
</VStack>
1819
</Navigation>
1920
);

src/components/account/AccountCard.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
import Avatar from 'boring-avatars';
1616
import { ChangeEvent, useState } from 'react';
1717
import { BsClipboard } from 'react-icons/bs';
18-
1918
import Card from 'components/cards/Card';
2019

2120
import { useUserContext } from 'contexts/user';
@@ -29,15 +28,15 @@ import Modal from '../Modal';
2928
const AccountCard = (): JSX.Element => {
3029
const { user } = useUserContext();
3130
const [isOpen, setIsOpen] = useState<boolean>(false);
32-
const [input, setInput] = useState<string>(user.contact.username || '');
31+
const [input, setInput] = useState<string>(user.fullContact.contact.username || '');
3332
const [isLoading, setIsLoading] = useState<boolean>(false);
3433

3534
const toast = useToast({ duration: 2000, isClosable: true });
3635

3736
const changeName = async () => {
3837
setIsLoading(true);
3938
try {
40-
const config1 = await user.contact.update(user.account.address, input);
39+
const config1 = await user.fullContact.manage.update(user.account.address, input);
4140
setIsOpen(false);
4241
toast({ title: config1.message, status: config1.success ? 'success' : 'error' });
4342
} catch (error) {
@@ -92,7 +91,7 @@ const AccountCard = (): JSX.Element => {
9291
]}
9392
/>
9493
<Text color={textColor} size="xl">
95-
{user.contact.username}
94+
{user.fullContact.contact.username}
9695
</Text>
9796
</HStack>
9897
<HStack spacing="16px">

src/components/account/ConfigCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ConfigCard = (): JSX.Element => {
3434
const changeConfig = async (key: string, value: string) => {
3535
setIsLoading(true);
3636
try {
37-
const config1 = await user.contact.updateConfig(key, value);
37+
const config1 = await user.fullContact.manage.updateConfig(key, value);
3838
setConfig({
3939
...user.config,
4040
[key]: {

src/components/cards/FileCard.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ const FileCard = ({ file }: { file: IPCFile }): JSX.Element => {
2222
const { files } = useDriveContext();
2323
const {
2424
user: {
25-
contact: { username },
25+
fullContact: {
26+
contact: { username },
27+
},
2628
},
2729
} = useUserContext();
2830

@@ -33,7 +35,6 @@ const FileCard = ({ file }: { file: IPCFile }): JSX.Element => {
3335

3436
const isDrawer = useBreakpointValue({ base: true, sm: false }) || false;
3537
const textColor = useColorModeValue(textColorMode.light, textColorMode.dark);
36-
3738
return (
3839
<>
3940
<Card

src/components/cards/FolderCard.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ const FolderCard = ({ folder }: { folder: IPCFolder }): JSX.Element => {
2020
const { path, setPath } = useDriveContext();
2121
const {
2222
user: {
23-
contact: { username },
23+
fullContact: {
24+
contact: { username },
25+
},
2426
},
2527
} = useUserContext();
2628

0 commit comments

Comments
 (0)