bottomsheet

This commit is contained in:
focp212@naver.com
2025-11-07 16:23:49 +09:00
parent 0696c42e62
commit 6b6d3cff0e
24 changed files with 185 additions and 124 deletions

View File

@@ -178,13 +178,15 @@ export const FundAccountResultDetail = ({
</div> </div>
</div> </div>
</motion.div> </motion.div>
<EmailBottomSheet { !!emailBottomSheetOn &&
bottomSheetOn={emailBottomSheetOn} <EmailBottomSheet
setBottomSheetOn={setEmailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
imageSave={false} setBottomSheetOn={ setEmailBottomSheetOn }
sendEmail={true} imageMode={ false }
sendRequest={onSendRequest} emailMode={ true }
></EmailBottomSheet> sendRequest={ onSendRequest }
></EmailBottomSheet>
}
</> </>
); );
}; };

View File

@@ -398,13 +398,15 @@ export const FundAccountResultListWrap = () => {
mid={ detailMid } mid={ detailMid }
tid={ detailTid } tid={ detailTid }
></FundAccountResultDetail> ></FundAccountResultDetail>
<EmailBottomSheet { !!emailBottomSheetOn &&
bottomSheetOn={emailBottomSheetOn} <EmailBottomSheet
setBottomSheetOn={setEmailBottomSheetOn} bottomSheetOn={emailBottomSheetOn}
imageSave={false} setBottomSheetOn={setEmailBottomSheetOn}
sendEmail={true} imageMode={false}
sendRequest={onSendRequest} emailMode={true}
></EmailBottomSheet> sendRequest={onSendRequest}
></EmailBottomSheet>
}
</> </>
); );
}; };

View File

@@ -364,13 +364,15 @@ export const FundAccountTransferListWrap = () => {
setDetailOn={ setDetailOn } setDetailOn={ setDetailOn }
seq={ detailSeq } seq={ detailSeq }
></FundAccountTransferDetail> ></FundAccountTransferDetail>
<EmailBottomSheet { emailBottomSheetOn &&
bottomSheetOn={emailBottomSheetOn} <EmailBottomSheet
setBottomSheetOn={setEmailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
imageSave={false} setBottomSheetOn={ setEmailBottomSheetOn }
sendEmail={true} imageMode={ false }
sendRequest={onSendRequest} emailMode={ true }
/> sendRequest={ onSendRequest }
/>
}
</> </>
); );
}; };

View File

@@ -310,13 +310,15 @@ export const LinkPaymentHistoryWrap = () => {
requestId={detailRequestId} requestId={detailRequestId}
subReqId={detailSubReqId} subReqId={detailSubReqId}
></LinkPaymentHistoryDetail> ></LinkPaymentHistoryDetail>
<EmailBottomSheet { emailBottomSheetOn &&
bottomSheetOn={emailBottomSheetOn} <EmailBottomSheet
setBottomSheetOn={setEmailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
imageSave={false} setBottomSheetOn={ setEmailBottomSheetOn }
sendEmail={true} imageMode={ false }
sendRequest={onSendRequest} emailMode={ true }
></EmailBottomSheet> sendRequest={ onSendRequest }
></EmailBottomSheet>
}
</> </>
); );
} }

View File

@@ -278,13 +278,15 @@ export const LinkPaymentWaitSendWrap = () => {
mid={ detailMid } mid={ detailMid }
requestId={ detailRequestId } requestId={ detailRequestId }
></LinkPaymentWaitDetail> ></LinkPaymentWaitDetail>
<EmailBottomSheet { !!emailBottomSheetOn &&
bottomSheetOn={emailBottomSheetOn} <EmailBottomSheet
setBottomSheetOn={setEmailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
imageSave={false} setBottomSheetOn={ setEmailBottomSheetOn }
sendEmail={true} imageMode={ false }
sendRequest={onSendRequest} emailMode={ true }
></EmailBottomSheet> sendRequest={ onSendRequest }
></EmailBottomSheet>
}
</> </>
); );
} }

View File

@@ -197,13 +197,15 @@ export const PayoutDetail = ({
setBottomSheetOn={setDownloadTypeBottomSheetOn} setBottomSheetOn={setDownloadTypeBottomSheetOn}
onSelectType={onSelectDownloadType} onSelectType={onSelectDownloadType}
/> />
<EmailBottomSheet { !!emailBottomSheetOn &&
bottomSheetOn={emailBottomSheetOn} <EmailBottomSheet
setBottomSheetOn={setEmailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
imageSave={false} setBottomSheetOn={ setEmailBottomSheetOn }
sendEmail={true} imageMode={ false }
sendRequest={onSendRequest} emailMode={ true }
/> sendRequest={ onSendRequest }
/>
}
</motion.div> </motion.div>
</> </>
); );

View File

@@ -2,7 +2,7 @@ import { BottomSheetMotionDuration, BottomSheetMotionVaiants } from '@/entities/
import { IMAGE_ROOT } from '@/shared/constants/common'; import { IMAGE_ROOT } from '@/shared/constants/common';
import { useStore } from '@/shared/model/store'; import { useStore } from '@/shared/model/store';
import { motion } from 'framer-motion'; import { motion } from 'framer-motion';
import { ChangeEvent, useState } from 'react'; import { ChangeEvent, useEffect, useState } from 'react';
import { toPng } from 'html-to-image'; import { toPng } from 'html-to-image';
import { snackBar } from '@/shared/lib'; import { snackBar } from '@/shared/lib';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@@ -10,22 +10,32 @@ import { useTranslation } from 'react-i18next';
export interface EmailBottomSheetProps { export interface EmailBottomSheetProps {
bottomSheetOn: boolean; bottomSheetOn: boolean;
setBottomSheetOn: (bottomSheetOn: boolean) => void; setBottomSheetOn: (bottomSheetOn: boolean) => void;
imageSave: boolean; imageMode: boolean;
sendEmail: boolean; emailMode: boolean;
sendRequest: (email?: string) => void; sendRequest: (email?: string) => void;
}; };
export enum EmailBottomSheetSelectedMode {
IMAGE = 'IMAGE',
EMAIL = 'EMAIL'
};
export const EmailBottomSheet = ({ export const EmailBottomSheet = ({
bottomSheetOn, bottomSheetOn,
setBottomSheetOn, setBottomSheetOn,
imageSave, imageMode,
sendEmail, emailMode,
sendRequest sendRequest
}: EmailBottomSheetProps) => { }: EmailBottomSheetProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const optionsEmails = useStore.getState().UserStore.selectOptionsEmails; const optionsEmails = useStore.getState().UserStore.selectOptionsEmails;
const email = useStore.getState().UserStore.email; const email = useStore.getState().UserStore.email;
const [userEmail, setUserEmail] = useState<string>(email); const [userEmail, setUserEmail] = useState<string>(email);
const [sheetImageMode, setSheetImageMode] = useState<boolean>(imageMode);
const [sheetEmailMode, setSheetEmailMode] = useState<boolean>(emailMode);
const [selectedMode, setSelectedMode] = useState<EmailBottomSheetSelectedMode | undefined>();
const onClickToClose = () => { const onClickToClose = () => {
setBottomSheetOn(false); setBottomSheetOn(false);
}; };
@@ -48,11 +58,23 @@ export const EmailBottomSheet = ({
}); });
}; };
const onDownloadImage = () => { const onDownloadImage = () => {
downloadImage(); // downloadImage();
setTimeout(() => { setTimeout(() => {
onClickToClose(); onClickToClose();
}, 2000); }, 2000);
}; };
useEffect(() => {
setSheetImageMode(imageMode);
setSheetEmailMode(emailMode);
if(imageMode && !emailMode){
setSelectedMode(EmailBottomSheetSelectedMode.IMAGE);
}
else if(!imageMode && emailMode){
setSelectedMode(EmailBottomSheetSelectedMode.EMAIL);
}
}, [imageMode, emailMode]);
return ( return (
<> <>
@@ -84,7 +106,7 @@ export const EmailBottomSheet = ({
<div className="bottomsheet-content"> <div className="bottomsheet-content">
<div className="email-section"> <div className="email-section">
{ !!imageSave && { !!sheetImageMode &&
<div <div
className="email-label mb-10" className="email-label mb-10"
onClick={ onDownloadImage } onClick={ onDownloadImage }
@@ -99,7 +121,7 @@ export const EmailBottomSheet = ({
<span className="label-text">{t('common.imageSave')}</span> <span className="label-text">{t('common.imageSave')}</span>
</div> </div>
} }
{ !!sendEmail && { !!sheetEmailMode &&
<> <>
<div className="email-label"> <div className="email-label">
<div className="mail-icon"> <div className="mail-icon">
@@ -111,7 +133,9 @@ export const EmailBottomSheet = ({
</div> </div>
<span className="label-text">{t('common.receiveByEmail')}</span> <span className="label-text">{t('common.receiveByEmail')}</span>
</div> </div>
{ optionsEmails && optionsEmails.length > 0 && { selectedMode === EmailBottomSheetSelectedMode.EMAIL &&
optionsEmails &&
optionsEmails.length > 0 &&
<div className="email-select"> <div className="email-select">
<div className="select-wrapper"> <div className="select-wrapper">
<select <select
@@ -130,7 +154,8 @@ export const EmailBottomSheet = ({
</div> </div>
</div> </div>
} }
{ (!optionsEmails || optionsEmails.length === 0) && { selectedMode === EmailBottomSheetSelectedMode.EMAIL &&
(!optionsEmails || optionsEmails.length === 0) &&
<div className="error-message"> <div className="error-message">
<p> .<br /> .</p> <p> .<br /> .</p>
</div> </div>

View File

@@ -532,8 +532,8 @@ export const ListWrap = ({
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={ emailBottomSheetOn } bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={ setEmailBottomSheetOn } setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={ false } imageMode={ false }
sendEmail={ true } emailMode={ true }
sendRequest={ onRequestDownloadExcel } sendRequest={ onRequestDownloadExcel }
></EmailBottomSheet> ></EmailBottomSheet>
} }

View File

@@ -231,13 +231,15 @@ export const EscrowDetail = ({
> </button> > </button>
</div> </div>
</motion.div> </motion.div>
<EmailBottomSheet { !!bottomSheetOn &&
setBottomSheetOn={ setBottomSheetOn } <EmailBottomSheet
bottomSheetOn={ bottomSheetOn } setBottomSheetOn={ setBottomSheetOn }
imageSave={ false } bottomSheetOn={ bottomSheetOn }
sendEmail={ true } imageMode={ false }
sendRequest={ callMailResend } emailMode={ true }
></EmailBottomSheet> sendRequest={ callMailResend }
></EmailBottomSheet>
}
</> </>
); );
}; };

View File

@@ -7,6 +7,8 @@ import 'react-slidedown/lib/slidedown.css';
import { showAlert } from '@/widgets/show-alert'; import { showAlert } from '@/widgets/show-alert';
import { snackBar } from '@/shared/lib'; import { snackBar } from '@/shared/lib';
import { useCashReceiptReceiptDownloadMutation } from '../../api/use-cash-receipt-receipt-download-mutation'; import { useCashReceiptReceiptDownloadMutation } from '../../api/use-cash-receipt-receipt-download-mutation';
import { useState } from 'react';
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
export const AmountInfoSection = ({ export const AmountInfoSection = ({
transactionCategory, transactionCategory,
@@ -20,7 +22,7 @@ export const AmountInfoSection = ({
const { t } = useTranslation(); const { t } = useTranslation();
const { mutateAsync: cashReceiptReceiptDownload } = useCashReceiptReceiptDownloadMutation(); const { mutateAsync: cashReceiptReceiptDownload } = useCashReceiptReceiptDownloadMutation();
const [emailBottomSheetOn, setEmailBottomSheetOn] = useState<boolean>(false);
let newAmountInfo: Record<string, any> | undefined = amountInfo; let newAmountInfo: Record<string, any> | undefined = amountInfo;
const subItems: Record<string, Record<string, string>> = { const subItems: Record<string, Record<string, string>> = {
mid: {name: t('transaction.fields.mid'), type: 'string'}, mid: {name: t('transaction.fields.mid'), type: 'string'},
@@ -184,7 +186,15 @@ export const AmountInfoSection = ({
} }
}; };
const onClickToDownload = () => { const onClickToOpenDownloadBottomSheet = () => {
setEmailBottomSheetOn(true);
};
const onSendRequest = (email?: string) => {
};
const onRequestToDownload = () => {
if(!!tid){ if(!!tid){
let params: CashReceiptReceiptDownloadParams = { let params: CashReceiptReceiptDownloadParams = {
tid: tid tid: tid
@@ -395,15 +405,22 @@ export const AmountInfoSection = ({
<div className="txn-doc"> <div className="txn-doc">
{ {
(transactionCategory === TransactionCategory.CashReceipt) && (transactionCategory === TransactionCategory.CashReceipt) &&
!!canDownloadReceipt &&
<button <button
className="doc-btn" className="doc-btn"
type="button" type="button"
onClick={ () => onClickToDownload() } onClick={ () => onClickToOpenDownloadBottomSheet() }
>{t('transaction.fields.transactionConfirmation')}</button> >{t('transaction.fields.transactionConfirmation')}</button>
} }
</div> </div>
</div> </div>
<EmailBottomSheet
bottomSheetOn={emailBottomSheetOn}
setBottomSheetOn={setEmailBottomSheetOn}
imageMode={true}
emailMode={true}
sendRequest={onSendRequest}
/>
</> </>
); );
}; };

View File

@@ -251,8 +251,8 @@ export const ListWrap = () => {
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={ emailBottomSheetOn } bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={ setEmailBottomSheetOn } setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={ false } imageMode={ false }
sendEmail={ true } emailMode={ true }
sendRequest={ onRequestDownloadExcel } sendRequest={ onRequestDownloadExcel }
></EmailBottomSheet> ></EmailBottomSheet>
} }

View File

@@ -89,8 +89,8 @@ export const AmountSection = ({
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={ downloadBottomSheetOn } bottomSheetOn={ downloadBottomSheetOn }
setBottomSheetOn={ setDownloadBottomSheetOn } setBottomSheetOn={ setDownloadBottomSheetOn }
imageSave={ true } imageMode={ true }
sendEmail={ true } emailMode={ true }
sendRequest={ onRequestDownload } sendRequest={ onRequestDownload }
></EmailBottomSheet> ></EmailBottomSheet>
} }

View File

@@ -289,11 +289,11 @@ export const AccountHolderAuthPage = () => {
tid={detailTid} tid={detailTid}
></AccountHolderAuthDetail> ></AccountHolderAuthDetail>
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={emailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={setEmailBottomSheetOn} setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={false} imageMode={ false }
sendEmail={true} emailMode={ true }
sendRequest={onSendRequest} sendRequest={ onSendRequest }
></EmailBottomSheet> ></EmailBottomSheet>
</> </>
); );

View File

@@ -306,12 +306,12 @@ export const AccountHolderSearchPage = () => {
tid={detailTid} tid={detailTid}
></AccountHolderSearchDetail> ></AccountHolderSearchDetail>
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={emailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={setEmailBottomSheetOn} setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={false} imageMode={ false }
sendEmail={true} emailMode={ true }
sendRequest={onSendRequest} sendRequest={ onSendRequest }
/> ></EmailBottomSheet>
</> </>
); );
}; };

View File

@@ -357,13 +357,12 @@ export const AlimtalkListPage = () => {
seq={ detailSeq } seq={ detailSeq }
></AlimtalkDetail> ></AlimtalkDetail>
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={emailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={setEmailBottomSheetOn} setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={false} imageMode={ false }
sendEmail={true} emailMode={ true }
sendRequest={onSendRequest} sendRequest={onSendRequest}
> ></EmailBottomSheet>
</EmailBottomSheet>
</> </>
); );
}; };

View File

@@ -324,10 +324,10 @@ export const ArsListPage = () => {
tid={detailTid} tid={detailTid}
></ArsDetail> ></ArsDetail>
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={emailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={setEmailBottomSheetOn} setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={false} imageMode={ false }
sendEmail={true} emailMode={ true }
sendRequest={onSendRequest} sendRequest={onSendRequest}
></EmailBottomSheet> ></EmailBottomSheet>
</> </>

View File

@@ -318,11 +318,11 @@ export const FaceAuthPage = () => {
setAuthResult={setAuthResult} setAuthResult={setAuthResult}
/> />
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={emailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={setEmailBottomSheetOn} setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={false} imageMode={ false }
sendEmail={true} emailMode={ true }
sendRequest={onSendRequest} sendRequest={ onSendRequest }
></EmailBottomSheet> ></EmailBottomSheet>
</> </>
); );

View File

@@ -278,13 +278,15 @@ export const KeyInPaymentPage = () => {
setMinAmount={setMinAmount} setMinAmount={setMinAmount}
setMaxAmount={setMaxAmount} setMaxAmount={setMaxAmount}
></KeyInPaymentFilter> ></KeyInPaymentFilter>
<EmailBottomSheet { !!emailBottomSheetOn &&
bottomSheetOn={emailBottomSheetOn} <EmailBottomSheet
setBottomSheetOn={setEmailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
imageSave={false} setBottomSheetOn={ setEmailBottomSheetOn }
sendEmail={true} imageMode={ false }
sendRequest={onSendRequest} emailMode={ true }
></EmailBottomSheet> sendRequest={ onSendRequest }
></EmailBottomSheet>
}
</> </>
); );
}; };

View File

@@ -375,13 +375,15 @@ export const PayoutListPage = () => {
tid={detailTid} tid={detailTid}
> >
</PayoutDetail> </PayoutDetail>
<EmailBottomSheet { !!emailBottomSheetOn &&
bottomSheetOn={emailBottomSheetOn} <EmailBottomSheet
setBottomSheetOn={setEmailBottomSheetOn} bottomSheetOn={ emailBottomSheetOn }
imageSave={false} setBottomSheetOn={ setEmailBottomSheetOn }
sendEmail={true} imageMode={ false }
sendRequest={onSendRequest} emailMode={ true }
></EmailBottomSheet> sendRequest={ onSendRequest }
></EmailBottomSheet>
}
</> </>
); );
}; };

View File

@@ -274,13 +274,15 @@ export const SmsPaymentPage = () => {
setToDate={setToDate} setToDate={setToDate}
setSmsCl={setSmsCl} setSmsCl={setSmsCl}
></SmsPaymentFilter> ></SmsPaymentFilter>
<EmailBottomSheet { !!emailBottomSheetOn &&
bottomSheetOn={emailBottomSheetOn} <EmailBottomSheet
setBottomSheetOn={setEmailBottomSheetOn} bottomSheetOn={emailBottomSheetOn}
imageSave={false} setBottomSheetOn={setEmailBottomSheetOn}
sendEmail={true} imageMode={false}
sendRequest={onSendRequest} emailMode={true}
></EmailBottomSheet> sendRequest={onSendRequest}
></EmailBottomSheet>
}
</> </>
); );
}; };

View File

@@ -403,8 +403,8 @@ export const AllTransactionListPage = () => {
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={ emailBottomSheetOn } bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={ setEmailBottomSheetOn } setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={ false } imageMode={ false }
sendEmail={ true } emailMode={ true }
sendRequest={ onRequestDownloadExcel } sendRequest={ onRequestDownloadExcel }
></EmailBottomSheet> ></EmailBottomSheet>
} }

View File

@@ -290,8 +290,8 @@ export const BillingListPage = () => {
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={ downloadBottomSheetOn } bottomSheetOn={ downloadBottomSheetOn }
setBottomSheetOn={ setDownloadBottomSheetOn } setBottomSheetOn={ setDownloadBottomSheetOn }
imageSave={ false } imageMode={ false }
sendEmail={ true } emailMode={ true }
sendRequest={ onRequestDownload } sendRequest={ onRequestDownload }
></EmailBottomSheet> ></EmailBottomSheet>
} }

View File

@@ -334,8 +334,8 @@ export const CashReceiptListPage = () => {
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={ emailBottomSheetOn } bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={ setEmailBottomSheetOn } setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={ false } imageMode={ false }
sendEmail={ true } emailMode={ true }
sendRequest={ onRequestDownloadExcel } sendRequest={ onRequestDownloadExcel }
></EmailBottomSheet> ></EmailBottomSheet>
} }

View File

@@ -279,8 +279,8 @@ export const EscrowListPage = () => {
<EmailBottomSheet <EmailBottomSheet
bottomSheetOn={ emailBottomSheetOn } bottomSheetOn={ emailBottomSheetOn }
setBottomSheetOn={ setEmailBottomSheetOn } setBottomSheetOn={ setEmailBottomSheetOn }
imageSave={ false } imageMode={ false }
sendEmail={ true } emailMode={ true }
sendRequest={ onRequestDownloadExcel } sendRequest={ onRequestDownloadExcel }
></EmailBottomSheet> ></EmailBottomSheet>
} }