diff --git a/src/index.css b/src/index.css index a89a9aea..1512f92c 100644 --- a/src/index.css +++ b/src/index.css @@ -15,7 +15,7 @@ button { } .markdown { - @apply prose prose-zinc max-w-none select-text break-words dark:prose-invert prose-p:mb-2 prose-p:mt-0 prose-p:last:mb-0 prose-a:break-words prose-a:font-normal prose-a:leading-tight prose-a:text-fuchsia-400 hover:prose-a:text-fuchsia-500 prose-blockquote:m-0 prose-ol:m-0 prose-ol:mb-1 prose-ul:mb-1 prose-li:leading-tight prose-hr:mx-0 prose-hr:my-2; + @apply prose prose-zinc max-w-none select-text break-words dark:prose-invert prose-p:mb-2 prose-p:mt-0 prose-p:last:mb-0 prose-a:break-all prose-a:font-normal prose-a:leading-tight prose-a:text-fuchsia-400 hover:prose-a:text-fuchsia-500 prose-blockquote:m-0 prose-ol:m-0 prose-ol:mb-1 prose-ul:mb-1 prose-li:leading-tight prose-hr:mx-0 prose-hr:my-2; } /* For Webkit-based browsers (Chrome, Safari and Opera) */ diff --git a/src/shared/composer/types/post.tsx b/src/shared/composer/types/post.tsx index 27d06f65..84820c56 100644 --- a/src/shared/composer/types/post.tsx +++ b/src/shared/composer/types/post.tsx @@ -87,18 +87,10 @@ export function Post() { let tags: string[][] = []; if (reply.id && reply.pubkey) { - if (reply.root && reply.root !== reply.id) { - tags = [ - ['e', reply.id, FULL_RELAYS[0], 'root'], - ['e', reply.root, FULL_RELAYS[0], 'reply'], - ['p', reply.pubkey], - ]; - } else { - tags = [ - ['e', reply.id, FULL_RELAYS[0], 'root'], - ['p', reply.pubkey], - ]; - } + tags = [ + ['e', reply.id, FULL_RELAYS[0], 'reply'], + ['p', reply.pubkey], + ]; } else { tags = []; } diff --git a/src/shared/icons/index.tsx b/src/shared/icons/index.tsx index 3cbb94b8..8227667d 100644 --- a/src/shared/icons/index.tsx +++ b/src/shared/icons/index.tsx @@ -44,4 +44,5 @@ export * from './logout'; export * from './follow'; export * from './unfollow'; export * from './reaction'; +export * from './thread'; // @endindex diff --git a/src/shared/icons/thread.tsx b/src/shared/icons/thread.tsx index 95d8af55..406c90c0 100644 --- a/src/shared/icons/thread.tsx +++ b/src/shared/icons/thread.tsx @@ -11,12 +11,9 @@ export function ThreadIcon(props: JSX.IntrinsicAttributes & SVGProps + fill="currentColor" + d="M12 19.25V20a.75.75 0 00.75-.75H12zm8.5-9a.75.75 0 001.5 0h-1.5zm-.75 3.5a.75.75 0 00-1.5 0h1.5zm-1.5 6.5a.75.75 0 001.5 0h-1.5zm-2.5-4a.75.75 0 000 1.5v-1.5zm6.5 1.5a.75.75 0 000-1.5v1.5zm-18.75.5V5.75H2v12.5h1.5zm8.5.25H3.75V20H12v-1.5zm8.5-12.75v4.5H22v-4.5h-1.5zM3.75 5.5H12V4H3.75v1.5zm8.25 0h8.25V4H12v1.5zm.75 13.75V4.75h-1.5v14.5h1.5zm5.5-5.5V17h1.5v-3.25h-1.5zm0 3.25v3.25h1.5V17h-1.5zm-2.5.75H19v-1.5h-3.25v1.5zm3.25 0h3.25v-1.5H19v1.5zm3-12A1.75 1.75 0 0020.25 4v1.5a.25.25 0 01.25.25H22zm-18.5 0a.25.25 0 01.25-.25V4A1.75 1.75 0 002 5.75h1.5zM2 18.25c0 .966.784 1.75 1.75 1.75v-1.5a.25.25 0 01-.25-.25H2z" + > ); } diff --git a/src/shared/notes/actions.tsx b/src/shared/notes/actions.tsx index 86051ad7..6846de61 100644 --- a/src/shared/notes/actions.tsx +++ b/src/shared/notes/actions.tsx @@ -1,28 +1,47 @@ import * as Tooltip from '@radix-ui/react-tooltip'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { createBlock } from '@libs/storage'; + +import { ThreadIcon } from '@shared/icons'; import { NoteReaction } from '@shared/notes/actions/reaction'; import { NoteReply } from '@shared/notes/actions/reply'; import { NoteRepost } from '@shared/notes/actions/repost'; import { NoteZap } from '@shared/notes/actions/zap'; -export function NoteActions({ - id, - rootID, - eventPubkey, -}: { - id: string; - rootID?: string; - eventPubkey: string; -}) { +export function NoteActions({ id, pubkey }: { id: string; pubkey: string }) { + const queryClient = useQueryClient(); + + const block = useMutation({ + mutationFn: (data: { kind: number; title: string; content: string }) => { + return createBlock(data.kind, data.title, data.content); + }, + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['blocks'] }); + }, + }); + + const openThread = (thread: string) => { + block.mutate({ kind: 2, title: 'Thread', content: thread }); + }; + return ( -
+
+ + - -
+
+
); diff --git a/src/shared/notes/actions/reply.tsx b/src/shared/notes/actions/reply.tsx index 8ab4b1a0..e391849d 100644 --- a/src/shared/notes/actions/reply.tsx +++ b/src/shared/notes/actions/reply.tsx @@ -4,15 +4,7 @@ import { ReplyIcon } from '@shared/icons'; import { useComposer } from '@stores/composer'; -export function NoteReply({ - id, - rootID, - pubkey, -}: { - id: string; - rootID?: string; - pubkey: string; -}) { +export function NoteReply({ id, pubkey }: { id: string; pubkey: string }) { const setReply = useComposer((state) => state.setReply); return ( @@ -20,7 +12,7 @@ export function NoteReply({
diff --git a/src/shared/notes/kinds/repost.tsx b/src/shared/notes/kinds/repost.tsx index 7ab7ff16..15f9759f 100644 --- a/src/shared/notes/kinds/repost.tsx +++ b/src/shared/notes/kinds/repost.tsx @@ -43,11 +43,7 @@ export function Repost({ event }: { event: LumeEvent }) {
- +
diff --git a/src/shared/notes/kinds/sub.tsx b/src/shared/notes/kinds/sub.tsx index 23b5e3b1..b9ff380e 100644 --- a/src/shared/notes/kinds/sub.tsx +++ b/src/shared/notes/kinds/sub.tsx @@ -31,7 +31,7 @@ export function SubNote({ id }: { id: string }) {
- +
diff --git a/src/shared/notes/kinds/thread.tsx b/src/shared/notes/kinds/thread.tsx index 5a6fd43a..bb30576d 100644 --- a/src/shared/notes/kinds/thread.tsx +++ b/src/shared/notes/kinds/thread.tsx @@ -28,11 +28,7 @@ export function NoteThread({
- +
diff --git a/src/shared/notes/kinds/unsupport.tsx b/src/shared/notes/kinds/unsupport.tsx index 1d9cec68..8566bb6d 100644 --- a/src/shared/notes/kinds/unsupport.tsx +++ b/src/shared/notes/kinds/unsupport.tsx @@ -25,11 +25,7 @@ export function NoteKindUnsupport({ event }: { event: LumeEvent }) {

{event.content.toString()}

- + diff --git a/src/shared/notes/metadata.tsx b/src/shared/notes/metadata.tsx index b56de16d..5fa0a850 100644 --- a/src/shared/notes/metadata.tsx +++ b/src/shared/notes/metadata.tsx @@ -63,7 +63,7 @@ export function NoteMetadata({ id }: { id: string }) { ); const block = useMutation({ - mutationFn: (data: any) => { + mutationFn: (data: { kind: number; title: string; content: string }) => { return createBlock(data.kind, data.title, data.content); }, onSuccess: () => { diff --git a/src/shared/user.tsx b/src/shared/user.tsx index 37dcbb83..b6e164b7 100644 --- a/src/shared/user.tsx +++ b/src/shared/user.tsx @@ -2,6 +2,7 @@ import { Popover, Transition } from '@headlessui/react'; import { Fragment } from 'react'; import { Link } from 'react-router-dom'; +import { ChevronDownIcon, VerticalDotsIcon } from '@shared/icons'; import { Image } from '@shared/image'; import { DEFAULT_AVATAR } from '@stores/constants'; @@ -79,7 +80,15 @@ export function User({ user?.display_name || shortenKey(pubkey)} - {createdAt} +
+ {createdAt} + +
void; - setReply: (id: string, root: string, pubkey: string) => void; + setReply: (id: string, pubkey: string) => void; clearReply: () => void; } @@ -14,11 +14,11 @@ export const useComposer = create((set) => ({ toggleModal: (status: boolean) => { set({ open: status }); }, - setReply: (id: string, root: string, pubkey: string) => { - set({ reply: { id: id, root: root, pubkey: pubkey } }); + setReply: (id: string, pubkey: string) => { + set({ reply: { id: id, pubkey: pubkey } }); set({ open: true }); }, clearReply: () => { - set({ reply: { id: null, root: null, pubkey: null } }); + set({ reply: { id: null, pubkey: null } }); }, }));