wip: tiptap editor

This commit is contained in:
Ren Amamiya
2023-07-21 16:16:41 +07:00
parent 8f4cf7e948
commit 64cd17389d
12 changed files with 1155 additions and 330 deletions

View File

@@ -3,8 +3,7 @@ import { Fragment } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import { Button } from '@shared/button';
import { Post } from '@shared/composer/types/post';
import { User } from '@shared/composer/user';
import { Composer, ComposerUser } from '@shared/composer';
import {
CancelIcon,
ChevronDownIcon,
@@ -17,9 +16,8 @@ import { COMPOSE_SHORTCUT } from '@stores/shortcuts';
import { useAccount } from '@utils/hooks/useAccount';
export function Composer() {
export function ComposerModal() {
const { account } = useAccount();
const [toggle, open] = useComposer((state) => [state.toggleModal, state.open]);
const closeModal = () => {
@@ -60,7 +58,7 @@ export function Composer() {
<Dialog.Panel className="relative h-min w-full max-w-xl rounded-xl border-t border-zinc-800/50 bg-zinc-900">
<div className="flex items-center justify-between px-4 py-4">
<div className="flex items-center gap-2">
<div>{account && <User pubkey={account.pubkey} />}</div>
{account && <ComposerUser pubkey={account.pubkey} />}
<span>
<ChevronRightIcon
width={14}
@@ -83,7 +81,7 @@ export function Composer() {
<CancelIcon width={16} height={16} className="text-zinc-500" />
</div>
</div>
{account && <Post />}
<Composer />
</Dialog.Panel>
</Transition.Child>
</div>