Browse Source

fix: 🐛

imwald
codytseng 1 year ago
parent
commit
0f2f82b3ac
  1. 9
      src/components/Embedded/EmbeddedMention.tsx
  2. 9
      src/components/Username/index.tsx
  3. 8
      src/pages/secondary/NotePage/index.tsx

9
src/components/Embedded/EmbeddedMention.tsx

@ -2,7 +2,14 @@ import Username from '../Username'
import { TEmbeddedRenderer } from './types' import { TEmbeddedRenderer } from './types'
export function EmbeddedMention({ userId }: { userId: string }) { export function EmbeddedMention({ userId }: { userId: string }) {
return <Username userId={userId} showAt className="text-highlight font-normal inline-block" /> return (
<Username
userId={userId}
showAt
className="text-highlight font-normal inline-block"
withoutSkeleton
/>
)
} }
export const embeddedNostrNpubRenderer: TEmbeddedRenderer = { export const embeddedNostrNpubRenderer: TEmbeddedRenderer = {

9
src/components/Username/index.tsx

@ -10,15 +10,20 @@ export default function Username({
userId, userId,
showAt = false, showAt = false,
className, className,
skeletonClassName skeletonClassName,
withoutSkeleton = false
}: { }: {
userId: string userId: string
showAt?: boolean showAt?: boolean
className?: string className?: string
skeletonClassName?: string skeletonClassName?: string
withoutSkeleton?: boolean
}) { }) {
const { profile } = useFetchProfile(userId) const { profile } = useFetchProfile(userId)
if (!profile) return <Skeleton className={cn('w-16 my-1', skeletonClassName)} /> if (!profile && !withoutSkeleton) {
return <Skeleton className={cn('w-16 my-1', skeletonClassName)} />
}
if (!profile) return null
const { username, pubkey } = profile const { username, pubkey } = profile

8
src/pages/secondary/NotePage/index.tsx

@ -81,8 +81,12 @@ function ParentNote({ eventId }: { eventId?: string }) {
className="flex space-x-1 p-1 items-center clickable text-sm text-muted-foreground hover:text-foreground" className="flex space-x-1 p-1 items-center clickable text-sm text-muted-foreground hover:text-foreground"
onClick={() => push(toNote(event))} onClick={() => push(toNote(event))}
> >
<UserAvatar userId={event.pubkey} size="tiny" /> <UserAvatar userId={event.pubkey} size="tiny" className="shrink-0" />
<Username userId={event.pubkey} className="font-semibold" skeletonClassName="h-4" /> <Username
userId={event.pubkey}
className="font-semibold"
skeletonClassName="h-4 shrink-0"
/>
<div className="truncate">{event.content}</div> <div className="truncate">{event.content}</div>
</Card> </Card>
<div className="ml-5 w-px h-2 bg-border" /> <div className="ml-5 w-px h-2 bg-border" />

Loading…
Cancel
Save