on master help sign in
views: remove unused admin views
a2dd484Fang
src/views/Admin.jsdeleted−73
@@ -1,73 +0,0 @@
1−import React from 'react';
2−import { Grid } from 'indigo-react';
3−
4−import { useHistory } from 'store/history';
5−
6−import useCurrentPointName from 'lib/useCurrentPointName';
7−import useRouter from 'lib/useRouter';
8−import { LocalRouterProvider } from 'lib/LocalRouter';
9−
10−import View from 'components/View';
11−import Crumbs from 'components/Crumbs';
12−
13−import AdminHome from './Admin/AdminHome';
14−import AdminEditPermissions from './Admin/AdminEditPermissions';
15−import AdminReticket from './Admin/AdminReticket';
16−import AdminSetProxy from './Admin/AdminSetProxy';
17−import AdminTransfer from './Admin/AdminTransfer';
18−import AdminCancelTransfer from './Admin/AdminCancelTransfer';
19−import AdminNetworkingKeys from './Admin/AdminNetworkingKeys';
20−
21−const NAMES = {
22− HOME: 'HOME',
23− EDIT_PERMISSIONS: 'EDIT_PERMISSIONS',
24− RETICKET: 'RETICKET',
25− SET_PROXY: 'SET_PROXY',
26− TRANSFER: 'TRANSFER',
27− CANCEL_TRANSFER: 'CANCEL_TRANSFER',
28− NETWORKING_KEYS: 'NETWORKING_KEYS',
29−};
30−
31−const VIEWS = {
32− [NAMES.HOME]: AdminHome,
33− [NAMES.EDIT_PERMISSIONS]: AdminEditPermissions,
34− [NAMES.RETICKET]: AdminReticket,
35− [NAMES.SET_PROXY]: AdminSetProxy,
36− [NAMES.TRANSFER]: AdminTransfer,
37− [NAMES.CANCEL_TRANSFER]: AdminCancelTransfer,
38− [NAMES.NETWORKING_KEYS]: AdminNetworkingKeys,
39−};
40−
41−export default function Admin() {
42− const history = useHistory();
43− const name = useCurrentPointName();
44−
45− const { Route, ...router } = useRouter({
46− names: NAMES,
47− views: VIEWS,
48− initialRoutes: [{ key: NAMES.HOME }],
49− });
50−
51− return (
52− <View pop={router.pop} inset>
53− <LocalRouterProvider value={router}>
54− <Grid className="mb4">
55− <Grid.Item
56− full
57− as={Crumbs}
58− routes={[
59− {
60− text: name,
61− action: () => history.pop(),
62− },
63− {
64− text: 'Admin',
65− },
66− ]}
67− />
68− </Grid>
69− <Route />
70− </LocalRouterProvider>
71− </View>
72− );
73−}
src/views/Admin/AdminCancelTransfer.jsdeleted−84
@@ -1,84 +0,0 @@
1−import React, { useCallback } from 'react';
2−import cn from 'classnames';
3−import { Grid, Text } from 'indigo-react';
4−import * as azimuth from 'azimuth-js';
5−
6−import { useNetwork } from 'store/network';
7−import { usePointCursor } from 'store/pointCursor';
8−import { usePointCache } from 'store/pointCache';
9−
10−import * as need from 'lib/need';
11−import { useLocalRouter } from 'lib/LocalRouter';
12−import useCurrentPointName from 'lib/useCurrentPointName';
13−import useEthereumTransaction from 'lib/useEthereumTransaction';
14−import { GAS_LIMITS } from 'lib/constants';
15−import { ETH_ZERO_ADDR } from 'lib/wallet';
16−import useLifecycle from 'lib/useLifecycle';
17−
18−import ViewHeader from 'components/ViewHeader';
19−import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
20−
21−function useCancelTransfer() {
22− const { contracts } = useNetwork();
23− const { pointCursor } = usePointCursor();
24− const { syncDetails } = usePointCache();
25−
26− const _contracts = need.contracts(contracts);
27− const _point = need.point(pointCursor);
28−
29− const { construct, ...rest } = useEthereumTransaction(
30− useCallback(
31− () =>
32− azimuth.ecliptic.setTransferProxy(_contracts, _point, ETH_ZERO_ADDR),
33− [_contracts, _point]
34− ),
35− useCallback(() => syncDetails(_point), [_point, syncDetails]),
36− GAS_LIMITS.SET_PROXY
37− );
38−
39− useLifecycle(() => {
40− construct();
41− });
42−
43− return {
44− ...rest,
45− };
46−}
47−
48−export default function AdminCancelTransfer() {
49− const { pop } = useLocalRouter();
50− const { getDetails } = usePointCache();
51− const { pointCursor } = usePointCursor();
52− const _point = need.point(pointCursor);
53−
54− const name = useCurrentPointName();
55− const _details = need.details(getDetails(_point));
56−
57− const { completed, bind } = useCancelTransfer();
58−
59− return (
60− <Grid>
61− <Grid.Item full as={ViewHeader}>
62− Cancel Outgoing Transfer
63− </Grid.Item>
64−
65− <Grid.Item
66− full
67− as={Text}
68− className={cn('f5 wrap', {
69− green3: completed,
70− })}>
71− {completed
72− ? `The outgoing transfer of ${name} has been cancelled.`
73− : `Cancel the outgoing transfer of ${name} to ${_details.transferProxy}.`}
74− </Grid.Item>
75−
76− <Grid.Item
77− full
78− as={InlineEthereumTransaction}
79− {...bind}
80− onReturn={() => pop()}
81− />
82− </Grid>
83− );
84−}