Handle missing notes

This commit is contained in:
Bojan Mojsilovic 2024-03-26 11:29:37 +01:00
parent 7c13ded03c
commit 913c478e9e
3 changed files with 59 additions and 21 deletions

View File

@ -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;

View File

@ -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,9 +181,19 @@ const Thread: Component = () => {
}
</For>
</div>
</Show>
<Show when={primaryNote()}>
<Show
when={primaryNote()}
fallback={
<div class={styles.missingNote}>
<p>
{intl.formatMessage(tPlaceholders.missingNote.firstLine)}
</p>
<p>
{intl.formatMessage(tPlaceholders.missingNote.secondLine)}
</p>
</div>
}>
<div id="primary_note">
<NotePrimary
note={primaryNote() as PrimalNote}
@ -207,6 +217,7 @@ const Thread: Component = () => {
</For>
</div>
</Show>
</Show>
</div>
)
}

View File

@ -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',