From 913c478e9e93f2570cd9c2f3ba697981258f882e Mon Sep 17 00:00:00 2001 From: Bojan Mojsilovic Date: Tue, 26 Mar 2024 11:29:37 +0100 Subject: [PATCH] Handle missing notes --- src/pages/Thread.module.scss | 15 ++++++++++ src/pages/Thread.tsx | 53 ++++++++++++++++++++++-------------- src/translations.ts | 12 ++++++++ 3 files changed, 59 insertions(+), 21 deletions(-) diff --git a/src/pages/Thread.module.scss b/src/pages/Thread.module.scss index 487c161..4bacbd7 100644 --- a/src/pages/Thread.module.scss +++ b/src/pages/Thread.module.scss @@ -36,6 +36,21 @@ background-color: var(--background-card); } +.missingNote { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + p { + font-weight: 700; + font-size: 18px; + line-height: 34px; + padding-inline: 20px; + margin: 2px; + color: var(--text-secondary); + } +} + @media only screen and (max-width: 720px) { .border { height: 36px; diff --git a/src/pages/Thread.tsx b/src/pages/Thread.tsx index 7adc252..d3cca34 100644 --- a/src/pages/Thread.tsx +++ b/src/pages/Thread.tsx @@ -16,7 +16,7 @@ import { sortByRecency } from '../stores/note'; import { scrollWindowTo } from '../lib/scroll'; import { useIntl } from '@cookbook/solid-intl'; import Search from '../components/Search/Search'; -import { thread as t } from '../translations'; +import { placeholders as tPlaceholders, thread as t } from '../translations'; import { userName } from '../stores/profile'; import PageTitle from '../components/PageTitle/PageTitle'; import NavHeader from '../components/NavHeader/NavHeader'; @@ -181,31 +181,42 @@ const Thread: Component = () => { } - - -
- - - +

+ {intl.formatMessage(tPlaceholders.missingNote.firstLine)} +

+

+ {intl.formatMessage(tPlaceholders.missingNote.secondLine)} +

+
+ }> +
+ - + + + +
+
+ +
+ + {note => +
+ +
+ } +
- -
- - {note => -
- -
- } -
-
) diff --git a/src/translations.ts b/src/translations.ts index 95c6b79..d4e7d8e 100644 --- a/src/translations.ts +++ b/src/translations.ts @@ -992,6 +992,18 @@ export const notifications = { }; export const placeholders = { + missingNote: { + firstLine: { + id: 'placeholders.missingNote.firstLine', + defaultMessage: 'Oups! We can\'t seem to find this note.', + description: 'Placeholder when the note is missing', + }, + secondLine: { + id: 'placeholders.missingNote.secondLine', + defaultMessage: 'It may have been deleted by the author.', + description: 'Placeholder when the note is missing', + }, + }, noLikeDetails: { id: 'placeholders.noLikeDetails', defaultMessage: 'No details for likes found',