feat: search profiles

This commit is contained in:
Kieran 2023-01-28 16:31:03 +00:00
parent 81a928a11c
commit 27b041a894
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
4 changed files with 12 additions and 2 deletions

View File

@ -12,7 +12,8 @@ export interface ProfilePreviewProps {
options?: { options?: {
about?: boolean about?: boolean
}, },
actions?: ReactNode actions?: ReactNode,
className?: string
} }
export default function ProfilePreview(props: ProfilePreviewProps) { export default function ProfilePreview(props: ProfilePreviewProps) {
const pubkey = props.pubkey; const pubkey = props.pubkey;
@ -24,7 +25,7 @@ export default function ProfilePreview(props: ProfilePreviewProps) {
}; };
return ( return (
<div className="profile-preview" ref={ref}> <div className={`profile-preview${props.className ? ` ${props.className}` : ""}`} ref={ref}>
{inView && <> {inView && <>
<ProfileImage pubkey={pubkey} subHeader= <ProfileImage pubkey={pubkey} subHeader=
{options.about ? <div className="f-ellipsis about"> {options.about ? <div className="f-ellipsis about">

View File

@ -8,6 +8,7 @@ import Note from "Element/Note";
import NoteReaction from "Element/NoteReaction"; import NoteReaction from "Element/NoteReaction";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faForward } from "@fortawesome/free-solid-svg-icons"; import { faForward } from "@fortawesome/free-solid-svg-icons";
import ProfilePreview from "./ProfilePreview";
export interface TimelineProps { export interface TimelineProps {
postsOnly: boolean, postsOnly: boolean,
@ -37,6 +38,9 @@ export default function Timeline({ subject, postsOnly = false, method }: Timelin
function eventElement(e: TaggedRawEvent) { function eventElement(e: TaggedRawEvent) {
switch (e.kind) { switch (e.kind) {
case EventKind.SetMetadata: {
return <ProfilePreview pubkey={e.pubkey} className="card"/>
}
case EventKind.TextNote: { case EventKind.TextNote: {
return <Note key={e.id} data={e} related={related.notes} /> return <Note key={e.id} data={e} related={related.notes} />
} }

View File

@ -48,6 +48,7 @@ export default function useTimelineFeed(subject: TimelineSubject, options: Timel
break; break;
} }
case "keyword": { case "keyword": {
sub.Kinds.add(EventKind.SetMetadata);
sub.Search = subject.items[0]; sub.Search = subject.items[0];
break; break;
} }

View File

@ -328,6 +328,10 @@ body.scroll-lock {
margin-bottom: 10px; margin-bottom: 10px;
} }
.mb20 {
margin-bottom: 20px;
}
.mr-auto { .mr-auto {
margin-right: auto; margin-right: auto;
} }