@ -3,9 +3,9 @@ import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { MobileShell } from '../../components/layout/MobileShell' ;
import { MobileShell } from '../../components/layout/MobileShell' ;
import { CompactProductCard } from '../../components/common/CompactProductCard' ;
import { CompactProductCard } from '../../components/common/CompactProductCard' ;
import {
import {
CompactCarouselShimmer ,
EmptyStateBox ,
EmptyStateBox ,
InlineSpinner ,
InlineSpinner ,
ProductDetailBodyShimmer ,
RetryBanner ,
RetryBanner ,
ShimmerBox ,
ShimmerBox ,
} from '../../components/common/ShimmerSkeletons' ;
} from '../../components/common/ShimmerSkeletons' ;
@ -179,12 +179,13 @@ export const ShopSinglePage: React.FC = () => {
const storeDetail = liveProduct ? . store_detail ;
const storeDetail = liveProduct ? . store_detail ;
const storeSlug = storeDetail ? . slug || liveProduct ? . store_slug || 'al-hujjah-books' ;
const storeSlug = storeDetail ? . slug || liveProduct ? . store_slug || 'al-hujjah-books' ;
const inStock = liveProduct ? liveProduct . stock_qty > 0 : true ;
const inStock = liveProduct ? liveProduct . stock_qty > 0 : true ;
const isProductShimmer = ! isBare && loading && ! liveProduct ;
return (
return (
< MobileShell width = { 375 } height = { 1233 } backgroundColor = "#f3f1ef" >
< MobileShell width = { 375 } height = { 1233 } backgroundColor = "#f3f1ef" >
{ /* Hero Product Image & Floating Top Controls */ }
{ /* Hero Product Image & Floating Top Controls */ }
< div className = "habib-single-hero-wrap" >
< div className = "habib-single-hero-wrap" >
{ ! isBare && loading ? (
{ isProductShimmer ? (
< ShimmerBox width = "100%" height = "100%" borderRadius = { 0 } / >
< ShimmerBox width = "100%" height = "100%" borderRadius = { 0 } / >
) : ! liveProduct && ! useMockFallback ? (
) : ! liveProduct && ! useMockFallback ? (
< div style = { { width : '100%' , height : '100%' , backgroundColor : '#e8e4df' } } / >
< div style = { { width : '100%' , height : '100%' , backgroundColor : '#e8e4df' } } / >
@ -288,23 +289,23 @@ export const ShopSinglePage: React.FC = () => {
< / div >
< / div >
{ /* Image Carousel Dots */ }
{ /* Image Carousel Dots */ }
< img
src = "/assets/images/indicator-carousel-dots.svg"
alt = ""
style = { {
position : 'absolute' ,
left : '50%' ,
bottom : 56 ,
transform : 'translateX(-50%)' ,
width : 38 ,
height : 7 ,
} }
/ >
{ ! isProductShimmer && (
< img
src = "/assets/images/indicator-carousel-dots.svg"
alt = ""
style = { {
position : 'absolute' ,
left : '50%' ,
bottom : 56 ,
transform : 'translateX(-50%)' ,
width : 38 ,
height : 7 ,
} }
/ >
) }
< / div >
< / div >
{ ! isBare && loading ? (
< ProductDetailBodyShimmer / >
) : ! liveProduct && ! useMockFallback ? (
{ ! isProductShimmer && ! liveProduct && ! useMockFallback ? (
< div
< div
style = { {
style = { {
position : 'relative' ,
position : 'relative' ,
@ -360,27 +361,31 @@ export const ShopSinglePage: React.FC = () => {
gap : 8 ,
gap : 8 ,
} }
} }
>
>
< div
onClick = { ( ) = > {
if ( liveProduct ? . category_slug ) {
navigate ( ROUTES . category ( liveProduct . category_slug ) ) ;
}
} }
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 8.5 ,
lineHeight : '12.52px' ,
color : '#747474' ,
minWidth : 0 ,
cursor : liveProduct?.category_slug ? 'pointer' : undefined ,
} }
>
{ tr (
liveProduct ? . breadcrumb ||
'Leather accessories and supplies / Leather bags'
) }
< / div >
{ isProductShimmer ? (
< ShimmerBox width = "52%" height = { 12 } borderRadius = { 5 } / >
) : (
< div
onClick = { ( ) = > {
if ( liveProduct ? . category_slug ) {
navigate ( ROUTES . category ( liveProduct . category_slug ) ) ;
}
} }
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 8.5 ,
lineHeight : '12.52px' ,
color : '#747474' ,
minWidth : 0 ,
cursor : liveProduct?.category_slug ? 'pointer' : undefined ,
} }
>
{ tr (
liveProduct ? . breadcrumb ||
'Leather accessories and supplies / Leather bags'
) }
< / div >
) }
< div
< div
style = { {
style = { {
@ -472,18 +477,22 @@ export const ShopSinglePage: React.FC = () => {
{ /* Product Title & Rating */ }
{ /* Product Title & Rating */ }
< div style = { { display : 'flex' , flexDirection : 'column' , gap : 4 } } >
< div style = { { display : 'flex' , flexDirection : 'column' , gap : 4 } } >
< h1
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 18 ,
lineHeight : '26px' ,
color : '#111111' ,
margin : 0 ,
} }
>
{ liveProduct ? . title || 'Islam in the Bible Book' }
< / h1 >
{ isProductShimmer ? (
< ShimmerBox width = "78%" height = { 22 } borderRadius = { 7 } / >
) : (
< h1
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 18 ,
lineHeight : '26px' ,
color : '#111111' ,
margin : 0 ,
} }
>
{ liveProduct ? . title || 'Islam in the Bible Book' }
< / h1 >
) }
< div
< div
style = { {
style = { {
@ -501,41 +510,47 @@ export const ShopSinglePage: React.FC = () => {
height : 15 ,
height : 15 ,
} }
} }
/ >
/ >
{ isProductShimmer ? (
< ShimmerBox width = { 88 } height = { 14 } borderRadius = { 5 } / >
) : (
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 600 ,
fontSize : 12 ,
lineHeight : '17px' ,
color : '#3d3d3d' ,
} }
>
{ liveProduct
? Number (
useMockFallback
? liveProduct . rating_avg || 4.4
: liveProduct . rating_avg ? ? 0
) . toFixed ( 1 )
: '4.4' }
< / span >
) }
< / div >
{ ! isProductShimmer && (
< span
< span
style = { {
style = { {
fontFamily : 'var(--font-sans)' ,
fontFamily : 'var(--font-sans)' ,
fontWeight : 600 ,
fontWeight : 600 ,
fontSize : 12 ,
fontSize : 12 ,
lineHeight : '17px' ,
lineHeight : '17px' ,
color : '#3d3d3d' ,
color : '#747474 ' ,
} }
} }
>
>
{ liveProduct
? Number (
useMockFallback
? liveProduct . rating_avg || 4.4
: liveProduct . rating_avg ? ? 0
) . toFixed ( 1 )
: '4.4' }
{ tr (
isBare
? '0 Reviews'
: ` ${ displayReviews . length } ${
displayReviews . length === 1 ? 'Review' : 'Reviews'
} `
) }
< / span >
< / span >
< / div >
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 600 ,
fontSize : 12 ,
lineHeight : '17px' ,
color : '#747474' ,
} }
>
{ tr (
isBare
? '0 Reviews'
: ` ${ displayReviews . length } ${
displayReviews . length === 1 ? 'Review' : 'Reviews'
} `
) }
< / span >
) }
< / div >
< / div >
< / div >
< / div >
@ -569,38 +584,42 @@ export const ShopSinglePage: React.FC = () => {
>
>
{ tr ( 'Product Condition' ) }
{ tr ( 'Product Condition' ) }
< / div >
< / div >
< div
style = { {
display : 'inline-flex' ,
alignItems : 'center' ,
gap : 4 ,
} }
>
< span
style = { {
width : 7 ,
height : 7 ,
borderRadius : '50%' ,
backgroundColor : inStock ? '#0eb13c' : '#d44747' ,
flexShrink : 0 ,
} }
/ >
< span
{ isProductShimmer ? (
< ShimmerBox width = "68%" height = { 14 } borderRadius = { 5 } / >
) : (
< div
style = { {
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 'clamp(11px, 3.2vw, 12px)' ,
lineHeight : '17px' ,
color : inStock ? '#0eb13c' : '#d44747' ,
whiteSpace : 'nowrap' ,
display : 'inline-flex' ,
alignItems : 'center' ,
gap : 4 ,
} }
} }
>
>
{ tr (
liveProduct ? . condition_label ||
( inStock ? 'In Stock' : 'Out of Stock' )
) }
< / span >
< / div >
< span
style = { {
width : 7 ,
height : 7 ,
borderRadius : '50%' ,
backgroundColor : inStock ? '#0eb13c' : '#d44747' ,
flexShrink : 0 ,
} }
/ >
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 'clamp(11px, 3.2vw, 12px)' ,
lineHeight : '17px' ,
color : inStock ? '#0eb13c' : '#d44747' ,
whiteSpace : 'nowrap' ,
} }
>
{ tr (
liveProduct ? . condition_label ||
( inStock ? 'In Stock' : 'Out of Stock' )
) }
< / span >
< / div >
) }
< / div >
< / div >
{ /* Pill 2: Processing Time -> 2–3 Days */ }
{ /* Pill 2: Processing Time -> 2–3 Days */ }
@ -631,18 +650,22 @@ export const ShopSinglePage: React.FC = () => {
>
>
{ tr ( 'Processing Time' ) }
{ tr ( 'Processing Time' ) }
< / div >
< / div >
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 'clamp(11px, 3.2vw, 12px)' ,
lineHeight : '17px' ,
color : '#747474' ,
whiteSpace : 'nowrap' ,
} }
>
{ tr ( liveProduct ? . processing_time_label || '2–3 Days' ) }
< / div >
{ isProductShimmer ? (
< ShimmerBox width = "68%" height = { 14 } borderRadius = { 5 } / >
) : (
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 'clamp(11px, 3.2vw, 12px)' ,
lineHeight : '17px' ,
color : '#747474' ,
whiteSpace : 'nowrap' ,
} }
>
{ tr ( liveProduct ? . processing_time_label || '2–3 Days' ) }
< / div >
) }
< / div >
< / div >
{ /* Pill 3: Product Type -> Bag */ }
{ /* Pill 3: Product Type -> Bag */ }
@ -673,65 +696,81 @@ export const ShopSinglePage: React.FC = () => {
>
>
{ tr ( 'Product Type' ) }
{ tr ( 'Product Type' ) }
< / div >
< / div >
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 'clamp(11px, 3.2vw, 12px)' ,
lineHeight : '17px' ,
color : '#747474' ,
whiteSpace : 'nowrap' ,
} }
>
{ tr ( liveProduct ? . product_type_label || 'Bag' ) }
< / div >
{ isProductShimmer ? (
< ShimmerBox width = "68%" height = { 14 } borderRadius = { 5 } / >
) : (
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 'clamp(11px, 3.2vw, 12px)' ,
lineHeight : '17px' ,
color : '#747474' ,
whiteSpace : 'nowrap' ,
} }
>
{ tr ( liveProduct ? . product_type_label || 'Bag' ) }
< / div >
) }
< / div >
< / div >
< / div >
< / div >
{ /* Store Booth Row */ }
{ /* Store Booth Row */ }
< div
< div
onClick = { ( ) = > navigate ( ROUTES . store ( storeSlug ) ) }
onClick = { ( ) = > {
if ( ! isProductShimmer ) {
navigate ( ROUTES . store ( storeSlug ) ) ;
}
} }
style = { {
style = { {
display : 'flex' ,
display : 'flex' ,
alignItems : 'center' ,
alignItems : 'center' ,
justifyContent : 'space-between' ,
justifyContent : 'space-between' ,
gap : 10 ,
gap : 10 ,
minHeight : 49 ,
minHeight : 49 ,
cursor : 'pointer' ,
cursor : isProductShimmer ? 'default' : 'pointer' ,
} }
} }
>
>
< div style = { { display : 'flex' , alignItems : 'center' , gap : 8 , minWidth : 0 } } >
< div style = { { display : 'flex' , alignItems : 'center' , gap : 8 , minWidth : 0 } } >
< img
src = {
resolveMediaUrl ( storeDetail ? . logo_url ) ||
'/assets/images/avatar-al-hujjah-books.png'
}
alt = { storeDetail ? . name || 'Al-Hujjah Books' }
style = { {
width : 39 ,
height : 39 ,
borderRadius : 108 ,
objectFit : 'cover' ,
flexShrink : 0 ,
} }
/ >
{ isProductShimmer ? (
< ShimmerBox width = { 39 } height = { 39 } borderRadius = "50%" / >
) : (
< img
src = {
resolveMediaUrl ( storeDetail ? . logo_url ) ||
'/assets/images/avatar-al-hujjah-books.png'
}
alt = { storeDetail ? . name || 'Al-Hujjah Books' }
style = { {
width : 39 ,
height : 39 ,
borderRadius : 108 ,
objectFit : 'cover' ,
flexShrink : 0 ,
} }
/ >
) }
< div style = { { display : 'flex' , flexDirection : 'column' , gap : 2 , minWidth : 0 } } >
< div style = { { display : 'flex' , flexDirection : 'column' , gap : 2 , minWidth : 0 } } >
< div style = { { display : 'inline-flex' , alignItems : 'center' , gap : 3 } } >
< div style = { { display : 'inline-flex' , alignItems : 'center' , gap : 3 } } >
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 14 ,
lineHeight : '19px' ,
color : '#111111' ,
whiteSpace : 'nowrap' ,
} }
>
{ storeDetail ? . name ||
liveProduct ? . store_name ||
( useMockFallback ? 'Al-Hujjah Books' : tr ( 'Store' ) ) }
< / span >
{ isProductShimmer ? (
< ShimmerBox width = { 116 } height = { 15 } borderRadius = { 5 } / >
) : (
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 14 ,
lineHeight : '19px' ,
color : '#111111' ,
whiteSpace : 'nowrap' ,
} }
>
{ storeDetail ? . name ||
liveProduct ? . store_name ||
( useMockFallback ? 'Al-Hujjah Books' : tr ( 'Store' ) ) }
< / span >
) }
< img
< img
src = "/assets/images/icon-caret-right-gold.svg"
src = "/assets/images/icon-caret-right-gold.svg"
alt = ""
alt = ""
@ -743,21 +782,25 @@ export const ShopSinglePage: React.FC = () => {
} }
} }
/ >
/ >
< / div >
< / div >
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 8.5 ,
lineHeight : '12.52px' ,
color : '#8b8b8b' ,
} }
>
{ storeDetail
? [ storeDetail . city , storeDetail . country ] . filter ( Boolean ) . join ( ', ' )
: useMockFallback
? 'Qom, Iran'
: '' }
< / div >
{ isProductShimmer ? (
< ShimmerBox width = { 68 } height = { 10 } borderRadius = { 4 } / >
) : (
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 8.5 ,
lineHeight : '12.52px' ,
color : '#8b8b8b' ,
} }
>
{ storeDetail
? [ storeDetail . city , storeDetail . country ] . filter ( Boolean ) . join ( ', ' )
: useMockFallback
? 'Qom, Iran'
: '' }
< / div >
) }
< / div >
< / div >
< / div >
< / div >
@ -780,39 +823,47 @@ export const ShopSinglePage: React.FC = () => {
height : 15 ,
height : 15 ,
} }
} }
/ >
/ >
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 12 ,
lineHeight : '16px' ,
color : '#36363c' ,
} }
>
{ storeDetail
? Number (
useMockFallback
? storeDetail . rating_avg || 4.2
: storeDetail . rating_avg ? ? 0
) . toFixed ( 1 )
: useMockFallback
? '4.2'
: '0.0' }
< / span >
{ isProductShimmer ? (
< ShimmerBox width = { 28 } height = { 13 } borderRadius = { 4 } / >
) : (
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 12 ,
lineHeight : '16px' ,
color : '#36363c' ,
} }
>
{ storeDetail
? Number (
useMockFallback
? storeDetail . rating_avg || 4.2
: storeDetail . rating_avg ? ? 0
) . toFixed ( 1 )
: useMockFallback
? '4.2'
: '0.0' }
< / span >
) }
< / div >
< / div >
{ ( storeDetail ? . since_label || useMockFallback ) && (
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 8.5 ,
lineHeight : '12.52px' ,
color : '#747474' ,
whiteSpace : 'nowrap' ,
} }
>
( { tr ( storeDetail ? . since_label || 'Since 2008' ) } )
< / div >
{ isProductShimmer ? (
< ShimmerBox width = { 54 } height = { 10 } borderRadius = { 4 } / >
) : (
( storeDetail ? . since_label || useMockFallback ) && (
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 8.5 ,
lineHeight : '12.52px' ,
color : '#747474' ,
whiteSpace : 'nowrap' ,
} }
>
( { tr ( storeDetail ? . since_label || 'Since 2008' ) } )
< / div >
)
) }
) }
< / div >
< / div >
< / div >
< / div >
@ -864,7 +915,7 @@ export const ShopSinglePage: React.FC = () => {
transition : 'color 200ms cubic-bezier(0.22, 1, 0.36, 1)' ,
transition : 'color 200ms cubic-bezier(0.22, 1, 0.36, 1)' ,
} }
} }
>
>
{ tr ( ` Review( ${ displayReviews . length } ) ` ) }
{ isProductShimmer ? tr ( 'Review' ) : tr ( ` Review( ${ displayReviews . length } ) ` ) }
< / button >
< / button >
{ /* Active Tab Indicator Bar */ }
{ /* Active Tab Indicator Bar */ }
@ -920,17 +971,21 @@ export const ShopSinglePage: React.FC = () => {
>
>
{ tr ( 'Category' ) }
{ tr ( 'Category' ) }
< / div >
< / div >
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 12 ,
lineHeight : '18px' ,
color : '#747474' ,
} }
>
{ tr ( liveProduct ? . category_title || 'Art & Handicrafts' ) }
< / div >
{ isProductShimmer ? (
< ShimmerBox width = { 118 } height = { 14 } borderRadius = { 5 } / >
) : (
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 12 ,
lineHeight : '18px' ,
color : '#747474' ,
} }
>
{ tr ( liveProduct ? . category_title || 'Art & Handicrafts' ) }
< / div >
) }
< / div >
< / div >
{ /* Introduction block */ }
{ /* Introduction block */ }
@ -946,21 +1001,29 @@ export const ShopSinglePage: React.FC = () => {
>
>
{ tr ( 'Introduction' ) }
{ tr ( 'Introduction' ) }
< / div >
< / div >
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 12 ,
lineHeight : '18px' ,
color : '#747474' ,
whiteSpace : 'pre-line' ,
} }
>
{ liveProduct ? . description ||
( useMockFallback
? 'Mollit non deserunt ullamco est sit aliqua dolor do amet sint. Velit officia consequat duis enim velit mollit. Exercitation veniam consequat sunt.\nVelit officia consequat duis enim velit mollit. Amet minim mollit non deserunt ullamco est sit aliqua dolor do amet sint. Velit officia consequat duis enim velit mollit. Exercitation veniam consequat sunt nostrud amet.'
: tr ( 'No description available.' ) ) }
< / div >
{ isProductShimmer ? (
< div style = { { display : 'flex' , flexDirection : 'column' , gap : 7 } } >
< ShimmerBox width = "96%" height = { 13 } borderRadius = { 5 } / >
< ShimmerBox width = "90%" height = { 13 } borderRadius = { 5 } / >
< ShimmerBox width = "72%" height = { 13 } borderRadius = { 5 } / >
< / div >
) : (
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 12 ,
lineHeight : '18px' ,
color : '#747474' ,
whiteSpace : 'pre-line' ,
} }
>
{ liveProduct ? . description ||
( useMockFallback
? 'Mollit non deserunt ullamco est sit aliqua dolor do amet sint. Velit officia consequat duis enim velit mollit. Exercitation veniam consequat sunt.\nVelit officia consequat duis enim velit mollit. Amet minim mollit non deserunt ullamco est sit aliqua dolor do amet sint. Velit officia consequat duis enim velit mollit. Exercitation veniam consequat sunt nostrud amet.'
: tr ( 'No description available.' ) ) }
< / div >
) }
< / div >
< / div >
< / div >
< / div >
) : (
) : (
@ -988,7 +1051,9 @@ export const ShopSinglePage: React.FC = () => {
color : '#3d3d3d' ,
color : '#3d3d3d' ,
} }
} }
>
>
{ tr ( ` Customer Reviews ( ${ displayReviews . length } ) ` ) }
{ isProductShimmer
? tr ( 'Customer Reviews' )
: tr ( ` Customer Reviews ( ${ displayReviews . length } ) ` ) }
< / span >
< / span >
< div style = { { display : 'inline-flex' , alignItems : 'center' , gap : 4 } } >
< div style = { { display : 'inline-flex' , alignItems : 'center' , gap : 4 } } >
< img
< img
@ -996,23 +1061,27 @@ export const ShopSinglePage: React.FC = () => {
alt = ""
alt = ""
style = { { width : 14 , height : 13 } }
style = { { width : 14 , height : 13 } }
/ >
/ >
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 12 ,
lineHeight : '17px' ,
color : '#3d3d3d' ,
} }
>
{ liveProduct
? Number (
useMockFallback
? liveProduct . rating_avg || 4.4
: liveProduct . rating_avg ? ? 0
) . toFixed ( 1 )
: '4.4' }
< / span >
{ isProductShimmer ? (
< ShimmerBox width = { 26 } height = { 14 } borderRadius = { 4 } / >
) : (
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 12 ,
lineHeight : '17px' ,
color : '#3d3d3d' ,
} }
>
{ liveProduct
? Number (
useMockFallback
? liveProduct . rating_avg || 4.4
: liveProduct . rating_avg ? ? 0
) . toFixed ( 1 )
: '4.4' }
< / span >
) }
< span
< span
style = { {
style = { {
fontFamily : 'var(--font-sans)' ,
fontFamily : 'var(--font-sans)' ,
@ -1117,7 +1186,12 @@ export const ShopSinglePage: React.FC = () => {
< / form >
< / form >
) }
) }
{ displayReviews . length === 0 && ! useMockFallback ? (
{ isProductShimmer ? (
< >
< ShimmerBox height = { 78 } borderRadius = { 15 } / >
< ShimmerBox height = { 78 } borderRadius = { 15 } / >
< / >
) : displayReviews . length === 0 && ! useMockFallback ? (
< EmptyStateBox message = "No reviews yet." compact / >
< EmptyStateBox message = "No reviews yet." compact / >
) : (
) : (
displayReviews . map ( ( review ) = > (
displayReviews . map ( ( review ) = > (
@ -1251,7 +1325,7 @@ export const ShopSinglePage: React.FC = () => {
{ tr ( 'Populars' ) }
{ tr ( 'Populars' ) }
< / div >
< / div >
< div
< div
onClick = { ( ) = > navigate ( ROUTES . search ( ) ) }
onClick = { ( ) = > navigate ( isBare ? ROUTES . search ( ) : ROUTES . collection ( 'popular' ) ) }
style = { {
style = { {
display : 'inline-flex' ,
display : 'inline-flex' ,
alignItems : 'center' ,
alignItems : 'center' ,
@ -1283,7 +1357,9 @@ export const ShopSinglePage: React.FC = () => {
< / div >
< / div >
< / div >
< / div >
{ liveProduct ? . related_products ? . length ? (
{ isProductShimmer ? (
< CompactCarouselShimmer count = { 3 } / >
) : liveProduct ? . related_products ? . length ? (
< div className = "habib-carousel-scroller habib-scroll-container" >
< div className = "habib-carousel-scroller habib-scroll-container" >
< div className = "habib-carousel-track" >
< div className = "habib-carousel-track" >
{ liveProduct . related_products . map ( ( rel ) = > (
{ liveProduct . related_products . map ( ( rel ) = > (
@ -1317,6 +1393,7 @@ export const ShopSinglePage: React.FC = () => {
{ /* Bottom Sticky Add to Cart Bar */ }
{ /* Bottom Sticky Add to Cart Bar */ }
< div
< div
className = "habib-sticky-bottom-bar"
style = { {
style = { {
position : 'sticky' ,
position : 'sticky' ,
bottom : 0 ,
bottom : 0 ,
@ -1334,63 +1411,67 @@ export const ShopSinglePage: React.FC = () => {
} }
} }
>
>
{ /* Left Price & Discount Badge */ }
{ /* Left Price & Discount Badge */ }
< div style = { { display : 'flex' , flexDirection : 'column' , gap : 2 } } >
{ ( isBare || liveProduct ? . formatted_old_price || liveProduct ? . discount_badge ) && (
< div style = { { display : 'inline-flex' , alignItems : 'center' , gap : 6 } } >
{ ( isBare || liveProduct ? . formatted_old_price ) && (
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 12 ,
lineHeight : '18px' ,
color : '#747474' ,
textDecoration : 'line-through' ,
} }
>
{ isBare ? '$28.50' : liveProduct ? . formatted_old_price }
< / span >
) }
{ ( isBare || liveProduct ? . discount_badge ) && (
< span
style = { {
minWidth : 29 ,
height : 16 ,
padding : '0 5px' ,
borderRadius : 10 ,
backgroundColor : '#d44747' ,
display : 'inline-flex' ,
alignItems : 'center' ,
justifyContent : 'center' ,
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 10 ,
lineHeight : '13.9px' ,
color : '#f5f5f5' ,
} }
>
{ isBare ? '20%' : liveProduct ? . discount_badge }
< / span >
) }
{ isProductShimmer ? (
< ShimmerBox width = { 84 } height = { 24 } borderRadius = { 7 } / >
) : (
< div style = { { display : 'flex' , flexDirection : 'column' , gap : 2 } } >
{ ( isBare || liveProduct ? . formatted_old_price || liveProduct ? . discount_badge ) && (
< div style = { { display : 'inline-flex' , alignItems : 'center' , gap : 6 } } >
{ ( isBare || liveProduct ? . formatted_old_price ) && (
< span
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 400 ,
fontSize : 12 ,
lineHeight : '18px' ,
color : '#747474' ,
textDecoration : 'line-through' ,
} }
>
{ isBare ? '$28.50' : liveProduct ? . formatted_old_price }
< / span >
) }
{ ( isBare || liveProduct ? . discount_badge ) && (
< span
style = { {
minWidth : 29 ,
height : 16 ,
padding : '0 5px' ,
borderRadius : 10 ,
backgroundColor : '#d44747' ,
display : 'inline-flex' ,
alignItems : 'center' ,
justifyContent : 'center' ,
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 10 ,
lineHeight : '13.9px' ,
color : '#f5f5f5' ,
} }
>
{ isBare ? '20%' : liveProduct ? . discount_badge }
< / span >
) }
< / div >
) }
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 22 ,
lineHeight : '26px' ,
color : '#3d3d3d' ,
} }
>
{ isBare ? '$24.00' : liveProduct ? . formatted_price || '$24.00' }
< / div >
< / div >
) }
< div
style = { {
fontFamily : 'var(--font-sans)' ,
fontWeight : 700 ,
fontSize : 22 ,
lineHeight : '26px' ,
color : '#3d3d3d' ,
} }
>
{ isBare ? '$24.00' : liveProduct ? . formatted_price || '$24.00' }
< / div >
< / div >
< / div >
) }
{ /* Add to Cart Button */ }
{ /* Add to Cart Button */ }
< button
< button
type = "button"
type = "button"
disabled = { isCartBusy || ! inStock }
disabled = { isProductShimmer || isCartBusy || ! inStock }
className = "habib-cta-btn"
className = "habib-cta-btn"
onClick = { ( ) = > {
onClick = { ( ) = > {
void handleAddToCart ( ) ;
void handleAddToCart ( ) ;
@ -1402,8 +1483,8 @@ export const ShopSinglePage: React.FC = () => {
padding : '0 14px' ,
padding : '0 14px' ,
borderRadius : 11 ,
borderRadius : 11 ,
border : 'none' ,
border : 'none' ,
cursor : isCartBusy || ! inStock ? 'not-allowed' : 'pointer' ,
opacity : isCartBusy || ! inStock ? 0.65 : 1 ,
cursor : isProductShimmer || is CartBusy || ! inStock ? 'not-allowed' : 'pointer' ,
opacity : isProductShimmer || is CartBusy || ! inStock ? 0.65 : 1 ,
display : 'inline-flex' ,
display : 'inline-flex' ,
alignItems : 'center' ,
alignItems : 'center' ,
justifyContent : 'center' ,
justifyContent : 'center' ,
@ -1434,7 +1515,11 @@ export const ShopSinglePage: React.FC = () => {
whiteSpace : 'nowrap' ,
whiteSpace : 'nowrap' ,
} }
} }
>
>
{ isCartBusy ? tr ( 'Adding...' ) : inStock ? tr ( 'Add to Cart' ) : tr ( 'Sold Out' ) }
{ isCartBusy
? tr ( 'Adding...' )
: isProductShimmer || inStock
? tr ( 'Add to Cart' )
: tr ( 'Sold Out' ) }
< / span >
< / span >
< / button >
< / button >
< / div >
< / div >