From af86168c2f73665f60295c4f5159634b006f9d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Quiroz?= Date: Wed, 7 Dec 2022 14:30:09 -0300 Subject: [PATCH] feat: add empty state for platforms without releases --- src/components/UI/DataTable.tsx | 58 +++++++++++++------ .../UI/downloads/DownloadsTable.tsx | 2 +- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/components/UI/DataTable.tsx b/src/components/UI/DataTable.tsx index 1aa5341ce9..810d92813a 100644 --- a/src/components/UI/DataTable.tsx +++ b/src/components/UI/DataTable.tsx @@ -1,4 +1,15 @@ -import { Link, Table, Thead, Tr, Th, TableContainer, Text, Tbody, Td } from '@chakra-ui/react'; +import { + Link, + Table, + Thead, + Tr, + Th, + TableContainer, + Text, + Tbody, + Td, + Stack +} from '@chakra-ui/react'; import { FC } from 'react'; import { OpenPGPSignaturesData, ReleaseData } from '../../types'; import { getParsedDate } from '../../utils'; @@ -20,6 +31,7 @@ export const DataTable: FC = ({ columnHeaders, data }) => { css={{ '&::-webkit-scrollbar': { borderTop: '2px solid var(--chakra-colors-primary)', + borderBottom: '2px solid var(--chakra-colors-primary)', height: 18 }, '&::-webkit-scrollbar-thumb': { @@ -30,26 +42,34 @@ export const DataTable: FC = ({ columnHeaders, data }) => { pb={4} > - - - {columnHeaders.map((columnHeader, idx) => { - return ( - - ); - })} - - + {data.length > 0 && ( + + + {columnHeaders.map((columnHeader, idx) => { + return ( + + ); + })} + + + )} + {data.length === 0 && ( + + No builds found + + )} + {dataType === 'Releases' && data.map((r: ReleaseData, idx: number) => { return ( diff --git a/src/components/UI/downloads/DownloadsTable.tsx b/src/components/UI/downloads/DownloadsTable.tsx index 7b3263313c..a5feab18c0 100644 --- a/src/components/UI/downloads/DownloadsTable.tsx +++ b/src/components/UI/downloads/DownloadsTable.tsx @@ -36,7 +36,7 @@ export const DownloadsTable: FC = ({ const LAST_2_LINUX_RELEASES = amountOfReleasesToShow + 12; return ( - + setTotalReleases(totalReleases[idx])}> {DOWNLOADS_TABLE_TABS.map((tab, idx) => {
- - {columnHeader} - -
+ + {columnHeader} + +