Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated tab switch logic #420

Merged
merged 4 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslation } from "react-i18next";
import type { VirtuosoHandle } from "react-virtuoso";
import { Virtuoso } from "react-virtuoso";
import { useMemo, useRef } from "react";
import { useMemo, useRef, useState } from "react";
import { useConsent } from "@xmtp/react-sdk";
import { useXmtpStore } from "../../../store/xmtp";

Expand Down Expand Up @@ -34,10 +34,10 @@ const BeginningMessage: React.FC = () => {
const AcceptOrDeny = ({ address }: { address: string }) => {
const { t } = useTranslation();
const { allow, deny } = useConsent();
const setActiveTab = useXmtpStore((s) => s.setActiveTab);
const activeTab = useXmtpStore((s) => s.activeTab);
const [modalOpen, setModalOpen] = useState(true);

return activeTab === "requests" ? (
return activeTab === "requests" && modalOpen ? (
<div
className="bg-gray-100 p-4 w-full flex flex-col justify-center items-center text-gray-500 border-2 border-gray-300"
data-testid="accept_or_deny_container">
Expand All @@ -49,7 +49,7 @@ const AcceptOrDeny = ({ address }: { address: string }) => {
className="text-indigo-600 flex w-full justify-center border border-2 border-indigo-600 rounded-md p-2 hover:bg-indigo-600 hover:text-white"
onClick={() => {
void allow([address]);
setActiveTab("messages");
setModalOpen(false);
}}>
{t("consent.accept")}
</button>
Expand All @@ -58,7 +58,7 @@ const AcceptOrDeny = ({ address }: { address: string }) => {
className="text-red-600 flex w-full justify-center border border-2 border-red-600 rounded-md p-2 hover:bg-red-600 hover:text-white"
onClick={() => {
void deny([address]);
setActiveTab("blocked");
setModalOpen(false);
}}>
{t("consent.block")}
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/FullConversationController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const FullConversationController: React.FC<
id="scrollableDiv"
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
tabIndex={0}
className="w-full h-full flex flex-col overflow-auto relative">
className="w-full h-full flex flex-col overflow-auto relative pb-4">
{effect === "SNOW" ? (
<SnowEffect messageId={messageId} key={messageId} />
) : effect === "RAIN" ? (
Expand Down
Loading