feat: show replies count
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
9b66b7b1da
commit
ddb8e623f4
@ -1,6 +1,6 @@
|
|||||||
import "./Note.css";
|
import "./Note.css";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { EventKind, TaggedNostrEvent } from "@snort/system";
|
import { EventKind, NostrEvent, TaggedNostrEvent } from "@snort/system";
|
||||||
import { NostrFileElement } from "Element/Event/NostrFileHeader";
|
import { NostrFileElement } from "Element/Event/NostrFileHeader";
|
||||||
import ZapstrEmbed from "Element/Embed/ZapstrEmbed";
|
import ZapstrEmbed from "Element/Embed/ZapstrEmbed";
|
||||||
import PubkeyList from "Element/Embed/PubkeyList";
|
import PubkeyList from "Element/Embed/PubkeyList";
|
||||||
@ -20,6 +20,7 @@ export interface NoteProps {
|
|||||||
onClick?: (e: TaggedNostrEvent) => void;
|
onClick?: (e: TaggedNostrEvent) => void;
|
||||||
depth?: number;
|
depth?: number;
|
||||||
searchedValue?: string;
|
searchedValue?: string;
|
||||||
|
threadChains?: Map<string, Array<NostrEvent>>;
|
||||||
options?: {
|
options?: {
|
||||||
showHeader?: boolean;
|
showHeader?: boolean;
|
||||||
showContextMenu?: boolean;
|
showContextMenu?: boolean;
|
||||||
|
@ -40,6 +40,7 @@ export interface NoteFooterProps {
|
|||||||
reposts: TaggedNostrEvent[];
|
reposts: TaggedNostrEvent[];
|
||||||
zaps: ParsedZap[];
|
zaps: ParsedZap[];
|
||||||
positive: TaggedNostrEvent[];
|
positive: TaggedNostrEvent[];
|
||||||
|
replies?: number;
|
||||||
ev: TaggedNostrEvent;
|
ev: TaggedNostrEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +250,7 @@ export default function NoteFooter(props: NoteFooterProps) {
|
|||||||
className={note.show ? "reacted" : ""}
|
className={note.show ? "reacted" : ""}
|
||||||
iconName="reply"
|
iconName="reply"
|
||||||
title={formatMessage({ defaultMessage: "Reply" })}
|
title={formatMessage({ defaultMessage: "Reply" })}
|
||||||
value={0}
|
value={props.replies ?? 0}
|
||||||
onClick={async () => handleReplyButtonClick()}
|
onClick={async () => handleReplyButtonClick()}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -23,6 +23,7 @@ import Reactions from "./Reactions";
|
|||||||
import HiddenNote from "./HiddenNote";
|
import HiddenNote from "./HiddenNote";
|
||||||
import { NoteProps } from "./Note";
|
import { NoteProps } from "./Note";
|
||||||
import { useEventReactions } from "Hooks/useEventReactions";
|
import { useEventReactions } from "Hooks/useEventReactions";
|
||||||
|
import { chainKey } from "Hooks/useThreadContext";
|
||||||
|
|
||||||
export function NoteInner(props: NoteProps) {
|
export function NoteInner(props: NoteProps) {
|
||||||
const { data: ev, related, highlight, options: opt, ignoreModeration = false, className } = props;
|
const { data: ev, related, highlight, options: opt, ignoreModeration = false, className } = props;
|
||||||
@ -306,7 +307,15 @@ export function NoteInner(props: NoteProps) {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{options.showFooter && <NoteFooter ev={ev} positive={reactions.positive} reposts={reposts} zaps={zaps} />}
|
{options.showFooter && (
|
||||||
|
<NoteFooter
|
||||||
|
ev={ev}
|
||||||
|
positive={reactions.positive}
|
||||||
|
reposts={reposts}
|
||||||
|
zaps={zaps}
|
||||||
|
replies={props.threadChains?.get(chainKey(ev))?.length}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Reactions
|
<Reactions
|
||||||
show={showReactions}
|
show={showReactions}
|
||||||
setShow={setShowReactions}
|
setShow={setShowReactions}
|
||||||
|
@ -50,6 +50,7 @@ const Subthread = ({ active, notes, related, chains, onNavigate }: SubthreadProp
|
|||||||
key={a.id}
|
key={a.id}
|
||||||
related={related}
|
related={related}
|
||||||
onClick={onNavigate}
|
onClick={onNavigate}
|
||||||
|
threadChains={chains}
|
||||||
/>
|
/>
|
||||||
<div className="line-container"></div>
|
<div className="line-container"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -94,6 +95,7 @@ const ThreadNote = ({ active, note, isLast, isLastSubthread, related, chains, on
|
|||||||
key={note.id}
|
key={note.id}
|
||||||
related={related}
|
related={related}
|
||||||
onClick={onNavigate}
|
onClick={onNavigate}
|
||||||
|
threadChains={chains}
|
||||||
/>
|
/>
|
||||||
<div className="line-container"></div>
|
<div className="line-container"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -164,6 +166,7 @@ const TierThree = ({ active, isLastSubthread, notes, related, chains, onNavigate
|
|||||||
data={first}
|
data={first}
|
||||||
key={first.id}
|
key={first.id}
|
||||||
related={related}
|
related={related}
|
||||||
|
threadChains={chains}
|
||||||
/>
|
/>
|
||||||
<div className="line-container"></div>
|
<div className="line-container"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -196,6 +199,7 @@ const TierThree = ({ active, isLastSubthread, notes, related, chains, onNavigate
|
|||||||
key={r.id}
|
key={r.id}
|
||||||
related={related}
|
related={related}
|
||||||
onClick={onNavigate}
|
onClick={onNavigate}
|
||||||
|
threadChains={chains}
|
||||||
/>
|
/>
|
||||||
<div className="line-container"></div>
|
<div className="line-container"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -251,6 +255,7 @@ export function Thread(props: { onBack?: () => void; disableSpotlight?: boolean
|
|||||||
related={getLinkReactions(thread.reactions, NostrLink.fromEvent(note))}
|
related={getLinkReactions(thread.reactions, NostrLink.fromEvent(note))}
|
||||||
options={{ showReactionsLink: true, showMediaSpotlight: !props.disableSpotlight }}
|
options={{ showReactionsLink: true, showMediaSpotlight: !props.disableSpotlight }}
|
||||||
onClick={navigateThread}
|
onClick={navigateThread}
|
||||||
|
threadChains={thread.chains}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user