minor fixes

This commit is contained in:
Ren Amamiya 2023-06-02 18:32:09 +07:00
parent 48e453fe5c
commit e2491e47c0
10 changed files with 33 additions and 34 deletions

View File

@ -29,7 +29,7 @@ export function ChannelMessageUser({
</>
) : (
<>
<div className="relative h-11 w-11 shrink rounded-md">
<div className="relative h-11 w-11 shrink-0 rounded-md">
<Image
src={user?.picture || DEFAULT_AVATAR}
alt={pubkey}
@ -38,7 +38,7 @@ export function ChannelMessageUser({
</div>
<div className="flex w-full flex-1 items-start justify-between">
<div className="flex items-baseline gap-2 text-base">
<span className="font-semibold leading-none text-white">
<span className="max-w-[10rem] truncate font-semibold leading-none text-white">
{user?.nip05 || user?.name || shortenKey(pubkey)}
</span>
<span className="leading-none text-zinc-500">·</span>

View File

@ -22,7 +22,7 @@ export function UserReply({ pubkey }: { pubkey: string }) {
className="h-9 w-9 rounded object-cover"
/>
</div>
<span className="text-sm font-medium leading-none text-zinc-500">
<span className="max-w-[10rem] truncate text-sm font-medium leading-none text-zinc-500">
Replying to {user?.name || shortenKey(pubkey)}
</span>
</>

View File

@ -3,6 +3,7 @@ import { RelayContext } from "@shared/relayProvider";
import { useActiveAccount } from "@stores/accounts";
import { WRITEONLY_RELAYS } from "@stores/constants";
import { dateToUnix } from "@utils/date";
import { useProfile } from "@utils/hooks/useProfile";
import { getEventHash, getSignature } from "nostr-tools";
import { useContext, useState } from "react";
@ -10,6 +11,7 @@ export function NoteReplyForm({ id }: { id: string }) {
const pool: any = useContext(RelayContext);
const account = useActiveAccount((state: any) => state.account);
const { user } = useProfile(account.pubkey);
const [value, setValue] = useState("");
const submitEvent = () => {
@ -32,12 +34,12 @@ export function NoteReplyForm({ id }: { id: string }) {
};
return (
<div className="flex gap-2.5 px-3 py-4">
<div className="flex gap-2.5 py-4">
<div>
<div className="relative h-9 w-9 shrink-0 overflow-hidden rounded-md">
<Image
src={account?.picture}
alt={account?.pubkey}
src={user?.picture}
alt={id}
className="h-9 w-9 rounded-md object-cover"
/>
</div>

View File

@ -1,4 +1,5 @@
import { Kind1 } from "@app/note/components/kind1";
import { NoteMetadata } from "@app/note/components/metadata";
import { NoteReplyUser } from "@app/note/components/user/reply";
import { noteParser } from "@utils/parser";
@ -6,11 +7,12 @@ export function Reply({ data }: { data: any }) {
const content = noteParser(data);
return (
<div className="flex h-min min-h-min w-full select-text flex-col px-3 py-3">
<div className="flex h-min min-h-min w-full select-text flex-col px-3 pt-5 mb-3 rounded-md bg-zinc-900">
<div className="flex flex-col">
<NoteReplyUser pubkey={data.pubkey} time={data.created_at} />
<div className="-mt-[20px] pl-[47px]">
<Kind1 content={content} />
<NoteMetadata id={data.id} eventPubkey={data.pubkey} />
</div>
</div>
</div>

View File

@ -17,8 +17,7 @@ export function RepliesList({ id }: { id: string }) {
[
{
"#e": [key],
since: 0,
kinds: [1, 1063],
kinds: [1],
limit: 20,
},
],
@ -39,26 +38,24 @@ export function RepliesList({ id }: { id: string }) {
<div className="mb-2">
<h5 className="text-lg font-semibold text-zinc-300">Replies</h5>
</div>
<div className="rounded-lg border border-zinc-800 bg-zinc-900 shadow-input shadow-black/20">
<div className="flex flex-col divide-y divide-zinc-800">
<NoteReplyForm id={id} />
{error && <div>failed to load</div>}
{!data ? (
<div className="flex gap-2 px-3 py-4">
<div className="relative h-9 w-9 shrink animate-pulse rounded-md bg-zinc-800" />
<div className="flex w-full flex-1 flex-col justify-center gap-1">
<div className="flex items-baseline gap-2 text-base">
<div className="h-2.5 w-20 animate-pulse rounded-sm bg-zinc-800" />
</div>
<div className="h-4 w-44 animate-pulse rounded-sm bg-zinc-800" />
<div className="flex flex-col">
<NoteReplyForm id={id} />
{error && <div>failed to load</div>}
{!data ? (
<div className="flex gap-2 px-3 py-4">
<div className="relative h-9 w-9 shrink animate-pulse rounded-md bg-zinc-800" />
<div className="flex w-full flex-1 flex-col justify-center gap-1">
<div className="flex items-baseline gap-2 text-base">
<div className="h-2.5 w-20 animate-pulse rounded-sm bg-zinc-800" />
</div>
<div className="h-4 w-44 animate-pulse rounded-sm bg-zinc-800" />
</div>
) : (
sortEvents(data).map((event: any) => {
return <Reply key={event.id} data={event} />;
})
)}
</div>
</div>
) : (
sortEvents(data).map((event: any) => {
return <Reply key={event.id} data={event} />;
})
)}
</div>
</div>
);

View File

@ -27,7 +27,7 @@ export function NoteQuoteUser({
</div>
<div className="flex w-full flex-1 items-start justify-between">
<div className="flex items-baseline gap-2 text-base">
<span className="font-semibold leading-none text-white">
<span className="max-w-[10rem] truncate font-semibold leading-none text-white">
{user?.nip05 || user?.name || shortenKey(pubkey)}
</span>
<span className="leading-none text-zinc-500">·</span>

View File

@ -27,7 +27,7 @@ export function NoteReplyUser({
</div>
<div className="flex w-full flex-1 items-start justify-between">
<div className="flex items-baseline gap-2 text-base">
<span className="font-semibold leading-none text-white">
<span className="max-w-[10rem] truncate font-semibold leading-none text-white">
{user?.nip05 || user?.name || shortenKey(pubkey)}
</span>
<span className="leading-none text-zinc-500">·</span>

View File

@ -17,7 +17,7 @@ export function ActiveAccount({ data }: { data: any }) {
const notChatPage = pathnames.includes("/chat") ? false : true;
const notChannelPage = pathnames.includes("/channel") ? false : true;
const notSpacePage = pathnames.includes("/space") ? false : true;
// const notSpacePage = pathnames.includes("/space") ? false : true;
const lastLogin = useActiveAccount((state: any) => state.lastLogin);
const notifyChat = useChats((state: any) => state.add);

View File

@ -116,7 +116,7 @@ export function Post({ pubkey, privkey }: { pubkey: string; privkey: string }) {
<div className="flex w-8 shrink-0 items-center justify-center">
<div className="h-full w-[2px] bg-zinc-800" />
</div>
<div className="markdown">
<div className="w-full markdown">
<Editable
autoFocus
placeholder="What's on your mind?"

View File

@ -55,9 +55,7 @@ export const useActiveAccount = create(
const target = state.blocks.findIndex(
(b: { id: string }) => b.id === id,
);
if (target) {
state.blocks.splice(target, 1);
}
state.blocks.splice(target, 1);
});
},
updateFollows: (list: any) => {