diff options
Diffstat (limited to 'src/containers/Feed')
-rw-r--r-- | src/containers/Feed/Feed.tsx | 12 | ||||
-rw-r--r-- | src/containers/Feed/types.ts | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/containers/Feed/Feed.tsx b/src/containers/Feed/Feed.tsx index 10b1adc..337f4c1 100644 --- a/src/containers/Feed/Feed.tsx +++ b/src/containers/Feed/Feed.tsx @@ -3,18 +3,26 @@ import { Container } from '@material-ui/core/'; import PollsList from '../../components/PollsList/PollsList'; import Fab from '../../components/Fab/Fab'; +import Loading from '../../components/Loading/Loading'; +import EmptyState from '../../components/EmptyState/EmptyState'; import { useAuth } from '../../hooks/useAuth'; import { useFeed } from '../../hooks/APIClient'; const Feed: React.FC = () => { - const { data: polls, mutate } = useFeed(); + const { data: polls, isValidating, mutate } = useFeed(); const { isAuthenticated } = useAuth(); return ( <Container maxWidth="sm" disableGutters> {isAuthenticated && <Fab hideOnScroll />} - <PollsList polls={polls} mutate={mutate} /> + { + polls + ? polls.length + ? <PollsList polls={polls} mutate={mutate} /> + : <EmptyState /> + : isValidating && <Loading /> + } </Container> ); }; diff --git a/src/containers/Feed/types.ts b/src/containers/Feed/types.ts deleted file mode 100644 index 24ace4e..0000000 --- a/src/containers/Feed/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface ImageData { - url: string; -} -export interface Contents { - left: ImageData; - right: ImageData; -} |