NoteInner prop waitUntilInView = false
This commit is contained in:
@ -41,6 +41,7 @@ export interface NoteProps {
|
|||||||
longFormPreview?: boolean;
|
longFormPreview?: boolean;
|
||||||
truncate?: boolean;
|
truncate?: boolean;
|
||||||
};
|
};
|
||||||
|
waitUntilInView?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Note(props: NoteProps) {
|
export default function Note(props: NoteProps) {
|
||||||
|
@ -31,7 +31,7 @@ import DisplayName from "@/Element/User/DisplayName";
|
|||||||
const TEXT_TRUNCATE_LENGTH = 400;
|
const TEXT_TRUNCATE_LENGTH = 400;
|
||||||
|
|
||||||
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 , waitUntilInView } = props;
|
||||||
|
|
||||||
const baseClassName = classNames("note min-h-[110px] flex flex-col gap-4 card", className);
|
const baseClassName = classNames("note min-h-[110px] flex flex-col gap-4 card", className);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -326,7 +326,7 @@ export function NoteInner(props: NoteProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function content() {
|
function content() {
|
||||||
if (!inView) return undefined;
|
if (waitUntilInView && !inView) return undefined;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{options.showHeader && (
|
{options.showHeader && (
|
||||||
|
@ -13,6 +13,7 @@ export interface TimelineFragment {
|
|||||||
export interface TimelineFragProps {
|
export interface TimelineFragProps {
|
||||||
frag: TimelineFragment;
|
frag: TimelineFragment;
|
||||||
related: Array<TaggedNostrEvent>;
|
related: Array<TaggedNostrEvent>;
|
||||||
|
index: number;
|
||||||
noteRenderer?: (ev: TaggedNostrEvent) => ReactNode;
|
noteRenderer?: (ev: TaggedNostrEvent) => ReactNode;
|
||||||
noteOnClick?: (ev: TaggedNostrEvent) => void;
|
noteOnClick?: (ev: TaggedNostrEvent) => void;
|
||||||
noteContext?: (ev: TaggedNostrEvent) => ReactNode;
|
noteContext?: (ev: TaggedNostrEvent) => ReactNode;
|
||||||
@ -41,6 +42,7 @@ export function TimelineFragment(props: TimelineFragProps) {
|
|||||||
options={{
|
options={{
|
||||||
truncate: true,
|
truncate: true,
|
||||||
}}
|
}}
|
||||||
|
waitUntilInView={props.index > 10}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
)}
|
)}
|
||||||
|
@ -99,6 +99,7 @@ export function TimelineRenderer(props: TimelineRendererProps) {
|
|||||||
noteRenderer={props.noteRenderer}
|
noteRenderer={props.noteRenderer}
|
||||||
noteOnClick={props.noteOnClick}
|
noteOnClick={props.noteOnClick}
|
||||||
noteContext={props.noteContext}
|
noteContext={props.noteContext}
|
||||||
|
index={index}
|
||||||
/>
|
/>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
));
|
));
|
||||||
|
Reference in New Issue
Block a user