Skip to content

Commit

Permalink
fix: fixing the modal close (#4922)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanahem authored May 17, 2024
1 parent 6825631 commit 4b9b7e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ const FeedEmbed: FC<FeedEmbedProps> = ({
}) => {
const { address } = useAccount();
const { selectedNftOaCurrency } = useNftOaCurrencyStore();
const { selectedQuantity, setShowOpenActionModal, showOpenActionModal } =
useNftOpenActionStore();
const { selectedQuantity, setShowOpenActionModal } = useNftOpenActionStore();

const [nft, setNft] = useState({
chain: og.nft?.chain || null,
Expand Down Expand Up @@ -199,8 +198,20 @@ const FeedEmbed: FC<FeedEmbedProps> = ({
]
});

const actionData = actionDataResponse?.data;
const dataType = actionDataResponse?.type;
const [actionData, setActionData] = useState(actionDataResponse?.data);
const [dataType, setDataType] = useState(actionDataResponse?.type);

useEffect(() => {
if (actionDataResponse?.data) {
setActionData(actionDataResponse?.data);
}
}, [actionDataResponse?.data]);

useEffect(() => {
if (actionDataResponse?.type) {
setDataType(actionDataResponse?.type);
}
}, [actionDataResponse?.type]);

useEffect(() => {
refetch();
Expand Down Expand Up @@ -273,7 +284,7 @@ const FeedEmbed: FC<FeedEmbedProps> = ({
<DecentOpenActionShimmer />
) : null}
</Card>
{Boolean(actionData) && dataType === ActionDataResponseType.FULL ? (
{dataType === ActionDataResponseType.FULL ? (
<DecentOpenActionModule
actionData={actionData as ActionData}
module={module as UnknownOpenActionModuleSettings}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import stopEventPropagation from '@hey/helpers/stopEventPropagation';
import { useNftOpenActionStore } from './FeedEmbed';

const QuantityConfig: FC = () => {
const { selectedQuantity, setSelectedQuantity } = useNftOpenActionStore();
const { selectedQuantity, setSelectedQuantity, setShowOpenActionModal } =
useNftOpenActionStore();

return (
<div className="flex items-center justify-between border-y border-zinc-200 px-5 py-4">
Expand All @@ -17,6 +18,7 @@ const QuantityConfig: FC = () => {
disabled={selectedQuantity === 1}
onClick={(e) => {
stopEventPropagation(e);
setShowOpenActionModal(true);
setSelectedQuantity(selectedQuantity - 1);
}}
>
Expand All @@ -27,6 +29,7 @@ const QuantityConfig: FC = () => {
className="flex size-6 items-center justify-center rounded-full bg-gray-200 disabled:opacity-40"
onClick={(e) => {
stopEventPropagation(e);
setShowOpenActionModal(true);
setSelectedQuantity(selectedQuantity + 1);
}}
>
Expand Down

1 comment on commit 4b9b7e3

@vercel
Copy link

@vercel vercel bot commented on 4b9b7e3 May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web – ./apps/web

heyxyz.vercel.app
web-git-main-heyxyz.vercel.app
web-heyxyz.vercel.app
hey.xyz

Please sign in to comment.