update kind 41

This commit is contained in:
Ren Amamiya
2023-05-10 17:00:07 +07:00
parent e7bcf6c3f8
commit 62d6f06b39
4 changed files with 43 additions and 42 deletions

View File

@@ -19,7 +19,12 @@ export default function ChannelsListItem({ data }: { data: any }) {
pageID === data.event_id ? 'dark:bg-zinc-900 dark:text-zinc-100 hover:dark:bg-zinc-800' : ''
)}
>
<div className="inline-flex h-5 w-5 items-center justify-center rounded bg-zinc-900 group-hover:bg-zinc-800">
<div
className={twMerge(
'inline-flex h-5 w-5 items-center justify-center rounded bg-zinc-900 group-hover:bg-zinc-800',
pageID === data.event_id ? 'dark:bg-zinc-800 group-hover:dark:bg-zinc-700' : ''
)}
>
<span className="text-xs text-zinc-200">#</span>
</div>
<div>

View File

@@ -11,16 +11,16 @@ export default function ChannelsList() {
const { data, error }: any = useSWR('channels', fetcher);
return (
<div className="flex flex-col">
<div className="flex flex-col gap-px">
{!data || error ? (
<>
<div className="inline-flex h-8 items-center gap-2 rounded-md px-2.5">
<div className="relative h-5 w-5 shrink-0 animate-pulse rounded bg-zinc-800"></div>
<div className="h-3 w-full animate-pulse bg-zinc-800"></div>
<div className="h-3 w-full animate-pulse rounded-sm bg-zinc-800"></div>
</div>
<div className="inline-flex h-8 items-center gap-2 rounded-md px-2.5">
<div className="relative h-5 w-5 shrink-0 animate-pulse rounded bg-zinc-800"></div>
<div className="h-3 w-full animate-pulse bg-zinc-800"></div>
<div className="h-3 w-full animate-pulse rounded-sm bg-zinc-800"></div>
</div>
</>
) : (

View File

@@ -9,7 +9,7 @@ import { DEFAULT_AVATAR, WRITEONLY_RELAYS } from '@stores/constants';
import { dateToUnix } from '@utils/date';
import { useActiveAccount } from '@utils/hooks/useActiveAccount';
import { getChannel, updateChannelMetadata } from '@utils/storage';
import { getChannel } from '@utils/storage';
import { Dialog, Transition } from '@headlessui/react';
import { getEventHash, signEvent } from 'nostr-tools';
@@ -58,15 +58,13 @@ export default function ChannelUpdateModal({ id }: { id: string }) {
created_at: dateToUnix(),
kind: 41,
pubkey: account.pubkey,
tags: [],
tags: [['e', id]],
};
event.id = getEventHash(event);
event.sig = signEvent(event, account.privkey);
// publish channel
pool.publish(event, WRITEONLY_RELAYS);
// update channel metadata in database
updateChannelMetadata(event.id, event.content);
// reset form
reset();
// close modal