diff --git a/src/component-library/components/FullConversation/AcceptOrDeny.tsx b/src/component-library/components/FullConversation/AcceptOrDeny.tsx new file mode 100644 index 00000000..9aa3acc7 --- /dev/null +++ b/src/component-library/components/FullConversation/AcceptOrDeny.tsx @@ -0,0 +1,45 @@ +import { useTranslation } from "react-i18next"; +import { useState } from "react"; +import { useConsent } from "@xmtp/react-sdk"; +import { useXmtpStore } from "../../../store/xmtp"; + +export const AcceptOrDeny = ({ address }: { address: string }) => { + const { t } = useTranslation(); + const { allow, deny } = useConsent(); + const activeTab = useXmtpStore((s) => s.activeTab); + const changedConsentCount = useXmtpStore((s) => s.changedConsentCount); + const setChangedConsentCount = useXmtpStore((s) => s.setChangedConsentCount); + + const [modalOpen, setModalOpen] = useState(true); + + return activeTab === "requests" && modalOpen ? ( +
+

{t("consent.new_message_request")}

+

{t("consent.new_message_request_description")}

+
+ + +
+
+ ) : null; +}; diff --git a/src/component-library/components/FullConversation/FullConversation.tsx b/src/component-library/components/FullConversation/FullConversation.tsx index 3876988a..f0c9f746 100644 --- a/src/component-library/components/FullConversation/FullConversation.tsx +++ b/src/component-library/components/FullConversation/FullConversation.tsx @@ -1,14 +1,11 @@ import { useTranslation } from "react-i18next"; import type { VirtuosoHandle } from "react-virtuoso"; import { Virtuoso } from "react-virtuoso"; -import { useMemo, useRef, useState } from "react"; -import { useConsent } from "@xmtp/react-sdk"; -import { useXmtpStore } from "../../../store/xmtp"; +import { useMemo, useRef } from "react"; interface FullConversationProps { messages?: Array; isLoading?: boolean; - address: string; } const LoadingMessage: React.FC = () => { @@ -31,51 +28,9 @@ const BeginningMessage: React.FC = () => { ); }; -const AcceptOrDeny = ({ address }: { address: string }) => { - const { t } = useTranslation(); - const { allow, deny } = useConsent(); - const activeTab = useXmtpStore((s) => s.activeTab); - const changedConsentCount = useXmtpStore((s) => s.changedConsentCount); - const setChangedConsentCount = useXmtpStore((s) => s.setChangedConsentCount); - - const [modalOpen, setModalOpen] = useState(true); - - return activeTab === "requests" && modalOpen ? ( -
-

{t("consent.new_message_request")}

-

{t("consent.new_message_request_description")}

-
- - -
-
- ) : null; -}; - export const FullConversation = ({ messages = [], isLoading = false, - address, }: FullConversationProps) => { const virtuosoRef = useRef(null); const filteredMessages = useMemo(() => { @@ -87,9 +42,8 @@ export const FullConversation = ({ ), ...filtered, - , ]; - }, [isLoading, messages, address]); + }, [isLoading, messages]); return ( ) : null} - + + ); };