From 90206d14ab033c3281be75fe0c9b1e878a301b12 Mon Sep 17 00:00:00 2001 From: "focp212@naver.com" Date: Thu, 20 Nov 2025 11:24:40 +0900 Subject: [PATCH] bottomsheet back key --- src/entities/settlement/ui/list-wrap.tsx | 4 ++-- .../transaction/ui/detail/cash-receit-detail.tsx | 13 +++++++------ .../transaction/ui/detail/escrow-detail.tsx | 3 ++- .../transaction/ui/section/amount-info-section.tsx | 3 ++- .../vat-return/ui/detail/tax-invoice-detail.tsx | 11 ++++++----- src/entities/vat-return/ui/list-wrap.tsx | 4 ++-- .../vat-return/ui/section/amount-section.tsx | 3 ++- src/pages/transaction/all-transaction/list-page.tsx | 4 ++-- src/pages/transaction/billing/list-page.tsx | 4 ++-- src/pages/transaction/cash-receipt/list-page.tsx | 4 ++-- src/pages/transaction/escrow/list-page.tsx | 4 ++-- src/shared/model/store.ts | 13 +++++++++++++ src/widgets/sub-layout/index.tsx | 12 ++++++++++-- 13 files changed, 54 insertions(+), 28 deletions(-) diff --git a/src/entities/settlement/ui/list-wrap.tsx b/src/entities/settlement/ui/list-wrap.tsx index 2c8000f..531fdb5 100644 --- a/src/entities/settlement/ui/list-wrap.tsx +++ b/src/entities/settlement/ui/list-wrap.tsx @@ -38,7 +38,7 @@ import { checkGrant } from '@/shared/lib/check-grant'; import { snackBar } from '@/shared/lib'; import { useSettlementsHistoryExcelMutation } from '../api/use-settlements-history-excel-mutation'; import { VatReturnDownloadExcelResponse } from '@/entities/vat-return/model/types'; -import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; +import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; export interface ListWrapProps { startDateFromCalendar?: string; @@ -92,7 +92,7 @@ export const ListWrap = ({ const [detailSettlementId, setDetailSettlementId] = useState(''); const [detailTid, setDetailTid] = useState(''); - const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const [groupDate, setGroupDate] = useState(''); const [groupDateOn, setGroupDateOn] = useState(false); diff --git a/src/entities/transaction/ui/detail/cash-receit-detail.tsx b/src/entities/transaction/ui/detail/cash-receit-detail.tsx index d2fcda4..6d8784c 100644 --- a/src/entities/transaction/ui/detail/cash-receit-detail.tsx +++ b/src/entities/transaction/ui/detail/cash-receit-detail.tsx @@ -26,6 +26,7 @@ import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@ import { FullMenuClose } from '@/entities/common/ui/full-menu-close'; import { checkGrant } from '@/shared/lib/check-grant'; import { showAlert } from '@/widgets/show-alert'; +import { useDownloadBottomSheetOnStore } from '@/shared/model/store'; export interface CashReceiptDetailProps { detailOn: boolean; @@ -49,7 +50,7 @@ export const CashReceiptDetail = ({ const [detailInfo, setDetailInfo] = useState(); const [showAmountInfo, setShowAmountInfo] = useState(false); const [showDetailInfo, setShowDetailInfo] = useState(false); - const [bottomSheetOn, setBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const [purposeType, setPurposeType] = useState(); const [canDownloadReceipt, setCanDownloadReceipt] = useState(false); @@ -65,7 +66,7 @@ export const CashReceiptDetail = ({ }; cashReceiptPurposeUpdate(params).then((rs) => { setPurposeType(rs.afterPurposeType); - setBottomSheetOn(false); + setDownloadBottomSheetOn(false); snackBar('용도 변경을 성공하였습니다.', function(){ reload(); }, 2000); @@ -120,7 +121,7 @@ export const CashReceiptDetail = ({ const onClickToPurposeUpdate = () => { if(checkGrant(menuId, 'W')){ - setBottomSheetOn(true); + setDownloadBottomSheetOn(true); } else{ showAlert(t('common.nopermission')); @@ -196,10 +197,10 @@ export const CashReceiptDetail = ({ } - { bottomSheetOn && + { downloadBottomSheetOn && } diff --git a/src/entities/transaction/ui/detail/escrow-detail.tsx b/src/entities/transaction/ui/detail/escrow-detail.tsx index 8b0e3ef..f9e327f 100644 --- a/src/entities/transaction/ui/detail/escrow-detail.tsx +++ b/src/entities/transaction/ui/detail/escrow-detail.tsx @@ -33,6 +33,7 @@ import { checkGrant } from '@/shared/lib/check-grant'; import { showAlert } from '@/widgets/show-alert'; import { snackBar } from '@/shared/lib'; import { EscrowMailResendBottomSheet } from '../escrow-mail-resend-bottom-sheet'; +import { useDownloadBottomSheetOnStore } from '@/shared/model/store'; export interface EscrowDetailProps { detailOn: boolean; @@ -68,7 +69,7 @@ export const EscrowDetail = ({ const [showSettlementInfo, setShowSettlementInfo] = useState(false); const [showMerchantInfo, setShowMerchantInfo] = useState(false); - const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const [orderNumber, setOrderNumber] = useState(); diff --git a/src/entities/transaction/ui/section/amount-info-section.tsx b/src/entities/transaction/ui/section/amount-info-section.tsx index 51c5324..e090eb2 100644 --- a/src/entities/transaction/ui/section/amount-info-section.tsx +++ b/src/entities/transaction/ui/section/amount-info-section.tsx @@ -10,6 +10,7 @@ import { useState } from 'react'; import { DownloadBottomSheet, DownloadSelectedMode } from '@/entities/common/ui/download-bottom-sheet'; import { CashReceiptSample } from '@/entities/common/ui/cash-receipt-sample'; import { useCashReceiptReceiptSendEmailMutation } from '../../api/use-cash-receipt-receipt-send-email-mutation'; +import { useDownloadBottomSheetOnStore } from '@/shared/model/store'; export const AmountInfoSection = ({ transactionCategory, @@ -25,7 +26,7 @@ export const AmountInfoSection = ({ const { mutateAsync: cashReceiptReceiptDownload } = useCashReceiptReceiptDownloadMutation(); const { mutateAsync: cashReceiptReceiptSendEamil } = useCashReceiptReceiptSendEmailMutation(); - const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const [cashReceiptSampleOn, setCashReceiptSampleOn] = useState(false); const [receiptIssueInfo, setReceiptIssueInfo] = useState({}); diff --git a/src/entities/vat-return/ui/detail/tax-invoice-detail.tsx b/src/entities/vat-return/ui/detail/tax-invoice-detail.tsx index 38454bf..56eec99 100644 --- a/src/entities/vat-return/ui/detail/tax-invoice-detail.tsx +++ b/src/entities/vat-return/ui/detail/tax-invoice-detail.tsx @@ -21,6 +21,7 @@ import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@ import { FullMenuClose } from '@/entities/common/ui/full-menu-close'; import { showAlert } from '@/widgets/show-alert'; import { snackBar } from '@/shared/lib'; +import { useDownloadBottomSheetOnStore } from '@/shared/model/store'; export interface TaxInvoiceDetailProps { detailOn: boolean; @@ -38,7 +39,7 @@ export const TaxInvoiceDetail = ({ const location = useLocation(); const [openAmount, setOpenAmount] = useState(false); - const [bottomSheetOn, setBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const [detail, setDetail] = useState({}); const [breakdown, setBreakdown] = useState>([]); @@ -76,7 +77,7 @@ export const TaxInvoiceDetail = ({ }; const onClickToOpenBottomSheet = () => { - setBottomSheetOn(true); + setDownloadBottomSheetOn(true); }; const onClickToClose = () => { @@ -144,10 +145,10 @@ export const TaxInvoiceDetail = ({ } - { !!bottomSheetOn && + { !!downloadBottomSheetOn && { const [receiptType, setReceiptType] = useState(defaultParams.receiptType); const [targetType, setTargetType] = useState(defaultParams.targetType); - const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const { detailOn, setDetailOn } = useDetailOnStore(); const [detailTaxInvoiceNumber, setDetailTaxInvoiceNumber] = useState(''); diff --git a/src/entities/vat-return/ui/section/amount-section.tsx b/src/entities/vat-return/ui/section/amount-section.tsx index d5622cf..7a2abaf 100644 --- a/src/entities/vat-return/ui/section/amount-section.tsx +++ b/src/entities/vat-return/ui/section/amount-section.tsx @@ -10,6 +10,7 @@ import { useVatReturnTaxInvoiceMutation } from '../../api/use-vat-return-tax-inv import { TaxInvoiceSample } from '@/entities/common/ui/tax-invoice-sample'; import { useVatReturnTaxInvoiceSendEmailMutation } from '../../api/use-vat-return-tax-invoice-send-email-mutation'; import { snackBar } from '@/shared/lib'; +import { useDownloadBottomSheetOnStore } from '@/shared/model/store'; export interface AmountSectionProps { taxInvoiceNumber: string; @@ -22,7 +23,7 @@ export const AmountSection = ({ }: AmountSectionProps) => { const { t, i18n } = useTranslation(); const [isOpen, setIsOpen] = useState(false); - const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const [taxInvoiceSampleOn, setTaxInvoiceSampleOn] = useState(false); diff --git a/src/pages/transaction/all-transaction/list-page.tsx b/src/pages/transaction/all-transaction/list-page.tsx index 62ee838..b8728ea 100644 --- a/src/pages/transaction/all-transaction/list-page.tsx +++ b/src/pages/transaction/all-transaction/list-page.tsx @@ -1,5 +1,5 @@ import moment from 'moment'; -import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; +import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; import { ChangeEvent, useEffect, useState } from 'react'; import { IMAGE_ROOT } from '@/shared/constants/common'; import { PATHS } from '@/shared/constants/paths'; @@ -87,7 +87,7 @@ export const AllTransactionListPage = () => { const [totalCount, setTotalCount] = useState(0); const [totalAmount, setTotalAmount] = useState(0); - const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const { detailOn, setDetailOn } = useDetailOnStore(); const [detailTid, setDetailTid] = useState(''); diff --git a/src/pages/transaction/billing/list-page.tsx b/src/pages/transaction/billing/list-page.tsx index d83a494..2f0f691 100644 --- a/src/pages/transaction/billing/list-page.tsx +++ b/src/pages/transaction/billing/list-page.tsx @@ -1,7 +1,7 @@ import moment from 'moment'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; +import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; import { IMAGE_ROOT } from '@/shared/constants/common'; import { PATHS } from '@/shared/constants/paths'; import { useNavigate } from '@/shared/lib/hooks/use-navigate'; @@ -72,7 +72,7 @@ export const BillingListPage = () => { const [minAmount, setMinAmount] = useState(defaultParams.minAmount); const [maxAmount, setMaxAmount] = useState(defaultParams.maxAmount); - const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const { detailOn, setDetailOn } = useDetailOnStore(); const [detailTid, setDetailTid] = useState(''); diff --git a/src/pages/transaction/cash-receipt/list-page.tsx b/src/pages/transaction/cash-receipt/list-page.tsx index 195a319..dbe7cf9 100644 --- a/src/pages/transaction/cash-receipt/list-page.tsx +++ b/src/pages/transaction/cash-receipt/list-page.tsx @@ -33,7 +33,7 @@ import { useSetFooterMode } from '@/widgets/sub-layout/use-sub-layout'; import { getCashReceiptTransactionTypeBtnGroup } from '@/entities/transaction/model/contant'; -import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; +import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; import { useCashReceiptSummaryMutation } from '@/entities/transaction/api/use-cash-receipt-summary-mutation'; import { DownloadBottomSheet, DownloadSelectedMode } from '@/entities/common/ui/download-bottom-sheet'; import useIntersectionObserver from '@/widgets/intersection-observer'; @@ -78,7 +78,7 @@ export const CashReceiptListPage = () => { const [cancelAmount, setCancelAmount] = useState(0); const [totalCount, setTotalCount] = useState(0); - const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const { detailOn, setDetailOn } = useDetailOnStore(); const [detailTid, setDetailTid] = useState(''); diff --git a/src/pages/transaction/escrow/list-page.tsx b/src/pages/transaction/escrow/list-page.tsx index 140b85a..6ad8553 100644 --- a/src/pages/transaction/escrow/list-page.tsx +++ b/src/pages/transaction/escrow/list-page.tsx @@ -1,7 +1,7 @@ import moment from 'moment'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; +import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store'; import { IMAGE_ROOT } from '@/shared/constants/common'; import { PATHS } from '@/shared/constants/paths'; import { useNavigate } from '@/shared/lib/hooks/use-navigate'; @@ -71,7 +71,7 @@ export const EscrowListPage = () => { const [minAmount, setMinAmount] = useState(); const [maxAmount, setMaxAmount] = useState(); - const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const { detailOn, setDetailOn } = useDetailOnStore(); const [detailTid, setDetailTid] = useState(''); diff --git a/src/shared/model/store.ts b/src/shared/model/store.ts index d41129e..96d6182 100644 --- a/src/shared/model/store.ts +++ b/src/shared/model/store.ts @@ -6,6 +6,10 @@ import { createUserInfoStore, UserInfoState } from '@/entities/user/model/store' import { createBannerInfoStore, BannerInfoState, createCommonStore, CommonState } from '@/entities/common/model/store'; import { StorageKeys } from '@/shared/constants/local-storage'; +export interface DownloadBottomSheetOnStore { + downloadBottomSheetOn: boolean; + setDownloadBottomSheetOn: (downloadBottomSheetOn: boolean) => void; +}; export interface FilterOnStore { filterOn: boolean; setFilterOn: (filterOn: boolean) => void; @@ -38,6 +42,15 @@ export interface MenuIdsStore { deleteMenuId: (menuId: number) => void; }; +export const useDownloadBottomSheetOnStore = create((set) => ({ + downloadBottomSheetOn: false, + setDownloadBottomSheetOn: (downloadBottomSheetOn: boolean) => { + set((state: {downloadBottomSheetOn: boolean}) => ({ + downloadBottomSheetOn: (state.downloadBottomSheetOn = downloadBottomSheetOn) + })); + } +})); + export const useFilterlOnStore = create((set) => ({ filterOn: false, setFilterOn: (filterOn: boolean) => { diff --git a/src/widgets/sub-layout/index.tsx b/src/widgets/sub-layout/index.tsx index c18ba41..28f18bb 100644 --- a/src/widgets/sub-layout/index.tsx +++ b/src/widgets/sub-layout/index.tsx @@ -18,7 +18,7 @@ import { import { useHomeGroupsMutation } from '@/entities/home/api/use-home-groups-mutation'; import { useUserInfo } from '@/entities/user/lib/use-user-info'; import { useAppBridge } from '@/hooks'; -import { useDetailOnStore, useFavoriteEditOnStore, useFilterlOnStore, useMenuOnStore, useStore, useTransactionCancelOnStore, useTransactionCancelPreventBondOnStore } from '@/shared/model/store'; +import { useDetailOnStore, useDownloadBottomSheetOnStore, useFavoriteEditOnStore, useFilterlOnStore, useMenuOnStore, useStore, useTransactionCancelOnStore, useTransactionCancelPreventBondOnStore } from '@/shared/model/store'; import { HomeGroupsParams, HomeGroupsResponse } from '@/entities/home/model/types'; import { BusinessPropertyParams, @@ -38,6 +38,7 @@ import { MenuItems } from '@/entities/common/model/constant'; import { AlarmLinkOptions } from '@/entities/alarm/model/types'; import { AlarmRoutes } from '@/entities/alarm/ui/alarm-routes'; import { useNavigate } from '@/shared/lib/hooks'; +import { PATHS } from '@/shared/constants/paths'; export interface ContextType { setOnBack: (onBack: () => void) => void; @@ -67,7 +68,7 @@ export const SubLayout = () => { updateUserData } = useUserInfo(); - const { reload, navigateBack } = useNavigate(); + const { reload, navigateBack, navigate } = useNavigate(); const { menuOn, setMenuOn } = useMenuOnStore(); const { favoriteEditOn, setFavoriteEditOn } = useFavoriteEditOnStore(); @@ -75,6 +76,7 @@ export const SubLayout = () => { const { transactionCancelOn, setTransactionCancelOn } = useTransactionCancelOnStore(); const { cancelPreventBondOn, setCancelPreventBondOn } = useTransactionCancelPreventBondOnStore(); const { filterOn, setFilterOn } = useFilterlOnStore(); + const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore(); const location = useLocation(); console.log(location) @@ -411,6 +413,9 @@ export const SubLayout = () => { console.log('pathname = [' + pathname + ']'); if(pathname === '/home'){ + } + else if(pathname === '/additionalService/list'){ + navigate(PATHS.home); } else{ if(menuOn){ @@ -423,6 +428,9 @@ export const SubLayout = () => { else if(transactionCancelOn){ setTransactionCancelOn(false); } + else if(downloadBottomSheetOn){ + setDownloadBottomSheetOn(false); + } else if(detailOn){ setDetailOn(false); }