mirror of
https://github.com/morten-olsen/parcel.git
synced 2026-02-08 01:36:24 +01:00
update
This commit is contained in:
33
src/App.tsx
33
src/App.tsx
@@ -1,25 +1,26 @@
|
||||
import React from 'react';
|
||||
import { hot } from 'react-hot-loader/root';
|
||||
import { Layout, Menu } from 'antd';
|
||||
import { Layout } from 'antd';
|
||||
import { HashRouter as Router } from 'react-router-dom';
|
||||
import { GithubProvider } from './contexts/Github';
|
||||
import { EncryptionProvider } from './contexts/Encryption';
|
||||
import { DecryptionProvider } from './contexts/Decryption';
|
||||
import AppRouter from './Router';
|
||||
|
||||
const App: React.FC = () => (
|
||||
<GithubProvider>
|
||||
<EncryptionProvider>
|
||||
<DecryptionProvider>
|
||||
<Layout style={{minHeight:"100vh"}}>
|
||||
<Layout.Header>
|
||||
</Layout.Header>
|
||||
<Layout.Content style={{ padding: '25px', maxWidth: '800px', width: '100%', margin: 'auto' }}>
|
||||
<AppRouter/>
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
</DecryptionProvider>
|
||||
</EncryptionProvider>
|
||||
</GithubProvider>
|
||||
);
|
||||
const App: React.FC = () => {
|
||||
return (
|
||||
<GithubProvider>
|
||||
<EncryptionProvider>
|
||||
<DecryptionProvider>
|
||||
<Layout style={{minHeight:"100vh"}}>
|
||||
<Router>
|
||||
<AppRouter/>
|
||||
</Router>
|
||||
</Layout>
|
||||
</DecryptionProvider>
|
||||
</EncryptionProvider>
|
||||
</GithubProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export default hot(App);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
HashRouter as Router,
|
||||
Switch,
|
||||
Route,
|
||||
useHistory,
|
||||
} from 'react-router-dom';
|
||||
import { HomeFilled } from '@ant-design/icons';
|
||||
import { Layout, Button, Space } from 'antd';
|
||||
|
||||
import Intro from './screens/Intro';
|
||||
import Encrypt from './screens/Encrypt';
|
||||
@@ -12,29 +14,44 @@ import SetupKey from './screens/SetupKey';
|
||||
import Welcome from './screens/Welcome';
|
||||
import Debug from './screens/Debug';
|
||||
|
||||
const AppRouter: React.FC = () => (
|
||||
<Router>
|
||||
<Switch>
|
||||
<Route path="/debug">
|
||||
<Debug />
|
||||
</Route>
|
||||
<Route path="/welcome">
|
||||
<Welcome />
|
||||
</Route>
|
||||
<Route path="/key">
|
||||
<SetupKey />
|
||||
</Route>
|
||||
<Route path="/receive">
|
||||
<Decrypt />
|
||||
</Route>
|
||||
<Route path="/send">
|
||||
<Encrypt />
|
||||
</Route>
|
||||
<Route path="/">
|
||||
<Intro />
|
||||
</Route>
|
||||
</Switch>
|
||||
</Router>
|
||||
);
|
||||
const AppRouter: React.FC = () => {
|
||||
const history = useHistory();
|
||||
return (
|
||||
<>
|
||||
<Layout style={{ textAlign: 'center' }}>
|
||||
<Space>
|
||||
<Button
|
||||
onClick={() => history.push('/')}
|
||||
icon={<HomeFilled />}
|
||||
>
|
||||
Home
|
||||
</Button>
|
||||
</Space>
|
||||
</Layout>
|
||||
<Layout.Content style={{ padding: '25px', maxWidth: '800px', width: '100%', margin: 'auto' }}>
|
||||
<Switch>
|
||||
<Route path="/debug">
|
||||
<Debug />
|
||||
</Route>
|
||||
<Route path="/welcome">
|
||||
<Welcome />
|
||||
</Route>
|
||||
<Route path="/key">
|
||||
<SetupKey />
|
||||
</Route>
|
||||
<Route path="/receive">
|
||||
<Decrypt />
|
||||
</Route>
|
||||
<Route path="/send">
|
||||
<Encrypt />
|
||||
</Route>
|
||||
<Route path="/">
|
||||
<Intro />
|
||||
</Route>
|
||||
</Switch>
|
||||
</Layout.Content>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default AppRouter;
|
||||
|
||||
@@ -21,9 +21,8 @@ const Thumb: React.FC = ({
|
||||
return (
|
||||
<Button
|
||||
size="large"
|
||||
shape="round"
|
||||
type="link"
|
||||
icon={<Icon />}
|
||||
type="link"
|
||||
onClick={() => history.push(link)}
|
||||
>
|
||||
{title}
|
||||
|
||||
Reference in New Issue
Block a user