diff --git a/src/app/channel/components/messageList.tsx b/src/app/channel/components/messageList.tsx index 71e8971b..eb76bf23 100644 --- a/src/app/channel/components/messageList.tsx +++ b/src/app/channel/components/messageList.tsx @@ -9,7 +9,6 @@ export function ChannelMessageList() { const virtuosoRef = useRef(null); const messages = useChannelMessages((state: any) => state.messages); - const sorted = messages; const itemContent: any = useCallback( (index: string | number) => { diff --git a/src/app/channel/components/messages/form.tsx b/src/app/channel/components/messages/form.tsx index 8a3d500b..fa7108c3 100644 --- a/src/app/channel/components/messages/form.tsx +++ b/src/app/channel/components/messages/form.tsx @@ -1,6 +1,5 @@ import UserReply from "@app/channel/components/messages/userReply"; import CancelIcon from "@icons/cancel"; -import { ImagePicker } from "@shared/form/imagePicker"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { useChannelMessages } from "@stores/channels"; @@ -11,7 +10,7 @@ import { useContext, useState } from "react"; export default function ChannelMessageForm({ channelID, -}: { channelID: string | string[] }) { +}: { channelID: string }) { const pool: any = useContext(RelayContext); const account = useActiveAccount((state: any) => state.account); @@ -22,7 +21,7 @@ export default function ChannelMessageForm({ ]); const submitEvent = () => { - let tags: any[][]; + let tags: string[][]; if (replyTo.id !== null) { tags = [ @@ -34,23 +33,21 @@ export default function ChannelMessageForm({ tags = [["e", channelID, "", "root"]]; } - if (account) { - const event: any = { - content: value, - created_at: dateToUnix(), - kind: 42, - pubkey: account.pubkey, - tags: tags, - }; + const event: any = { + content: value, + created_at: dateToUnix(), + kind: 42, + pubkey: account.pubkey, + tags: tags, + }; - event.id = getEventHash(event); - event.sig = getSignature(event, account.privkey); + event.id = getEventHash(event); + event.sig = getSignature(event, account.privkey); - // publish note - pool.publish(event, WRITEONLY_RELAYS); - } else { - console.log("error"); - } + // publish note + pool.publish(event, WRITEONLY_RELAYS); + // reset state + setValue(""); }; const handleEnterPress = (e) => { @@ -68,15 +65,15 @@ export default function ChannelMessageForm({