mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-19 19:46:34 +00:00
removed markdown editor
This commit is contained in:
parent
0c659b0902
commit
5d89a66ee0
@ -25,8 +25,6 @@
|
|||||||
"@tanstack/react-query": "^4.28.0",
|
"@tanstack/react-query": "^4.28.0",
|
||||||
"@tanstack/react-virtual": "3.0.0-beta.54",
|
"@tanstack/react-virtual": "3.0.0-beta.54",
|
||||||
"@tauri-apps/api": "^1.2.0",
|
"@tauri-apps/api": "^1.2.0",
|
||||||
"@uiw/react-markdown-preview": "^4.1.10",
|
|
||||||
"@uiw/react-md-editor": "^3.20.5",
|
|
||||||
"boring-avatars": "^1.7.0",
|
"boring-avatars": "^1.7.0",
|
||||||
"dayjs": "^1.11.7",
|
"dayjs": "^1.11.7",
|
||||||
"destr": "^1.2.2",
|
"destr": "^1.2.2",
|
||||||
|
1175
pnpm-lock.yaml
1175
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -7,20 +7,11 @@ import { relaysAtom } from '@stores/relays';
|
|||||||
|
|
||||||
import { dateToUnix } from '@utils/getDate';
|
import { dateToUnix } from '@utils/getDate';
|
||||||
|
|
||||||
import ImageIcon from '@assets/icons/image';
|
import { ImageIcon, ResetIcon } from '@radix-ui/react-icons';
|
||||||
|
|
||||||
import * as Dialog from '@radix-ui/react-dialog';
|
|
||||||
import { SizeIcon } from '@radix-ui/react-icons';
|
|
||||||
import * as commands from '@uiw/react-md-editor/lib/commands';
|
|
||||||
import { useAtom, useAtomValue } from 'jotai';
|
import { useAtom, useAtomValue } from 'jotai';
|
||||||
import { useResetAtom } from 'jotai/utils';
|
import { useResetAtom } from 'jotai/utils';
|
||||||
import dynamic from 'next/dynamic';
|
|
||||||
import { getEventHash, signEvent } from 'nostr-tools';
|
import { getEventHash, signEvent } from 'nostr-tools';
|
||||||
import { useContext, useState } from 'react';
|
import { useContext } from 'react';
|
||||||
|
|
||||||
const MDEditor = dynamic(() => import('@uiw/react-md-editor').then((mod) => mod.default), {
|
|
||||||
ssr: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default function FormBase() {
|
export default function FormBase() {
|
||||||
const pool: any = useContext(RelayContext);
|
const pool: any = useContext(RelayContext);
|
||||||
@ -30,8 +21,6 @@ export default function FormBase() {
|
|||||||
const [value, setValue] = useAtom(noteContentAtom);
|
const [value, setValue] = useAtom(noteContentAtom);
|
||||||
const resetValue = useResetAtom(noteContentAtom);
|
const resetValue = useResetAtom(noteContentAtom);
|
||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
|
|
||||||
const pubkey = activeAccount.id;
|
const pubkey = activeAccount.id;
|
||||||
const privkey = activeAccount.privkey;
|
const privkey = activeAccount.privkey;
|
||||||
|
|
||||||
@ -50,24 +39,7 @@ export default function FormBase() {
|
|||||||
resetValue;
|
resetValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
const postButton = {
|
|
||||||
name: 'post',
|
|
||||||
keyCommand: 'post',
|
|
||||||
buttonProps: { className: 'cta-btn', 'aria-label': 'Post a message' },
|
|
||||||
icon: (
|
|
||||||
<div className="inline-flex h-8 w-16 items-center justify-center rounded-md bg-fuchsia-500 px-4 text-sm font-medium shadow-md shadow-fuchsia-900/50 hover:bg-fuchsia-600 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50">
|
|
||||||
<span className="text-white drop-shadow">Send</span>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
execute: (state: { text: any }) => {
|
|
||||||
if (state.text > 0) {
|
|
||||||
submitEvent();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog.Root open={open} onOpenChange={setOpen}>
|
|
||||||
<div className="p-3">
|
<div className="p-3">
|
||||||
<div className="relative h-32 w-full shrink-0 overflow-hidden before:pointer-events-none before:absolute before:-inset-1 before:rounded-[11px] before:border before:border-blue-500 before:opacity-0 before:ring-2 before:ring-blue-500/20 before:transition after:pointer-events-none after:absolute after:inset-px after:rounded-[7px] after:shadow-highlight after:shadow-white/5 after:transition focus-within:before:opacity-100 focus-within:after:shadow-blue-500/100 dark:focus-within:after:shadow-blue-500/20">
|
<div className="relative h-32 w-full shrink-0 overflow-hidden before:pointer-events-none before:absolute before:-inset-1 before:rounded-[11px] before:border before:border-blue-500 before:opacity-0 before:ring-2 before:ring-blue-500/20 before:transition after:pointer-events-none after:absolute after:inset-px after:rounded-[7px] after:shadow-highlight after:shadow-white/5 after:transition focus-within:before:opacity-100 focus-within:after:shadow-blue-500/100 dark:focus-within:after:shadow-blue-500/20">
|
||||||
<div>
|
<div>
|
||||||
@ -82,11 +54,12 @@ export default function FormBase() {
|
|||||||
<div className="absolute bottom-2 w-full px-2">
|
<div className="absolute bottom-2 w-full px-2">
|
||||||
<div className="flex w-full items-center justify-between bg-zinc-800">
|
<div className="flex w-full items-center justify-between bg-zinc-800">
|
||||||
<div className="flex items-center gap-2 divide-x divide-zinc-700">
|
<div className="flex items-center gap-2 divide-x divide-zinc-700">
|
||||||
<Dialog.Trigger asChild>
|
<button
|
||||||
<span className="inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md hover:bg-zinc-700">
|
onClick={resetValue}
|
||||||
<SizeIcon className="h-4 w-4 text-zinc-400" />
|
className="inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md hover:bg-zinc-700"
|
||||||
</span>
|
>
|
||||||
</Dialog.Trigger>
|
<ResetIcon className="h-4 w-4 text-zinc-400" />
|
||||||
|
</button>
|
||||||
<div className="flex items-center gap-2 pl-2">
|
<div className="flex items-center gap-2 pl-2">
|
||||||
<EmojiPicker />
|
<EmojiPicker />
|
||||||
<span className="inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md hover:bg-zinc-700">
|
<span className="inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md hover:bg-zinc-700">
|
||||||
@ -107,46 +80,5 @@ export default function FormBase() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Dialog.Portal>
|
|
||||||
<Dialog.Overlay className="fixed inset-0 bg-black bg-opacity-30 backdrop-blur-sm data-[state=open]:animate-overlayShow" />
|
|
||||||
<Dialog.Content className="fixed inset-0 overflow-y-auto">
|
|
||||||
<div className="flex min-h-full items-center justify-center p-4 text-center">
|
|
||||||
<div className="relative w-full max-w-2xl transform overflow-hidden rounded-lg text-zinc-100 shadow-modal transition-all">
|
|
||||||
<div className="absolute top-0 left-0 h-full w-full bg-black bg-opacity-20 backdrop-blur-lg"></div>
|
|
||||||
<div className="absolute bottom-0 left-0 h-24 w-full border-t border-white/10 bg-zinc-900"></div>
|
|
||||||
<div className="relative z-10 px-4 pt-4 pb-2">
|
|
||||||
<MDEditor
|
|
||||||
value={value}
|
|
||||||
preview={'edit'}
|
|
||||||
height={200}
|
|
||||||
minHeight={200}
|
|
||||||
visibleDragbar={false}
|
|
||||||
highlightEnable={false}
|
|
||||||
defaultTabEnable={true}
|
|
||||||
autoFocus={true}
|
|
||||||
commands={[
|
|
||||||
commands.bold,
|
|
||||||
commands.italic,
|
|
||||||
commands.strikethrough,
|
|
||||||
commands.divider,
|
|
||||||
commands.checkedListCommand,
|
|
||||||
commands.unorderedListCommand,
|
|
||||||
commands.orderedListCommand,
|
|
||||||
commands.divider,
|
|
||||||
commands.link,
|
|
||||||
commands.image,
|
|
||||||
]}
|
|
||||||
extraCommands={[postButton]}
|
|
||||||
textareaProps={{
|
|
||||||
placeholder: "What's your thought?",
|
|
||||||
}}
|
|
||||||
onChange={(val) => setValue(val)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Dialog.Content>
|
|
||||||
</Dialog.Portal>
|
|
||||||
</Dialog.Root>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,15 @@ import { relaysAtom } from '@stores/relays';
|
|||||||
|
|
||||||
import { dateToUnix } from '@utils/getDate';
|
import { dateToUnix } from '@utils/getDate';
|
||||||
|
|
||||||
|
import EmojiPicker from '@emoji-mart/react';
|
||||||
|
import { ImageIcon } from '@radix-ui/react-icons';
|
||||||
import destr from 'destr';
|
import destr from 'destr';
|
||||||
import { useAtom, useAtomValue } from 'jotai';
|
import { useAtom, useAtomValue } from 'jotai';
|
||||||
import { useResetAtom } from 'jotai/utils';
|
import { useResetAtom } from 'jotai/utils';
|
||||||
import { getEventHash, signEvent } from 'nostr-tools';
|
import { getEventHash, signEvent } from 'nostr-tools';
|
||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
|
|
||||||
export default function FormComment({ eventID }: { eventID: string }) {
|
export default function FormComment({ eventID }: { eventID: any }) {
|
||||||
const pool: any = useContext(RelayContext);
|
const pool: any = useContext(RelayContext);
|
||||||
|
|
||||||
const relays = useAtomValue(relaysAtom);
|
const relays = useAtomValue(relaysAtom);
|
||||||
@ -39,7 +41,7 @@ export default function FormComment({ eventID }: { eventID: string }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-3">
|
<div className="px-5 py-3">
|
||||||
<div className="flex gap-1">
|
<div className="flex gap-1">
|
||||||
<div>
|
<div>
|
||||||
<div className="relative h-11 w-11 shrink-0 overflow-hidden rounded-md border border-white/10">
|
<div className="relative h-11 w-11 shrink-0 overflow-hidden rounded-md border border-white/10">
|
||||||
@ -63,42 +65,7 @@ export default function FormComment({ eventID }: { eventID: string }) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="absolute bottom-2 w-full px-2">
|
<div className="absolute bottom-2 w-full px-2">
|
||||||
<div className="flex w-full items-center justify-between bg-zinc-800">
|
<div className="flex w-full items-center justify-between bg-zinc-800">
|
||||||
<div className="flex items-center gap-2 divide-x divide-zinc-700">
|
<div className="flex items-center gap-2 divide-x divide-zinc-700"></div>
|
||||||
<div className="flex items-center gap-2 pl-2">
|
|
||||||
<span className="inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md hover:bg-zinc-700">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
strokeWidth={1.5}
|
|
||||||
stroke="currentColor"
|
|
||||||
className="h-4 w-4 text-zinc-400"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
d="M15.182 15.182a4.5 4.5 0 01-6.364 0M21 12a9 9 0 11-18 0 9 9 0 0118 0zM9.75 9.75c0 .414-.168.75-.375.75S9 10.164 9 9.75 9.168 9 9.375 9s.375.336.375.75zm-.375 0h.008v.015h-.008V9.75zm5.625 0c0 .414-.168.75-.375.75s-.375-.336-.375-.75.168-.75.375-.75.375.336.375.75zm-.375 0h.008v.015h-.008V9.75z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
<span className="inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md hover:bg-zinc-700">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
strokeWidth={1.5}
|
|
||||||
stroke="currentColor"
|
|
||||||
className="h-4 w-4 text-zinc-400"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<button
|
<button
|
||||||
onClick={() => submitEvent()}
|
onClick={() => submitEvent()}
|
||||||
|
@ -14,7 +14,7 @@ export default function EmojiPicker() {
|
|||||||
<Popover.Root>
|
<Popover.Root>
|
||||||
<Popover.Trigger asChild>
|
<Popover.Trigger asChild>
|
||||||
<button className="inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md hover:bg-zinc-700">
|
<button className="inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md hover:bg-zinc-700">
|
||||||
<EmojiIcon className="h-4 w-4 text-zinc-400" />
|
<EmojiIcon className="h-[16.5px] w-[16.5px] text-zinc-400" />
|
||||||
</button>
|
</button>
|
||||||
</Popover.Trigger>
|
</Popover.Trigger>
|
||||||
<Popover.Portal>
|
<Popover.Portal>
|
||||||
|
@ -54,7 +54,7 @@ export const NoteExtend = memo(function NoteExtend({ event }: { event: any }) {
|
|||||||
}, [event.content, event.tags]);
|
}, [event.content, event.tags]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative z-10 flex h-min min-h-min w-full select-text flex-col border-b border-zinc-800 px-3">
|
<div className="relative z-10 flex h-min min-h-min w-full select-text flex-col">
|
||||||
<div className="relative z-10 flex flex-col">
|
<div className="relative z-10 flex flex-col">
|
||||||
<UserLarge pubkey={event.pubkey} time={event.created_at} />
|
<UserLarge pubkey={event.pubkey} time={event.created_at} />
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
|
@ -61,7 +61,7 @@ export default function Page() {
|
|||||||
}, [id, pool, relays]);
|
}, [id, pool, relays]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="scrollbar-hide flex h-full flex-col gap-2 overflow-y-auto py-5">
|
<div className="scrollbar-hide flex h-full flex-col gap-2 overflow-y-auto py-3">
|
||||||
<div className="flex h-min min-h-min w-full select-text flex-col px-3">
|
<div className="flex h-min min-h-min w-full select-text flex-col px-3">
|
||||||
{rootEvent && <NoteExtend event={rootEvent} />}
|
{rootEvent && <NoteExtend event={rootEvent} />}
|
||||||
</div>
|
</div>
|
||||||
@ -69,7 +69,12 @@ export default function Page() {
|
|||||||
<FormComment eventID={id} />
|
<FormComment eventID={id} />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
{comments.length > 0 && comments.map((comment) => <p key={comment.id}>{comment.content}</p>)}
|
{comments.length > 0 &&
|
||||||
|
comments.map((comment) => (
|
||||||
|
<p key={comment.id}>
|
||||||
|
{comment.id}-{comment.content}
|
||||||
|
</p>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import BaseLayout from '@layouts/base';
|
import BaseLayout from '@layouts/base';
|
||||||
import WithSidebarLayout from '@layouts/withSidebar';
|
import WithSidebarLayout from '@layouts/withSidebar';
|
||||||
|
|
||||||
import FormBasic from '@components/form/base';
|
import FormBase from '@components/form/base';
|
||||||
import { NoteBase } from '@components/note/base';
|
import { NoteBase } from '@components/note/base';
|
||||||
import { Placeholder } from '@components/note/placeholder';
|
import { Placeholder } from '@components/note/placeholder';
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ export default function Page() {
|
|||||||
return (
|
return (
|
||||||
<div ref={parentRef} className="scrollbar-hide h-full w-full overflow-y-auto" style={{ contain: 'strict' }}>
|
<div ref={parentRef} className="scrollbar-hide h-full w-full overflow-y-auto" style={{ contain: 'strict' }}>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<FormBasic />
|
<FormBase />
|
||||||
</div>
|
</div>
|
||||||
<Suspense fallback={<Placeholder />}>
|
<Suspense fallback={<Placeholder />}>
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
Reference in New Issue
Block a user