failing thread root load, show current note
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Martti Malmi 2024-03-04 10:43:49 +02:00
parent 1f4427641e
commit 23584205aa
3 changed files with 27 additions and 1 deletions

View File

@ -2,7 +2,7 @@ import "./Thread.css";
import { EventExt, TaggedNostrEvent, u256 } from "@snort/system";
import { ReactNode, useCallback, useContext, useMemo } from "react";
import { useIntl } from "react-intl";
import { FormattedMessage, useIntl } from "react-intl";
import { useNavigate } from "react-router-dom";
import BackButton from "@/Components/Button/BackButton";
@ -72,6 +72,22 @@ export function Thread(props: { onBack?: () => void; disableSpotlight?: boolean
}
}
function renderCurrent() {
if (thread.current) {
const note = thread.data.find(n => n.id === thread.current);
return (
note && (
<Note
data={note}
options={{ showReactionsLink: true, showMediaSpotlight: true }}
threadChains={thread.chains}
onClick={navigateThread}
/>
)
);
}
}
function goBack() {
if (parent) {
thread.setCurrent(parent);
@ -119,6 +135,12 @@ export function Thread(props: { onBack?: () => void; disableSpotlight?: boolean
<div className="main-content">
{thread.root && renderRoot(thread.root)}
{thread.root && renderChain(chainKey(thread.root))}
{!thread.root && renderCurrent()}
{!thread.root && !thread.current && (
<NoteGhost>
<FormattedMessage defaultMessage="Looking up thread..." id="JA+tz3" />
</NoteGhost>
)}
</div>
</>
);

View File

@ -631,6 +631,9 @@
"J2HeQ+": {
"defaultMessage": "Use commas to separate words e.g. word1, word2, word3"
},
"JA+tz3": {
"defaultMessage": "Looking up thread..."
},
"JCIgkj": {
"defaultMessage": "Username"
},

View File

@ -208,6 +208,7 @@
"J+dIsA": "Subscriptions",
"J1iLmb": "Notifications Not Allowed",
"J2HeQ+": "Use commas to separate words e.g. word1, word2, word3",
"JA+tz3": "Looking up thread...",
"JCIgkj": "Username",
"JGrt9q": "Send sats to {name}",
"JHEHCk": "Zaps ({n})",