From 2598700e1816bae021af5c0997433efb70d45383 Mon Sep 17 00:00:00 2001 From: Apostolof Date: Sun, 6 Dec 2020 18:05:37 +0200 Subject: [PATCH] Fix location eternally loading when not set --- .../public/locales/en/translation.json | 1 + packages/concordia-app/src/assets/css/index.css | 5 +++++ .../src/views/Profile/GeneralTab/index.jsx | 15 ++++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/concordia-app/public/locales/en/translation.json b/packages/concordia-app/public/locales/en/translation.json index 809fb50..443ce20 100644 --- a/packages/concordia-app/public/locales/en/translation.json +++ b/packages/concordia-app/public/locales/en/translation.json @@ -8,6 +8,7 @@ "post.form.subject.field.placeholder": "Subject", "post.list.row.post.id": "#{{id}}", "profile.general.tab.address.row.title": "Account address:", + "profile.general.tab.location.row.not.set": "Not set", "profile.general.tab.location.row.title": "Location:", "profile.general.tab.number.of.posts.row.title": "Number of posts:", "profile.general.tab.number.of.topics.row.title": "Number of topics created:", diff --git a/packages/concordia-app/src/assets/css/index.css b/packages/concordia-app/src/assets/css/index.css index bd79003..2a2d849 100644 --- a/packages/concordia-app/src/assets/css/index.css +++ b/packages/concordia-app/src/assets/css/index.css @@ -10,3 +10,8 @@ body.app { .i18next-newlines { white-space: pre-line !important; } + +.text-secondary { + color: gray; + font-style: italic; +} diff --git a/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx b/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx index e003fb1..6dddc44 100644 --- a/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx +++ b/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx @@ -79,6 +79,17 @@ const GeneralTab = (props) => { /> )), [profileMeta]); + const userLocation = useMemo(() => { + if (profileMeta === null) { + return ( + + ); + } if (profileMeta[USER_LOCATION] === undefined) { + return {t('profile.general.tab.location.row.not.set')}; + } + return profileMeta[USER_LOCATION]; + }, [profileMeta, t]); + return useMemo(() => ( @@ -126,9 +137,7 @@ const GeneralTab = (props) => { {t('profile.general.tab.location.row.title')} - {profileMeta !== null && profileMeta[USER_LOCATION] - ? profileMeta[USER_LOCATION] - : } + {userLocation}