Commit 9225e72c authored by tom's avatar tom

use skeleton and not content loader

parent 24a96aea
...@@ -3,7 +3,6 @@ import type { NextPage } from 'next'; ...@@ -3,7 +3,6 @@ import type { NextPage } from 'next';
import Head from 'next/head'; import Head from 'next/head';
import React, { useCallback, useState } from 'react'; import React, { useCallback, useState } from 'react';
import delay from 'lib/delay';
import PrivateTags from 'ui/pages/PrivateTags'; import PrivateTags from 'ui/pages/PrivateTags';
const TABS = [ 'address', 'transaction' ]; const TABS = [ 'address', 'transaction' ];
...@@ -20,10 +19,7 @@ const PrivateTagsPage: NextPage = () => { ...@@ -20,10 +19,7 @@ const PrivateTagsPage: NextPage = () => {
// FIXME: request data only for active tab and only once // FIXME: request data only for active tab and only once
// don't refetch after tab change // don't refetch after tab change
useQuery([ 'address' ], async() => { useQuery([ 'address' ], async() => {
const [ response ] = await Promise.all([ const response = await fetch('/api/account/private-tags/address');
fetch('/api/account/private-tags/address'),
delay(5000),
]);
if (!response.ok) { if (!response.ok) {
throw new Error('Network response was not ok'); throw new Error('Network response was not ok');
} }
...@@ -31,10 +27,7 @@ const PrivateTagsPage: NextPage = () => { ...@@ -31,10 +27,7 @@ const PrivateTagsPage: NextPage = () => {
}); });
useQuery([ 'transaction' ], async() => { useQuery([ 'transaction' ], async() => {
const [ response ] = await Promise.all([ const response = await fetch('/api/account/private-tags/transaction');
fetch('/api/account/private-tags/transaction'),
delay(5000),
]);
if (!response.ok) { if (!response.ok) {
throw new Error('Network response was not ok'); throw new Error('Network response was not ok');
} }
......
import { Box, Button, HStack, Link, Text, useDisclosure } from '@chakra-ui/react'; import { Box, Button, HStack, Link, Text, Skeleton, useDisclosure } from '@chakra-ui/react';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import React, { useCallback, useState } from 'react'; import React, { useCallback, useState } from 'react';
import type { ApiKey, ApiKeys } from 'types/api/account'; import type { ApiKey, ApiKeys } from 'types/api/account';
import delay from 'lib/delay';
import { space } from 'lib/html-entities'; import { space } from 'lib/html-entities';
import ApiKeyModal from 'ui/apiKey/ApiKeyModal/ApiKeyModal'; import ApiKeyModal from 'ui/apiKey/ApiKeyModal/ApiKeyModal';
import ApiKeyTable from 'ui/apiKey/ApiKeyTable/ApiKeyTable'; import ApiKeyTable from 'ui/apiKey/ApiKeyTable/ApiKeyTable';
import DeleteApiKeyModal from 'ui/apiKey/DeleteApiKeyModal'; import DeleteApiKeyModal from 'ui/apiKey/DeleteApiKeyModal';
import AccountPageHeader from 'ui/shared/AccountPageHeader'; import AccountPageHeader from 'ui/shared/AccountPageHeader';
import ContentLoader from 'ui/shared/ContentLoader';
import Page from 'ui/shared/Page/Page'; import Page from 'ui/shared/Page/Page';
import SkeletonTable from 'ui/shared/SkeletonTable';
const DATA_LIMIT = 3; const DATA_LIMIT = 3;
...@@ -23,10 +22,7 @@ const ApiKeysPage: React.FC = () => { ...@@ -23,10 +22,7 @@ const ApiKeysPage: React.FC = () => {
const [ deleteModalData, setDeleteModalData ] = useState<ApiKey>(); const [ deleteModalData, setDeleteModalData ] = useState<ApiKey>();
const { data, isLoading, isError } = useQuery<unknown, unknown, ApiKeys>([ 'api-keys' ], async() => { const { data, isLoading, isError } = useQuery<unknown, unknown, ApiKeys>([ 'api-keys' ], async() => {
const [ response ] = await Promise.all([ const response = await fetch('/api/account/api-keys');
fetch('/api/account/api-keys'),
delay(5000),
]);
if (!response.ok) { if (!response.ok) {
throw new Error('Network response was not ok'); throw new Error('Network response was not ok');
} }
...@@ -56,7 +52,10 @@ const ApiKeysPage: React.FC = () => { ...@@ -56,7 +52,10 @@ const ApiKeysPage: React.FC = () => {
const content = (() => { const content = (() => {
if (isLoading || isError) { if (isLoading || isError) {
return ( return (
<ContentLoader/> <>
<SkeletonTable columns={ [ '100%', '108px' ] }/>
<Skeleton height="44px" width="156px" marginTop={ 8 }/>
</>
); );
} }
......
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