Browse Source

Fix location eternally loading when not set

develop
Apostolos Fanakis 4 years ago
parent
commit
2598700e18
  1. 1
      packages/concordia-app/public/locales/en/translation.json
  2. 5
      packages/concordia-app/src/assets/css/index.css
  3. 15
      packages/concordia-app/src/views/Profile/GeneralTab/index.jsx

1
packages/concordia-app/public/locales/en/translation.json

@ -8,6 +8,7 @@
"post.form.subject.field.placeholder": "Subject", "post.form.subject.field.placeholder": "Subject",
"post.list.row.post.id": "#{{id}}", "post.list.row.post.id": "#{{id}}",
"profile.general.tab.address.row.title": "Account address:", "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.location.row.title": "Location:",
"profile.general.tab.number.of.posts.row.title": "Number of posts:", "profile.general.tab.number.of.posts.row.title": "Number of posts:",
"profile.general.tab.number.of.topics.row.title": "Number of topics created:", "profile.general.tab.number.of.topics.row.title": "Number of topics created:",

5
packages/concordia-app/src/assets/css/index.css

@ -10,3 +10,8 @@ body.app {
.i18next-newlines { .i18next-newlines {
white-space: pre-line !important; white-space: pre-line !important;
} }
.text-secondary {
color: gray;
font-style: italic;
}

15
packages/concordia-app/src/views/Profile/GeneralTab/index.jsx

@ -79,6 +79,17 @@ const GeneralTab = (props) => {
/> />
)), [profileMeta]); )), [profileMeta]);
const userLocation = useMemo(() => {
if (profileMeta === null) {
return (
<Placeholder><Placeholder.Line length="medium" /></Placeholder>
);
} if (profileMeta[USER_LOCATION] === undefined) {
return <span className="text-secondary">{t('profile.general.tab.location.row.not.set')}</span>;
}
return profileMeta[USER_LOCATION];
}, [profileMeta, t]);
return useMemo(() => ( return useMemo(() => (
<Table basic="very" singleLine> <Table basic="very" singleLine>
<Table.Body> <Table.Body>
@ -126,9 +137,7 @@ const GeneralTab = (props) => {
<Table.Row> <Table.Row>
<Table.Cell><strong>{t('profile.general.tab.location.row.title')}</strong></Table.Cell> <Table.Cell><strong>{t('profile.general.tab.location.row.title')}</strong></Table.Cell>
<Table.Cell> <Table.Cell>
{profileMeta !== null && profileMeta[USER_LOCATION] {userLocation}
? profileMeta[USER_LOCATION]
: <Placeholder><Placeholder.Line length="medium" /></Placeholder>}
</Table.Cell> </Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>

Loading…
Cancel
Save