index.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2019 @polkadot/app-generic-asset authors & contributors
  2. // This software may be modified and distributed under the terms
  3. // of the Apache-2.0 license. See the LICENSE file for details.
  4. import { AppProps, BareProps } from '@polkadot/react-components/types';
  5. import React, { useMemo } from 'react';
  6. import { Route, Switch } from 'react-router';
  7. import { Tabs } from '@polkadot/react-components';
  8. import Transfer from './Transfer';
  9. import Assets from './Assets';
  10. import { useTranslation } from './translate';
  11. interface Props extends AppProps, BareProps {}
  12. function AssetApp ({ basePath }: Props): React.ReactElement<Props> {
  13. const { t } = useTranslation();
  14. const items = useMemo(() => [
  15. {
  16. isRoot: true,
  17. name: 'assets',
  18. text: t('Assets')
  19. },
  20. {
  21. name: 'transfer',
  22. text: t('Transfer')
  23. }
  24. ], [t]);
  25. return (
  26. <main className='treasury--App'>
  27. <header>
  28. <Tabs
  29. basePath={basePath}
  30. items={items}
  31. />
  32. </header>
  33. <Switch>
  34. <Route path={`${basePath}/transfer`}><Transfer /></Route>
  35. <Route><Assets /></Route>
  36. </Switch>
  37. </main>
  38. );
  39. }
  40. export default React.memo(AssetApp);