feat: add empty state for platforms without releases

pull/26459/head^2
Nicolás Quiroz 2 years ago
parent faa0640465
commit af86168c2f
  1. 22
      src/components/UI/DataTable.tsx
  2. 2
      src/components/UI/downloads/DownloadsTable.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 { FC } from 'react';
import { OpenPGPSignaturesData, ReleaseData } from '../../types'; import { OpenPGPSignaturesData, ReleaseData } from '../../types';
import { getParsedDate } from '../../utils'; import { getParsedDate } from '../../utils';
@ -20,6 +31,7 @@ export const DataTable: FC<Props> = ({ columnHeaders, data }) => {
css={{ css={{
'&::-webkit-scrollbar': { '&::-webkit-scrollbar': {
borderTop: '2px solid var(--chakra-colors-primary)', borderTop: '2px solid var(--chakra-colors-primary)',
borderBottom: '2px solid var(--chakra-colors-primary)',
height: 18 height: 18
}, },
'&::-webkit-scrollbar-thumb': { '&::-webkit-scrollbar-thumb': {
@ -30,6 +42,7 @@ export const DataTable: FC<Props> = ({ columnHeaders, data }) => {
pb={4} pb={4}
> >
<Table variant='unstyled'> <Table variant='unstyled'>
{data.length > 0 && (
<Thead> <Thead>
<Tr> <Tr>
{columnHeaders.map((columnHeader, idx) => { {columnHeaders.map((columnHeader, idx) => {
@ -48,8 +61,15 @@ export const DataTable: FC<Props> = ({ columnHeaders, data }) => {
})} })}
</Tr> </Tr>
</Thead> </Thead>
)}
<Tbody> <Tbody>
{data.length === 0 && (
<Stack justifyContent='center' alignItems='center' w='100%' minH={80}>
<Text textStyle='header4'>No builds found</Text>
</Stack>
)}
{dataType === 'Releases' && {dataType === 'Releases' &&
data.map((r: ReleaseData, idx: number) => { data.map((r: ReleaseData, idx: number) => {
return ( return (

@ -36,7 +36,7 @@ export const DownloadsTable: FC<Props> = ({
const LAST_2_LINUX_RELEASES = amountOfReleasesToShow + 12; const LAST_2_LINUX_RELEASES = amountOfReleasesToShow + 12;
return ( return (
<Stack sx={{ mt: '0 !important' }} borderBottom='2px solid' borderColor='primary'> <Stack sx={{ mt: '0 !important' }}>
<Tabs variant='unstyled' onChange={idx => setTotalReleases(totalReleases[idx])}> <Tabs variant='unstyled' onChange={idx => setTotalReleases(totalReleases[idx])}>
<TabList color='primary' bg='button-bg'> <TabList color='primary' bg='button-bg'>
{DOWNLOADS_TABLE_TABS.map((tab, idx) => { {DOWNLOADS_TABLE_TABS.map((tab, idx) => {

Loading…
Cancel
Save