From 7e8e5a931b73476daff2c2f32a7d0bf3483d1213 Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Tue, 16 May 2023 09:56:24 +0700 Subject: [PATCH] update threads (kind 30023) page --- src/app/note/components/mentions/user.tsx | 9 +++++- src/app/threads/components/author.tsx | 35 +++++++++++++++++++++-- src/app/threads/components/base.tsx | 31 ++++++++++++++++---- src/app/threads/pages/index.page.tsx | 15 ++++++++-- 4 files changed, 77 insertions(+), 13 deletions(-) diff --git a/src/app/note/components/mentions/user.tsx b/src/app/note/components/mentions/user.tsx index 9eff234e..33dace1c 100644 --- a/src/app/note/components/mentions/user.tsx +++ b/src/app/note/components/mentions/user.tsx @@ -1,8 +1,15 @@ import { useProfile } from "@utils/hooks/useProfile"; import { shortenKey } from "@utils/shortenKey"; +const hexRegex = /[0-9A-Fa-f]{6}/g; + export function MentionUser(props: { children: any[] }) { - const pubkey = props.children[0]; + const pubkey = props.children[0].match(hexRegex) ? props.children[0] : null; + + if (!pubkey) { + return null; + } + const { user } = useProfile(pubkey); return ( diff --git a/src/app/threads/components/author.tsx b/src/app/threads/components/author.tsx index f1e351ff..cb75c84d 100644 --- a/src/app/threads/components/author.tsx +++ b/src/app/threads/components/author.tsx @@ -1,11 +1,40 @@ +import { Image } from "@shared/image"; +import { DEFAULT_AVATAR, IMGPROXY_URL } from "@stores/constants"; +import { useProfile } from "@utils/hooks/useProfile"; +import { shortenKey } from "@utils/shortenKey"; +import dayjs from "dayjs"; + export function ThreadAuthor({ pubkey, time, }: { pubkey: string; time: number }) { + const { user } = useProfile(pubkey); + return ( -
{pubkey}
- {time} +{summary}
+{summary}
+