diff options
author | eug-vs <eug-vs@keemail.me> | 2020-08-14 17:52:40 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-08-14 17:53:02 +0300 |
commit | c3ebdfe3b959f0d4a670e08176e71906107041af (patch) | |
tree | 5c367352b443914f8de0c6af98769f9fcfb0e361 /src/containers/Profile/Profile.tsx | |
parent | d309f375af53dbb3415e2f892dc85e495ea0cf4c (diff) | |
download | which-ui-c3ebdfe3b959f0d4a670e08176e71906107041af.tar.gz |
feat: add EmptyState message in Profile
Diffstat (limited to 'src/containers/Profile/Profile.tsx')
-rw-r--r-- | src/containers/Profile/Profile.tsx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/containers/Profile/Profile.tsx b/src/containers/Profile/Profile.tsx index 701aa06..a46dbde 100644 --- a/src/containers/Profile/Profile.tsx +++ b/src/containers/Profile/Profile.tsx @@ -28,6 +28,11 @@ const Profile: React.FC = () => { }, [username, history, user]); const isOwnProfile = useMemo(() => user?.username === username, [user, username]); + const message = useMemo(() => { + return isOwnProfile + ? 'Create a poll and it will show up here.' + : 'This user has not uploaded anything yet.'; + }, [isOwnProfile]); const totalVotes = useMemo(() => polls?.reduce( (total: number, current: Poll) => { @@ -48,7 +53,7 @@ const Profile: React.FC = () => { polls ? polls.length ? <PollsList polls={polls} mutate={mutatePolls} /> - : <EmptyState message={isOwnProfile ? 'Create a poll and it will show up here.' : ''} /> + : <EmptyState message={message} /> : isValidating && <Loading /> } {isOwnProfile && <Fab />} |