From 5f0a0433bd9ed7800ee8260e0baff59843288653 Mon Sep 17 00:00:00 2001 From: MuckT Date: Sat, 10 Feb 2024 16:25:41 -0800 Subject: [PATCH 1/3] chore: update translations --- src/locales/en_US.json | 4 +--- src/locales/hi_IN.json | 14 +++++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/locales/en_US.json b/src/locales/en_US.json index 45e73b69..7eb53ec6 100644 --- a/src/locales/en_US.json +++ b/src/locales/en_US.json @@ -86,9 +86,7 @@ "share_code": "Share the power of the XMTP network with your friends, family and colleagues", "share_link": "Copy your share link", "share_qr_code": "Share QR Code", - "report_bug": "Report a bug", - "allow": "Allow", - "deny": "Deny" + "report_bug": "Report a bug" }, "consent": { "accept": "Accept", diff --git a/src/locales/hi_IN.json b/src/locales/hi_IN.json index c4bd7b71..27aa5766 100644 --- a/src/locales/hi_IN.json +++ b/src/locales/hi_IN.json @@ -62,9 +62,17 @@ "share_code": "XMTP नेटवर्क की शक्ति को अपने मित्रों, परिवार और सहकर्मियों के साथ साझा करें", "share_link": "अपने शेयर लिंक को कॉपी करें", "share_qr_code": "क्यूआर कोड साझा करें", - "report_bug": "बग रिपोर्ट करो", - "allow": "स्वीकार करना", - "deny": "अस्वीकार करना" + "report_bug": "बग रिपोर्ट करो" + }, + "consent": { + "accept": "लेना", + "block": "खंड", + "unblock": "खुलना", + "messages": "संदेशों", + "requests": "अनुरोध", + "blocked": "अवरोधित", + "new_message_request": "नया संदेश अनुरोध", + "new_message_request_description": "आपने पहले कभी इस वॉलेट पते से बातचीत नहीं की है। आप क्या करना चाहेंगे?" }, "aria_labels": { "address_input": "पता इनपुट", From 7589d134d07146d4276711794f55ad2955041daf Mon Sep 17 00:00:00 2001 From: MuckT Date: Sat, 10 Feb 2024 16:35:25 -0800 Subject: [PATCH 2/3] feat: use block and unblock in address input for clarity --- .../components/AddressInput/AddressInput.tsx | 33 +++++++++++++++---- src/controllers/AddressInputController.tsx | 13 ++++++-- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/component-library/components/AddressInput/AddressInput.tsx b/src/component-library/components/AddressInput/AddressInput.tsx index 5e3076f9..ce2d5dfb 100644 --- a/src/component-library/components/AddressInput/AddressInput.tsx +++ b/src/component-library/components/AddressInput/AddressInput.tsx @@ -1,7 +1,9 @@ import { ChevronLeftIcon, XCircleIcon } from "@heroicons/react/outline"; import { useTranslation } from "react-i18next"; import { Avatar } from "../Avatar/Avatar"; -import { classNames } from "../../../helpers"; +import { TAILWIND_MD_BREAKPOINT, classNames } from "../../../helpers"; +import { ActiveTab } from "../../../store/xmtp"; +import useWindowSize from "../../../hooks/useWindowSize"; interface AddressInputProps { /** @@ -50,6 +52,10 @@ interface AddressInputProps { * Is there a right icon click event that needs to be handled? */ onRightIconClick?: () => void; + /** + * Currently Active Tab + */ + activeTab: ActiveTab; } export const AddressInput = ({ @@ -61,9 +67,12 @@ export const AddressInput = ({ value, onLeftIconClick, onRightIconClick, + activeTab, }: AddressInputProps) => { const { t } = useTranslation(); const subtextColor = isError ? "text-red-600" : "text-gray-500"; + const [width] = useWindowSize(); + const isMobileView = width <= TAILWIND_MD_BREAKPOINT; return (
- {onRightIconClick && ( - + {onRightIconClick && activeTab === "messages" && ( + + )} + {/* Check for mobile view to avoid having multiple block elements visible on Desktop */} + {isMobileView && onRightIconClick && activeTab === "blocked" && ( + )} ); diff --git a/src/controllers/AddressInputController.tsx b/src/controllers/AddressInputController.tsx index 97e9c141..397945fd 100644 --- a/src/controllers/AddressInputController.tsx +++ b/src/controllers/AddressInputController.tsx @@ -22,9 +22,10 @@ export const AddressInputController = () => { const setConversationTopic = useXmtpStore((s) => s.setConversationTopic); const changedConsentCount = useXmtpStore((s) => s.changedConsentCount); const setChangedConsentCount = useXmtpStore((s) => s.setChangedConsentCount); + const activeTab = useXmtpStore((s) => s.activeTab); const { getCachedByPeerAddress, getCachedByTopic } = useConversation(); - const { deny } = useConsent(); + const { deny, allow } = useConsent(); // manage address input state useAddressInput(); @@ -105,9 +106,15 @@ export const AddressInputController = () => { setConversationTopic(""); }} onRightIconClick={() => { - void deny([recipientAddress]); - setChangedConsentCount(changedConsentCount + 1); + if (activeTab === "messages") { + void deny([recipientAddress]); + setChangedConsentCount(changedConsentCount + 1); + } else if (activeTab === "blocked") { + void allow([recipientAddress]); + setChangedConsentCount(changedConsentCount + 1); + } }} + activeTab={activeTab} /> ); }; From 06de2e70c0b32ad91eea69ba9b7bf8ea210f871c Mon Sep 17 00:00:00 2001 From: MuckT Date: Sat, 10 Feb 2024 16:41:12 -0800 Subject: [PATCH 3/3] fix: lint errors --- .../components/AddressInput/AddressInput.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/component-library/components/AddressInput/AddressInput.tsx b/src/component-library/components/AddressInput/AddressInput.tsx index ce2d5dfb..ee306ca9 100644 --- a/src/component-library/components/AddressInput/AddressInput.tsx +++ b/src/component-library/components/AddressInput/AddressInput.tsx @@ -1,9 +1,9 @@ -import { ChevronLeftIcon, XCircleIcon } from "@heroicons/react/outline"; +import { ChevronLeftIcon } from "@heroicons/react/outline"; import { useTranslation } from "react-i18next"; -import { Avatar } from "../Avatar/Avatar"; import { TAILWIND_MD_BREAKPOINT, classNames } from "../../../helpers"; -import { ActiveTab } from "../../../store/xmtp"; import useWindowSize from "../../../hooks/useWindowSize"; +import type { ActiveTab } from "../../../store/xmtp"; +import { Avatar } from "../Avatar/Avatar"; interface AddressInputProps { /**