From 98df524ecf3854f5d6f6e0db590f9559d81b962b Mon Sep 17 00:00:00 2001 From: optrader Date: Thu, 11 Dec 2025 14:54:31 +0900 Subject: [PATCH] [251211] fix: NBCU Detailpanel QRCodeNew->QRCode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ• ์ปค๋ฐ‹ ์‹œ๊ฐ„: 2025. 12. 11. 14:54:31 ๐Ÿ“Š ๋ณ€๊ฒฝ ํ†ต๊ณ„: โ€ข ์ด ํŒŒ์ผ: 2๊ฐœ โ€ข ์ถ”๊ฐ€: +15์ค„ โ€ข ์‚ญ์ œ: -3์ค„ ๐Ÿ“ ์ถ”๊ฐ€๋œ ํŒŒ์ผ: + com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCodePatnr21.jsx ๐Ÿ“ ์ˆ˜์ •๋œ ํŒŒ์ผ: ~ com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCode.jsx --- .../ProductInfoSection/QRCode/QRCode.jsx | 18 ++++- .../QRCode/QRCodePatnr21.jsx | 78 +++++++++++++++++++ 2 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCodePatnr21.jsx diff --git a/com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCode.jsx b/com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCode.jsx index 9da15d9d..49009bbe 100644 --- a/com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCode.jsx +++ b/com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCode.jsx @@ -5,6 +5,7 @@ import { useSelector } from 'react-redux'; import TQRCode from '../../../../components/TQRCode/TQRCode'; import TQRCodeNew from '../../../../components/TQRCode/TQRCodeNew'; +import QRCodePatnr21 from './QRCodePatnr21'; import { getQRCodeUrl } from '../../../../utils/helperMethods'; import css from './QRCode.module.less'; @@ -57,22 +58,33 @@ export default function QRCode({ return detailUrl; }, [productInfo, isShopByMobile, detailUrl]); - // patnrId === 21์ธ ๊ฒฝ์šฐ TQRCodeNew ์‚ฌ์šฉ (์›ํ˜• QR์ฝ”๋“œ) + // patnrId === 21์ธ ๊ฒฝ์šฐ qrImgUrl ์ฒ˜๋ฆฌ const isPatnrId21 = productInfo?.patnrId === 21 || productInfo?.patnrId === "21"; + const qrImgUrl = isPatnrId21 ? productInfo?.qrImgUrl : null; return (
{/* {qrCodeUrl && } */} {kind === "detail" ? ( isPatnrId21 ? ( - + ) : ( ) ) : ( qrCodeUrl && ( isPatnrId21 ? ( - + ) : ( ) diff --git a/com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCodePatnr21.jsx b/com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCodePatnr21.jsx new file mode 100644 index 00000000..6eee80fe --- /dev/null +++ b/com.twin.app.shoptime/src/views/DetailPanel/ProductInfoSection/QRCode/QRCodePatnr21.jsx @@ -0,0 +1,78 @@ +import React, { useState } from 'react'; + +import TQRCode from '../../../../components/TQRCode/TQRCode'; + +/** + * patnrId=21 ์ „์šฉ QR ์ด๋ฏธ์ง€ ์ฒ˜๋ฆฌ ์ปดํฌ๋„ŒํŠธ + * ์„œ๋ฒ„์—์„œ ์ œ๊ณตํ•˜๋Š” qrImgUrl์„ ์šฐ์„  ํ‘œ์‹œํ•˜๊ณ , + * ๋กœ๋“œ ์‹คํŒจ ์‹œ TQRCode(QR ์ฝ”๋“œ ์ƒ์„ฑ)๋กœ ํด๋ฐฑํ•ฉ๋‹ˆ๋‹ค. + * + * @param {string} qrImgUrl - ์„œ๋ฒ„ ์ œ๊ณต QR ์ด๋ฏธ์ง€ URL (productData.qrImgUrl) + * @param {string} fallbackText - TQRCode ์ƒ์„ฑ ์‹œ ์‚ฌ์šฉํ•  QR ํ…์ŠคํŠธ (qrCodeUrl) + * @param {string} width - ๋„ˆ๋น„ ("190" ๋˜๋Š” "240") + * @param {string} height - ๋†’์ด ("190" ๋˜๋Š” "240") + */ +export default function QRCodePatnr21({ + qrImgUrl, + fallbackText, + width = '190', + height = '190', +}) { + const [imageError, setImageError] = useState(false); + const [imageLoaded, setImageLoaded] = useState(false); + + // 1. qrImgUrl์ด ์—†์œผ๋ฉด TQRCode ํด๋ฐฑ + if (!qrImgUrl) { + return ; + } + + // 2. ์ด๋ฏธ์ง€ ๋กœ๋“œ ์‹คํŒจ โ†’ TQRCode ํด๋ฐฑ + if (imageError) { + return ; + } + + // 3. ์ด๋ฏธ์ง€ ๋กœ๋“œ ์„ฑ๊ณต โ†’ ์ด๋ฏธ์ง€ ํ‘œ์‹œ (๊ธฐ์กด QRCode์™€ ๋™์ผํ•œ ๋ ˆ์ด์•„์›ƒ) + const sizeInPx = `${width}px`; + + return ( +
+ QR Code setImageLoaded(true)} + onError={() => setImageError(true)} + style={{ + display: imageLoaded ? 'block' : 'none', + width: '100%', + height: '100%', + objectFit: 'contain', + }} + /> + {!imageLoaded && ( +
+ Loading... +
+ )} +
+ ); +}