Merge pull request #139 from ethereum/empty-state-releases

feat: add empty state for platforms without releases
pull/26459/head^2
Corwin Smith 2 years ago committed by GitHub
commit 4315911af4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 57
      src/components/UI/DataTable.tsx
  2. 11
      src/components/UI/downloads/DownloadsTable.tsx
  3. 2
      src/pages/downloads.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';
@ -30,26 +41,34 @@ export const DataTable: FC<Props> = ({ columnHeaders, data }) => {
pb={4} pb={4}
> >
<Table variant='unstyled'> <Table variant='unstyled'>
<Thead> {data.length > 0 && (
<Tr> <Thead>
{columnHeaders.map((columnHeader, idx) => { <Tr>
return ( {columnHeaders.map((columnHeader, idx) => {
<Th key={idx} textTransform='none' minW={'130.5px'} px={4}> return (
<Text <Th key={idx} textTransform='none' minW={'130.5px'} px={4}>
fontFamily='"JetBrains Mono", monospace' <Text
fontWeight={700} fontFamily='"JetBrains Mono", monospace'
fontSize='md' fontWeight={700}
color='#868b87' //? Use theme color? Or add to theme? fontSize='md'
> color='#868b87' // TODO: Use theme color? Or add to theme?
{columnHeader} >
</Text> {columnHeader}
</Th> </Text>
); </Th>
})} );
</Tr> })}
</Thead> </Tr>
</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 (

@ -12,6 +12,7 @@ interface Props {
windowsData: ReleaseData[]; windowsData: ReleaseData[];
iOSData: ReleaseData[]; iOSData: ReleaseData[];
androidData: ReleaseData[]; androidData: ReleaseData[];
totalReleasesNumber: number;
amountOfReleasesToShow: number; amountOfReleasesToShow: number;
setTotalReleases: (idx: number) => void; setTotalReleases: (idx: number) => void;
} }
@ -22,6 +23,7 @@ export const DownloadsTable: FC<Props> = ({
windowsData, windowsData,
iOSData, iOSData,
androidData, androidData,
totalReleasesNumber,
amountOfReleasesToShow, amountOfReleasesToShow,
setTotalReleases setTotalReleases
}) => { }) => {
@ -36,7 +38,14 @@ 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' }}
borderBottom={
amountOfReleasesToShow < totalReleasesNumber
? '2px solid var(--chakra-colors-primary)'
: 'none'
}
>
<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) => {

@ -368,6 +368,7 @@ const DownloadsPage: NextPage<Props> = ({ data }) => {
windowsData={ALL_WINDOWS_STABLE_RELEASES} windowsData={ALL_WINDOWS_STABLE_RELEASES}
iOSData={ALL_IOS_STABLE_RELEASES} iOSData={ALL_IOS_STABLE_RELEASES}
androidData={ALL_ANDROID_STABLE_RELEASES} androidData={ALL_ANDROID_STABLE_RELEASES}
totalReleasesNumber={totalStableReleases}
amountOfReleasesToShow={amountStableReleases} amountOfReleasesToShow={amountStableReleases}
setTotalReleases={setTotalStableReleases} setTotalReleases={setTotalStableReleases}
/> />
@ -423,6 +424,7 @@ const DownloadsPage: NextPage<Props> = ({ data }) => {
windowsData={ALL_WINDOWS_DEV_BUILDS} windowsData={ALL_WINDOWS_DEV_BUILDS}
iOSData={ALL_IOS_DEV_BUILDS} iOSData={ALL_IOS_DEV_BUILDS}
androidData={ALL_ANDROID_DEV_BUILDS} androidData={ALL_ANDROID_DEV_BUILDS}
totalReleasesNumber={totalDevBuilds}
amountOfReleasesToShow={amountDevBuilds} amountOfReleasesToShow={amountDevBuilds}
setTotalReleases={setTotalDevBuilds} setTotalReleases={setTotalDevBuilds}
/> />

Loading…
Cancel
Save