wip: refactor

This commit is contained in:
Ren Amamiya
2023-08-18 07:37:11 +07:00
parent 414dd50a5c
commit 5626579b3f
17 changed files with 156 additions and 307 deletions

View File

@@ -4,12 +4,10 @@ import { Image } from '@shared/image';
import { NoteActions, NoteMetadata } from '@shared/notes';
import { User } from '@shared/user';
function isImage(url: string) {
return /\.(jpg|jpeg|gif|png|webp|avif)$/.test(url);
}
import { isImage } from '@utils/isImage';
export function NoteKind_1063({ event }: { event: NDKEvent }) {
const url = event.tags[0][1];
const url = event.tags.find((el) => el[0] === 'url')[1];
return (
<div className="h-min w-full px-3 py-1.5">

View File

@@ -46,13 +46,17 @@ export function Repost({ event }: { event: NDKEvent }) {
<div className="relative flex flex-col">
<div className="isolate flex flex-col -space-y-4">
<RepostUser pubkey={event.pubkey} />
<User pubkey={data.pubkey} time={data.created_at} isRepost={true} />
<User
pubkey={data.event.pubkey}
time={data.event.created_at}
isRepost={true}
/>
</div>
<div className="flex items-start gap-3">
<div className="w-11 shrink-0" />
<div className="relative z-20 flex-1">
<NoteContent content={data.content} />
<NoteActions id={repostID} pubkey={data.pubkey} />
<NoteContent content={data.richContent} />
<NoteActions id={repostID} pubkey={data.event.pubkey} />
</div>
</div>
<NoteMetadata id={repostID} />

View File

@@ -26,12 +26,12 @@ export function SubNote({ id, root }: { id: string; root?: string }) {
<>
<div className="absolute bottom-0 left-[18px] h-[calc(100%-3.4rem)] w-0.5 bg-gradient-to-t from-white/20 to-white/10" />
<div className="mb-5 flex flex-col">
<User pubkey={data.pubkey} time={data.created_at} />
<User pubkey={data.event.pubkey} time={data.event.created_at} />
<div className="-mt-6 flex items-start gap-3">
<div className="w-11 shrink-0" />
<div className="relative z-20 flex-1">
<NoteContent content={data.content} long={data.kind === 30023} />
<NoteActions id={data.id} pubkey={data.pubkey} root={root} />
<NoteContent content={data.richContent} long={data.event.kind === 30023} />
<NoteActions id={data.event.id} pubkey={data.event.pubkey} root={root} />
</div>
</div>
</div>