fix: context
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Kieran 2023-11-14 11:43:40 +00:00
parent b1e7cf6bf9
commit eb47da0417
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
3 changed files with 11 additions and 5 deletions

View File

@ -66,9 +66,7 @@ const TimelineFollows = (props: TimelineFollowsProps) => {
const findHashTagContext = (a: NostrEvent) => {
const tag = a.tags.filter(a => a[0] === "t").find(a => login.tags.item.includes(a[1].toLowerCase()))?.[1];
if (tag) {
return <Link to={`/t/${tag}`}>{`#${tag}`}</Link>;
}
return tag;
};
const mixinFiltered = useMemo(() => {
const mainFeedIds = new Set(mainFeed.map(a => a.id));
@ -114,6 +112,11 @@ const TimelineFollows = (props: TimelineFollowsProps) => {
showLatest={t => onShowLatest(t)}
noteOnClick={props.noteOnClick}
noteRenderer={props.noteRenderer}
noteContext={e => {
if (typeof e.context === "string") {
return <Link to={`/t/${e.context}`}>{`#${e.context}`}</Link>;
}
}}
/>
{sortedFeed.length > 0 && (
<ShowMoreInView onClick={async () => await FollowsFeed.loadMore(system, login, oldest ?? unixNow())} />

View File

@ -24,6 +24,7 @@ export interface TimelineRendererProps {
showLatest: (toTop: boolean) => void;
noteRenderer?: (ev: TaggedNostrEvent) => ReactNode;
noteOnClick?: (ev: TaggedNostrEvent) => void;
noteContext?: (ev: TaggedNostrEvent) => ReactNode;
}
export function TimelineRenderer(props: TimelineRendererProps) {
@ -65,6 +66,7 @@ export function TimelineRenderer(props: TimelineRendererProps) {
related={props.related}
noteRenderer={props.noteRenderer}
noteOnClick={props.noteOnClick}
noteContext={props.noteContext}
/>
))}
</>
@ -76,6 +78,7 @@ export interface TimelineFragProps {
related: Array<TaggedNostrEvent>;
noteRenderer?: (ev: TaggedNostrEvent) => ReactNode;
noteOnClick?: (ev: TaggedNostrEvent) => void;
noteContext?: (ev: TaggedNostrEvent) => ReactNode;
}
export function TimelineFragment(props: TimelineFragProps) {
@ -97,7 +100,7 @@ export function TimelineFragment(props: TimelineFragProps) {
key={e.id}
depth={0}
onClick={props.noteOnClick}
context={e.context}
context={props.noteContext?.(e)}
/>
),
)}

View File

@ -19,7 +19,7 @@ export interface TaggedNostrEvent extends NostrEvent {
/**
* Additional context
*/
context?: never;
context?: object;
}
/**