From 406988260a92fa1d9c2c184d79cab4b418585c38 Mon Sep 17 00:00:00 2001 From: oak Date: Wed, 16 Oct 2024 20:10:46 +0300 Subject: [PATCH 1/2] wip --- .../managers/orders/orderDetails.tsx | 46 ++++++++++++++----- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/src/components/managers/orders/orderDetails.tsx b/src/components/managers/orders/orderDetails.tsx index 9afee58..f976573 100644 --- a/src/components/managers/orders/orderDetails.tsx +++ b/src/components/managers/orders/orderDetails.tsx @@ -274,9 +274,14 @@ export const OrderDetails = () => { )} {payment.paymentInsert?.transactionAmount && ( -
- AMOUNT: {payment.paymentInsert?.transactionAmount.value}{' '} - {payment.paymentInsert?.transactionAmountPaymentCurrency?.value} +
+ AMOUNT:  + {payment.paymentInsert.paymentMethod === 'PAYMENT_METHOD_NAME_ENUM_CARD' || + payment.paymentInsert.paymentMethod === 'PAYMENT_METHOD_NAME_ENUM_CARD_TEST' ? ( +

{payment.paymentInsert?.transactionAmountPaymentCurrency?.value}

+ ) : ( +

{payment.paymentInsert?.transactionAmount.value}

+ )}
)} {payment.paymentInsert?.payer && ( @@ -293,15 +298,32 @@ export const OrderDetails = () => { )} {payment.paymentInsert?.isTransactionDone && (
- TXID:  - + {payment.paymentInsert?.paymentMethod === 'PAYMENT_METHOD_NAME_ENUM_CARD_TEST' || + payment.paymentInsert?.paymentMethod === 'PAYMENT_METHOD_NAME_ENUM_CARD' ? ( + <> + CLIENT SECRET:  + + + ) : ( + <> + TXID:  + + + )}
)}
From 63fdc6566f4080724b51508c05d67ae480736a7b Mon Sep 17 00:00:00 2001 From: oak Date: Wed, 16 Oct 2024 21:20:06 +0300 Subject: [PATCH 2/2] wip --- .../common/singleMediaViewAndSelect.tsx | 24 ++++++++++------- .../managers/hero/selectHeroType.tsx | 6 ++++- .../hero/utility/heroValidationShema.ts | 26 +++++++++++++++---- .../mediaView/mediaView.tsx | 2 ++ .../mediaSelector/mediaSelectorLayout.tsx | 7 +---- src/styles/hero.scss | 1 + 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/src/components/common/singleMediaViewAndSelect.tsx b/src/components/common/singleMediaViewAndSelect.tsx index 861351f..0144d6e 100644 --- a/src/components/common/singleMediaViewAndSelect.tsx +++ b/src/components/common/singleMediaViewAndSelect.tsx @@ -8,6 +8,7 @@ import styles from 'styles/product-id-media.scss'; interface SingleMediaView { link: string | undefined; isEditMode?: boolean; + isAddingProduct?: boolean; aspectRatio?: string[]; hideVideos?: boolean; saveSelectedMedia: (newSelectedMedia: common_MediaFull[]) => void; @@ -16,6 +17,7 @@ interface SingleMediaView { export const SingleMediaViewAndSelect: FC = ({ link, isEditMode, + isAddingProduct, aspectRatio, hideVideos, saveSelectedMedia, @@ -29,16 +31,18 @@ export const SingleMediaViewAndSelect: FC = ({ ) : ( thumbnail ))} - - - + {(isEditMode === undefined || isEditMode || isAddingProduct) && ( + + + + )} ); diff --git a/src/components/managers/hero/selectHeroType.tsx b/src/components/managers/hero/selectHeroType.tsx index 4d7b629..f44061c 100644 --- a/src/components/managers/hero/selectHeroType.tsx +++ b/src/components/managers/hero/selectHeroType.tsx @@ -18,14 +18,18 @@ export const SelectHeroType: FC = ({ arrayHelpers, entityRefs }) const isOtherEntitiesExist = values.entities?.some( (entity) => entity.type !== 'HERO_TYPE_MAIN_ADD', ); - const isMainAddExists = values.entities?.some((entity) => entity.type === 'HERO_TYPE_MAIN_ADD'); const [addedEntityIndex, setAddedEntityIndex] = useState(null); + const isMainAddExists = values.entities?.some((entity) => entity.type === 'HERO_TYPE_MAIN_ADD'); + const isEntityIncomplete = values.entities?.some((entity) => { const validateEntity = validationForSelectHeroType[entity.type as common_HeroType]; return validateEntity ? validateEntity(entity) : false; }); const handleAddEntity = () => { + if (entityType === 'HERO_TYPE_MAIN_ADD' && isMainAddExists) { + return; + } const newEntity = { ...emptyHeroForm.entities?.[0] }; newEntity.type = entityType as common_HeroType; arrayHelpers.push(newEntity); diff --git a/src/components/managers/hero/utility/heroValidationShema.ts b/src/components/managers/hero/utility/heroValidationShema.ts index 7138833..16c3735 100644 --- a/src/components/managers/hero/utility/heroValidationShema.ts +++ b/src/components/managers/hero/utility/heroValidationShema.ts @@ -1,3 +1,4 @@ +import { isValidUrl } from 'components/managers/archive/utility/isValidUrl'; import * as Yup from 'yup'; export const heroValidationSchema = Yup.object().shape({ @@ -10,7 +11,10 @@ export const heroValidationSchema = Yup.object().shape({ mainAdd: Yup.object().shape({ singleAdd: Yup.object().shape({ mediaId: Yup.number().min(1, 'Main Add Media is required'), - exploreLink: Yup.string().nullable(), + exploreLink: Yup.string().nullable().test( + 'is-valid-url', + (value) => !value || isValidUrl(value), + ), exploreText: Yup.string().nullable(), }), }), @@ -21,7 +25,10 @@ export const heroValidationSchema = Yup.object().shape({ type: Yup.string().required('Hero type is required'), singleAdd: Yup.object().shape({ mediaId: Yup.number().min(1, 'Single Add Media is required'), - exploreLink: Yup.string().nullable(), + exploreLink: Yup.string().nullable().test( + 'is-valid-url', + (value) => !value || isValidUrl(value), + ), exploreText: Yup.string().nullable(), }), }); @@ -32,12 +39,18 @@ export const heroValidationSchema = Yup.object().shape({ doubleAdd: Yup.object().shape({ left: Yup.object().shape({ mediaId: Yup.number().min(1, 'Left media is required'), - exploreLink: Yup.string().nullable(), + exploreLink: Yup.string().nullable().test( + 'is-valid-url', + (value) => !value || isValidUrl(value), + ), exploreText: Yup.string().nullable(), }), right: Yup.object().shape({ mediaId: Yup.number().min(1, 'Right media is required'), - exploreLink: Yup.string().nullable(), + exploreLink: Yup.string().nullable().test( + 'is-valid-url', + (value) => !value || isValidUrl(value), + ), exploreText: Yup.string().nullable(), }), }), @@ -51,7 +64,10 @@ export const heroValidationSchema = Yup.object().shape({ .of(Yup.number().min(1)) .min(1, 'At least one product is required'), title: Yup.string().nullable(), - exploreLink: Yup.string().nullable(), + exploreLink: Yup.string().nullable().test( + 'is-valid-url', + (value) => !value || isValidUrl(value), + ), exploreText: Yup.string().nullable(), }), }); diff --git a/src/components/managers/products/genericProductComponent/mediaView/mediaView.tsx b/src/components/managers/products/genericProductComponent/mediaView/mediaView.tsx index 91a192a..7547436 100644 --- a/src/components/managers/products/genericProductComponent/mediaView/mediaView.tsx +++ b/src/components/managers/products/genericProductComponent/mediaView/mediaView.tsx @@ -77,6 +77,8 @@ export const MediaView: FC = ({ imagePreviewUrl || product?.product?.productDisplay?.thumbnail?.media?.thumbnail?.mediaUrl } + isEditMode={isEditMode} + isAddingProduct={isAddingProduct} aspectRatio={['4:5']} hideVideos={true} saveSelectedMedia={uploadThumbnailInProduct} diff --git a/src/features/mediaSelector/mediaSelectorLayout.tsx b/src/features/mediaSelector/mediaSelectorLayout.tsx index 43827d9..6fe5510 100644 --- a/src/features/mediaSelector/mediaSelectorLayout.tsx +++ b/src/features/mediaSelector/mediaSelectorLayout.tsx @@ -19,12 +19,7 @@ export const MediaSelectorLayout: FC = ({ return ( - diff --git a/src/styles/hero.scss b/src/styles/hero.scss index 48630e5..b9e8ed5 100644 --- a/src/styles/hero.scss +++ b/src/styles/hero.scss @@ -34,6 +34,7 @@ display: flex; align-items: center; justify-content: center; + margin-top: 20px; margin-bottom: 100px; } }