Skip to content
This repository was archived by the owner on Mar 28, 2024. It is now read-only.

Commit 69630ab

Browse files
committed
feat: add message when no data available
1 parent 94178bd commit 69630ab

File tree

2 files changed

+55
-47
lines changed

2 files changed

+55
-47
lines changed

packages/client/src/components/podcast/PodcastCard.tsx

+45-39
Original file line numberDiff line numberDiff line change
@@ -95,45 +95,51 @@ export function PodcastCard(props: PodcastProps) {
9595
return (
9696
<>
9797
<Zoom in={visible} timeout={{ enter: 0, exit: 600 }} unmountOnExit>
98-
<Card key={podcast.id} id={`podcast-${podcast.id}`}>
99-
<CardHeader
100-
title={podcast.title}
101-
action={
102-
<IconButton onClick={handleCardMenuOpen}>
103-
<MoreVertIcon />
104-
</IconButton>
105-
}
106-
/>
107-
<CardContent>
108-
<Grid container>
109-
<Grid item xs={2}>
110-
<img src={podcast.image} height="150" width="150" />
111-
</Grid>
112-
<Grid item xs={10}>
113-
<Typography variant="body2">{podcast.description}</Typography>
114-
</Grid>
115-
</Grid>
116-
</CardContent>
117-
<CardActions>
118-
<IconButton>
119-
<FavoriteIcon />
120-
</IconButton>
121-
<IconButton
122-
className={clsx(classes.expand, {
123-
[classes.expandOpen]: expanded,
124-
})}
125-
onClick={handleExpandClick}
126-
>
127-
<ExpandMoreIcon />
128-
</IconButton>
129-
</CardActions>
130-
<Collapse in={expanded} unmountOnExit>
131-
<CardContent>
132-
<Typography>Episodes</Typography>
133-
<EpisodeList episodes={podcast.episodes} />
134-
</CardContent>
135-
</Collapse>
136-
</Card>
98+
<Grid container spacing={3} key={`podcast-row-${podcast.id}`}>
99+
<Grid item key={`podcast-col-${podcast.id}`}>
100+
<Card key={podcast.id} id={`podcast-${podcast.id}`}>
101+
<CardHeader
102+
title={podcast.title}
103+
action={
104+
<IconButton onClick={handleCardMenuOpen}>
105+
<MoreVertIcon />
106+
</IconButton>
107+
}
108+
/>
109+
<CardContent>
110+
<Grid container>
111+
<Grid item xs={2}>
112+
<img src={podcast.image} height="150" width="150" />
113+
</Grid>
114+
<Grid item xs={10}>
115+
<Typography variant="body2">
116+
{podcast.description}
117+
</Typography>
118+
</Grid>
119+
</Grid>
120+
</CardContent>
121+
<CardActions>
122+
<IconButton>
123+
<FavoriteIcon />
124+
</IconButton>
125+
<IconButton
126+
className={clsx(classes.expand, {
127+
[classes.expandOpen]: expanded,
128+
})}
129+
onClick={handleExpandClick}
130+
>
131+
<ExpandMoreIcon />
132+
</IconButton>
133+
</CardActions>
134+
<Collapse in={expanded} unmountOnExit>
135+
<CardContent>
136+
<Typography>Episodes</Typography>
137+
<EpisodeList episodes={podcast.episodes} />
138+
</CardContent>
139+
</Collapse>
140+
</Card>
141+
</Grid>
142+
</Grid>
137143
</Zoom>
138144

139145
<Menu

packages/client/src/components/podcast/PodcastList.tsx

+10-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { useQuery } from '@apollo/react-hooks';
33
import { gql } from 'apollo-boost';
44
import { PageInfo, Podcast } from '../../interfaces';
5-
import { Grid } from '@material-ui/core';
5+
import { Typography } from '@material-ui/core';
66
import { PodcastCard } from './PodcastCard';
77

88
interface PodcastEdge {
@@ -60,14 +60,16 @@ export function PodcastList() {
6060
<h3>Loading...</h3>
6161
) : (
6262
<>
63-
{data &&
63+
{data ? (
6464
data.podcasts.edges.map((edge) => (
65-
<Grid container spacing={3} key={`podcast-row-${edge.node.id}`}>
66-
<Grid item key={`podcast-col-${edge.node.id}`}>
67-
<PodcastCard podcast={edge.node} />
68-
</Grid>
69-
</Grid>
70-
))}
65+
<PodcastCard podcast={edge.node} />
66+
))
67+
) : (
68+
<>
69+
<Typography variant="h5">No Podcasts</Typography>
70+
<Typography>Add a podcast using the button below.</Typography>
71+
</>
72+
)}
7173
</>
7274
)}
7375
</>

0 commit comments

Comments
 (0)