You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

264 lines
7.6 KiB

import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { MobileShell } from '../../components/layout/MobileShell';
import { BottomNavBar } from '../../components/layout/BottomNavBar';
import { StickyFooterBar } from '../../components/layout/StickyFooterBar';
import { OrderSummaryBgItemCard } from '../../components/checkout/CartItemCard';
import { PaymentMethodCard } from '../../components/checkout/PaymentMethodCard';
import {
ORDER_SUMMARY_BG_ITEMS,
PAYMENT_METHODS_LIST,
} from '../../data/checkoutData';
import { useShopApp } from '../../context/ShopAppContext';
import { isRtlLanguage, tr } from '../../lib/cookies';
/**
* Node 4171:1394 — `shop-payment` (Payment Methods Bottom Sheet Modal, 375×814)
*/
export const ShopPaymentMethodsPage: React.FC = () => {
const navigate = useNavigate();
const { language } = useShopApp();
const isRtl = isRtlLanguage(language);
const [selectedMethodId, setSelectedMethodId] = useState('pm-google');
return (
<MobileShell width={375} height={814} backgroundColor="#f5f5f5">
{/* Underlying Cart Screen Layer */}
<div
style={{
flex: 1,
display: 'flex',
flexDirection: 'column',
padding: 'calc(41px + var(--safe-top, 0px)) var(--page-px) 24px',
gap: 11,
}}
>
<div
style={{
fontFamily: 'var(--font-sans)',
fontWeight: 700,
fontSize: 16,
lineHeight: '20px',
color: '#111111',
textAlign: 'center',
}}
>
{tr('Cart')}
</div>
<div
style={{
fontFamily: 'var(--font-sans)',
fontWeight: 700,
fontSize: 12,
lineHeight: '17px',
color: '#747474',
textAlign: 'center',
}}
>
{tr('3 Products from 2 Shops')}
</div>
<div
style={{
marginTop: 12,
display: 'flex',
flexDirection: 'column',
gap: 10,
}}
>
{ORDER_SUMMARY_BG_ITEMS.map((item) => (
<OrderSummaryBgItemCard key={item.id} item={item} />
))}
</div>
</div>
<div style={{ width: '100%', marginTop: 'auto' }}>
<StickyFooterBar
aboveBottomNav={true}
height={104}
price="$24.00"
oldPrice="$28.50"
totalItemsLabel="Total 4 item"
buttonText="checkout"
buttonFontWeight={600}
iconSrc="/assets/images/icon-credit-card-white.svg"
targetRoute="/shop-payresult"
/>
<BottomNavBar activeTab="cart" showCartBadge={true} />
</div>
{/* Dark Backdrop Overlay & Payment Methods Bottom Sheet Modal */}
<div
onClick={() => navigate('/shop-payment')}
style={{
position: 'absolute',
inset: 0,
backgroundColor: 'rgba(17, 17, 17, 0.9)',
zIndex: 40,
display: 'flex',
flexDirection: 'column',
justifyContent: 'flex-end',
}}
>
<div
className="habib-bottom-sheet"
onClick={(e) => e.stopPropagation()}
style={{
padding: '22px var(--page-px) 24px',
display: 'flex',
flexDirection: 'column',
gap: 24,
}}
>
{/* Header & Close X Button */}
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
gap: 12,
}}
>
<div
style={{
fontFamily: 'var(--font-sans)',
fontWeight: 700,
fontSize: 14,
lineHeight: '19px',
color: '#111111',
}}
>
{tr('Payment methos')}
</div>
<button
type="button"
onClick={() => navigate('/shop-payment')}
aria-label={tr('Close')}
style={{
width: 24,
height: 24,
background: 'transparent',
border: 'none',
padding: 0,
cursor: 'pointer',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<img
src="/assets/images/icon-modal-close-cross.svg"
alt=""
style={{
width: 11.67,
height: 11.67,
display: 'block',
}}
/>
</button>
</div>
{/* 3 Payment Method Cards */}
<div
style={{
display: 'flex',
flexDirection: 'column',
gap: 15,
}}
>
{PAYMENT_METHODS_LIST.map((method) => (
<PaymentMethodCard
key={method.id}
item={method}
isSelected={method.id === selectedMethodId}
onSelect={() => setSelectedMethodId(method.id)}
/>
))}
</div>
{/* "Purchase" CTA Button */}
<button
type="button"
className="habib-cta-btn"
onClick={() => navigate('/shop-payresult')}
style={{
position: 'relative',
width: '100%',
height: 52,
padding: '0 14px',
borderRadius: 11,
backgroundColor: '#d78e06',
border: 'none',
cursor: 'pointer',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
{/* Center Icon + "Purchase" Text */}
<div
style={{
display: 'inline-flex',
alignItems: 'center',
gap: 6,
}}
>
<img
src="/assets/images/icon-credit-card-white.svg"
alt=""
style={{
width: 24,
height: 24,
flexShrink: 0,
}}
/>
<span
style={{
fontFamily: 'var(--font-sans)',
fontWeight: 700,
fontSize: 16,
lineHeight: '24px',
color: '#fbfbfc',
}}
>
{tr('Purchase')}
</span>
</div>
{/* Right Price Pill "$24.00" */}
<div
style={{
position: 'absolute',
...(isRtl ? { left: 14 } : { right: 14 }),
top: '50%',
transform: 'translateY(-50%)',
minWidth: 56,
height: 24,
padding: '0 6px',
borderRadius: 5,
backgroundColor: 'rgba(255, 255, 255, 0.2)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<span
style={{
fontFamily: 'var(--font-sans)',
fontWeight: 700,
fontSize: 14,
lineHeight: '19px',
color: 'rgba(255, 255, 255, 0.8)',
}}
>
$24.00
</span>
</div>
</button>
</div>
</div>
</MobileShell>
);
};