update composer

This commit is contained in:
Ren Amamiya
2023-07-08 15:21:06 +07:00
parent 3752a3ab0f
commit 4747299ade
6 changed files with 54 additions and 68 deletions

View File

@@ -45,7 +45,7 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) {
) : status === 'success' ? (
<>
<User pubkey={data.pubkey} time={data.created_at} size="small" />
<div className="mt-2">
<div>
{data.kind === 1 && <Kind1 content={data.content} truncate={true} />}
{data.kind === 1063 && <Kind1063 metadata={data.tags} />}
{data.kind !== 1 && data.kind !== 1063 && (

View File

@@ -1,8 +1,10 @@
import * as Tooltip from '@radix-ui/react-tooltip';
import { usePublish } from '@libs/ndk';
import { RepostIcon } from '@shared/icons';
import { useComposer } from '@stores/composer';
import { FULL_RELAYS } from '@stores/constants';
import { compactNumber } from '@utils/number';
@@ -15,13 +17,21 @@ export function NoteRepost({
pubkey: string;
reposts: number;
}) {
const setRepost = useComposer((state) => state.setRepost);
const publish = usePublish();
const submit = async () => {
const tags = [
['e', id, FULL_RELAYS[0], 'root'],
['p', pubkey],
];
await publish({ content: '', kind: 6, tags: tags });
};
return (
<Tooltip.Root delayDuration={150}>
<button
type="button"
onClick={() => setRepost(id, pubkey)}
onClick={() => submit()}
className="group group inline-flex h-6 w-20 items-center gap-1.5"
>
<Tooltip.Trigger asChild>