feat(columns): update timeline column

This commit is contained in:
2023-12-27 15:01:40 +07:00
parent b4dac2d477
commit ed538c91c6
14 changed files with 282 additions and 130 deletions

View File

@@ -7,10 +7,10 @@ export function ChildReply({
}: { event: NDKEvent; rootEventId?: string }) {
return (
<Note.Provider event={event}>
<Note.Root>
<Note.Root className="pl-4 gap-2 mb-5">
<Note.User />
<Note.TextContent content={event.content} className="min-w-0" />
<div className="-ml-1 flex h-14 items-center gap-10">
<div className="-ml-1 flex items-center gap-10">
<Note.Reply rootEventId={rootEventId} />
<Note.Reaction />
<Note.Repost />

View File

@@ -39,23 +39,21 @@ export const MentionNote = memo(function MentionNote({
}
return (
<Note.Root className="my-2 flex w-full cursor-default flex-col gap-1 rounded-lg bg-neutral-100 dark:bg-neutral-900">
<div className="mt-3 px-3">
<Note.User
pubkey={data.pubkey}
time={data.created_at}
variant="mention"
/>
</div>
<div className="mt-1 px-3 pb-3">
{renderKind(data)}
<Link
to={`/events/${data.id}`}
className="mt-2 text-blue-500 hover:text-blue-600"
>
Show more
</Link>
</div>
</Note.Root>
<Note.Provider event={data}>
<Note.Root className="my-2 flex w-full cursor-default flex-col gap-1 rounded-lg bg-neutral-100 dark:bg-neutral-900">
<div className="mt-3 px-3">
<Note.User variant="mention" />
</div>
<div className="mt-1 px-3 pb-3">
{renderKind(data)}
<Link
to={`/events/${data.id}`}
className="mt-2 text-blue-500 hover:text-blue-600"
>
Show more
</Link>
</div>
</Note.Root>
</Note.Provider>
);
});

View File

@@ -1,5 +1,7 @@
import { WIDGET_KIND } from "@lume/utils";
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
import { memo } from "react";
import { Link } from "react-router-dom";
import { useProfile } from "../../../hooks/useProfile";
import { useWidget } from "../../../hooks/useWidget";
@@ -10,18 +12,35 @@ export const MentionUser = memo(function MentionUser({
const { addWidget } = useWidget();
return (
<button
type="button"
onClick={() =>
addWidget.mutate({
kind: WIDGET_KIND.user,
title: user?.name || user?.display_name || user?.displayName,
content: pubkey,
})
}
className="break-words text-blue-500 hover:text-blue-600"
>
{`@${user?.name || user?.displayName || user?.username || "unknown"}`}
</button>
<DropdownMenu.Root>
<DropdownMenu.Trigger className="break-words text-blue-500 hover:text-blue-600">
{`@${user?.name || user?.displayName || user?.username || "anon"}`}
</DropdownMenu.Trigger>
<DropdownMenu.Content className="left-[50px] z-50 relative flex w-[200px] flex-col overflow-hidden rounded-xl border border-neutral-200 bg-neutral-950 focus:outline-none dark:border-neutral-900">
<DropdownMenu.Item asChild>
<Link
to={`/users/${pubkey}`}
className="inline-flex h-10 items-center px-4 text-sm text-white hover:bg-neutral-900 focus:outline-none"
>
View profile
</Link>
</DropdownMenu.Item>
<DropdownMenu.Item asChild>
<button
type="button"
onClick={() =>
addWidget.mutate({
kind: WIDGET_KIND.user,
title: user?.name || user?.displayName || "",
content: pubkey,
})
}
className="inline-flex h-10 items-center px-4 text-sm text-white hover:bg-neutral-900 focus:outline-none"
>
Pin
</button>
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>
);
});

View File

@@ -63,7 +63,7 @@ export function NoteUser({
<Avatar.Image
src={user?.picture || user?.image}
alt={event.pubkey}
loading="lazy"
loading="eager"
decoding="async"
className="h-6 w-6 rounded-md"
/>
@@ -94,12 +94,12 @@ export function NoteUser({
if (variant === "repost") {
if (isLoading) {
return (
<div className={twMerge("flex gap-3", className)}>
<div className="inline-flex w-10 items-center justify-center">
<div className={twMerge("flex gap-2 px-3", className)}>
<div className="inline-flex shrink-0 w-10 items-center justify-center">
<RepostIcon className="h-5 w-5 text-blue-500" />
</div>
<div className="inline-flex items-center gap-2">
<div className="h-6 w-6 animate-pulse rounded bg-neutral-300 dark:bg-neutral-700" />
<div className="h-6 w-6 shrink-0 animate-pulse rounded bg-neutral-300 dark:bg-neutral-700" />
<div className="h-4 w-24 animate-pulse rounded bg-neutral-300 dark:bg-neutral-700" />
</div>
</div>
@@ -107,8 +107,8 @@ export function NoteUser({
}
return (
<div className={twMerge("flex gap-2", className)}>
<div className="inline-flex w-10 items-center justify-center">
<div className={twMerge("flex gap-2 px-3", className)}>
<div className="inline-flex shrink-0 w-10 items-center justify-center">
<RepostIcon className="h-5 w-5 text-blue-500" />
</div>
<div className="inline-flex items-center gap-2">
@@ -116,7 +116,7 @@ export function NoteUser({
<Avatar.Image
src={user?.picture || user?.image}
alt={event.pubkey}
loading="lazy"
loading="eager"
decoding="async"
className="h-6 w-6 rounded object-cover"
/>
@@ -161,7 +161,7 @@ export function NoteUser({
<Avatar.Image
src={user?.picture || user?.image}
alt={event.pubkey}
loading="lazy"
loading="eager"
decoding="async"
className="h-10 w-10 rounded-lg object-cover ring-1 ring-neutral-200/50 dark:ring-neutral-800/50"
/>
@@ -212,7 +212,7 @@ export function NoteUser({
<Avatar.Image
src={user?.picture || user?.image}
alt={event.pubkey}
loading="lazy"
loading="eager"
decoding="async"
className="h-9 w-9 rounded-lg bg-white object-cover ring-1 ring-neutral-200/50 dark:ring-neutral-800/50"
/>