diff --git a/src/components/CreateConvo.tsx b/src/components/CreateConvo.tsx new file mode 100644 index 0000000..b72fb64 --- /dev/null +++ b/src/components/CreateConvo.tsx @@ -0,0 +1,69 @@ +import { Button } from './ui/button'; +import { useState } from 'react'; +import { Dialog, DialogContent, DialogHeader, DialogTrigger } from './ui/dialog'; +import { useTranslation } from 'react-i18next'; +import { MessageCirclePlusIcon } from 'lucide-react'; +import { cn } from '@/lib/utils'; +import { HandleInput } from './ui/HandleInput'; +import { useBlueskyStore } from '@/lib/bluesky/store'; +import { useNavigate } from '@tanstack/react-router'; + +export function CreateConvo() { + const agent = useBlueskyStore((state) => state.agent); + const { t } = useTranslation(['app', 'post']); + const [isOpen, setIsOpen] = useState(false); + const [value, setValue] = useState(''); + const isPending = false; + const navigate = useNavigate(); + + const onClickCancel = () => { + setIsOpen(false); + }; + + return ( + + + + + + + + +
+ { + const proxy = agent.withProxy('bsky_chat', 'did:web:api.bsky.chat'); + const convo = await proxy.api.chat.bsky.convo.getConvoForMembers({ + members: [profile.did], + }); + + navigate({ + to: '/messages/$convoId', + params: { + convoId: convo.data.convo.id, + }, + }); + }} + /> +
+
+
+ ); +} diff --git a/src/lib/bluesky/hooks/useSendMessage.ts b/src/lib/bluesky/hooks/useSendMessage.ts index 09276cb..15b54a5 100644 --- a/src/lib/bluesky/hooks/useSendMessage.ts +++ b/src/lib/bluesky/hooks/useSendMessage.ts @@ -7,7 +7,6 @@ export function useSendMessage({ convoId }: { convoId: string }) { return useMutation({ mutationKey: ['convo', { convoId }], mutationFn: async ({ message }: { message: string }) => { - // @ts-expect-error bsky_chat does in fact work const proxy = agent.withProxy('bsky_chat', 'did:web:api.bsky.chat'); await proxy.api.chat.bsky.convo.sendMessage({ convoId, diff --git a/src/routes/messages/index.lazy.tsx b/src/routes/messages/index.lazy.tsx index b424f19..fd29252 100644 --- a/src/routes/messages/index.lazy.tsx +++ b/src/routes/messages/index.lazy.tsx @@ -12,6 +12,7 @@ import { forwardRef, HtmlHTMLAttributes, Ref } from 'react'; import { Avatar } from '@/components/ui/avatar'; import { Helmet } from 'react-helmet'; import { useTranslation } from 'react-i18next'; +import { CreateConvo } from '@/components/CreateConvo'; function Conversation({ convo }: { convo: BSkyConvo }) { const session = useBlueskyStore((state) => state.session); @@ -73,6 +74,7 @@ function Messages() { }} followOutput /> + );