This commit is contained in:
2020-08-21 22:53:46 +02:00
parent c5db725b8c
commit 42e8de1473
12 changed files with 128 additions and 94 deletions

View File

@@ -1,32 +1,28 @@
import React, { useContext } from 'react';
import { Collapse, Badge } from 'antd';
import Profile from '../components/Profile';
import React, { useContext, useEffect } from 'react';
import { Divider, PageHeader } from 'antd';
import { useHistory } from 'react-router';
import Add from '../components/Add';
import FileList from '../components/FileList';
import EncryptionContext from '../contexts/Encryption';
const Encrypt: React.FC = () => {
const history = useHistory();
const { files } = useContext(EncryptionContext);
useEffect(() => {
if (localStorage.getItem('welcome') !== 'seen') {
history.replace('/welcome');
}
}, []);
return (
<>
<Collapse ghost defaultActiveKey={[2, 3]}>
<Collapse.Panel key={2} header="Encrypt">
<Add />
</Collapse.Panel>
<Collapse.Panel
key={3}
header={(
<Badge count={Object.keys(files).length} offset={[20, 7]}>
Files
</Badge>
)}
>
<Add />
{Object.keys(files).length > 0 && (
<>
<Divider>Files</Divider>
<FileList />
</Collapse.Panel>
<Collapse.Panel key={1} header="Profile">
<Profile />
</Collapse.Panel>
</Collapse>
</>
)}
</>
);
};