Commit 403eaee3 authored by isstuev's avatar isstuev

fix empty state

parent 34520c97
...@@ -45,7 +45,7 @@ const BreadcrumbItem = ({ text, href, isLast, scrollRef }: BreadcrumbItemProps) ...@@ -45,7 +45,7 @@ const BreadcrumbItem = ({ text, href, isLast, scrollRef }: BreadcrumbItemProps)
if (isLast) { if (isLast) {
return ( return (
<Grid gap={ 2 } overflow="hidden" templateColumns="auto 24px"> <Grid gap={ 2 } overflow="hidden" templateColumns="auto 24px" alignItems="center">
<Box <Box
overflow="hidden" overflow="hidden"
whiteSpace="nowrap" whiteSpace="nowrap"
...@@ -59,7 +59,7 @@ const BreadcrumbItem = ({ text, href, isLast, scrollRef }: BreadcrumbItemProps) ...@@ -59,7 +59,7 @@ const BreadcrumbItem = ({ text, href, isLast, scrollRef }: BreadcrumbItemProps)
} }
return ( return (
<Grid gap={ 2 } overflow="hidden" templateColumns="auto 24px"> <Grid gap={ 2 } overflow="hidden" templateColumns="auto 24px" alignItems="center">
<LinkInternal <LinkInternal
href={ href } href={ href }
onClick={ onLinkClick } onClick={ onLinkClick }
......
...@@ -41,3 +41,19 @@ test('expanded view +@mobile', async({ render, mockApiResponse }) => { ...@@ -41,3 +41,19 @@ test('expanded view +@mobile', async({ render, mockApiResponse }) => {
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
test('empty +@mobile', async({ render, mockApiResponse }) => {
await mockApiResponse(
'address_mud_records',
{ ...mudRecords, items: [] },
{ pathParams: { hash: ADDRESS_HASH, table_id: TABLE_ID } });
const component = await render(
<Box pt={{ base: '134px', lg: 6 }}>
<AddressMudTable tableId={ TABLE_ID }/>
</Box>,
{ hooksConfig },
);
await expect(component).toHaveScreenshot();
});
...@@ -129,6 +129,13 @@ const AddressMudTable = ({ scrollRef, tableId, isQueryEnabled = true }: Props) = ...@@ -129,6 +129,13 @@ const AddressMudTable = ({ scrollRef, tableId, isQueryEnabled = true }: Props) =
/> />
) : null; ) : null;
const emptyText = (
<>
<chakra.span>There are no records for </chakra.span>
{ data?.table.table_full_name ? <chakra.span fontWeight={ 600 }>{ data?.table.table_full_name }</chakra.span> : 'this table' }
</>
);
return ( return (
<> <>
{ isMobile && ( { isMobile && (
...@@ -137,7 +144,7 @@ const AddressMudTable = ({ scrollRef, tableId, isQueryEnabled = true }: Props) = ...@@ -137,7 +144,7 @@ const AddressMudTable = ({ scrollRef, tableId, isQueryEnabled = true }: Props) =
<DataListDisplay <DataListDisplay
isError={ isError } isError={ isError }
items={ data?.items } items={ data?.items }
emptyText="There are no records for this table." emptyText={ emptyText }
filterProps={{ filterProps={{
emptyFilteredText: `Couldn${ apos }t find records that match your filter query.`, emptyFilteredText: `Couldn${ apos }t find records that match your filter query.`,
hasActiveFilters: Object.values(filters).some(Boolean), hasActiveFilters: Object.values(filters).some(Boolean),
...@@ -145,6 +152,7 @@ const AddressMudTable = ({ scrollRef, tableId, isQueryEnabled = true }: Props) = ...@@ -145,6 +152,7 @@ const AddressMudTable = ({ scrollRef, tableId, isQueryEnabled = true }: Props) =
content={ content } content={ content }
actionBar={ actionBar } actionBar={ actionBar }
showActionBarIfEmpty={ !isMobile } showActionBarIfEmpty={ !isMobile }
mt={ data?.items.length ? 0 : 2 }
/> />
</> </>
); );
......
...@@ -13,7 +13,7 @@ type FilterProps = { ...@@ -13,7 +13,7 @@ type FilterProps = {
type Props = { type Props = {
isError: boolean; isError: boolean;
items?: Array<unknown>; items?: Array<unknown>;
emptyText: string; emptyText: string | React.ReactNode;
actionBar?: React.ReactNode; actionBar?: React.ReactNode;
showActionBarIfEmpty?: boolean; showActionBarIfEmpty?: boolean;
content: React.ReactNode; content: React.ReactNode;
......
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