Commit 50c71a0d authored by tom's avatar tom

skeleton for private tags page

parent e1253b7d
...@@ -54,7 +54,7 @@ const ApiKeysPage: React.FC = () => { ...@@ -54,7 +54,7 @@ const ApiKeysPage: React.FC = () => {
return ( return (
<> <>
<Skeleton height={ 6 } width="250px" borderRadius="full" marginBottom={ 12 }/> <Skeleton height={ 6 } width="250px" borderRadius="full" marginBottom={ 12 }/>
<SkeletonTable columns={ [ 'auto', '108px' ] }/> <SkeletonTable columns={ [ '100%', '108px' ] }/>
<Skeleton height="44px" width="156px" borderRadius="base" marginTop={ 8 }/> <Skeleton height="44px" width="156px" borderRadius="base" marginTop={ 8 }/>
</> </>
); );
......
import { Box, Button, Spinner, Text, useDisclosure } from '@chakra-ui/react'; import { Box, Button, Text, Skeleton, useDisclosure } from '@chakra-ui/react';
import React, { useCallback, useState } from 'react'; import React, { useCallback, useState } from 'react';
import type { AddressTags, AddressTag } from 'types/api/account'; import type { AddressTags, AddressTag } from 'types/api/account';
import SkeletonTable from 'ui/shared/SkeletonTable';
import AddressModal from './AddressModal/AddressModal'; import AddressModal from './AddressModal/AddressModal';
import AddressTagTable from './AddressTagTable/AddressTagTable'; import AddressTagTable from './AddressTagTable/AddressTagTable';
import DeletePrivateTagModal from './DeletePrivateTagModal'; import DeletePrivateTagModal from './DeletePrivateTagModal';
type Props = { type Props = {
addressTags: AddressTags; addressTags?: AddressTags;
} }
const PrivateAddressTags = ({ addressTags }: Props) => { const PrivateAddressTags = ({ addressTags }: Props) => {
...@@ -38,13 +40,22 @@ const PrivateAddressTags = ({ addressTags }: Props) => { ...@@ -38,13 +40,22 @@ const PrivateAddressTags = ({ addressTags }: Props) => {
deleteModalProps.onClose(); deleteModalProps.onClose();
}, [ deleteModalProps ]); }, [ deleteModalProps ]);
if (!addressTags) {
return (
<>
<Skeleton height={ 6 } width="250px" borderRadius="full" marginBottom={ 12 }/>
<SkeletonTable columns={ [ 'auto', '40%', '108px' ] }/>
<Skeleton height="44px" width="156px" borderRadius="base" marginTop={ 8 }/>
</>
);
}
return ( return (
<> <>
<Text marginBottom={ 12 }> <Text marginBottom={ 12 }>
Use private transaction tags to label any transactions of interest. Use private transaction tags to label any transactions of interest.
Private tags are saved in your account and are only visible when you are logged in. Private tags are saved in your account and are only visible when you are logged in.
</Text> </Text>
{ !addressTags && <Spinner/> }
{ Boolean(addressTags?.length) && ( { Boolean(addressTags?.length) && (
<AddressTagTable <AddressTagTable
data={ addressTags } data={ addressTags }
......
import { Box, Button, Text, useDisclosure } from '@chakra-ui/react'; import { Box, Button, Skeleton, Text, useDisclosure } from '@chakra-ui/react';
import React, { useCallback, useState } from 'react'; import React, { useCallback, useState } from 'react';
import type { TransactionTags, TransactionTag } from 'types/api/account'; import type { TransactionTags, TransactionTag } from 'types/api/account';
import SkeletonTable from 'ui/shared/SkeletonTable';
import DeletePrivateTagModal from './DeletePrivateTagModal'; import DeletePrivateTagModal from './DeletePrivateTagModal';
import TransactionModal from './TransactionModal/TransactionModal'; import TransactionModal from './TransactionModal/TransactionModal';
import TransactionTagTable from './TransactionTagTable/TransactionTagTable'; import TransactionTagTable from './TransactionTagTable/TransactionTagTable';
type Props = { type Props = {
transactionTags: TransactionTags; transactionTags?: TransactionTags;
} }
const PrivateTransactionTags = ({ transactionTags }: Props) => { const PrivateTransactionTags = ({ transactionTags }: Props) => {
...@@ -38,6 +40,16 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => { ...@@ -38,6 +40,16 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => {
deleteModalProps.onClose(); deleteModalProps.onClose();
}, [ deleteModalProps ]); }, [ deleteModalProps ]);
if (!transactionTags) {
return (
<>
<Skeleton height={ 6 } width="250px" borderRadius="full" marginBottom={ 12 }/>
<SkeletonTable columns={ [ 'auto', '25%', '108px' ] }/>
<Skeleton height="44px" width="156px" borderRadius="base" marginTop={ 8 }/>
</>
);
}
return ( return (
<> <>
<Text marginBottom={ 12 }> <Text marginBottom={ 12 }>
......
...@@ -9,14 +9,14 @@ const SkeletonTable = ({ columns }: Props) => { ...@@ -9,14 +9,14 @@ const SkeletonTable = ({ columns }: Props) => {
return ( return (
<div> <div>
<Skeleton height={ 10 } width="100%" borderTopLeftRadius="base" borderTopRightRadius="base"/> <Skeleton height={ 10 } width="100%" borderTopLeftRadius="base" borderTopRightRadius="base"/>
{ Array.from(Array(5)).map((item, index) => ( { Array.from(Array(4)).map((item, index) => (
<HStack key={ index } spacing={ 6 } marginTop={ 8 }> <HStack key={ index } spacing={ 6 } marginTop={ 8 }>
{ columns.map((width, index) => ( { columns.map((width, index) => (
<Skeleton <Skeleton
key={ index } key={ index }
height={ 5 } height={ 5 }
flexBasis={ width === 'auto' ? '100%' : width } width={ width }
flexShrink={ width === 'auto' ? 'initial' : 0 } flexShrink={ width.includes('%') ? 'initial' : 0 }
borderRadius="full" borderRadius="full"
/> />
)) } )) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment