From c3ebdfe3b959f0d4a670e08176e71906107041af Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 14 Aug 2020 17:52:40 +0300
Subject: feat: add EmptyState message in Profile

---
 src/containers/Profile/Profile.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/containers/Profile/Profile.tsx')

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 />}
-- 
cgit v1.2.3

