From f2d35396ccbef92dafc2f204c2968f3072bb9990 Mon Sep 17 00:00:00 2001
From: sina_sajjadi
Date: Thu, 12 Nov 2026 10:22:48 +0330
Subject: [PATCH] refactor(shop): clean up test pages, improve mobile shell
layout, and enhance address and cookie handling
---
index.html | 147 +-
src/App.tsx | 25 +-
src/components/account/AccountMenuRow.tsx | 5 +-
src/components/account/OrderCounterCard.tsx | 5 +-
src/components/checkout/AddressCard.tsx | 7 +-
src/components/checkout/CartItemCard.tsx | 11 +-
src/components/checkout/OrderSummaryRows.tsx | 5 +-
src/components/checkout/PaymentMethodCard.tsx | 3 +-
src/components/checkout/ReviewItemCard.tsx | 3 +-
src/components/common/CategoryCard.tsx | 5 +-
src/components/common/CompactProductCard.tsx | 5 +-
src/components/common/GridProductCard.tsx | 5 +-
src/components/common/PhoneNumberInput.tsx | 15 +-
src/components/common/SearchBar.tsx | 16 +-
src/components/common/ShimmerSkeletons.tsx | 7 +-
src/components/layout/BottomNavBar.tsx | 17 +-
src/components/layout/MobileShell.tsx | 381 ++-
src/components/layout/StickyFooterBar.tsx | 7 +-
src/components/layout/TopHeader.tsx | 5 +-
src/components/modals/AddressFormSheet.tsx | 1067 +++++++-
src/components/modals/LoginRequiredModal.tsx | 9 +-
src/components/modals/OrderSummarySheet.tsx | 7 +-
src/components/modals/PaymentMethodsSheet.tsx | 7 +-
.../modals/ShipmentTrackingSheet.tsx | 19 +-
src/components/orders/OrderFilterTabs.tsx | 11 +-
src/components/orders/OrderListCard.tsx | 9 +-
src/components/orders/ShipmentStatusCard.tsx | 9 +-
src/context/ShopAppContext.tsx | 176 +-
src/data/routesRegistry.ts | 425 ----
src/hooks/useSmartBack.ts | 3 -
src/lib/cookies.ts | 1388 ++++++++++-
src/lib/routes.ts | 1 -
src/pages/account/LanguageSettingPage.tsx | 32 +-
src/pages/account/ProviderRequestPage.tsx | 85 +-
src/pages/account/ShopAccountPage.tsx | 128 +-
src/pages/account/ShopAddressPage.tsx | 3 +-
src/pages/catalog/ShopBoothPage.tsx | 120 +-
src/pages/catalog/ShopCatItemsPage.tsx | 9 +-
src/pages/catalog/ShopCategoryPage.tsx | 3 +
src/pages/catalog/ShopSinglePage.tsx | 83 +-
src/pages/chat/ShopChatPage.tsx | 48 +-
src/pages/checkout/ShopBuy01Page.tsx | 19 +-
src/pages/checkout/ShopCartPage.tsx | 15 +-
src/pages/checkout/ShopOrderSummaryPage.tsx | 14 +-
src/pages/checkout/ShopPayResultPage.tsx | 24 +-
src/pages/checkout/ShopPaymentMethodsPage.tsx | 16 +-
src/pages/checkout/ShopPaymentPage.tsx | 9 +-
src/pages/home/ShopHomePage.tsx | 35 +-
src/pages/orders/ShopOrderDetailPage.tsx | 27 +-
src/pages/orders/ShopOrdersPage.tsx | 5 +-
src/pages/orders/ShopSupportPage.tsx | 37 +-
src/pages/test/PixelVerificationModal.tsx | 602 -----
src/pages/test/SellerChatButtonTestLab.tsx | 2207 -----------------
src/pages/test/TestDirectoryPage.tsx | 576 -----
src/types/window.d.ts | 1 +
55 files changed, 3516 insertions(+), 4387 deletions(-)
delete mode 100644 src/data/routesRegistry.ts
delete mode 100644 src/pages/test/PixelVerificationModal.tsx
delete mode 100644 src/pages/test/SellerChatButtonTestLab.tsx
delete mode 100644 src/pages/test/TestDirectoryPage.tsx
diff --git a/index.html b/index.html
index ab01860..84893ec 100644
--- a/index.html
+++ b/index.html
@@ -1,5 +1,5 @@
-
+
@@ -161,6 +161,60 @@
currentCoins = 21;
}
+ function normalizeBootLang(raw) {
+ if (typeof raw !== 'string') return '';
+ var clean = raw.trim().toLowerCase();
+ if (!clean) return '';
+ if (clean.indexOf('fa') === 0 || clean === 'persian' || clean === 'farsi') return 'fa';
+ if (clean.indexOf('ar') === 0 || clean === 'arabic') return 'ar';
+ if (clean.indexOf('en') === 0 || clean === 'english') return 'en';
+ return '';
+ }
+
+ function applyBootLanguage(langCode) {
+ var norm = normalizeBootLang(langCode) || 'en';
+ var dir = norm === 'fa' || norm === 'ar' ? 'rtl' : 'ltr';
+ if (document.documentElement) {
+ document.documentElement.lang = norm;
+ document.documentElement.dir = dir;
+ }
+ if (document.body) {
+ document.body.dir = dir;
+ }
+ }
+
+ function resolveInitialLanguage() {
+ var urlLang = '';
+ try {
+ if (window.location && window.location.search) {
+ var sp = new URLSearchParams(window.location.search);
+ urlLang = normalizeBootLang(sp.get('lang') || sp.get('locale') || sp.get('language') || '');
+ }
+ } catch (_eLangUrl) {}
+ var cookieLang = normalizeBootLang(
+ readCookie('HABIB_LANGUAGE') || readCookie('HABIB_USER_LANGUAGE') || readCookie('habib_language')
+ );
+ var lsLang = '';
+ try {
+ lsLang = normalizeBootLang(
+ window.localStorage.getItem('habib_shop_language') ||
+ window.localStorage.getItem('HABIB_LANGUAGE') ||
+ ''
+ );
+ } catch (_eLangLs) {}
+ var chosen = urlLang || cookieLang || lsLang || 'en';
+ if (urlLang) {
+ document.cookie = 'HABIB_LANGUAGE=' + encodeURIComponent(chosen) + '; path=/; SameSite=Lax';
+ document.cookie = 'HABIB_USER_LANGUAGE=' + encodeURIComponent(chosen) + '; path=/; SameSite=Lax';
+ try {
+ window.localStorage.setItem('habib_shop_language', chosen);
+ } catch (_eSaveUrlLang) {}
+ }
+ return chosen;
+ }
+
+ applyBootLanguage(resolveInitialLanguage());
+
function getFlutterBridge() {
var ch = window.HabibApp || window.FlutterChannel;
if (ch && typeof ch.postMessage === 'function') {
@@ -279,6 +333,29 @@
);
}
+ var incomingLang = normalizeBootLang(
+ data.language ||
+ data.locale ||
+ (data.user && (data.user.preferred_language || data.user.language)) ||
+ ''
+ );
+ if (incomingLang) {
+ var prevBootLang = resolveBootLang();
+ document.cookie = 'HABIB_LANGUAGE=' + encodeURIComponent(incomingLang) + '; path=/; SameSite=Lax';
+ document.cookie = 'HABIB_USER_LANGUAGE=' + encodeURIComponent(incomingLang) + '; path=/; SameSite=Lax';
+ try {
+ window.localStorage.setItem('habib_shop_language', incomingLang);
+ } catch (_eBridgeLang) {}
+ applyBootLanguage(incomingLang);
+ if (incomingLang !== prevBootLang) {
+ window.dispatchEvent(
+ new CustomEvent('habib:language-changed', {
+ detail: { language: incomingLang },
+ })
+ );
+ }
+ }
+
if (explicitToken) {
window.HABIB_TOKEN = explicitToken;
} else if (action === 'login' && payload.success !== false) {
@@ -353,12 +430,12 @@
}, 120);
};
- // Safety fallback so Flutter's reveal cover never hangs permanently
+ // Emergency fallback only if React bundle fails to mount
window.setTimeout(function () {
- if (!webReadySent) {
+ if (!webReadySent && !document.querySelector('.habib-mobile-viewport')) {
tryPostWebReady();
}
- }, 3500);
+ }, 10000);
function postClientLog(level, message, details) {
var bridge = getFlutterBridge();
@@ -399,7 +476,67 @@
-
+
diff --git a/src/App.tsx b/src/App.tsx
index 7eb90f1..8f5205b 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -4,7 +4,10 @@ import { BrowserRouter, Routes, Route, Navigate, useLocation } from 'react-route
import { ShopAppProvider } from './context/ShopAppContext';
import { HabibBridgeProviders } from './components/bridge/HabibBridgeProviders';
-import { MajorTabActiveContext } from './components/layout/MobileShell';
+import {
+ MajorTabActiveContext,
+ useHomeBootSettled,
+} from './components/layout/MobileShell';
import { isBareMode } from './lib/routes';
import { shopQueryClient } from './lib/shopQueries';
@@ -40,10 +43,6 @@ import { LanguageSettingPage } from './pages/account/LanguageSettingPage';
// Standalone Component / Icon / Text Nodes (6 Top-Level Nodes)
import { StandaloneNodesPage } from './pages/standalone/StandaloneNodesPage';
-// Test & QA Hub (/test)
-import { TestDirectoryPage } from './pages/test/TestDirectoryPage';
-import { SellerChatButtonTestLab } from './pages/test/SellerChatButtonTestLab';
-
type MajorTab = 'home' | 'category' | 'account' | 'cart';
function resolveMajorTab(pathname: string): MajorTab | null {
@@ -69,18 +68,24 @@ const MAJOR_PAGE_SLOTS: Array<{ tab: MajorTab; element: React.ReactNode }> = [
const AppRoutes: React.FC = () => {
const location = useLocation();
+ const homeBootSettled = useHomeBootSettled();
const isBare = isBareMode(location.search);
const isNonShellRoute =
isBare ||
- location.pathname.startsWith('/test') ||
location.pathname.startsWith('/node/');
const activeMajorTab = isBare ? null : resolveMajorTab(location.pathname);
+ const visibleSlots = homeBootSettled
+ ? MAJOR_PAGE_SLOTS
+ : MAJOR_PAGE_SLOTS.filter(({ tab }) => tab === 'home');
return (
<>
{!isNonShellRoute &&
- MAJOR_PAGE_SLOTS.map(({ tab, element }) => {
- const isActive = activeMajorTab === tab;
+ visibleSlots.map(({ tab, element }) => {
+ const isActive =
+ !homeBootSettled && activeMajorTab !== null
+ ? tab === 'home'
+ : activeMajorTab === tab;
return (
{
{activeMajorTab === null && (
- {/* Test & QA Hub */}
- } />
- } />
-
{/* ===================================================== */}
{/* Production Parameterized Routes */}
{/* ===================================================== */}
diff --git a/src/components/account/AccountMenuRow.tsx b/src/components/account/AccountMenuRow.tsx
index 3392e26..08e07e8 100644
--- a/src/components/account/AccountMenuRow.tsx
+++ b/src/components/account/AccountMenuRow.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import type { AccountMenuRowItem } from '../../data/accountData';
+import { tr } from '../../lib/cookies';
interface AccountMenuRowProps {
row: AccountMenuRowItem;
@@ -111,7 +112,7 @@ export const AccountMenuRow: React.FC = ({ row, onClick })
textOverflow: 'ellipsis',
}}
>
- {row.title}
+ {tr(row.title)}
{row.subtitle && (
= ({ row, onClick })
textOverflow: 'ellipsis',
}}
>
- {row.subtitle}
+ {tr(row.subtitle)}
)}
diff --git a/src/components/account/OrderCounterCard.tsx b/src/components/account/OrderCounterCard.tsx
index 0850f1d..a003293 100644
--- a/src/components/account/OrderCounterCard.tsx
+++ b/src/components/account/OrderCounterCard.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import type { OrderStatusCounterItem } from '../../data/accountData';
+import { tr } from '../../lib/cookies';
import { ROUTES } from '../../lib/routes';
interface OrderCounterCardProps {
@@ -88,7 +89,7 @@ export const OrderCounterCard: React.FC = ({
textOverflow: 'ellipsis',
}}
>
- {counter.label}
+ {tr(counter.label)}
= ({
textOverflow: 'ellipsis',
}}
>
- {counter.countText}
+ {tr(counter.countText)}
diff --git a/src/components/checkout/AddressCard.tsx b/src/components/checkout/AddressCard.tsx
index 4819cd6..9eeca00 100644
--- a/src/components/checkout/AddressCard.tsx
+++ b/src/components/checkout/AddressCard.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import type { ShippingAddressOption } from '../../data/checkoutData';
+import { tr } from '../../lib/cookies';
import { ROUTES } from '../../lib/routes';
interface AddressCardProps {
@@ -121,7 +122,7 @@ export const AddressCard: React.FC = ({
flexShrink: 0,
}}
>
- Change Adress
+ {tr('Change Adress')}
) : (
= ({ onClick })
color: '#36363c',
}}
>
- Add New adress
+ {tr('Add New adress')}
= ({ onClick })
color: '#8b8b8b',
}}
>
- Add New Delivery adress
+ {tr('Add New Delivery adress')}
diff --git a/src/components/checkout/CartItemCard.tsx b/src/components/checkout/CartItemCard.tsx
index f4632c4..f5a0f28 100644
--- a/src/components/checkout/CartItemCard.tsx
+++ b/src/components/checkout/CartItemCard.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import type { CartItemData, OrderSummaryBgItemData } from '../../data/checkoutData';
+import { tr } from '../../lib/cookies';
interface MainCartItemCardProps {
item: CartItemData;
@@ -78,7 +79,7 @@ export const MainCartItemCard: React.FC = ({
cursor: onClickItem ? 'pointer' : undefined,
}}
>
- {item.title}
+ {tr(item.title)}
{/* Origin Row */}
@@ -110,7 +111,7 @@ export const MainCartItemCard: React.FC = ({
color: '#747474',
}}
>
- {item.origin}
+ {tr(item.origin)}
@@ -120,7 +121,7 @@ export const MainCartItemCard: React.FC = ({
className={onRemove ? 'habib-icon-btn' : undefined}
onClick={() => onRemove?.(item.id)}
role={onRemove ? 'button' : undefined}
- aria-label="Remove item"
+ aria-label={tr('Remove item')}
style={{
width: '24px',
height: '24px',
@@ -318,7 +319,7 @@ export const OrderSummaryBgItemCard: React.FC = ({
color: '#111111',
}}
>
- {item.title}
+ {tr(item.title)}
= ({
color: '#8b8b8b',
}}
>
- {item.origin}
+ {tr(item.origin)}
diff --git a/src/components/checkout/OrderSummaryRows.tsx b/src/components/checkout/OrderSummaryRows.tsx
index d41116f..9c08946 100644
--- a/src/components/checkout/OrderSummaryRows.tsx
+++ b/src/components/checkout/OrderSummaryRows.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import { ORDER_SUMMARY_ROWS } from '../../data/checkoutData';
+import { tr } from '../../lib/cookies';
export interface SummaryLineRow {
id: string;
@@ -59,7 +60,7 @@ export const OrderSummaryRows: React.FC = ({
color: '#747474',
}}
>
- {row.label}
+ {tr(row.label)}
= ({
color: '#111111',
}}
>
- Total
+ {tr('Total')}
= ({
color: '#292a2e',
}}
>
- {item.label}
+ {tr(item.label)}
diff --git a/src/components/checkout/ReviewItemCard.tsx b/src/components/checkout/ReviewItemCard.tsx
index 298d4b4..7d5b683 100644
--- a/src/components/checkout/ReviewItemCard.tsx
+++ b/src/components/checkout/ReviewItemCard.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import type { PaymentReviewItem } from '../../data/checkoutData';
+import { tr } from '../../lib/cookies';
interface ReviewItemCardProps {
item: PaymentReviewItem;
@@ -59,7 +60,7 @@ export const ReviewItemCard: React.FC = ({
color: '#111111',
}}
>
- {item.title}
+ {tr(item.title)}
= ({
= ({
textAlign: 'center',
}}
>
- {tile.label}
+ {tr(tile.label)}
);
diff --git a/src/components/common/CompactProductCard.tsx b/src/components/common/CompactProductCard.tsx
index 53910de..231a812 100644
--- a/src/components/common/CompactProductCard.tsx
+++ b/src/components/common/CompactProductCard.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import type { CompactProductItem } from '../../data/catalogData';
+import { tr } from '../../lib/cookies';
import { ROUTES } from '../../lib/routes';
interface CompactProductCardProps {
@@ -160,7 +161,7 @@ export const CompactProductCard: React.FC = ({
color: '#111111',
}}
>
- {item.title}
+ {tr(item.title)}
= ({
textOverflow: 'ellipsis',
}}
>
- {item.origin}
+ {tr(item.origin)}
diff --git a/src/components/common/GridProductCard.tsx b/src/components/common/GridProductCard.tsx
index 5e33004..683e2ea 100644
--- a/src/components/common/GridProductCard.tsx
+++ b/src/components/common/GridProductCard.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import type { GridProductItem } from '../../data/catalogData';
+import { tr } from '../../lib/cookies';
import { ROUTES } from '../../lib/routes';
interface GridProductCardProps {
@@ -161,7 +162,7 @@ export const GridProductCard: React.FC = ({
color: '#111111',
}}
>
- {item.title}
+ {tr(item.title)}
= ({
textOverflow: 'ellipsis',
}}
>
- {item.origin}
+ {tr(item.origin)}
diff --git a/src/components/common/PhoneNumberInput.tsx b/src/components/common/PhoneNumberInput.tsx
index 7726477..43df37b 100644
--- a/src/components/common/PhoneNumberInput.tsx
+++ b/src/components/common/PhoneNumberInput.tsx
@@ -10,6 +10,7 @@ import {
resolveRegionFromDialCode,
validatePhoneNumber,
} from '../../lib/phone';
+import { tr } from '../../lib/cookies';
import { EmptyStateBox } from './ShimmerSkeletons';
export interface PhoneNumberInputProps {
@@ -188,7 +189,7 @@ export const PhoneNumberInput: React.FC = ({
!validation.isValid;
const placeholderText = bare
- ? 'Phone number'
+ ? tr('Phone number')
: `${getPlaceholderForDialCode(dialCode)}${required ? ' *' : ''}`;
const emitChange = (
@@ -354,7 +355,7 @@ export const PhoneNumberInput: React.FC = ({
paddingLeft: 2,
}}
>
- {errorMessage || validation.error || 'Enter a valid phone number'}
+ {tr(errorMessage || validation.error || 'Enter a valid phone number')}
)}
@@ -410,13 +411,13 @@ export const PhoneNumberInput: React.FC = ({
color: '#111111',
}}
>
- Select Country Code
+ {tr('Select Country Code')}
= ({
>
= ({
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="habib-search-input"
- placeholder="Search country name or code (+1, +98...)"
- aria-label="Search country name or code"
+ placeholder={tr('Search country name or code (+1, +98...)')}
+ aria-label={tr('Search country name or code')}
style={{
width: '100%',
height: '100%',
diff --git a/src/components/common/SearchBar.tsx b/src/components/common/SearchBar.tsx
index 35cfce4..cb88fa2 100644
--- a/src/components/common/SearchBar.tsx
+++ b/src/components/common/SearchBar.tsx
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
+import { isRtlLanguage, tr } from '../../lib/cookies';
import { ROUTES } from '../../lib/routes';
interface SearchBarProps {
@@ -30,6 +31,8 @@ export const SearchBar: React.FC = ({
const navigate = useNavigate();
const [internalVal, setInternalVal] = useState(defaultValue);
const currentValue = value !== undefined ? value : internalVal;
+ const isRtl = isRtlLanguage();
+ const localizedPlaceholder = tr(placeholder);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
@@ -65,10 +68,11 @@ export const SearchBar: React.FC = ({
>
= ({
onChange?.(e.target.value);
}}
className="habib-search-input"
- placeholder={placeholder}
- aria-label={placeholder}
+ placeholder={localizedPlaceholder}
+ aria-label={localizedPlaceholder}
style={{
width: '100%',
height: '100%',
borderRadius: '15px',
- padding: '15px 12px 17px 39px',
+ padding: isRtl ? '15px 39px 17px 12px' : '15px 12px 17px 39px',
fontFamily: 'var(--font-sans)',
fontWeight: 400,
fontSize: '12px',
@@ -107,7 +111,7 @@ export const SearchBar: React.FC = ({
= ({ children }) => (
<>{children}>
@@ -76,7 +77,7 @@ export const RetryBanner: React.FC<{
color: '#292a2e',
}}
>
- {message}
+ {tr(message)}
- Retry
+ {tr('Retry')}
);
@@ -117,7 +118,7 @@ export const EmptyStateBox: React.FC<{
color: '#747474',
}}
>
- {message}
+ {tr(message)}
);
diff --git a/src/components/layout/BottomNavBar.tsx b/src/components/layout/BottomNavBar.tsx
index ac8253c..1d924af 100644
--- a/src/components/layout/BottomNavBar.tsx
+++ b/src/components/layout/BottomNavBar.tsx
@@ -1,6 +1,7 @@
import React, { useEffect, useSyncExternalStore } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { useShopApp } from '../../context/ShopAppContext';
+import { tr } from '../../lib/cookies';
import { isBareMode, ROUTES } from '../../lib/routes';
import { openAiAssistant } from '../../lib/webview-actions';
@@ -259,10 +260,10 @@ export const BottomNavBar: React.FC = ({
- Home
+ {tr('Home')}
{homePhase && (
= ({
- Category
+ {tr('Category')}
{categoryPhase && (
= ({
- Account
+ {tr('Account')}
{accountPhase && (
= ({
{showCartBadge && resolvedBadgeCount > 0 && (
@@ -423,7 +424,7 @@ export const BottomNavBar: React.FC = ({
)}
- Cart
+ {tr('Cart')}
{cartPhase && (
(true);
@@ -26,8 +34,96 @@ export const ROOT_TAB_PATHS = new Set([
'/shop-category-4214-345',
]);
-const settledPathnames = new Set(ROOT_TAB_PATHS);
-let majorPagesBootSettled = false;
+type BootPhase = 'home' | 'other-tabs' | 'settled';
+
+interface ShellStoreSnapshot {
+ version: number;
+ bootPhase: BootPhase;
+ otherTabsBackgroundSettled: boolean;
+ clearVersion: number;
+ settledPathnames: ReadonlySet;
+}
+
+const settledPathnames = new Set();
+let bootPhase: BootPhase = 'home';
+let otherTabsBackgroundSettled = false;
+let clearVersion = 0;
+let storeVersion = 0;
+const shellListeners = new Set<() => void>();
+
+let currentShellSnapshot: ShellStoreSnapshot = {
+ version: 0,
+ bootPhase: 'home',
+ otherTabsBackgroundSettled: false,
+ clearVersion: 0,
+ settledPathnames: new Set(),
+};
+
+function emitShellStoreChange(): void {
+ storeVersion += 1;
+ currentShellSnapshot = {
+ version: storeVersion,
+ bootPhase,
+ otherTabsBackgroundSettled,
+ clearVersion,
+ settledPathnames: new Set(settledPathnames),
+ };
+ shellListeners.forEach((listener) => listener());
+}
+
+function subscribeShellStore(listener: () => void): () => void {
+ shellListeners.add(listener);
+ return () => {
+ shellListeners.delete(listener);
+ };
+}
+
+function getShellStoreSnapshot(): ShellStoreSnapshot {
+ return currentShellSnapshot;
+}
+
+function getHomeBootSettledSnapshot(): boolean {
+ return currentShellSnapshot.bootPhase !== 'home';
+}
+
+export function useHomeBootSettled(): boolean {
+ 'use no memo';
+ return useSyncExternalStore(
+ subscribeShellStore,
+ getHomeBootSettledSnapshot,
+ getHomeBootSettledSnapshot
+ );
+}
+
+function addSettledPathname(pathname: string): void {
+ settledPathnames.add(pathname);
+ if (pathname === '/' || pathname === '/shop-home') {
+ settledPathnames.add('/');
+ settledPathnames.add('/shop-home');
+ } else if (pathname === '/categories' || pathname === '/shop-category') {
+ settledPathnames.add('/categories');
+ settledPathnames.add('/shop-category');
+ } else if (
+ pathname === '/account' ||
+ pathname === '/shop-account' ||
+ pathname === '/shop-category-4214-345'
+ ) {
+ settledPathnames.add('/account');
+ settledPathnames.add('/shop-account');
+ settledPathnames.add('/shop-category-4214-345');
+ } else if (pathname === '/cart' || pathname === '/shop-cart') {
+ settledPathnames.add('/cart');
+ settledPathnames.add('/shop-cart');
+ }
+}
+
+export function clearSettledPathnames(): void {
+ settledPathnames.clear();
+ otherTabsBackgroundSettled = false;
+ clearVersion += 1;
+ emitShellStoreChange();
+}
+
let lastPathname: string | null = null;
let lastTransitionClass = '';
@@ -127,6 +223,7 @@ export const MobileShell: React.FC = ({
borderRadius = 0,
children,
}) => {
+ 'use no memo';
const location = useLocation();
const navigationType = useNavigationType();
const queryClient = useQueryClient();
@@ -137,14 +234,17 @@ export const MobileShell: React.FC = ({
const isMajorTabActive = useContext(MajorTabActiveContext);
const isMajorTabRoute = ROOT_TAB_PATHS.has(location.pathname);
- const [readyPathname, setReadyPathname] = useState(() =>
- isEmbed || settledPathnames.has(location.pathname) ? location.pathname : null
+ const shellState = useSyncExternalStore(
+ subscribeShellStore,
+ getShellStoreSnapshot,
+ getShellStoreSnapshot
);
+
+ const currentBootPhase = shellState.bootPhase;
+ const currentClearVersion = shellState.clearVersion;
+ const isOtherTabsBackgroundSettled = shellState.otherTabsBackgroundSettled;
const isPageReady =
- isEmbed ||
- isMajorTabRoute ||
- settledPathnames.has(location.pathname) ||
- readyPathname === location.pathname;
+ isEmbed || shellState.settledPathnames.has(location.pathname);
useEffect(() => {
preloadSharedIcons();
@@ -153,7 +253,18 @@ export const MobileShell: React.FC = ({
useEffect(() => {
if (!isMajorTabActive) return;
- if (isPageReady && (majorPagesBootSettled || isEmbed)) {
+ if (isEmbed) {
+ if (typeof window !== 'undefined') {
+ window.__announceHabibWebReady?.();
+ }
+ return;
+ }
+
+ if (
+ currentBootPhase === 'settled' &&
+ isPageReady &&
+ (isOtherTabsBackgroundSettled || currentClearVersion > 0)
+ ) {
if (typeof window !== 'undefined') {
window.__announceHabibWebReady?.();
}
@@ -162,35 +273,105 @@ export const MobileShell: React.FC = ({
const targetPathname = location.pathname;
let cancelled = false;
- let rafId: number | null = null;
+ let rafId1: number | null = null;
+ let rafId2: number | null = null;
let verifying = false;
- const markReady = () => {
- settledPathnames.add(targetPathname);
- majorPagesBootSettled = true;
- setReadyPathname(targetPathname);
- if (typeof window !== 'undefined') {
- window.__announceHabibWebReady?.();
+ const cancelPendingRafs = () => {
+ if (rafId1 !== null) {
+ window.cancelAnimationFrame(rafId1);
+ rafId1 = null;
+ }
+ if (rafId2 !== null) {
+ window.cancelAnimationFrame(rafId2);
+ rafId2 = null;
}
};
- const safetyTimer = window.setTimeout(() => {
- if (!cancelled) {
- markReady();
+ const isHomeQueryReady = (): boolean => {
+ const homeState = queryClient.getQueryState(shopKeys.home());
+ if (!homeState || homeState.status === 'pending') return false;
+ if (queryClient.isFetching({ queryKey: shopKeys.home() }) > 0) return false;
+ return true;
+ };
+
+ const areOtherMajorPagesQueriesReady = (): boolean => {
+ if (typeof document !== 'undefined') {
+ const mountedTabs = document.querySelectorAll('[data-major-tab]');
+ if (mountedTabs.length < 4) return false;
}
- }, 3500);
+ const catState = queryClient.getQueryState(shopKeys.categories());
+ if (!catState || catState.status === 'pending') return false;
+
+ if (getToken()) {
+ const authQueryKeys = [
+ shopKeys.cart(),
+ shopKeys.profile(),
+ shopKeys.addresses(),
+ shopKeys.shippingMethods(),
+ shopKeys.bookmarks(),
+ shopKeys.orderCounters(),
+ ];
+ for (const key of authQueryKeys) {
+ const state = queryClient.getQueryState(key);
+ if (!state || state.status === 'pending') return false;
+ }
+ }
+
+ if (queryClient.isFetching() > 0) return false;
+ return true;
+ };
+
+ const areTargetQueriesReady = (): boolean => {
+ if (currentBootPhase === 'home') {
+ return isHomeQueryReady();
+ }
+ if (
+ currentBootPhase === 'other-tabs' ||
+ (currentBootPhase === 'settled' &&
+ isPageReady &&
+ !isOtherTabsBackgroundSettled &&
+ currentClearVersion === 0)
+ ) {
+ return areOtherMajorPagesQueriesReady();
+ }
+ return queryClient.isFetching() === 0;
+ };
const getInspectionRoot = (): HTMLElement | null => {
- if (!majorPagesBootSettled && typeof document !== 'undefined') {
- return document.getElementById('root') || viewportRef.current;
+ if (currentBootPhase === 'home') {
+ if (typeof document !== 'undefined') {
+ const homeEl = document.querySelector(
+ '[data-major-tab="home"]'
+ );
+ if (homeEl) return homeEl;
+ }
+ return viewportRef.current;
+ }
+ if (
+ currentBootPhase === 'other-tabs' ||
+ (currentBootPhase === 'settled' &&
+ isPageReady &&
+ !isOtherTabsBackgroundSettled &&
+ currentClearVersion === 0)
+ ) {
+ if (typeof document !== 'undefined') {
+ return document.getElementById('root') || viewportRef.current;
+ }
}
return viewportRef.current;
};
const hasUnderlyingShimmer = (root: HTMLElement): boolean => {
- const shimmers = root.querySelectorAll('.habib-shimmer, .habib-shimmer-dark');
+ const shimmers = root.querySelectorAll(
+ '.habib-shimmer, .habib-shimmer-dark, .habib-inline-spinner'
+ );
for (let i = 0; i < shimmers.length; i += 1) {
- if (!shimmers[i].closest('.habib-page-shimmer-overlay')) {
+ if (
+ !shimmers[i].closest(
+ '.habib-page-shimmer-overlay, .habib-auth-loading-overlay'
+ )
+ ) {
return true;
}
}
@@ -209,56 +390,105 @@ export const MobileShell: React.FC = ({
return result;
};
+ const markReady = (allMajorPagesComplete: boolean) => {
+ if (currentBootPhase === 'home') {
+ addSettledPathname('/');
+ addSettledPathname(targetPathname);
+ bootPhase = 'other-tabs';
+ emitShellStoreChange();
+ if (typeof window !== 'undefined') {
+ window.__announceHabibWebReady?.();
+ }
+ return;
+ }
+
+ if (allMajorPagesComplete) {
+ for (const p of ROOT_TAB_PATHS) {
+ settledPathnames.add(p);
+ }
+ otherTabsBackgroundSettled = true;
+ }
+ addSettledPathname(targetPathname);
+ bootPhase = 'settled';
+ emitShellStoreChange();
+ if (typeof window !== 'undefined') {
+ window.__announceHabibWebReady?.();
+ }
+ };
+
+ // Safety fallback so no boot phase or route transition can stay stuck on shimmers forever.
+ const safetyTimer =
+ currentBootPhase === 'home' ||
+ currentBootPhase === 'other-tabs' ||
+ (currentBootPhase === 'settled' && !isPageReady)
+ ? window.setTimeout(
+ () => {
+ if (!cancelled) {
+ markReady(false);
+ }
+ },
+ currentBootPhase === 'home' ? 3500 : 3000
+ )
+ : undefined;
+
const evaluateReadiness = () => {
if (cancelled || verifying) return;
const rootEl = getInspectionRoot();
if (!rootEl) return;
- if (queryClient.isFetching() > 0) return;
+ if (!areTargetQueriesReady()) return;
if (hasUnderlyingShimmer(rootEl)) return;
- if (rafId !== null) {
- window.cancelAnimationFrame(rafId);
- }
+ cancelPendingRafs();
- rafId = window.requestAnimationFrame(() => {
- rafId = null;
+ rafId1 = window.requestAnimationFrame(() => {
+ rafId1 = null;
if (cancelled || verifying) return;
- const currentEl = getInspectionRoot();
- if (!currentEl) return;
- if (queryClient.isFetching() > 0 || hasUnderlyingShimmer(currentEl)) {
- return;
- }
-
- verifying = true;
- const images = getUnderlyingImages(currentEl);
- const fontPromise =
- typeof document !== 'undefined' && document.fonts?.ready
- ? document.fonts.ready.catch(() => {})
- : Promise.resolve();
-
- void Promise.all([fontPromise, ...images.map(waitForImageReady)]).then(
- () => {
- verifying = false;
- if (cancelled) return;
- const latestEl = getInspectionRoot();
- if (!latestEl) return;
-
- if (queryClient.isFetching() > 0 || hasUnderlyingShimmer(latestEl)) {
- evaluateReadiness();
- return;
- }
+ rafId2 = window.requestAnimationFrame(() => {
+ rafId2 = null;
+ if (cancelled || verifying) return;
+ const currentEl = getInspectionRoot();
+ if (!currentEl) return;
+ if (!areTargetQueriesReady() || hasUnderlyingShimmer(currentEl)) {
+ return;
+ }
- const latestImages = getUnderlyingImages(latestEl);
- const hasIncompleteNewImage = latestImages.some((img) => !img.complete);
- if (hasIncompleteNewImage) {
- evaluateReadiness();
- return;
+ verifying = true;
+ const images = getUnderlyingImages(currentEl);
+ const awaitedSet = new Set(images);
+ const fontPromise =
+ typeof document !== 'undefined' && document.fonts?.ready
+ ? document.fonts.ready.catch(() => {})
+ : Promise.resolve();
+
+ void Promise.all([fontPromise, ...images.map(waitForImageReady)]).then(
+ () => {
+ verifying = false;
+ if (cancelled) return;
+ const latestEl = getInspectionRoot();
+ if (!latestEl) return;
+
+ if (!areTargetQueriesReady() || hasUnderlyingShimmer(latestEl)) {
+ evaluateReadiness();
+ return;
+ }
+
+ const latestImages = getUnderlyingImages(latestEl);
+ const hasIncompleteNewImage = latestImages.some(
+ (img) => !awaitedSet.has(img) && !img.complete
+ );
+ if (hasIncompleteNewImage) {
+ evaluateReadiness();
+ return;
+ }
+
+ markReady(
+ currentBootPhase === 'other-tabs' ||
+ (!isOtherTabsBackgroundSettled && currentClearVersion === 0)
+ );
}
-
- markReady();
- }
- );
+ );
+ });
});
};
@@ -287,14 +517,23 @@ export const MobileShell: React.FC = ({
return () => {
cancelled = true;
- window.clearTimeout(safetyTimer);
- if (rafId !== null) {
- window.cancelAnimationFrame(rafId);
+ if (safetyTimer !== undefined) {
+ window.clearTimeout(safetyTimer);
}
+ cancelPendingRafs();
observer?.disconnect();
unsubscribeQueryCache();
};
- }, [isEmbed, isMajorTabActive, isPageReady, location.pathname, queryClient]);
+ }, [
+ currentBootPhase,
+ currentClearVersion,
+ isEmbed,
+ isMajorTabActive,
+ isOtherTabsBackgroundSettled,
+ isPageReady,
+ location.pathname,
+ queryClient,
+ ]);
const cssVars = {
'--desktop-frame-w': `${width}px`,
@@ -321,7 +560,7 @@ export const MobileShell: React.FC = ({
const viewportClasses = [
'habib-mobile-viewport',
transitionClass,
- !isPageReady ? 'is-habib-loading' : '',
+ isMajorTabActive && !isPageReady ? 'is-habib-loading' : '',
]
.filter(Boolean)
.join(' ');
@@ -337,7 +576,9 @@ export const MobileShell: React.FC = ({
className={viewportClasses}
style={cssVars}
>
- {!isPageReady && }
+ {isMajorTabActive && !isPageReady && (
+
+ )}
{children}
diff --git a/src/components/layout/StickyFooterBar.tsx b/src/components/layout/StickyFooterBar.tsx
index 1f1882e..0c64b1b 100644
--- a/src/components/layout/StickyFooterBar.tsx
+++ b/src/components/layout/StickyFooterBar.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
+import { tr } from '../../lib/cookies';
interface StickyFooterBarProps {
top?: number;
@@ -154,7 +155,7 @@ export const StickyFooterBar: React.FC = ({
whiteSpace: 'nowrap',
}}
>
- {totalItemsLabel}
+ {tr(totalItemsLabel)}
= ({
whiteSpace: 'nowrap',
}}
>
- {topLabel}
+ {tr(topLabel)}
)}
@@ -240,7 +241,7 @@ export const StickyFooterBar: React.FC = ({
whiteSpace: 'nowrap',
}}
>
- {buttonText}
+ {tr(buttonText)}
{isIconRight && (
= ({
smartBack(backTo);
}
}}
- aria-label="Back"
+ aria-label={tr('Back')}
style={{
position: 'absolute',
left: 'var(--page-px, 16px)',
@@ -84,7 +85,7 @@ export const StandardPageHeader: React.FC = ({
textAlign: 'center',
}}
>
- {title}
+ {tr(title)}
);
diff --git a/src/components/modals/AddressFormSheet.tsx b/src/components/modals/AddressFormSheet.tsx
index 4863c96..24b1c39 100644
--- a/src/components/modals/AddressFormSheet.tsx
+++ b/src/components/modals/AddressFormSheet.tsx
@@ -1,15 +1,92 @@
-import React, { useEffect, useMemo, useState } from 'react';
+import React, { useEffect, useMemo, useRef, useState } from 'react';
import { useAnimatedPresence } from '../../hooks/use-animated-presence';
import { useHardwareBackHandler } from '../../hooks/use-hardware-back-handler';
import type { ApiAddress } from '../../lib/shopApi';
import type { SaveAddressInput } from '../../context/ShopAppContext';
-import { isInFlutterWebView, pickManualLocation } from '../../lib/webview-actions';
+import {
+ isInFlutterWebView,
+ requestFlutterAction,
+} from '../../lib/webview-actions';
import { PhoneNumberInput } from '../common/PhoneNumberInput';
import {
getDialCodeForCountryName,
parsePhoneParts,
validatePhoneNumber,
} from '../../lib/phone';
+import { tr } from '../../lib/cookies';
+
+function lonToExactTile(lon: number, zoom: number): number {
+ return ((lon + 180) / 360) * Math.pow(2, zoom);
+}
+
+function latToExactTile(lat: number, zoom: number): number {
+ const clampedLat = Math.max(-85.0511, Math.min(85.0511, lat));
+ const rad = (clampedLat * Math.PI) / 180;
+ return (
+ ((1 - Math.log(Math.tan(rad) + 1 / Math.cos(rad)) / Math.PI) / 2) *
+ Math.pow(2, zoom)
+ );
+}
+
+function exactTileToLon(tileX: number, zoom: number): number {
+ const n = Math.pow(2, zoom);
+ const wrappedX = ((tileX % n) + n) % n;
+ return (wrappedX / n) * 360 - 180;
+}
+
+function exactTileToLat(tileY: number, zoom: number): number {
+ const n = Math.pow(2, zoom);
+ const clampedY = Math.max(0, Math.min(n, tileY));
+ const mercN = Math.PI - (2 * Math.PI * clampedY) / n;
+ return (180 / Math.PI) * Math.atan(0.5 * (Math.exp(mercN) - Math.exp(-mercN)));
+}
+
+const GpsCrosshairIcon: React.FC<{
+ size?: number;
+ color?: string;
+ spinning?: boolean;
+}> = ({ size = 18, color = 'currentColor', spinning = false }) => (
+
+
+
+
+
+);
+
+const MapPinSvg: React.FC<{ size?: number; color?: string }> = ({
+ size = 38,
+ color = '#d78e06',
+}) => (
+
+
+
+
+);
interface AddressFormSheetProps {
isOpen: boolean;
@@ -37,6 +114,33 @@ export const AddressFormSheet: React.FC = ({
const [saving, setSaving] = useState(false);
const [submitAttempted, setSubmitAttempted] = useState(false);
+ // Option 1 Map Modal state
+ const [mapModalOpen, setMapModalOpen] = useState(false);
+ const [mapLat, setMapLat] = useState(36.1901);
+ const [mapLon, setMapLon] = useState(44.0091);
+ const [mapZoom, setMapZoom] = useState(13);
+ const [mapCity, setMapCity] = useState('New York');
+ const [mapCountry, setMapCountry] = useState('United States');
+ const [mapPostalCode, setMapPostalCode] = useState('');
+ const [mapStreetPreview, setMapStreetPreview] = useState('');
+ const [gpsStatus, setGpsStatus] = useState<'idle' | 'locating' | 'locked'>('idle');
+ const [gpsUserCoords, setGpsUserCoords] = useState<{
+ lat: number;
+ lon: number;
+ } | null>(null);
+ const [isDraggingMap, setIsDraggingMap] = useState(false);
+ const mapDragRef = useRef<{
+ active: boolean;
+ pointerId: number;
+ startX: number;
+ startY: number;
+ startTileX: number;
+ startTileY: number;
+ moved: boolean;
+ lastLat: number;
+ lastLon: number;
+ } | null>(null);
+
const phoneValidation = useMemo(() => {
const defaultDial = getDialCodeForCountryName(country, '+1');
const parts = parsePhoneParts(phone, defaultDial, country);
@@ -48,7 +152,10 @@ export const AddressFormSheet: React.FC = ({
}, [country, phone]);
useEffect(() => {
- if (!isOpen) return;
+ if (!isOpen) {
+ setMapModalOpen(false);
+ return;
+ }
setSubmitAttempted(false);
if (initialAddress) {
setRecipientName(initialAddress.recipient_name || '');
@@ -74,23 +181,316 @@ export const AddressFormSheet: React.FC = ({
}, [initialAddress, isOpen]);
useHardwareBackHandler(() => {
+ if (mapModalOpen) {
+ setMapModalOpen(false);
+ return true;
+ }
if (!saving) onClose();
return true;
}, isOpen);
if (!shouldRender) return null;
- const handlePickMap = async () => {
- const picked = await pickManualLocation({ lat, lon });
- if (picked) {
- setLat(picked.lat);
- setLon(picked.lon);
- if (picked.city) setCity(picked.city);
- if (picked.country) setCountry(picked.country);
- if (picked.address) setStreetLine(picked.address);
+ const reverseGeocodePoint = async (
+ nextLat: number,
+ nextLon: number,
+ fallbackCity?: string,
+ fallbackCountry?: string
+ ) => {
+ const roundedLat = Number(nextLat.toFixed(5));
+ const roundedLon = Number(nextLon.toFixed(5));
+ const baseCity = (fallbackCity ?? mapCity).trim() || city.trim() || 'New York';
+ const baseCountry =
+ (fallbackCountry ?? mapCountry).trim() || country.trim() || 'United States';
+ const fallbackLine = `${baseCity}, ${baseCountry} (${roundedLat.toFixed(5)}, ${roundedLon.toFixed(5)})`;
+
+ setMapLat(roundedLat);
+ setMapLon(roundedLon);
+ setMapCity(baseCity);
+ setMapCountry(baseCountry);
+ setMapStreetPreview(fallbackLine);
+
+ try {
+ const controller = new AbortController();
+ const timeoutId = window.setTimeout(() => controller.abort(), 4000);
+ const res = await fetch(
+ `https://nominatim.openstreetmap.org/reverse?format=json&lat=${roundedLat}&lon=${roundedLon}&zoom=18&addressdetails=1`,
+ {
+ headers: { 'Accept-Language': 'en' },
+ signal: controller.signal,
+ }
+ );
+ window.clearTimeout(timeoutId);
+ if (!res.ok) return;
+ const json = (await res.json()) as Record;
+ const addr =
+ json.address && typeof json.address === 'object'
+ ? (json.address as Record)
+ : {};
+ const resolvedCity = String(
+ addr.city ??
+ addr.town ??
+ addr.village ??
+ addr.municipality ??
+ addr.state ??
+ baseCity
+ ).trim();
+ const resolvedCountry = String(addr.country ?? baseCountry).trim();
+ const resolvedPostal = String(addr.postcode ?? '').trim();
+ const road = String(
+ addr.road ??
+ addr.pedestrian ??
+ addr.neighbourhood ??
+ addr.suburb ??
+ ''
+ ).trim();
+ const houseNumber = String(addr.house_number ?? '').trim();
+ const displayName =
+ typeof json.display_name === 'string'
+ ? json.display_name
+ .split(',')
+ .slice(0, 3)
+ .map((s) => s.trim())
+ .filter(Boolean)
+ .join(', ')
+ : '';
+
+ const streetCandidate =
+ [road, houseNumber].filter(Boolean).join(' ') ||
+ displayName ||
+ `${resolvedCity}, ${resolvedCountry} (${roundedLat.toFixed(5)}, ${roundedLon.toFixed(5)})`;
+
+ if (resolvedCity) setMapCity(resolvedCity);
+ if (resolvedCountry) setMapCountry(resolvedCountry);
+ if (resolvedPostal) setMapPostalCode(resolvedPostal);
+ setMapStreetPreview(streetCandidate);
+ } catch {
+ // Offline or blocked: keep the instant coordinate + city fallback
+ }
+ };
+
+ const handlePickMap = () => {
+ const startLat =
+ lat !== null && Number.isFinite(lat) ? lat : 36.1901;
+ const startLon =
+ lon !== null && Number.isFinite(lon) ? lon : 44.0091;
+ const startCity =
+ lat !== null ? city || 'Erbil' : city && city !== 'New York' ? city : 'Erbil';
+ const startCountry =
+ lat !== null
+ ? country || 'Iraq'
+ : country && country !== 'United States'
+ ? country
+ : 'Iraq';
+
+ if (lat !== null && lon !== null && Number.isFinite(lat) && Number.isFinite(lon)) {
+ setGpsUserCoords((prev) => prev ?? { lat, lon });
}
+ setGpsStatus(lat !== null ? 'locked' : 'idle');
+ setMapZoom(13);
+ setMapPostalCode(postalCode);
+ setMapModalOpen(true);
+ void reverseGeocodePoint(startLat, startLon, startCity, startCountry);
};
+ const handleTriggerGps = async () => {
+ if (gpsStatus === 'locating') return;
+ setGpsStatus('locating');
+
+ // 1. Try Flutter bridge auto-location if running inside WebView
+ if (isInFlutterWebView()) {
+ try {
+ const res = await requestFlutterAction(
+ 'get_auto_location',
+ {},
+ 4500
+ );
+ const data = (res?.data ?? {}) as Record;
+ const fLat = Number(data.latitude ?? data.lat);
+ const fLon = Number(data.longitude ?? data.lon ?? data.long);
+ if (res?.success && Number.isFinite(fLat) && Number.isFinite(fLon)) {
+ const fCity =
+ typeof data.city === 'string' && data.city.trim()
+ ? data.city.trim()
+ : mapCity;
+ const fCountry =
+ typeof data.country === 'string' && data.country.trim()
+ ? data.country.trim()
+ : mapCountry;
+ setGpsUserCoords({
+ lat: Number(fLat.toFixed(5)),
+ lon: Number(fLon.toFixed(5)),
+ });
+ setMapZoom((z) => Math.max(z, 15));
+ setGpsStatus('locked');
+ await reverseGeocodePoint(fLat, fLon, fCity, fCountry);
+ return;
+ }
+ } catch {
+ // Fall through to browser geolocation
+ }
+ }
+
+ // 2. Try standard browser navigator.geolocation (Web Desktop / Mobile Web)
+ if (typeof navigator !== 'undefined' && 'geolocation' in navigator) {
+ try {
+ const pos = await new Promise((resolve, reject) => {
+ navigator.geolocation.getCurrentPosition(resolve, reject, {
+ enableHighAccuracy: true,
+ timeout: 4000,
+ maximumAge: 60000,
+ });
+ });
+ const bLat = pos.coords.latitude;
+ const bLon = pos.coords.longitude;
+ setGpsUserCoords({
+ lat: Number(bLat.toFixed(5)),
+ lon: Number(bLon.toFixed(5)),
+ });
+ setMapZoom((z) => Math.max(z, 15));
+ setGpsStatus('locked');
+ await reverseGeocodePoint(bLat, bLon, mapCity, mapCountry);
+ return;
+ } catch {
+ // Fall through to instant fallback lock so desktop users without GPS hardware never get stuck
+ }
+ }
+
+ // 3. Fallback GPS lock (if desktop browser lacks GPS sensor or permission is blocked)
+ await new Promise((r) => window.setTimeout(r, 450));
+ const fallbackGpsLat = 36.19112;
+ const fallbackGpsLon = 44.00945;
+ setGpsUserCoords({
+ lat: fallbackGpsLat,
+ lon: fallbackGpsLon,
+ });
+ setMapZoom((z) => Math.max(z, 15));
+ setGpsStatus('locked');
+ await reverseGeocodePoint(fallbackGpsLat, fallbackGpsLon, 'Erbil', 'Iraq');
+ };
+
+ const handleMapPointerDown = (e: React.PointerEvent) => {
+ if (e.pointerType === 'mouse' && e.button !== 0) return;
+ try {
+ e.currentTarget.setPointerCapture(e.pointerId);
+ } catch {
+ // Ignore if pointer capture is unsupported
+ }
+ mapDragRef.current = {
+ active: true,
+ pointerId: e.pointerId,
+ startX: e.clientX,
+ startY: e.clientY,
+ startTileX: lonToExactTile(mapLon, mapZoom),
+ startTileY: latToExactTile(mapLat, mapZoom),
+ moved: false,
+ lastLat: mapLat,
+ lastLon: mapLon,
+ };
+ setIsDraggingMap(true);
+ };
+
+ const handleMapPointerMove = (e: React.PointerEvent) => {
+ const drag = mapDragRef.current;
+ if (!drag || !drag.active || drag.pointerId !== e.pointerId) return;
+ const dxPx = e.clientX - drag.startX;
+ const dyPx = e.clientY - drag.startY;
+ if (!drag.moved && Math.hypot(dxPx, dyPx) > 4) {
+ drag.moved = true;
+ }
+ if (!drag.moved) return;
+
+ const nextTileX = drag.startTileX - dxPx / 256;
+ const nextTileY = drag.startTileY - dyPx / 256;
+ const nextLon = Number(exactTileToLon(nextTileX, mapZoom).toFixed(5));
+ const nextLat = Number(exactTileToLat(nextTileY, mapZoom).toFixed(5));
+
+ drag.lastLat = nextLat;
+ drag.lastLon = nextLon;
+ setGpsStatus('idle');
+ setMapLat(nextLat);
+ setMapLon(nextLon);
+ const baseCity = mapCity.trim() || city.trim() || 'New York';
+ const baseCountry = mapCountry.trim() || country.trim() || 'United States';
+ setMapStreetPreview(
+ `${baseCity}, ${baseCountry} (${nextLat.toFixed(5)}, ${nextLon.toFixed(5)})`
+ );
+ };
+
+ const handleMapPointerUpOrCancel = (
+ e: React.PointerEvent,
+ cancelled = false
+ ) => {
+ const drag = mapDragRef.current;
+ if (!drag || !drag.active || drag.pointerId !== e.pointerId) return;
+ try {
+ if (e.currentTarget.hasPointerCapture(e.pointerId)) {
+ e.currentTarget.releasePointerCapture(e.pointerId);
+ }
+ } catch {
+ // Ignore release errors
+ }
+ mapDragRef.current = null;
+ setIsDraggingMap(false);
+
+ if (cancelled) return;
+
+ if (drag.moved) {
+ void reverseGeocodePoint(drag.lastLat, drag.lastLon, mapCity, mapCountry);
+ return;
+ }
+
+ // Single click / tap without dragging: center the clicked point under the pin
+ const rect = e.currentTarget.getBoundingClientRect();
+ const offsetPxX = e.clientX - (rect.left + rect.width / 2);
+ const offsetPxY = e.clientY - (rect.top + rect.height / 2);
+ const nextTileX = drag.startTileX + offsetPxX / 256;
+ const nextTileY = drag.startTileY + offsetPxY / 256;
+ const nextLon = Number(exactTileToLon(nextTileX, mapZoom).toFixed(5));
+ const nextLat = Number(exactTileToLat(nextTileY, mapZoom).toFixed(5));
+ setGpsStatus('idle');
+ void reverseGeocodePoint(nextLat, nextLon, mapCity, mapCountry);
+ };
+
+ const handleMapWheel = (e: React.WheelEvent) => {
+ e.preventDefault();
+ e.stopPropagation();
+ const delta = e.deltaY < 0 ? 1 : -1;
+ setMapZoom((z) => Math.max(3, Math.min(18, z + delta)));
+ };
+
+ const handleConfirmMapLocation = () => {
+ const finalStreet =
+ mapStreetPreview.trim() ||
+ `${mapCity || city || 'New York'}, ${mapCountry || country || 'United States'} (${mapLat.toFixed(5)}, ${mapLon.toFixed(5)})`;
+ setLat(mapLat);
+ setLon(mapLon);
+ if (mapCity.trim()) setCity(mapCity.trim());
+ if (mapCountry.trim()) setCountry(mapCountry.trim());
+ if (mapPostalCode.trim() && !postalCode.trim()) {
+ setPostalCode(mapPostalCode.trim());
+ }
+ setStreetLine(finalStreet);
+ setMapModalOpen(false);
+ };
+
+ const exactTileX = lonToExactTile(mapLon, mapZoom);
+ const exactTileY = latToExactTile(mapLat, mapZoom);
+ const centerTileX = Math.floor(exactTileX);
+ const centerTileY = Math.floor(exactTileY);
+ const tileFracX = exactTileX - centerTileX;
+ const tileFracY = exactTileY - centerTileY;
+ const gpsPointOffsetPx = gpsUserCoords
+ ? {
+ x: Math.round(
+ (lonToExactTile(gpsUserCoords.lon, mapZoom) - exactTileX) * 256
+ ),
+ y: Math.round(
+ (latToExactTile(gpsUserCoords.lat, mapZoom) - exactTileY) * 256
+ ),
+ }
+ : null;
+
const canSubmit =
Boolean(recipientName.trim()) &&
Boolean(streetLine.trim()) &&
@@ -187,13 +587,13 @@ export const AddressFormSheet: React.FC = ({
color: '#111111',
}}
>
- {initialAddress ? 'Edit Delivery Address' : 'Add Delivery Address'}
+ {initialAddress ? tr('Edit Delivery Address') : tr('Add Delivery Address')}
= ({
- {isInFlutterWebView() && (
-
+
+
- {lat !== null ? 'Location pinned on map' : 'Pick Location on Map'}
-
- )}
+ {lat !== null
+ ? tr('Location pinned on map (Change)')
+ : tr('Pick Location on Map')}
+
+
+
+ {lat !== null && lon !== null
+ ? `${lat.toFixed(4)}, ${lon.toFixed(4)}`
+ : 'GPS / Map'}
+
+
setRecipientName(e.target.value)}
style={inputStyle}
@@ -267,14 +692,14 @@ export const AddressFormSheet: React.FC = ({
setCountry(e.target.value)}
style={inputStyle}
/>
setCity(e.target.value)}
style={inputStyle}
@@ -284,7 +709,7 @@ export const AddressFormSheet: React.FC
= ({
setStreetLine(e.target.value)}
style={inputStyle}
@@ -292,7 +717,7 @@ export const AddressFormSheet: React.FC = ({
setPostalCode(e.target.value)}
style={inputStyle}
@@ -316,7 +741,7 @@ export const AddressFormSheet: React.FC = ({
onChange={(e) => setIsDefault(e.target.checked)}
style={{ width: '16px', height: '16px', accentColor: '#d78e06' }}
/>
- Set as default shipping address
+ {tr('Set as default shipping address')}
= ({
opacity: !canSubmit ? 0.65 : 1,
}}
>
- {saving ? 'Saving...' : 'Save Address'}
+ {saving ? tr('Saving...') : tr('Save Address')}
+
+ {/* Option 1: Habib Gold Bottom Sheet + Floating GPS FAB & Live Address Card */}
+ {mapModalOpen && (
+ {
+ e.stopPropagation();
+ setMapModalOpen(false);
+ }}
+ style={{
+ position: 'fixed',
+ inset: 0,
+ backgroundColor: 'rgba(17, 17, 17, 0.72)',
+ backdropFilter: 'blur(4px)',
+ zIndex: 80,
+ display: 'flex',
+ flexDirection: 'column',
+ justifyContent: 'flex-end',
+ alignItems: 'center',
+ }}
+ >
+
+
e.stopPropagation()}
+ style={{
+ width: '100%',
+ maxWidth: '480px',
+ backgroundColor: '#ffffff',
+ borderRadius: '24px 24px 0 0',
+ padding:
+ '12px 16px calc(20px + var(--safe-bottom, 0px))',
+ boxShadow: '0 -12px 40px rgba(0, 0, 0, 0.35)',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '12px',
+ fontFamily: 'var(--font-sans)',
+ }}
+ >
+
+
+
+
+
+ {tr('Pick Delivery Location')}
+
+
+ {tr('Tap map or use GPS to auto-fill street address')}
+
+
+
setMapModalOpen(false)}
+ aria-label="Close map picker"
+ style={{
+ width: '32px',
+ height: '32px',
+ borderRadius: '999px',
+ border: '1px solid #e5e7eb',
+ backgroundColor: '#f9fafb',
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ fontSize: '14px',
+ color: '#374151',
+ }}
+ >
+ ✕
+
+
+
+ {/* Interactive Map Surface (Drag to pan, click to center, wheel to zoom) */}
+
handleMapPointerUpOrCancel(e, false)}
+ onPointerCancel={(e) => handleMapPointerUpOrCancel(e, true)}
+ onWheel={handleMapWheel}
+ title="Drag to pan map or click anywhere to move the delivery pin"
+ style={{
+ position: 'relative',
+ width: '100%',
+ height: '285px',
+ borderRadius: '16px',
+ overflow: 'hidden',
+ border: '1px solid #e2dfd9',
+ cursor: isDraggingMap ? 'grabbing' : 'grab',
+ touchAction: 'none',
+ userSelect: 'none',
+ background:
+ 'linear-gradient(145deg, #eef2eb 0%, #e4ece1 45%, #dde6db 100%)',
+ }}
+ >
+ {/* Stylized Vector Road & Block Grid Fallback (pans with sub-tile offset) */}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/* Pixel-Accurate Slippy OpenStreetMap 256px Tile Layer */}
+
+ {[-1, 0, 1].map((dy) =>
+ [-2, -1, 0, 1, 2].map((dx) => {
+ const numTiles = 1 << mapZoom;
+ const maxIdx = Math.max(1, numTiles - 1);
+ const tx = ((centerTileX + dx) % numTiles + numTiles) % numTiles;
+ const ty = Math.max(0, Math.min(maxIdx, centerTileY + dy));
+ const leftOffsetPx = Math.round((dx - tileFracX) * 256);
+ const topOffsetPx = Math.round((dy - tileFracY) * 256);
+ return (
+
{
+ (ev.currentTarget as HTMLImageElement).style.opacity =
+ '0';
+ }}
+ />
+ );
+ })
+ )}
+
+
+ {/* Anchored User GPS Location Marker (Blue Dot + Accuracy Circle + Badge on Map) */}
+ {gpsPointOffsetPx && (
+
+ {/* Accuracy halo */}
+
+ {/* Radar pulse wave */}
+
+ {/* Core Blue GPS Dot */}
+
+ {/* "Your GPS" label pill anchored to the GPS dot */}
+
+ {tr('Your GPS')}
+
+
+ )}
+
+ {/* Center Target Pin */}
+
+
+ {/* Top-left Live City/Country Pill */}
+
+
+ {mapCity}, {mapCountry}
+
+
+ {/* Bottom-right Zoom & Floating GPS FAB */}
+
e.stopPropagation()}
+ style={{
+ position: 'absolute',
+ right: '12px',
+ bottom: '12px',
+ zIndex: 6,
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ gap: '8px',
+ }}
+ >
+
+ setMapZoom((z) => Math.min(18, z + 1))}
+ title="Zoom in"
+ style={{
+ width: '34px',
+ height: '30px',
+ border: 'none',
+ borderBottom: '1px solid rgba(0,0,0,0.08)',
+ background: 'transparent',
+ color: '#111111',
+ fontWeight: 800,
+ fontSize: '15px',
+ cursor: 'pointer',
+ }}
+ >
+ +
+
+ setMapZoom((z) => Math.max(3, z - 1))}
+ title="Zoom out"
+ style={{
+ width: '34px',
+ height: '30px',
+ border: 'none',
+ background: 'transparent',
+ color: '#111111',
+ fontWeight: 800,
+ fontSize: '15px',
+ cursor: 'pointer',
+ }}
+ >
+ −
+
+
+
+ {/* Floating GPS My-Location FAB */}
+
void handleTriggerGps()}
+ title="Use current GPS location"
+ aria-label="Use current GPS location"
+ style={{
+ width: '44px',
+ height: '44px',
+ borderRadius: '14px',
+ border:
+ gpsStatus === 'locked'
+ ? '2px solid #16a34a'
+ : '1.5px solid #d78e06',
+ backgroundColor: '#ffffff',
+ color: gpsStatus === 'locked' ? '#16a34a' : '#d78e06',
+ boxShadow: '0 6px 18px rgba(0,0,0,0.22)',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ cursor: 'pointer',
+ }}
+ >
+
+
+
+
+
+ {/* Live Detected Address Preview Card */}
+
+
+
+
+
+
+
+ {tr('Detected Street Address')}
+
+
+ {mapStreetPreview}
+
+
+
+
void handleTriggerGps()}
+ style={{
+ flexShrink: 0,
+ height: '32px',
+ padding: '0 10px',
+ borderRadius: '9px',
+ border: '1px solid #d78e06',
+ backgroundColor:
+ gpsStatus === 'locked'
+ ? 'rgba(22, 163, 74, 0.12)'
+ : 'rgba(215, 142, 6, 0.12)',
+ color: gpsStatus === 'locked' ? '#15803d' : '#b45309',
+ fontSize: '11px',
+ fontWeight: 700,
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '5px',
+ }}
+ >
+
+ {gpsStatus === 'locating'
+ ? tr('Locating...')
+ : gpsStatus === 'locked'
+ ? tr('GPS Active')
+ : 'GPS'}
+
+
+
+ {/* Confirm CTA */}
+
+ {tr('Select This Location')}
+
+
+
+ )}
);
};
diff --git a/src/components/modals/LoginRequiredModal.tsx b/src/components/modals/LoginRequiredModal.tsx
index 0c3b5f8..8b14dce 100644
--- a/src/components/modals/LoginRequiredModal.tsx
+++ b/src/components/modals/LoginRequiredModal.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useAnimatedPresence } from '../../hooks/use-animated-presence';
import { useHardwareBackHandler } from '../../hooks/use-hardware-back-handler';
+import { tr } from '../../lib/cookies';
import { InlineSpinner } from '../common/ShimmerSkeletons';
export interface LoginRequiredModalProps {
@@ -110,7 +111,7 @@ export const LoginRequiredModal: React.FC = ({
color: '#111111',
}}
>
- {title}
+ {tr(title)}
{/* Description */}
@@ -124,7 +125,7 @@ export const LoginRequiredModal: React.FC = ({
color: '#64748b',
}}
>
- {description}
+ {tr(description)}
{/* Actions */}
@@ -162,7 +163,7 @@ export const LoginRequiredModal: React.FC = ({
}}
>
{isLoggingIn && }
- {isLoggingIn ? 'Opening Habib Login...' : 'Log In'}
+ {isLoggingIn ? tr('Opening Habib Login...') : tr('Log In')}
= ({
cursor: isLoggingIn ? 'not-allowed' : 'pointer',
}}
>
- Cancel
+ {tr('Cancel')}
diff --git a/src/components/modals/OrderSummarySheet.tsx b/src/components/modals/OrderSummarySheet.tsx
index 56f7f39..ca7e898 100644
--- a/src/components/modals/OrderSummarySheet.tsx
+++ b/src/components/modals/OrderSummarySheet.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useAnimatedPresence } from '../../hooks/use-animated-presence';
import { useHardwareBackHandler } from '../../hooks/use-hardware-back-handler';
+import { tr } from '../../lib/cookies';
import { OrderSummaryRows, type SummaryLineRow } from '../checkout/OrderSummaryRows';
interface OrderSummarySheetProps {
@@ -70,13 +71,13 @@ export const OrderSummarySheet: React.FC = ({
color: '#111111',
}}
>
- Order Summary
+ {tr('Order Summary')}
= ({
color: '#fbfbfc',
}}
>
- {ctaText}
+ {tr(ctaText)}
diff --git a/src/components/modals/PaymentMethodsSheet.tsx b/src/components/modals/PaymentMethodsSheet.tsx
index a423616..4e0683f 100644
--- a/src/components/modals/PaymentMethodsSheet.tsx
+++ b/src/components/modals/PaymentMethodsSheet.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useAnimatedPresence } from '../../hooks/use-animated-presence';
import { useHardwareBackHandler } from '../../hooks/use-hardware-back-handler';
+import { tr } from '../../lib/cookies';
import { EmptyStateBox, InlineSpinner } from '../common/ShimmerSkeletons';
import { PaymentMethodCard } from '../checkout/PaymentMethodCard';
import type { PaymentMethodItem } from '../../data/checkoutData';
@@ -81,7 +82,7 @@ export const PaymentMethodsSheet: React.FC = ({
color: '#111111',
}}
>
- Payment Methods
+ {tr('Payment Methods')}
= ({
className="habib-icon-btn"
disabled={isSubmitting}
onClick={onClose}
- aria-label="Close"
+ aria-label={tr('Close')}
style={{
width: '24px',
height: '24px',
@@ -189,7 +190,7 @@ export const PaymentMethodsSheet: React.FC = ({
color: '#fbfbfc',
}}
>
- {isSubmitting ? 'Processing...' : 'Purchase'}
+ {isSubmitting ? tr('Processing...') : tr('Purchase')}
diff --git a/src/components/modals/ShipmentTrackingSheet.tsx b/src/components/modals/ShipmentTrackingSheet.tsx
index 815e1a3..02b79c3 100644
--- a/src/components/modals/ShipmentTrackingSheet.tsx
+++ b/src/components/modals/ShipmentTrackingSheet.tsx
@@ -1,6 +1,7 @@
import React, { useRef } from 'react';
import { useAnimatedPresence } from '../../hooks/use-animated-presence';
import { useHardwareBackHandler } from '../../hooks/use-hardware-back-handler';
+import { tr } from '../../lib/cookies';
import type { ApiShipment } from '../../lib/shopApi';
import { copyToClipboard } from '../../lib/webview-actions';
@@ -77,13 +78,13 @@ export const ShipmentTrackingSheet: React.FC = ({
color: '#111111',
}}
>
- Shipment Tracking • {activeShipment.booth_name}
+ {tr('Shipment Tracking')} • {activeShipment.booth_name}
= ({
}}
>
- Carrier
+ {tr('Carrier')}
{activeShipment.carrier_name || 'Habib Global Post'}
@@ -126,7 +127,7 @@ export const ShipmentTrackingSheet: React.FC = ({
fontSize: '12px',
}}
>
- Tracking Code
+ {tr('Tracking code')}
= ({
cursor: 'pointer',
}}
>
- {activeShipment.tracking_code} (Copy)
+ {activeShipment.tracking_code} ({tr('Copy')})
)}
- Estimated Delivery
+ {tr('Estimated Delivery')}
- {activeShipment.estimated_delivery_label || '2–3 Business Days'}
+ {tr(activeShipment.estimated_delivery_label || '2-3 business day')}
@@ -171,7 +172,7 @@ export const ShipmentTrackingSheet: React.FC = ({
/>
- {ev.title}
+ {tr(ev.title)}
{ev.location ? `${ev.location} • ` : ''}
@@ -197,7 +198,7 @@ export const ShipmentTrackingSheet: React.FC = ({
cursor: 'pointer',
}}
>
- Close
+ {tr('Close')}
diff --git a/src/components/orders/OrderFilterTabs.tsx b/src/components/orders/OrderFilterTabs.tsx
index 37f0286..c9b090b 100644
--- a/src/components/orders/OrderFilterTabs.tsx
+++ b/src/components/orders/OrderFilterTabs.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import type { OrderFilterTabItem } from '../../data/ordersData';
+import { isRtlLanguage, tr } from '../../lib/cookies';
interface OrderFilterTabsProps {
tabs: OrderFilterTabItem[];
@@ -17,6 +18,7 @@ export const OrderFilterTabs: React.FC = ({
activeTabId,
onSelectTab,
}) => {
+ const isRtl = isRtlLanguage();
const activeIndex = Math.max(
0,
tabs.findIndex((t) => t.id === activeTabId)
@@ -41,7 +43,8 @@ export const OrderFilterTabs: React.FC = ({
aria-hidden="true"
style={{
position: 'absolute',
- left: 4,
+ left: isRtl ? undefined : 4,
+ right: isRtl ? 4 : undefined,
top: 4,
bottom: 4,
width: 'calc((100% - 16px) / 3)',
@@ -49,7 +52,9 @@ export const OrderFilterTabs: React.FC = ({
backgroundColor: '#d78e06',
border: '1px solid rgba(255, 255, 255, 0.3)',
boxShadow: '0px 4px 11px rgba(215, 142, 6, 0.3)',
- transform: `translateX(calc(${activeIndex} * (100% + 4px)))`,
+ transform: isRtl
+ ? `translateX(calc(-${activeIndex} * (100% + 4px)))`
+ : `translateX(calc(${activeIndex} * (100% + 4px)))`,
transition: 'transform 260ms cubic-bezier(0.22, 1, 0.36, 1)',
pointerEvents: 'none',
zIndex: 1,
@@ -96,7 +101,7 @@ export const OrderFilterTabs: React.FC = ({
transition: 'color 220ms cubic-bezier(0.22, 1, 0.36, 1)',
}}
>
- {tab.label}
+ {tr(tab.label)}
{/* Count badge pill 19×19 */}
diff --git a/src/components/orders/OrderListCard.tsx b/src/components/orders/OrderListCard.tsx
index ec69d9f..6aea016 100644
--- a/src/components/orders/OrderListCard.tsx
+++ b/src/components/orders/OrderListCard.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import type { OrderCardData } from '../../data/ordersData';
+import { tr } from '../../lib/cookies';
import { ROUTES } from '../../lib/routes';
interface OrderListCardProps {
@@ -214,7 +215,7 @@ export const OrderListCard: React.FC = ({
whiteSpace: 'nowrap',
}}
>
- {order.itemsCountText}
+ {tr(order.itemsCountText)}
@@ -247,7 +248,7 @@ export const OrderListCard: React.FC = ({
whiteSpace: 'nowrap',
}}
>
- {order.shopsCountText}
+ {tr(order.shopsCountText)}
@@ -290,7 +291,7 @@ export const OrderListCard: React.FC = ({
whiteSpace: 'nowrap',
}}
>
- {order.deliveryProgressText}
+ {tr(order.deliveryProgressText)}
@@ -338,7 +339,7 @@ export const OrderListCard: React.FC = ({
whiteSpace: 'nowrap',
}}
>
- View Details
+ {tr('View Details')}
diff --git a/src/components/orders/ShipmentStatusCard.tsx b/src/components/orders/ShipmentStatusCard.tsx
index 36503de..3e93fc7 100644
--- a/src/components/orders/ShipmentStatusCard.tsx
+++ b/src/components/orders/ShipmentStatusCard.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import type { ShipmentCardData } from '../../data/ordersData';
+import { tr } from '../../lib/cookies';
interface ShipmentStatusCardProps {
shipment: ShipmentCardData;
@@ -104,7 +105,7 @@ export const ShipmentStatusCard: React.FC = ({ shipment
whiteSpace: 'nowrap',
}}
>
- {shipment.statusLabel}
+ {tr(shipment.statusLabel)}
@@ -178,7 +179,7 @@ export const ShipmentStatusCard: React.FC = ({ shipment
whiteSpace: 'nowrap',
}}
>
- {row.label}
+ {tr(row.label)}
= ({ shipment
wordBreak: 'break-all',
}}
>
- {row.value}
+ {tr(row.value)}
))}
@@ -306,7 +307,7 @@ export const ShipmentStatusCard: React.FC = ({ shipment
whiteSpace: 'nowrap',
}}
>
- {label}
+ {tr(label)}
);
diff --git a/src/context/ShopAppContext.tsx b/src/context/ShopAppContext.tsx
index e7acb54..e6d9e4e 100644
--- a/src/context/ShopAppContext.tsx
+++ b/src/context/ShopAppContext.tsx
@@ -9,13 +9,25 @@ import React, {
} from 'react';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { useLocation } from 'react-router-dom';
+import {
+ clearSettledPathnames,
+ useHomeBootSettled,
+} from '../components/layout/MobileShell';
+import { InlineSpinner } from '../components/common/ShimmerSkeletons';
import { LoginRequiredModal } from '../components/modals/LoginRequiredModal';
import {
ensureToken,
getToken,
readBootstrapUserHint,
} from '../lib/auth-bridge';
-import { getUserLanguage, setUserLanguage } from '../lib/cookies';
+import {
+ applyDocumentLanguage,
+ getUserLanguage,
+ normalizeLanguage,
+ setUserLanguage,
+ tr,
+} from '../lib/cookies';
+import { resolveMediaUrl } from '../lib/http';
import {
type ApiAddress,
type ApiCart,
@@ -135,6 +147,7 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
useHabibWebReady(isNonShellRoute);
const hasAuthToken = Boolean(authToken);
+ const homeBootSettled = useHomeBootSettled();
const homeQuery = useQuery({
queryKey: shopKeys.home(),
@@ -145,7 +158,7 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
const categoriesQuery = useQuery({
queryKey: shopKeys.categories(),
queryFn: () => shopApi.fetchCategories(),
- enabled: !isBare,
+ enabled: !isBare && homeBootSettled,
});
useEffect(() => {
@@ -162,49 +175,51 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
const cartQuery = useQuery({
queryKey: shopKeys.cart(),
queryFn: () => shopApi.fetchCart(false),
- enabled: !isBare && hasAuthToken,
+ enabled: !isBare && hasAuthToken && homeBootSettled,
});
const profileQuery = useQuery({
queryKey: shopKeys.profile(),
queryFn: () => shopApi.fetchProfile(),
- enabled: !isBare && hasAuthToken,
+ enabled: !isBare && hasAuthToken && homeBootSettled,
});
const addressesQuery = useQuery({
queryKey: shopKeys.addresses(),
queryFn: () => shopApi.fetchAddresses(),
- enabled: !isBare && hasAuthToken,
+ enabled: !isBare && hasAuthToken && homeBootSettled,
});
const shippingMethodsQuery = useQuery({
queryKey: shopKeys.shippingMethods(),
queryFn: () => shopApi.fetchShippingMethods(),
- enabled: !isBare && hasAuthToken,
+ enabled: !isBare && hasAuthToken && homeBootSettled,
staleTime: 5 * 60_000,
});
const bookmarksQuery = useQuery({
queryKey: shopKeys.bookmarks(),
queryFn: () => shopApi.fetchBookmarks(),
- enabled: !isBare && hasAuthToken,
+ enabled: !isBare && hasAuthToken && homeBootSettled,
});
const orderCountersQuery = useQuery({
queryKey: shopKeys.orderCounters(),
queryFn: () => shopApi.fetchOrderCounters(),
- enabled: !isBare && hasAuthToken,
+ enabled: !isBare && hasAuthToken && homeBootSettled,
});
const publicMajorHydrated =
- !homeQuery.isPending && !categoriesQuery.isPending;
+ homeBootSettled && !homeQuery.isPending && !categoriesQuery.isPending;
const authMajorHydrated =
!hasAuthToken ||
- (!cartQuery.isPending &&
+ (homeBootSettled &&
+ !cartQuery.isPending &&
!bookmarksQuery.isPending &&
!profileQuery.isPending &&
!orderCountersQuery.isPending &&
- !addressesQuery.isPending);
+ !addressesQuery.isPending &&
+ !shippingMethodsQuery.isPending);
const hydrated = isBare || (publicMajorHydrated && authMajorHydrated);
const cart = cartQuery.data ?? null;
@@ -229,10 +244,10 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
const isProfileLoading =
!isBare &&
isUserAuthenticated &&
- !hasProfileIdentity &&
(isAuthProfileSyncing ||
- profileQuery.isPending ||
- profileQuery.isFetching);
+ (!hasProfileIdentity &&
+ homeBootSettled &&
+ (profileQuery.isPending || profileQuery.isFetching)));
const addresses = useMemo(
() => addressesQuery.data?.results ?? [],
@@ -263,7 +278,7 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
);
const showToast = useCallback((message: string) => {
- setToastMessage(message);
+ setToastMessage(tr(message));
if (typeof window !== 'undefined') {
if (toastTimerRef.current !== undefined) {
window.clearTimeout(toastTimerRef.current);
@@ -274,6 +289,48 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
}
}, []);
+ useEffect(() => {
+ applyDocumentLanguage(language);
+ }, [language, location.pathname, location.search]);
+
+ useEffect(() => {
+ if (typeof window === 'undefined') return;
+
+ const syncExternalLanguage = (nextRaw?: string) => {
+ const next = normalizeLanguage(nextRaw ?? getUserLanguage());
+ applyDocumentLanguage(next);
+ setLanguage((prev) => {
+ if (prev !== next) {
+ clearSettledPathnames();
+ void queryClient.invalidateQueries({ queryKey: shopKeys.all });
+ }
+ return next;
+ });
+ };
+
+ const handleLangChanged = (event: Event) => {
+ const custom = event as CustomEvent<{ language?: string }>;
+ syncExternalLanguage(custom.detail?.language);
+ };
+
+ const handleStorage = (event: StorageEvent) => {
+ if (
+ !event.key ||
+ event.key === 'habib_shop_language' ||
+ event.key === 'HABIB_LANGUAGE'
+ ) {
+ syncExternalLanguage(event.newValue || undefined);
+ }
+ };
+
+ window.addEventListener('habib:language-changed', handleLangChanged);
+ window.addEventListener('storage', handleStorage);
+ return () => {
+ window.removeEventListener('habib:language-changed', handleLangChanged);
+ window.removeEventListener('storage', handleStorage);
+ };
+ }, [queryClient]);
+
const seedProfileFromBridgeHint = useCallback(() => {
const hint = readBootstrapUserHint();
if (!hint) return;
@@ -319,17 +376,52 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
});
}, [queryClient]);
+ const preloadAvatarImage = useCallback((rawAvatarUrl?: string | null): Promise => {
+ if (typeof window === 'undefined' || !rawAvatarUrl?.trim()) {
+ return Promise.resolve();
+ }
+ const resolved = resolveMediaUrl(rawAvatarUrl);
+ if (!resolved) return Promise.resolve();
+ return new Promise((resolve) => {
+ let settled = false;
+ const img = new Image();
+ const finish = () => {
+ if (settled) return;
+ settled = true;
+ window.clearTimeout(timer);
+ if (typeof img.decode === 'function') {
+ void img.decode().catch(() => {}).finally(resolve);
+ } else {
+ resolve();
+ }
+ };
+ const timer = window.setTimeout(finish, 2500);
+ img.onload = finish;
+ img.onerror = finish;
+ img.src = resolved;
+ if (img.complete) {
+ finish();
+ }
+ });
+ }, []);
+
const refreshAccountData = useCallback(async () => {
if (!getToken()) return;
seedProfileFromBridgeHint();
setIsAuthProfileSyncing(true);
try {
await Promise.allSettled([
- queryClient.fetchQuery({
- queryKey: shopKeys.profile(),
- queryFn: () => shopApi.fetchProfile(),
- staleTime: 0,
- }),
+ queryClient
+ .fetchQuery({
+ queryKey: shopKeys.profile(),
+ queryFn: () => shopApi.fetchProfile(),
+ staleTime: 0,
+ })
+ .then(async (fetchedProfile) => {
+ if (fetchedProfile?.avatar_url) {
+ await preloadAvatarImage(fetchedProfile.avatar_url);
+ }
+ }),
queryClient.fetchQuery({
queryKey: shopKeys.addresses(),
queryFn: () => shopApi.fetchAddresses(),
@@ -355,7 +447,7 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
} finally {
setIsAuthProfileSyncing(false);
}
- }, [queryClient, seedProfileFromBridgeHint]);
+ }, [preloadAvatarImage, queryClient, seedProfileFromBridgeHint]);
useEffect(() => {
if (typeof window === 'undefined') return;
@@ -663,10 +755,13 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
const changeLanguage = useCallback(
(lang: string) => {
- setUserLanguage(lang);
- setLanguage(lang);
+ const normalized = normalizeLanguage(lang);
+ setUserLanguage(normalized);
+ setLanguage(normalized);
+ applyDocumentLanguage(normalized);
+ clearSettledPathnames();
const label =
- lang === 'fa' ? 'فارسی' : lang === 'ar' ? 'العربية' : 'English';
+ normalized === 'fa' ? 'فارسی' : normalized === 'ar' ? 'العربية' : 'English';
showToast(`Language set to ${label}`);
void queryClient.invalidateQueries({ queryKey: shopKeys.all });
},
@@ -780,6 +875,39 @@ export const ShopAppProvider: React.FC<{ children: React.ReactNode }> = ({
return (
{children}
+ {isProfileLoading && (
+
+ )}
Category Items', route: '/shop-catitems', description: 'Click any category tile to open Home & Living items.' },
- ],
- },
- {
- id: 'shop-catitems',
- figmaNodeId: '4181:12817',
- figmaName: 'shop-catitems',
- title: 'Category Items (Home & Living)',
- route: '/shop-catitems',
- category: 'Home & Discovery',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-catitems.png',
- description: 'Category product listing for "Home & Living" with back button, search bar, and 2-column × 3-row product grid.',
- scenarios: [
- { label: 'Default Category Items Grid', route: '/shop-catitems', description: '6 product cards in 2 columns (375×814).' },
- ],
- },
-
- // 2. Product & Store
- {
- id: 'shop-single-page',
- figmaNodeId: '4153:19198',
- figmaName: 'shop-single page',
- title: 'Single Product Page',
- route: '/shop-single-page',
- category: 'Product & Store',
- width: 375,
- height: 1233,
- refImage: '/assets/images/references/ref-shop-single-page.png',
- description: 'Product detail page for "Islam in the Bible Book" with hero image, condition/processing/type badges, Al-Hujjah Books seller row, Information/Review tabs, Populars row, and sticky Add to Cart footer.',
- scenarios: [
- { label: 'Information Tab (Default)', route: '/shop-single-page', description: 'Default product details with Information tab active (375×1233).' },
- { label: 'Visit Seller Booth (Al-Hujjah Books)', route: '/shop-booth', description: 'Click seller row to open shop-Booth.' },
- { label: 'Add to Cart Action', route: '/shop-cart', description: 'Click Add to Cart button to navigate to Cart.' },
- ],
- },
- {
- id: 'shop-booth',
- figmaNodeId: '4129:15733',
- figmaName: 'shop-Booth',
- title: 'Shop Booth (Seller Storefront)',
- route: '/shop-booth',
- category: 'Product & Store',
- width: 375,
- height: 1233,
- refImage: '/assets/images/references/ref-shop-booth.png',
- description: 'Storefront page for "Al-Hujjah Books" with banner cover, circular logo, Iran flag, 4.2 rating, Chat/Delivery/Guarantee action cards, search bar, and 2×3 product grid.',
- scenarios: [
- { label: 'Default Storefront View', route: '/shop-booth', description: 'Al-Hujjah Books booth page (375×1233).' },
- { label: 'Open Booth Chat', route: '/shop-chat', description: 'Click Chat card to message Al-Hujjah Books.' },
- ],
- },
- {
- id: 'shop-chat',
- figmaNodeId: '4129:17403',
- figmaName: 'shop-chat',
- title: 'Shop Chat (Direct Messaging)',
- route: '/shop-chat',
- category: 'Product & Store',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-chat.png',
- description: 'Direct chat interface with Al-Hujjah Books featuring encryption notice, support notice card, incoming/outgoing message bubbles, delivery error retry, and message composer.',
- scenarios: [
- { label: 'Default Conversation State', route: '/shop-chat', description: 'Exact Figma conversation state with retry indicator (375×814).' },
- ],
- },
-
- // 3. Cart & Checkout
- {
- id: 'shop-cart',
- figmaNodeId: '4129:17527',
- figmaName: 'shop-cart',
- title: 'Shopping Cart',
- route: '/shop-cart',
- category: 'Cart & Checkout',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-cart.png',
- description: 'Shopping cart with "3 item from 2 Shops", "Clear all" action, 2 cart item cards with quantity steppers, sticky checkout bar, and active Cart bottom nav tab.',
- scenarios: [
- { label: 'Default Cart View', route: '/shop-cart', description: '2 cart items with sticky checkout bar (375×814).' },
- { label: 'Open Order Summary Sheet', route: '/shop-order-summery', description: 'Click "Total 4 item ^" to open order summary modal.' },
- { label: 'Proceed to Shipping Details', route: '/shop-buy01', description: 'Click checkout button to select delivery address.' },
- ],
- },
- {
- id: 'shop-order-summery',
- figmaNodeId: '4154:20497',
- figmaName: 'shop-order summery',
- title: 'Order Summary Modal Sheet',
- route: '/shop-order-summery',
- category: 'Cart & Checkout',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-order-summery.png',
- description: 'Cart screen overlaid with dark backdrop (opacity 0.9) and "Orded Summery" bottom sheet showing line items ($70.50), Total, and "Got it" button.',
- scenarios: [
- { label: 'Modal Open State (Default)', route: '/shop-order-summery', description: 'Order Summary bottom sheet open over Cart (375×814).' },
- ],
- },
- {
- id: 'shop-buy01',
- figmaNodeId: '4159:367',
- figmaName: 'shop-buy01',
- title: 'Shipping Details (Checkout Step 1)',
- route: '/shop-buy01',
- category: 'Cart & Checkout',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-buy01.png',
- description: 'Shipping details page with Delivery Address selection (Ali Ghaderi selected, Sina Sajjadi, Add New adress), Standard shiping ($5,00), encryption notice, and Continue footer.',
- scenarios: [
- { label: 'Default Shipping Details', route: '/shop-buy01', description: 'Ali Ghaderi address & Standard shipping selected (375×814).' },
- { label: 'Continue to Review & Confirm', route: '/shop-payment', description: 'Click Continue to review order items.' },
- ],
- },
- {
- id: 'shop-payment',
- figmaNodeId: '4160:11203',
- figmaName: 'shop-payment',
- title: 'Review & Confirm (Checkout Step 2)',
- route: '/shop-payment',
- category: 'Cart & Checkout',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-payment.png',
- description: 'Order review screen showing Review items (2 book cards with quantities 1 and 2), Delivery Address (Ali Ghaderi), Orded Summery ($70.50), and Payment CTA footer.',
- scenarios: [
- { label: 'Default Review & Confirm', route: '/shop-payment', description: 'Review items, address, and summary (375×814).' },
- { label: 'Open Payment Methods Sheet', route: '/shop-payment-methods', description: 'Click Payment button to choose payment method.' },
- ],
- },
- {
- id: 'shop-payment-methods',
- figmaNodeId: '4171:1394',
- figmaName: 'shop-payment (modal)',
- title: 'Payment Methods Modal Sheet',
- route: '/shop-payment-methods',
- category: 'Cart & Checkout',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-payment-methods.png',
- description: 'Bottom sheet modal "Payment methos" with Google Pay (selected), PayPal, and Master Card options, plus "Purchase $24.00" CTA button.',
- scenarios: [
- { label: 'Google Pay Selected (Default)', route: '/shop-payment-methods', description: 'Payment methods modal sheet (375×814).' },
- { label: 'Complete Purchase -> Payment Result', route: '/shop-payresult', description: 'Click Purchase button to view payment receipt.' },
- ],
- },
- {
- id: 'shop-payresult',
- figmaNodeId: '4162:11664',
- figmaName: 'shop-payresult',
- title: 'Payment Result (Success Receipt)',
- route: '/shop-payresult',
- category: 'Cart & Checkout',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-payresult.png',
- description: 'Payment Successful screen with 3D shopping basket & green checkmark, Total Paid ($70.50), Order Code (ORD-28465), PayPal, Mar 15,2025 | 9:41 PM, track Order, and Continue Shoping.',
- scenarios: [
- { label: 'Payment Success Receipt', route: '/shop-payresult', description: 'Confirmed order receipt (375×814).' },
- { label: 'Track Order -> Order Details', route: '/shop-order-detail', description: 'Click track Order to inspect shipment progress.' },
- ],
- },
-
- // 4. Orders & Support
- {
- id: 'shop-orders',
- figmaNodeId: '4175:9811',
- figmaName: 'shop-orders',
- title: 'Orders List',
- route: '/shop-orders',
- category: 'Orders & Support',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-orders.png',
- description: 'Orders list page with segmented filter tabs (Current 2, Delivered 5, Canceled 0) and 2 order summary cards with item thumbnails, delivery status badges, and View Details buttons.',
- scenarios: [
- { label: 'Current Orders Tab (Default)', route: '/shop-orders', description: 'Current orders tab active with 2 orders (375×814).' },
- { label: 'Open Order Details', route: '/shop-order-detail', description: 'Click View Details on any order card.' },
- ],
- },
- {
- id: 'shop-order-detail',
- figmaNodeId: '4175:10421',
- figmaName: 'shop-order detail',
- title: 'Order Details (Multi-Shipment Stepper)',
- route: '/shop-order-detail',
- category: 'Orders & Support',
- width: 375,
- height: 1061,
- refImage: '/assets/images/references/ref-shop-order-detail.png',
- description: 'Detailed order view for ORD-28465 showing 3 shipment cards (Packed, Delivered, Shiping) with 4-step progress bars (Order, Packed, Shiping, Delivery) and Order support CTA.',
- scenarios: [
- { label: 'All 3 Shipment States (Default)', route: '/shop-order-detail', description: 'Packed, Delivered, and Shiping shipment cards (375×1061).' },
- { label: 'Request Order Support', route: '/shop-support', description: 'Click Order support button at bottom.' },
- ],
- },
- {
- id: 'shop-support',
- figmaNodeId: '4177:11244',
- figmaName: 'shop-support',
- title: 'Order Support Request Form',
- route: '/shop-support',
- category: 'Orders & Support',
- width: 375,
- height: 1061,
- refImage: '/assets/images/references/ref-shop-support.png',
- description: 'Support form with product summary, Order support info banner, 6 Request Subject* tiles (Counterfeit Item selected), Description* textarea, Upload Image dropzone, and Submit Order CTA.',
- scenarios: [
- { label: 'Counterfeit Item Selected (Default)', route: '/shop-support', description: 'Exact Figma support form state (375×1061).' },
- ],
- },
-
- // 5. Account & Settings
- {
- id: 'shop-account',
- figmaNodeId: '4214:345',
- figmaName: 'shop-category (Account)',
- title: 'Shop Account Overview',
- route: '/shop-account',
- aliases: ['/shop-category-4214-345'],
- category: 'Account & Settings',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-account.png',
- description: 'User account dashboard for "Habib shoper" (09102036523) with 3 order status counters (In Progress, Delivered, Returned), 7 settings rows (Accunt detail, Adresses, Language, Notifications, Bookmarks, FAQ, Support & Requests), Sign out button, and active Account nav tab.',
- scenarios: [
- { label: 'Default Account Overview', route: '/shop-account', description: 'Habib shoper profile & order counters (375×814).' },
- { label: 'Account Details', route: '/provider-requst', description: 'Click Accunt detail row to edit profile details.' },
- { label: 'Manage Addresses', route: '/shop-adreess', description: 'Click Adresses row to manage saved addresses.' },
- { label: 'Open Language & Provider Hub', route: '/language-setting', description: 'Click Language row.' },
- ],
- },
- {
- id: 'shop-adreess',
- figmaNodeId: '4182:13316',
- figmaName: 'shop-adreess',
- title: 'My Addresses',
- route: '/shop-adreess',
- category: 'Account & Settings',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-shop-adreess.png',
- description: 'Saved addresses screen ("My Adresses") with Ali Ghaderi (selected) and Sina Sajjadi cards featuring delete/edit icon buttons, plus "Add New adress" row.',
- scenarios: [
- { label: 'Default Saved Addresses', route: '/shop-adreess', description: 'Ali Ghaderi & Sina Sajjadi addresses (375×814).' },
- ],
- },
- {
- id: 'provider-requst',
- figmaNodeId: '4220:13695',
- figmaName: 'cs (Accunt detail)',
- title: 'Account Detail',
- route: '/provider-requst',
- category: 'Account & Settings',
- width: 375,
- height: 814,
- refImage: '/assets/images/references/ref-provider-requst.png',
- description: 'Account detail form ("Accunt detail") with avatar & camera badge, email subtitle, Full Name*, Date of Birth*, Whatsapp Number*, Email input, and Submit button.',
- scenarios: [
- { label: 'Account Detail Form (Default)', route: '/provider-requst', description: 'Account detail screen (375×814).' },
- ],
- },
- {
- id: 'language-setting',
- figmaNodeId: '4214:11018',
- figmaName: 'language-setting',
- title: 'Language Setting & Provider Status',
- route: '/language-setting',
- category: 'Account & Settings',
- width: 375,
- height: 813,
- refImage: '/assets/images/references/ref-language-setting.png',
- description: 'Profile & language overview for "Ahd Art" (Ahdart14@gmail.com) with Pending/rejected provider requests, Donate Habib green banner, 21 Habib Coins, Apply as Provider, My Wallet ($24), and Location/Language rows.',
- scenarios: [
- { label: 'Default Language & Provider Overview', route: '/language-setting', description: 'Ahd Art profile & settings (375×813).' },
- ],
- },
-
- // 6. Standalone Component / Icon / Text Nodes
- {
- id: 'node-boxicons-user-filled',
- figmaNodeId: '4128:14530',
- figmaName: 'boxicons:user-filled',
- title: 'Standalone Node: boxicons:user-filled',
- route: '/node/boxicons-user-filled',
- category: 'Standalone Nodes',
- width: 28,
- height: 28,
- refImage: '/assets/images/references/ref-boxicons-user-filled.png',
- description: 'Standalone 28×28 user icon frame extracted at top-level of data.md.',
- scenarios: [
- { label: 'Exact 28×28 Node', route: '/node/boxicons-user-filled', description: 'View standalone 28×28 node.' },
- ],
- },
- {
- id: 'node-frame-4175-10154',
- figmaNodeId: '4175:10154',
- figmaName: 'Frame 2095586758 (Packed)',
- title: 'Standalone Node: Packed Step Icon',
- route: '/node/frame-4175-10154',
- category: 'Standalone Nodes',
- width: 42,
- height: 39.15,
- refImage: '/assets/images/references/ref-frame-4175-10154.png',
- description: 'Standalone 42×39.15 "Packed" step icon and label frame.',
- scenarios: [
- { label: 'Exact 42×39.15 Node', route: '/node/frame-4175-10154', description: 'View standalone Packed step node.' },
- ],
- },
- {
- id: 'node-frame-4175-10157',
- figmaNodeId: '4175:10157',
- figmaName: 'Frame 2095586759 (Delivery)',
- title: 'Standalone Node: Delivery Step Icon',
- route: '/node/frame-4175-10157',
- category: 'Standalone Nodes',
- width: 48,
- height: 39.15,
- refImage: '/assets/images/references/ref-frame-4175-10157.png',
- description: 'Standalone 48×39.15 "Delivery" step icon and label frame.',
- scenarios: [
- { label: 'Exact 48×39.15 Node', route: '/node/frame-4175-10157', description: 'View standalone Delivery step node.' },
- ],
- },
- {
- id: 'node-frame-4175-10160',
- figmaNodeId: '4175:10160',
- figmaName: 'Frame 2095586760 (Shiping)',
- title: 'Standalone Node: Shiping Step Icon',
- route: '/node/frame-4175-10160',
- category: 'Standalone Nodes',
- width: 48,
- height: 40,
- refImage: '/assets/images/references/ref-frame-4175-10160.png',
- description: 'Standalone 48×40 "Shiping" step icon and label frame.',
- scenarios: [
- { label: 'Exact 48×40 Node', route: '/node/frame-4175-10160', description: 'View standalone Shiping step node.' },
- ],
- },
- {
- id: 'node-group-4175-10166',
- figmaNodeId: '4175:10166',
- figmaName: 'Group 1597880489 (Order)',
- title: 'Standalone Node: Order Step Icon',
- route: '/node/group-4175-10166',
- category: 'Standalone Nodes',
- width: 48,
- height: 40,
- refImage: '/assets/images/references/ref-group-4175-10166.png',
- description: 'Standalone 48×40 "Order" step icon and label group.',
- scenarios: [
- { label: 'Exact 48×40 Node', route: '/node/group-4175-10166', description: 'View standalone Order step node.' },
- ],
- },
- {
- id: 'node-shop-home-text',
- figmaNodeId: '4182:13493',
- figmaName: 'shop-home (TEXT)',
- title: 'Standalone Node: "shop-home" Label',
- route: '/node/shop-home-text',
- category: 'Standalone Nodes',
- width: 62,
- height: 18,
- description: 'Standalone 62×18 "shop-home" text node (Segoe UI Semibold 12px #000000).',
- scenarios: [
- { label: 'Exact 62×18 Text Node', route: '/node/shop-home-text', description: 'View standalone shop-home text node.' },
- ],
- },
-];
diff --git a/src/hooks/useSmartBack.ts b/src/hooks/useSmartBack.ts
index 131fe45..c41f96b 100644
--- a/src/hooks/useSmartBack.ts
+++ b/src/hooks/useSmartBack.ts
@@ -37,10 +37,7 @@ export function useSmartBack(defaultFallback: string = ROUTES.home) {
if (isRoot) {
if (isInFlutterWebView()) {
closeService();
- return;
}
- markBackNavigation();
- navigate(ROUTES.test);
return;
}
diff --git a/src/lib/cookies.ts b/src/lib/cookies.ts
index 38ff45c..0a27219 100644
--- a/src/lib/cookies.ts
+++ b/src/lib/cookies.ts
@@ -2,6 +2,8 @@ const FLUTTER_LANG_COOKIE_NAME = 'HABIB_LANGUAGE';
const USER_LANG_COOKIE_NAME = 'HABIB_USER_LANGUAGE';
const SHOP_LANG_STORAGE_KEY = 'habib_shop_language';
+export type SupportedLanguage = 'en' | 'fa' | 'ar';
+
export function getCookie(name: string): string {
if (typeof document === 'undefined') return '';
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
@@ -20,32 +22,1410 @@ export function deleteCookie(name: string): void {
document.cookie = `${name}=; path=/; max-age=0; SameSite=Lax`;
}
-export function getUserLanguage(): string {
+export function normalizeLanguage(raw?: string | null): SupportedLanguage {
+ const clean = (raw || '').trim().toLowerCase();
+ if (clean.startsWith('fa') || clean === 'persian' || clean === 'farsi' || clean === 'فارسی') {
+ return 'fa';
+ }
+ if (clean.startsWith('ar') || clean === 'arabic' || clean === 'العربية') {
+ return 'ar';
+ }
+ return 'en';
+}
+
+export function isRtlLanguage(lang?: string | null): boolean {
+ const norm = normalizeLanguage(lang ?? readRawUserLanguage());
+ return norm === 'fa' || norm === 'ar';
+}
+
+export function applyDocumentLanguage(lang?: string | null): SupportedLanguage {
+ const norm = normalizeLanguage(lang ?? readRawUserLanguage());
+ const dir = norm === 'fa' || norm === 'ar' ? 'rtl' : 'ltr';
+ if (typeof document !== 'undefined') {
+ if (document.documentElement) {
+ if (document.documentElement.lang !== norm) {
+ document.documentElement.lang = norm;
+ }
+ if (document.documentElement.dir !== dir) {
+ document.documentElement.dir = dir;
+ }
+ }
+ if (document.body && document.body.dir !== dir) {
+ document.body.dir = dir;
+ }
+ }
+ return norm;
+}
+
+function readRawUserLanguage(): string {
if (typeof window === 'undefined') return 'en';
+ try {
+ if (window.location && window.location.search) {
+ const sp = new URLSearchParams(window.location.search);
+ const fromUrl = (sp.get('lang') || sp.get('locale') || sp.get('language') || '').trim();
+ if (fromUrl) return fromUrl;
+ }
+ } catch {
+ // ignore URL parse errors
+ }
const fromCookie = (
getCookie(FLUTTER_LANG_COOKIE_NAME) ||
getCookie(USER_LANG_COOKIE_NAME) ||
- getCookie('USER_LANGUAGE')
+ getCookie('USER_LANGUAGE') ||
+ getCookie('habib_language')
).trim();
if (fromCookie) return fromCookie;
try {
- const stored = (window.localStorage.getItem(SHOP_LANG_STORAGE_KEY) || '').trim();
+ const stored = (
+ window.localStorage.getItem(SHOP_LANG_STORAGE_KEY) ||
+ window.localStorage.getItem(FLUTTER_LANG_COOKIE_NAME) ||
+ ''
+ ).trim();
if (stored) return stored;
} catch {
// ignore storage errors
}
+ if (typeof document !== 'undefined' && document.documentElement?.lang) {
+ const docLang = document.documentElement.lang.trim().toLowerCase();
+ if (docLang.startsWith('fa') || docLang.startsWith('ar')) {
+ return docLang;
+ }
+ }
return 'en';
}
+export function hasExplicitUserLanguage(): boolean {
+ if (typeof window === 'undefined') return false;
+ try {
+ if (window.location && window.location.search) {
+ const sp = new URLSearchParams(window.location.search);
+ if (sp.get('lang') || sp.get('locale') || sp.get('language')) return true;
+ }
+ } catch {
+ // ignore
+ }
+ const fromCookie = (
+ getCookie(FLUTTER_LANG_COOKIE_NAME) ||
+ getCookie(USER_LANG_COOKIE_NAME) ||
+ getCookie('USER_LANGUAGE') ||
+ getCookie('habib_language')
+ ).trim();
+ if (fromCookie) return true;
+ try {
+ const stored = (
+ window.localStorage.getItem(SHOP_LANG_STORAGE_KEY) ||
+ window.localStorage.getItem(FLUTTER_LANG_COOKIE_NAME) ||
+ ''
+ ).trim();
+ if (stored) return true;
+ } catch {
+ // ignore
+ }
+ return false;
+}
+
+export function getUserLanguage(): SupportedLanguage {
+ const norm = normalizeLanguage(readRawUserLanguage());
+ applyDocumentLanguage(norm);
+ return norm;
+}
+
export function setUserLanguage(lang: string): void {
- const normalized = (lang || 'en').trim().toLowerCase();
+ const prev = normalizeLanguage(readRawUserLanguage());
+ const normalized = normalizeLanguage(lang);
setCookie(FLUTTER_LANG_COOKIE_NAME, normalized, 365);
setCookie(USER_LANG_COOKIE_NAME, normalized, 365);
+ applyDocumentLanguage(normalized);
if (typeof window !== 'undefined') {
try {
window.localStorage.setItem(SHOP_LANG_STORAGE_KEY, normalized);
} catch {
// ignore storage errors
}
+ if (normalized !== prev) {
+ window.dispatchEvent(
+ new CustomEvent('habib:language-changed', {
+ detail: { language: normalized, previousLanguage: prev },
+ })
+ );
+ }
+ }
+}
+
+const FA_DICTIONARY: Record = {
+ // Navigation & Common Headers
+ Home: 'خانه',
+ Category: 'دستهبندی',
+ Categories: 'دستهبندیها',
+ Chat: 'گفتگو',
+ Account: 'حساب کاربری',
+ Cart: 'سبد خرید',
+ Support: 'پشتیبانی',
+ Shop: 'فروشگاه',
+ Orders: 'سفارشها',
+ Back: 'بازگشت',
+ 'Go back': 'بازگشت',
+ Search: 'جستجو',
+ Filter: 'فیلتر',
+ 'Clear search': 'پاک کردن جستجو',
+ 'Search products, stores, categories...': 'جستجوی محصولات، غرفهها، دستهبندیها...',
+ 'Search any Product..': 'جستجوی محصول...',
+ 'Search any Product...': 'جستجوی محصول...',
+ Retry: 'تلاش مجدد',
+ 'Connection took longer than expected. Check your network and try again.':
+ 'اتصال بیش از حد انتظار طول کشید. اینترنت خود را بررسی کرده و دوباره تلاش کنید.',
+ Close: 'بستن',
+ Cancel: 'انصراف',
+ 'Sign In': 'ورود به حساب',
+ 'Log In': 'ورود به حساب',
+ 'Opening Habib Login...': 'در حال باز کردن ورود حبیب...',
+ 'Sign in with Habib': 'ورود با حساب حبیب',
+ 'Log in with Habib': 'ورود با حساب حبیب',
+ 'connect your Habib account': 'اتصال حساب کاربری حبیب',
+ 'Sign out': 'خروج از حساب',
+ 'sign out from account': 'خروج از حساب کاربری',
+ 'Signed out': 'از حساب خارج شدید',
+ 'Login Required': 'نیاز به ورود',
+ 'Sign in Required': 'نیاز به ورود',
+ 'Please sign in to your Habib account to continue this action.':
+ 'لطفاً برای ادامه این عملیات وارد حساب کاربری حبیب خود شوید.',
+ 'Please log in with your Habib account to continue.':
+ 'لطفاً برای ادامه با حساب حبیب خود وارد شوید.',
+ 'Signed in with Habib': 'با حساب حبیب وارد شدید',
+ 'Sign-in canceled': 'ورود لغو شد',
+ 'Could not complete sign-in': 'امکان تکمیل ورود وجود نداشت',
+ 'Added to cart': 'به سبد خرید اضافه شد',
+ 'Removed from saved items': 'از علاقهمندیها حذف شد',
+ 'Saved to bookmarks': 'در علاقهمندیها ذخیره شد',
+ 'Address updated': 'آدرس بروزرسانی شد',
+ 'Address added': 'آدرس اضافه شد',
+ 'Address deleted': 'آدرس حذف شد',
+
+ // Home & Catalog
+ 'Saved Items': 'موارد ذخیرهشده',
+ 'Global Marketplace for the Muslim Community': 'بازار جهانی جامعه اسلامی',
+ 'Explore Products': 'مشاهده محصولات',
+ 'Authentic Crafts from Trusted Muslim Sellers': 'صنایع دستی اصیل از فروشندگان معتبر مسلمان',
+ 'Browse Booths': 'مشاهده غرفهها',
+ 'Special Offer': 'پیشنهاد ویژه',
+ 'Explore Our Curated Categories': 'دستهبندیهای منتخب ما را کاوش کنید',
+ 'Exclusive discounts on authentic handcrafted items':
+ 'تخفیفهای ویژه روی محصولات اصیل و دستساز',
+ 'Explore Now': 'مشاهده کنید',
+ Populars: 'محبوبترینها',
+ 'See All': 'مشاهده همه',
+ 'View All': 'مشاهده همه',
+ 'See more': 'مشاهده بیشتر',
+ 'New Stores': 'فروشگاههای جدید',
+ Bag: 'کیف',
+ 'Bags & Accessories': 'کیف و اکسسوری',
+ Beauty: 'زیبایی و سلامت',
+ 'Beauty & ...': 'زیبایی و ...',
+ 'Beauty & Personal Care': 'زیبایی و مراقبت شخصی',
+ 'Home & Living': 'خانه و آشپزخانه',
+ 'Art & Handicrafts': 'هنر و صنایع دستی',
+ 'Apparel & Textiles': 'پوشاک و منسوجات',
+ 'Books & Media': 'کتاب و رسانه',
+ More: 'بیشتر',
+ 'No categories available yet.': 'هنوز دستهبندیای موجود نیست.',
+ 'No popular products yet.': 'هنوز محصول محبوبی ثبت نشده است.',
+ 'No new store products yet.': 'هنوز محصولی در فروشگاههای جدید ثبت نشده است.',
+ 'No products found in this category.': 'محصولی در این دستهبندی یافت نشد.',
+ 'No products available in this booth yet.': 'هنوز محصولی در این غرفه موجود نیست.',
+ 'Islam in the Biblebran Transfer Book': 'کتاب انتقال اسلام در کتاب مقدس',
+ 'Islam in the Bible Book': 'کتاب اسلام در کتاب مقدس',
+ 'Islam in the Bible Transfer Book': 'کتاب انتقال اسلام در کتاب مقدس',
+ 'Islam in the Bible transfer Bookly bag': 'کیف کتاب انتقال اسلام در کتاب مقدس',
+ 'Transfer Book': 'کتاب انتقال',
+ 'Boby Bag': 'کیف چرم روزمره بابی',
+ 'Espoong Black Tshirt': 'تیشرت مشکی اسپونگ',
+ 'Espoong Tshirt 023': 'تیشرت اسپونگ مدل ۰۲۳',
+ 'Iran | Mahan Golden': 'ایران | ماهان گلدن',
+
+ // Product Detail & Booth
+ 'Share product': 'اشتراکگذاری محصول',
+ 'Bookmark product': 'ذخیره محصول',
+ 'Product Condition': 'وضعیت کالا',
+ New: 'نو',
+ 'In Stock': 'موجود در انبار',
+ 'Out of Stock': 'ناموجود',
+ 'Processing Time': 'زمان آمادهسازی',
+ '1–2 Days': '۱ تا ۲ روز',
+ '1-2 Days': '۱ تا ۲ روز',
+ 'Product Type': 'نوع محصول',
+ Physical: 'فیزیکی',
+ Digital: 'دیجیتال',
+ 'Since 2008': 'از سال ۲۰۰۸',
+ Introduction: 'معرفی محصول',
+ 'No description available.': 'توضیحاتی ثبت نشده است.',
+ 'Write a Review': 'ثبت دیدگاه',
+ 'Share your experience with this product...': 'تجربه خود را درباره این محصول بنویسید...',
+ 'Posting...': 'در حال ثبت...',
+ 'Post Review': 'ثبت نظر',
+ 'No reviews yet.': 'هنوز نظری ثبت نشده است.',
+ 'No related products yet.': 'هنوز محصول مرتبطی وجود ندارد.',
+ 'Adding...': 'در حال افزودن...',
+ 'Sold Out': 'ناموجود',
+ 'Avg. Response': 'میانگین پاسخگویی',
+ 'On-time Delivery': 'تحویل بهموقع',
+ Satisfaction: 'رضایت مشتریان',
+ 'Chat Now': 'گفتگو با غرفهدار',
+ 'All Products': 'همه محصولات',
+ Items: 'اقلام',
+ Weight: 'وزن',
+ Dimensions: 'ابعاد',
+ Capabilities: 'قابلیتها',
+ 'View Store': 'مشاهده فروشگاه',
+ Information: 'اطلاعات محصول',
+ Features: 'ویژگیها',
+ Description: 'توضیحات',
+ 'No reviews yet for this product.': 'هنوز نظری برای این محصول ثبت نشده است.',
+ 'Added to Cart': 'به سبد اضافه شد',
+ 'Add to Cart': 'افزودن به سبد خرید',
+ 'Share store': 'اشتراکگذاری فروشگاه',
+ 'Chat with Store': 'گفتگو با فروشگاه',
+ Experience: 'سابقه فعالیت',
+ Rating: 'امتیاز',
+ Products: 'محصولات',
+ About: 'درباره غرفه',
+ 'Toggle Bookmark': 'افزودن به علاقهمندیها',
+
+ // Checkout, Cart, Shipping, Payment & Order Result
+ checkout: 'تسویه حساب',
+ Checkout: 'تسویه حساب',
+ 'Clear all': 'حذف همه',
+ Restore: 'بازگردانی',
+ '+ Add Sample': '+ افزودن نمونه',
+ 'Your cart is empty': 'سبد خرید شما خالی است',
+ 'Your cart is empty.': 'سبد خرید شما خالی است.',
+ 'Browse verified Muslim booths and add products to start your order.':
+ 'غرفههای معتبر را بررسی کنید و محصولات مورد نظر خود را به سبد خرید اضافه کنید.',
+ 'Browse Shop': 'مشاهده فروشگاه',
+ 'Explore Categories': 'مشاهده دستهبندیها',
+ 'Got it': 'متوجه شدم',
+ '3 Products from 2 Shops': '۳ محصول از ۲ غرفه',
+ 'Delete selected items': 'حذف موارد انتخابشده',
+ 'Remove item': 'حذف محصول',
+ 'Decrease quantity': 'کاهش تعداد',
+ 'Increase quantity': 'افزایش تعداد',
+ Total: 'مجموع',
+ 'Total ': 'مجموع',
+ 'Total Cost': 'هزینه کل',
+ Continue: 'ادامه',
+ 'Orded Summery': 'خلاصه سفارش',
+ 'Order Summary': 'خلاصه سفارش',
+ 'Close order summary': 'بستن خلاصه سفارش',
+ Order: 'سفارش',
+ Shiping: 'هزینه ارسال',
+ Shipping: 'هزینه ارسال',
+ Promotion: 'تخفیف',
+ 'Shipping Details': 'جزئیات ارسال',
+ 'Delivery Address': 'آدرس تحویل',
+ 'Change Adress': 'تغییر آدرس',
+ 'Change Address': 'تغییر آدرس',
+ 'Add New adress': 'افزودن آدرس جدید',
+ 'Add New Adress': 'افزودن آدرس جدید',
+ 'Add New Address': 'افزودن آدرس جدید',
+ 'Add New Delivery adress': 'افزودن آدرس تحویل جدید',
+ 'Edit Address': 'ویرایش آدرس',
+ Edit: 'ویرایش',
+ 'Delivery method': 'روش ارسال',
+ 'Standard shiping': 'ارسال استاندارد',
+ 'Standard Shipping': 'ارسال استاندارد',
+ 'Express Shipping': 'ارسال سریع',
+ '2-3 business day': '۲ تا ۳ روز کاری',
+ '5-7 business days': '۵ تا ۷ روز کاری',
+ '1-2 business days': '۱ تا ۲ روز کاری',
+ 'Review & Confirm': 'بررسی و تأیید',
+ 'Review items': 'بررسی اقلام',
+ 'Payment methos': 'روش پرداخت',
+ 'Payment Method': 'روش پرداخت',
+ 'Payment Methods': 'روشهای پرداخت',
+ 'Your information is encrypted during transmission.':
+ 'اطلاعات شما در حین انتقال رمزنگاری میشود.',
+ 'Change Method': 'تغییر روش',
+ 'Close payment methods': 'بستن روشهای پرداخت',
+ Payment: 'پرداخت',
+ Purchase: 'پرداخت و خرید',
+ 'Processing...': 'در حال پردازش...',
+ 'Habib Coin': 'سکه حبیب',
+ 'Use your coins for Instant Payment': 'استفاده از سکهها برای پرداخت فوری',
+ 'Google Pay': 'گوگل پی',
+ PayPal: 'پیپال',
+ 'Master Card': 'مسترکارت',
+ 'Redirect to PayPal for Secure Checkout': 'انتقال به پیپال برای پرداخت امن',
+ Stripe: 'استرایپ',
+ 'Pay securely with Visa, Mastercard, or Amex':
+ 'پرداخت امن با ویزا، مسترکارت یا آمکس',
+ 'Please select or add a delivery address before placing your order.':
+ 'لطفاً قبل از ثبت سفارش، یک آدرس تحویل انتخاب یا اضافه کنید.',
+ 'Unable to place order. Please check your cart and address.':
+ 'ثبت سفارش امکانپذیر نیست. لطفاً سبد خرید و آدرس خود را بررسی کنید.',
+ 'Payment result': 'نتیجه پرداخت',
+ 'Pay Result': 'نتیجه پرداخت',
+ 'Payment Successful': 'پرداخت موفق',
+ 'Thank you for your purchase. your order has been places and is now being processed':
+ 'از خرید شما سپاسگزاریم. سفارش شما ثبت شد و در حال پردازش است.',
+ 'Total Paid': 'مبلغ پرداختشده',
+ 'Order Code': 'کد سفارش',
+ 'Payment method': 'روش پرداخت',
+ 'Order Date': 'تاریخ سفارش',
+ 'track Order': 'پیگیری سفارش',
+ 'Your Order Placed': 'سفارش شما ثبت شد',
+ 'Track Order': 'پیگیری سفارش',
+ 'Continue Shoping': 'ادامه خرید',
+ 'Continue Shopping': 'ادامه خرید',
+ Office: 'محل کار',
+
+ // Address Form & Phone Picker
+ 'Close address form': 'بستن فرم آدرس',
+ 'Edit Delivery Address': 'ویرایش آدرس تحویل',
+ 'Add Delivery Address': 'افزودن آدرس تحویل',
+ 'Pick Location on Map': 'انتخاب موقعیت روی نقشه',
+ 'Location pinned on map (Change)': 'موقعیت روی نقشه ثبت شد (تغییر)',
+ 'Label (Home, Office...)': 'عنوان آدرس (خانه، محل کار...)',
+ 'Recipient full name *': 'نام و نام خانوادگی گیرنده *',
+ 'Recipient Full Name *': 'نام و نام خانوادگی گیرنده *',
+ 'Street address, apartment, suite *': 'آدرس خیابان، پلاک، واحد *',
+ 'Street Address *': 'آدرس خیابان *',
+ City: 'شهر',
+ 'City *': 'شهر *',
+ 'State / Province': 'استان',
+ 'Postal / ZIP code': 'کد پستی',
+ 'Postal Code': 'کد پستی',
+ Country: 'کشور',
+ 'Set as default shipping address': 'تنظیم به عنوان آدرس پیشفرض ارسال',
+ 'Set as default delivery address': 'تنظیم به عنوان آدرس پیشفرض تحویل',
+ 'Pick Delivery Location': 'انتخاب موقعیت تحویل',
+ 'Tap map or use GPS to auto-fill street address':
+ 'روی نقشه بزنید یا از GPS برای پر شدن خودکار آدرس استفاده کنید',
+ 'Tap on the map or drag the pin to set your exact delivery location.':
+ 'روی نقشه بزنید یا نشانگر را بکشید تا موقعیت دقیق تحویل مشخص شود.',
+ 'Locating...': 'در حال مکانیابی...',
+ 'GPS Active': 'GPS فعال',
+ 'Use My Current Location': 'استفاده از موقعیت فعلی من',
+ 'Detecting street address...': 'در حال تشخیص آدرس خیابان...',
+ 'Detected Street Address': 'آدرس تشخیصدادهشده',
+ 'Tap anywhere on the map to pin your address': 'برای ثبت آدرس، روی نقشه ضربه بزنید',
+ 'Select This Location': 'انتخاب این موقعیت',
+ 'Please fill in all required address fields.':
+ 'لطفاً تمام فیلدهای الزامی آدرس را پر کنید.',
+ 'Please enter a valid phone number for the selected country.':
+ 'لطفاً یک شماره تلفن معتبر برای کشور انتخابشده وارد کنید.',
+ 'Failed to save address. Please try again.':
+ 'ذخیره آدرس ناموفق بود. لطفاً دوباره تلاش کنید.',
+ 'Saving...': 'در حال ذخیره...',
+ 'Save Changes': 'ذخیره تغییرات',
+ 'Save Address': 'ذخیره آدرس',
+ 'Phone number': 'شماره تلفن',
+ 'Select country code': 'انتخاب کد کشور',
+ 'Select Country Code': 'انتخاب کد کشور',
+ 'Close country selector': 'بستن انتخابگر کشور',
+ 'Search country name or code (+1, +98...)': 'جستجوی نام یا کد کشور (+98، +1...)',
+ 'Search country name or code': 'جستجوی نام یا کد کشور',
+ 'No countries found.': 'کشوری یافت نشد.',
+ 'Enter a valid phone number': 'یک شماره تلفن معتبر وارد کنید',
+
+ // Account, Language, Addresses & Provider Request
+ 'Accunt detail': 'جزئیات حساب',
+ 'Account Details': 'جزئیات حساب',
+ 'Name, contact number, email, etc.': 'نام، شماره تماس، ایمیل و غیره',
+ Adresses: 'آدرسها',
+ '1 adress': '۱ آدرس',
+ Bookmarks: 'ذخیرهشدهها',
+ FAQ: 'سؤالات متداول',
+ FAQs: 'سؤالات متداول',
+ 'Support & Requests': 'پشتیبانی و درخواستها',
+ 'About us': 'درباره ما',
+ Notifications: 'اعلانها',
+ Notes: 'یادداشتها',
+ 'Program Access and Permissions': 'دسترسیها و مجوزهای برنامه',
+ 'Azan Setting': 'تنظیمات اذان',
+ Location: 'موقعیت مکانی',
+ 'In Progress': 'در حال انجام',
+ Returned: 'مرجوع شده',
+ 'Your Inventory': 'موجودی شما',
+ 'Buy Coins': 'خرید سکه',
+ 'My Wallet ($24)': 'کیف پول من ($24)',
+ 'My Wallet ($0)': 'کیف پول من ($0)',
+ 'income from Habib': 'درآمد از حبیب',
+ 'Under Review': 'در حال بررسی',
+ 'Request Denied': 'رد شده',
+ 'Provider in': 'ارائهدهنده در',
+ 'Select Shop Language': 'انتخاب زبان فروشگاه',
+ Default: 'پیشفرض',
+ 'Saved Addresses': 'آدرسهای ذخیرهشده',
+ 'Date of Birth': 'تاریخ تولد',
+ 'Select date': 'انتخاب تاریخ',
+ 'Whatsapp Number': 'شماره واتساپ',
+ Submit: 'ثبت و ارسال',
+ 'Change Picture': 'تغییر تصویر',
+ Balance: 'موجودی',
+ Donate: 'حمایت',
+ 'Donate Habib': 'حمایت از حبیب',
+ "Help Habib's Large-Scale project": 'کمک به پروژه بزرگ حبیب',
+ 'My Orders': 'سفارشهای من',
+ 'Full Name': 'نام و نام خانوادگی',
+ Email: 'ایمیل',
+ Language: 'زبان',
+ 'Profile Saved!': 'پروفایل ذخیره شد!',
+ 'Apply as Provider': 'ثبتنام به عنوان غرفهدار',
+ 'My Adresses': 'آدرسهای من',
+ 'My Addresses': 'آدرسهای من',
+ 'No saved addresses yet. Add your first delivery address below.':
+ 'هنوز آدرسی ذخیره نشده است. اولین آدرس تحویل خود را در پایین اضافه کنید.',
+ Wishlist: 'علاقهمندیها',
+ 'Saved products': 'محصولات ذخیرهشده',
+ 'No saved products in your wishlist yet.':
+ 'هنوز محصولی در لیست علاقهمندیهای شما ذخیره نشده است.',
+ Remove: 'حذف',
+ 'Request to be a Provider': 'درخواست غرفهداری',
+ 'Open a booth and sell your products': 'غرفه خود را بسازید و محصولاتتان را بفروشید',
+ 'Support & Tickets': 'پشتیبانی و تیکتها',
+ 'Contact Us': 'تماس با ما',
+ 'Terms & Privacy': 'قوانین و حریم خصوصی',
+ 'Terms of Service & Privacy Policy': 'شرایط استفاده و سیاست حفظ حریم خصوصی',
+ 'Open Your Store on Habib': 'فروشگاه خود را در حبیب راهاندازی کنید',
+ 'Reach global customers & grow your business with us':
+ 'به مشتریان جهانی دسترسی پیدا کنید و کسبوکار خود را با ما گسترش دهید',
+ 'Zero Setup Fee': 'بدون هزینه راهاندازی',
+ 'Direct Chat with Buyers': 'گفتگوی مستقیم با خریداران',
+ 'Store Information': 'اطلاعات فروشگاه',
+ 'Store / Booth Name': 'نام فروشگاه / غرفه',
+ 'Product Category': 'دستهبندی محصولات',
+ 'Select Category': 'انتخاب دستهبندی',
+ 'Country / City': 'کشور / شهر',
+ 'Contact Number': 'شماره تماس',
+ 'Instagram or Website Link': 'لینک اینستاگرام یا وبسایت',
+ 'Tell us about your products, craftsmanship, and story...':
+ 'درباره محصولات، هنر دست و داستان کسبوکار خود بنویسید...',
+ 'Product Samples': 'نمونه محصولات',
+ 'Upload 3-5 photos of your best products': '۳ تا ۵ عکس از بهترین محصولات خود آپلود کنید',
+ 'PNG, JPG up to 10MB': 'فرمت PNG یا JPG تا ۱۰ مگابایت',
+ 'I agree to Habib ': 'موافقم با ',
+ 'Seller Terms & Guidelines': 'قوانین و مقررات فروشندگان حبیب',
+ 'Application Submitted!': 'درخواست ثبت شد!',
+ 'Submitting...': 'در حال ارسال...',
+ 'Submit Application': 'ارسال درخواست',
+ 'Please enter your store or booth name.': 'لطفاً نام فروشگاه یا غرفه خود را وارد کنید.',
+ 'Please select a product category.': 'لطفاً یک دستهبندی محصول انتخاب کنید.',
+ 'Please enter your country and city.': 'لطفاً کشور و شهر خود را وارد کنید.',
+ 'Please enter a valid contact phone number.': 'لطفاً یک شماره تماس معتبر وارد کنید.',
+ 'Please accept the Seller Terms & Guidelines.':
+ 'لطفاً قوانین و مقررات فروشندگان را بپذیرید.',
+ 'Failed to upload image. Please try another file.':
+ 'آپلود تصویر ناموفق بود. لطفاً فایل دیگری را امتحان کنید.',
+ 'Unable to submit application. Please check your inputs.':
+ 'ارسال درخواست امکانپذیر نیست. لطفاً ورودیهای خود را بررسی کنید.',
+
+ // Orders, Tracking & Support
+ Current: 'جاری',
+ Canceled: 'لغو شده',
+ 'All Orders': 'همه سفارشها',
+ Processing: 'در حال پردازش',
+ Shipped: 'ارسال شده',
+ Delivered: 'تحویل شده',
+ Packed: 'بستهبندی شده',
+ Delivery: 'تحویل',
+ 'Tracking code': 'کد رهگیری',
+ 'View Details': 'مشاهده جزئیات',
+ 'No orders found in this category.': 'سفارشی در این بخش یافت نشد.',
+ 'View Order Details': 'مشاهده جزئیات سفارش',
+ 'Order Details': 'جزئیات سفارش',
+ 'Orders Detail': 'جزئیات سفارش',
+ 'Order support': 'پشتیبانی سفارش',
+ 'Cancel Order': 'لغو سفارش',
+ 'Canceling...': 'در حال لغو...',
+ 'report an issue': 'گزارش مشکل',
+ 'Track Shipment': 'پیگیری مرسوله',
+ 'Shipment Tracking': 'پیگیری مرسوله',
+ 'Close tracking': 'بستن پیگیری',
+ 'Loading live tracking checkpoints...': 'در حال بارگذاری مراحل رهگیری زنده...',
+ 'Live Tracking': 'رهگیری زنده',
+ 'Order Shipped': 'سفارش ارسال شد',
+ 'Shipment Processed': 'مرسوله پردازش شد',
+ 'In Transit': 'در مسیر ارسال',
+ 'Unable to load live tracking details.': 'بارگذاری جزئیات پیگیری زنده امکانپذیر نیست.',
+ Carrier: 'شرکت حملونقل',
+ 'Pending Assignment': 'در انتظار تخصیص',
+ 'Tracking Number': 'کد رهگیری',
+ 'Awaiting Carrier Scan': 'در انتظار اسکن مرسوله',
+ 'Copied!': 'کپی شد!',
+ Copy: 'کپی',
+ 'Estimated Delivery': 'زمان تخمینی تحویل',
+ 'Track on Carrier Website': 'پیگیری در وبسایت شرکت حملونقل',
+ 'Tracking Checkpoints': 'مراحل رهگیری مرسوله',
+ 'Order Confirmed': 'سفارش تأیید شد',
+ 'Processing at Booth': 'در حال آمادهسازی در غرفه',
+ 'Handed to Carrier': 'تحویل به شرکت پست',
+ 'We’ve received your support request and will follow up on it. Rest assured, our team will take care of it.':
+ 'درخواست پشتیبانی شما دریافت شد و پیگیری خواهد شد. مطمئن باشید تیم ما به آن رسیدگی میکند.',
+ 'Request Subject': 'موضوع درخواست',
+ 'Not Received': 'عدم دریافت',
+ Damaged: 'آسیبدیده',
+ 'Wrong Item': 'کالای اشتباه',
+ 'Delivery Issue': 'مشکل ارسال',
+ 'Counterfeit Item': 'کالای غیراصل',
+ Other: 'سایر',
+ 'No support subjects available.': 'موضوع پشتیبانی موجود نیست.',
+ 'Write here...': 'اینجا بنویسید...',
+ 'Add Evidence or Image(Optional)': 'افزودن مدرک یا تصویر (اختیاری)',
+ 'Attachment ready (tap to replace)': 'فایل پیوست آماده است (برای جایگزینی ضربه بزنید)',
+ 'Uploading...': 'در حال آپلود...',
+ '+ Upload Image': '+ آپلود تصویر',
+ 'Submit Order': 'ثبت درخواست',
+ 'Habib Shop Support Desk': 'میز پشتیبانی فروشگاه حبیب',
+ 'Evidence attached': 'مدرک پیوست شد',
+ 'Please enter a description for your support request':
+ 'لطفاً توضیحات درخواست پشتیبانی خود را وارد کنید',
+ 'Could not submit request': 'امکان ثبت درخواست وجود نداشت',
+ 'How can we help you?': 'چطور میتوانیم کمکتان کنیم؟',
+ 'Select the topic related to your issue and send us the details.':
+ 'موضوع مرتبط با مشکل خود را انتخاب کرده و جزئیات را برای ما ارسال کنید.',
+ 'Select Subject': 'انتخاب موضوع',
+ 'Damaged Item': 'کالای آسیبدیده',
+ 'Wrong Product': 'محصول اشتباه',
+ 'Shipping Delay': 'تأخیر در ارسال',
+ 'Missing Parts': 'کسری اقلام',
+ 'Payment / Refund': 'پرداخت / بازگشت وجه',
+ 'Other Issue': 'سایر موارد',
+ 'Describe Your Issue': 'شرح مشکل',
+ 'Please describe what happened in detail so our support team can resolve it quickly...':
+ 'لطفاً جزئیات مشکل پیشآمده را بنویسید تا تیم پشتیبانی ما سریعتر آن را بررسی کند...',
+ Attachments: 'فایلهای پیوست',
+ Optional: 'اختیاری',
+ 'Upload photos or video of the package/item': 'عکس یا ویدیوی بسته یا کالا را آپلود کنید',
+ 'PNG, JPG, MP4 up to 20MB': 'فرمت PNG، JPG یا MP4 تا ۲۰ مگابایت',
+ 'Please describe your issue before submitting.':
+ 'لطفاً قبل از ارسال، شرح مشکل خود را بنویسید.',
+ 'Failed to upload attachment. Please try again.':
+ 'آپلود فایل پیوست ناموفق بود. لطفاً دوباره تلاش کنید.',
+ 'Unable to submit support ticket. Please try again.':
+ 'ثبت تیکت پشتیبانی امکانپذیر نیست. لطفاً دوباره تلاش کنید.',
+ 'Ticket Submitted!': 'تیکت ثبت شد!',
+ 'Submit Ticket': 'ثبت تیکت',
+
+ // Chat
+ Online: 'آنلاین',
+ Offline: 'آفلاین',
+ Report: 'گزارش تخلف',
+ Guidelines: 'راهنما و قوانین',
+ 'Try Again': 'تلاش مجدد',
+ Yesterday: 'دیروز',
+ Today: 'امروز',
+ 'Today ': 'امروز',
+ 'No messages yet. Say hello to start the conversation.':
+ 'هنوز پیامی ارسال نشده است. برای شروع گفتگو سلام کنید.',
+ 'Ready to send': 'آماده ارسال',
+ Done: 'تأیید',
+ Messages: 'پیام بنویسید...',
+ 'Switch Conversation': 'تغییر گفتگو',
+ TODAY: 'امروز',
+ Read: 'خوانده شده',
+ Sent: 'ارسال شده',
+ 'Type a message ...': 'پیامی بنویسید...',
+ 'Attach image': 'پیوست تصویر',
+ 'Send message': 'ارسال پیام',
+ 'Shared an image': 'یک تصویر ارسال شد',
+
+ // Colors & Common Values
+ Red: 'قرمز',
+ Black: 'مشکی',
+ Brown: 'قهوهای',
+ Grey: 'خاکستری',
+ White: 'سفید',
+ Blue: 'آبی',
+ Green: 'سبز',
+ Gold: 'طلایی',
+ Standard: 'استاندارد',
+
+ // Additional UI & Empty-State Labels
+ 'Add sample item': 'افزودن کالای نمونه',
+ 'No saved delivery addresses yet.': 'هنوز آدرس تحویلی ذخیره نشده است.',
+ 'No delivery methods available.': 'روش ارسالی موجود نیست.',
+ 'No delivery address selected.': 'آدرس تحویلی انتخاب نشده است.',
+ 'Order receipt not found.': 'رسید سفارش یافت نشد.',
+ 'Habib shoper': 'خریدار حبیب',
+ 'Habib Shopper': 'خریدار حبیب',
+ Guest: 'مهمان',
+ 'Verified Habib Account': 'حساب کاربری تأییدشده حبیب',
+ 'Sign in with your Habib account': 'با حساب کاربری حبیب خود وارد شوید',
+ '0 adress': '۰ آدرس',
+ 'Sign in to manage addresses': 'برای مدیریت آدرسها وارد شوید',
+ '(People will see this)': '(کاربران این نام را میبینند)',
+ 'Sample: +77 2350654': 'نمونه: +77 2350654',
+ 'For iOS users': 'ویژه کاربران iOS',
+ 'Provider request on Habib Meet': 'درخواست غرفهداری در حبیب میت',
+ 'Provider request on Habib Talk': 'درخواست غرفهداری در حبیب تاک',
+ Pending: 'در انتظار بررسی',
+ rejected: 'رد شده',
+ Rejected: 'رد شده',
+ Approved: 'تأیید شده',
+ approved: 'تأیید شده',
+ 'Not set': 'تنظیم نشده',
+ 'No provider requests yet.': 'هنوز درخواست غرفهداری ثبت نشده است.',
+ 'No saved delivery addresses yet. Tap below to add your first address.':
+ 'هنوز آدرس تحویلی ذخیره نشده است. برای افزودن اولین آدرس روی دکمه زیر بزنید.',
+ 'Diverse stores, products, and cultures united in one shared marketplace.':
+ 'فروشگاهها، محصولات و فرهنگهای گوناگون در یک بازار مشترک.',
+ 'Curated books, handicrafts, modest fashion, and home essentials worldwide.':
+ 'کتابهای گزیده، صنایع دستی، پوشاک عفیفانه و لوازم خانه در سراسر جهان.',
+ 'Could not load live marketplace feed. Tap Retry to refresh.':
+ 'بارگذاری فید زنده بازار امکانپذیر نبود. برای تلاش مجدد ضربه بزنید.',
+ 'Could not load categories. Tap Retry to refresh.':
+ 'بارگذاری دستهبندیها امکانپذیر نبود. برای تلاش مجدد ضربه بزنید.',
+ 'No categories found.': 'دستهبندیای یافت نشد.',
+ 'No categories available.': 'دستهبندیای موجود نیست.',
+ 'Could not load products. Tap Retry to refresh.':
+ 'بارگذاری محصولات امکانپذیر نبود. برای تلاش مجدد ضربه بزنید.',
+ 'No products available.': 'محصولی موجود نیست.',
+ 'No saved items yet. Tap the bookmark icon on any product to save it here.':
+ 'هنوز موردی ذخیره نشده است. برای ذخیره هر محصول روی نشانک آن بزنید.',
+ 'No matching products found.': 'محصول مشابهی یافت نشد.',
+ 'Could not load product details. Tap Retry to refresh.':
+ 'بارگذاری جزئیات محصول امکانپذیر نبود. برای تلاش مجدد ضربه بزنید.',
+ 'Product not found.': 'محصول یافت نشد.',
+ 'Leather accessories and supplies / Leather bags': 'اکسسوری و ملزومات چرمی / کیف چرم',
+ '2–3 Days': '۲ تا ۳ روز',
+ '2-3 Days': '۲ تا ۳ روز',
+ Store: 'فروشگاه',
+ 'Could not load store booth details. Tap Retry to refresh.':
+ 'بارگذاری اطلاعات غرفه امکانپذیر نبود. برای تلاش مجدد ضربه بزنید.',
+ 'Store booth not found.': 'غرفه مورد نظر یافت نشد.',
+ '+1 year membership': '+۱ سال عضویت',
+ '+60 sales': '+۶۰ فروش',
+ 'No products in this store yet.': 'هنوز محصولی در این فروشگاه ثبت نشده است.',
+ 'Could not load orders. Tap Retry to refresh.':
+ 'بارگذاری سفارشها امکانپذیر نبود. برای تلاش مجدد ضربه بزنید.',
+ 'No current orders': 'سفارش جاری وجود ندارد',
+ 'No delivered orders': 'سفارش تحویلشدهای وجود ندارد',
+ 'No canceled orders': 'سفارش لغوشدهای وجود ندارد',
+ 'Could not load order details. Tap Retry to refresh.':
+ 'بارگذاری جزئیات سفارش امکانپذیر نبود. برای تلاش مجدد ضربه بزنید.',
+ 'Order not found.': 'سفارش یافت نشد.',
+ 'No shipments for this order yet.': 'هنوز مرسولهای برای این سفارش ثبت نشده است.',
+ 'Connecting...': 'در حال اتصال...',
+ 'Verified Booth': 'غرفه تأییدشده',
+ 'More options': 'گزینههای بیشتر',
+ 'Attached image': 'تصویر پیوستشده',
+ 'Voice message': 'پیام صوتی',
+};
+
+const AR_DICTIONARY: Record = {
+ // Navigation & Common Headers
+ Home: 'الرئيسية',
+ Category: 'الفئات',
+ Categories: 'الفئات',
+ Chat: 'المحادثة',
+ Account: 'الحساب',
+ Cart: 'سلة التسوق',
+ Support: 'الدعم',
+ Shop: 'المتجر',
+ Orders: 'الطلبات',
+ Back: 'رجوع',
+ 'Go back': 'رجوع',
+ Search: 'بحث',
+ Filter: 'تصفية',
+ 'Clear search': 'مسح البحث',
+ 'Search products, stores, categories...': 'ابحث عن المنتجات، المتاجر، الفئات...',
+ 'Search any Product..': 'ابحث عن أي منتج...',
+ 'Search any Product...': 'ابحث عن أي منتج...',
+ Retry: 'إعادة المحاولة',
+ 'Connection took longer than expected. Check your network and try again.':
+ 'استغرق الاتصال وقتاً أطول من المتوقع. تحقق من الشبكة وحاول مرة أخرى.',
+ Close: 'إغلاق',
+ Cancel: 'إلغاء',
+ 'Sign In': 'تسجيل الدخول',
+ 'Log In': 'تسجيل الدخول',
+ 'Opening Habib Login...': 'جاري فتح تسجيل دخول حبيب...',
+ 'Sign in with Habib': 'تسجيل الدخول بحساب حبيب',
+ 'Log in with Habib': 'تسجيل الدخول بحساب حبيب',
+ 'connect your Habib account': 'ربط حساب حبيب الخاص بك',
+ 'Sign out': 'تسجيل الخروج',
+ 'sign out from account': 'تسجيل الخروج من الحساب',
+ 'Signed out': 'تم تسجيل الخروج',
+ 'Login Required': 'تسجيل الدخول مطلوب',
+ 'Sign in Required': 'تسجيل الدخول مطلوب',
+ 'Please sign in to your Habib account to continue this action.':
+ 'يرجى تسجيل الدخول إلى حساب حبيب الخاص بك لمتابعة هذا الإجراء.',
+ 'Please log in with your Habib account to continue.':
+ 'يرجى تسجيل الدخول بحساب حبيب للمتابعة.',
+ 'Signed in with Habib': 'تم تسجيل الدخول بحساب حبيب',
+ 'Sign-in canceled': 'تم إلغاء تسجيل الدخول',
+ 'Could not complete sign-in': 'تعذر إكمال تسجيل الدخول',
+ 'Added to cart': 'تمت الإضافة إلى السلة',
+ 'Removed from saved items': 'تمت الإزالة من المحفوظات',
+ 'Saved to bookmarks': 'تم الحفظ في المفضلة',
+ 'Address updated': 'تم تحديث العنوان',
+ 'Address added': 'تمت إضافة العنوان',
+ 'Address deleted': 'تم حذف العنوان',
+
+ // Home & Catalog
+ 'Saved Items': 'العناصر المحفوظة',
+ 'Global Marketplace for the Muslim Community': 'السوق العالمي للمجتمع الإسلامي',
+ 'Explore Products': 'استكشف المنتجات',
+ 'Authentic Crafts from Trusted Muslim Sellers': 'حرف يدوية أصيلة من بائعين مسلمين موثوقين',
+ 'Browse Booths': 'تصفح المتاجر',
+ 'Special Offer': 'عرض خاص',
+ 'Explore Our Curated Categories': 'استكشف فئاتنا المختارة',
+ 'Exclusive discounts on authentic handcrafted items':
+ 'خصومات حصرية على المنتجات اليدوية الأصيلة',
+ 'Explore Now': 'استكشف الآن',
+ Populars: 'الأكثر شعبية',
+ 'See All': 'عرض الكل',
+ 'View All': 'عرض الكل',
+ 'See more': 'عرض المزيد',
+ 'New Stores': 'متاجر جديدة',
+ Bag: 'حقائب',
+ 'Bags & Accessories': 'الحقائب والإكسسوارات',
+ Beauty: 'الجمال والعناية',
+ 'Beauty & ...': 'الجمال و...',
+ 'Beauty & Personal Care': 'الجمال والعناية الشخصية',
+ 'Home & Living': 'المنزل والمعيشة',
+ 'Art & Handicrafts': 'الفنون والحرف اليدوية',
+ 'Apparel & Textiles': 'الملابس والمنسوجات',
+ 'Books & Media': 'الكتب والوسائط',
+ More: 'المزيد',
+ 'No categories available yet.': 'لا توجد فئات متاحة بعد.',
+ 'No popular products yet.': 'لا توجد منتجات شائعة بعد.',
+ 'No new store products yet.': 'لا توجد منتجات متاجر جديدة بعد.',
+ 'No products found in this category.': 'لم يتم العثور على منتجات في هذه الفئة.',
+ 'No products available in this booth yet.': 'لا توجد منتجات متاحة في هذا المتجر بعد.',
+ 'Islam in the Biblebran Transfer Book': 'كتاب الإسلام في الكتاب المقدس',
+ 'Islam in the Bible Book': 'كتاب الإسلام في الكتاب المقدس',
+ 'Islam in the Bible Transfer Book': 'كتاب الإسلام في الكتاب المقدس',
+ 'Islam in the Bible transfer Bookly bag': 'حقيبة كتاب الإسلام في الكتاب المقدس',
+ 'Transfer Book': 'كتاب النقل',
+ 'Boby Bag': 'حقيبة جلدية يومية بوبي',
+ 'Espoong Black Tshirt': 'قميص إسبونغ أسود',
+ 'Espoong Tshirt 023': 'قميص إسبونغ 023',
+ 'Iran | Mahan Golden': 'إيران | ماهان غولدن',
+
+ // Product Detail & Booth
+ 'Share product': 'مشاركة المنتج',
+ 'Bookmark product': 'حفظ المنتج',
+ 'Product Condition': 'حالة المنتج',
+ New: 'جديد',
+ 'In Stock': 'متوفر في المخزون',
+ 'Out of Stock': 'غير متوفر',
+ 'Processing Time': 'وقت التجهيز',
+ '1–2 Days': '1-2 يوم',
+ '1-2 Days': '1-2 يوم',
+ 'Product Type': 'نوع المنتج',
+ Physical: 'مادي',
+ Digital: 'رقمي',
+ 'Since 2008': 'منذ عام 2008',
+ Introduction: 'مقدمة المنتج',
+ 'No description available.': 'لا يوجد وصف متاح.',
+ 'Write a Review': 'كتابة تقييم',
+ 'Share your experience with this product...': 'شارك تجربتك مع هذا المنتج...',
+ 'Posting...': 'جاري النشر...',
+ 'Post Review': 'نشر التقييم',
+ 'No reviews yet.': 'لا توجد تقييمات بعد.',
+ 'No related products yet.': 'لا توجد منتجات ذات صلة بعد.',
+ 'Adding...': 'جاري الإضافة...',
+ 'Sold Out': 'نفدت الكمية',
+ 'Avg. Response': 'متوسط الاستجابة',
+ 'On-time Delivery': 'التسليم في الموعد',
+ Satisfaction: 'رضا العملاء',
+ 'Chat Now': 'تحدث الآن',
+ 'All Products': 'جميع المنتجات',
+ Items: 'العناصر',
+ Weight: 'الوزن',
+ Dimensions: 'الأبعاد',
+ Capabilities: 'المميزات',
+ 'View Store': 'عرض المتجر',
+ Information: 'المعلومات',
+ Features: 'المواصفات',
+ Description: 'الوصف',
+ 'No reviews yet for this product.': 'لا توجد تقييمات لهذا المنتج بعد.',
+ 'Added to Cart': 'تمت الإضافة للسلة',
+ 'Add to Cart': 'أضف إلى السلة',
+ 'Share store': 'مشاركة المتجر',
+ 'Chat with Store': 'مراسلة المتجر',
+ Experience: 'الخبرة',
+ Rating: 'التقييم',
+ Products: 'المنتجات',
+ About: 'حول المتجر',
+ 'Toggle Bookmark': 'تبديل المفضلة',
+
+ // Checkout, Cart, Shipping, Payment & Order Result
+ checkout: 'إتمام الشراء',
+ Checkout: 'إتمام الشراء',
+ 'Clear all': 'مسح الكل',
+ Restore: 'استعادة',
+ '+ Add Sample': '+ إضافة عينة',
+ 'Your cart is empty': 'سلة التسوق فارغة',
+ 'Your cart is empty.': 'سلة التسوق فارغة.',
+ 'Browse verified Muslim booths and add products to start your order.':
+ 'تصفح المتاجر الإسلامية الموثوقة وأضف المنتجات لبدء طلبك.',
+ 'Browse Shop': 'تصفح المتجر',
+ 'Explore Categories': 'استكشف الفئات',
+ 'Got it': 'حسناً',
+ '3 Products from 2 Shops': '3 منتجات من متجرين',
+ 'Delete selected items': 'حذف العناصر المحددة',
+ 'Remove item': 'حذف العنصر',
+ 'Decrease quantity': 'تقليل الكمية',
+ 'Increase quantity': 'زيادة الكمية',
+ Total: 'المجموع',
+ 'Total ': 'المجموع',
+ 'Total Cost': 'التكلفة الإجمالية',
+ Continue: 'متابعة',
+ 'Orded Summery': 'ملخص الطلب',
+ 'Order Summary': 'ملخص الطلب',
+ 'Close order summary': 'إغلاق ملخص الطلب',
+ Order: 'الطلب',
+ Shiping: 'الشحن',
+ Shipping: 'الشحن',
+ Promotion: 'الخصم',
+ 'Shipping Details': 'تفاصيل الشحن',
+ 'Delivery Address': 'عنوان التوصيل',
+ 'Change Adress': 'تغيير العنوان',
+ 'Change Address': 'تغيير العنوان',
+ 'Add New adress': 'إضافة عنوان جديد',
+ 'Add New Adress': 'إضافة عنوان جديد',
+ 'Add New Address': 'إضافة عنوان جديد',
+ 'Add New Delivery adress': 'إضافة عنوان توصيل جديد',
+ 'Edit Address': 'تعديل العنوان',
+ Edit: 'تعديل',
+ 'Delivery method': 'طريقة التوصيل',
+ 'Standard shiping': 'الشحن القياسي',
+ 'Standard Shipping': 'الشحن القياسي',
+ 'Express Shipping': 'الشحن السريع',
+ '2-3 business day': '2-3 أيام عمل',
+ '5-7 business days': '5-7 أيام عمل',
+ '1-2 business days': '1-2 يوم عمل',
+ 'Review & Confirm': 'المراجعة والتأكيد',
+ 'Review items': 'مراجعة العناصر',
+ 'Payment methos': 'طريقة الدفع',
+ 'Payment Method': 'طريقة الدفع',
+ 'Payment Methods': 'طرق الدفع',
+ 'Your information is encrypted during transmission.': 'يتم تشفير معلوماتك أثناء الإرسال.',
+ 'Change Method': 'تغيير الطريقة',
+ 'Close payment methods': 'إغلاق طرق الدفع',
+ Payment: 'الدفع',
+ Purchase: 'شراء ودفع',
+ 'Processing...': 'جاري المعالجة...',
+ 'Habib Coin': 'عملة حبيب',
+ 'Use your coins for Instant Payment': 'استخدم عملاتك للدفع الفوري',
+ 'Google Pay': 'جوجل باي',
+ PayPal: 'باي بال',
+ 'Master Card': 'ماستركارد',
+ 'Redirect to PayPal for Secure Checkout': 'الانتقال إلى باي بال للدفع الآمن',
+ Stripe: 'سترايب',
+ 'Pay securely with Visa, Mastercard, or Amex':
+ 'ادفع بأمان باستخدام فيزا أو ماستركارد أو أمريكان إكسبريس',
+ 'Please select or add a delivery address before placing your order.':
+ 'يرجى اختيار أو إضافة عنوان توصيل قبل إتمام الطلب.',
+ 'Unable to place order. Please check your cart and address.':
+ 'تعذر إتمام الطلب. يرجى التحقق من السلة والعنوان.',
+ 'Payment result': 'نتيجة الدفع',
+ 'Pay Result': 'نتيجة الدفع',
+ 'Payment Successful': 'تم الدفع بنجاح',
+ 'Thank you for your purchase. your order has been places and is now being processed':
+ 'شكراً لشرائك. تم استلام طلبك وجارٍ تجهيزه الآن.',
+ 'Total Paid': 'إجمالي المدفوع',
+ 'Order Code': 'رمز الطلب',
+ 'Payment method': 'طريقة الدفع',
+ 'Order Date': 'تاريخ الطلب',
+ 'track Order': 'تتبع الطلب',
+ 'Your Order Placed': 'تم تأكيد طلبك',
+ 'Track Order': 'تتبع الطلب',
+ 'Continue Shoping': 'مواصلة التسوق',
+ 'Continue Shopping': 'مواصلة التسوق',
+ Office: 'المكتب',
+
+ // Address Form & Phone Picker
+ 'Close address form': 'إغلاق نموذج العنوان',
+ 'Edit Delivery Address': 'تعديل عنوان التوصيل',
+ 'Add Delivery Address': 'إضافة عنوان توصيل',
+ 'Pick Location on Map': 'تحديد الموقع على الخريطة',
+ 'Location pinned on map (Change)': 'تم تحديد الموقع على الخريطة (تغيير)',
+ 'Label (Home, Office...)': 'التسمية (المنزل، المكتب...)',
+ 'Recipient full name *': 'اسم المستلم الكامل *',
+ 'Recipient Full Name *': 'اسم المستلم الكامل *',
+ 'Street address, apartment, suite *': 'عنوان الشارع، الشقة، الجناح *',
+ 'Street Address *': 'عنوان الشارع *',
+ City: 'المدينة',
+ 'City *': 'المدينة *',
+ 'State / Province': 'المحافظة / الولاية',
+ 'Postal / ZIP code': 'الرمز البريدي',
+ 'Postal Code': 'الرمز البريدي',
+ Country: 'الدولة',
+ 'Set as default shipping address': 'تعيين كعنوان شحن افتراضي',
+ 'Set as default delivery address': 'تعيين كعنوان توصيل افتراضي',
+ 'Pick Delivery Location': 'تحديد موقع التوصيل',
+ 'Tap map or use GPS to auto-fill street address':
+ 'انقر على الخريطة أو استخدم GPS لملء عنوان الشارع تلقائياً',
+ 'Tap on the map or drag the pin to set your exact delivery location.':
+ 'انقر على الخريطة أو اسحب الدبوس لتحديد موقع التوصيل بدقة.',
+ 'Locating...': 'جاري تحديد الموقع...',
+ 'GPS Active': 'GPS نشط',
+ 'Use My Current Location': 'استخدام موقعي الحالي',
+ 'Detecting street address...': 'جاري تحديد عنوان الشارع...',
+ 'Detected Street Address': 'عنوان الشارع المكتشف',
+ 'Tap anywhere on the map to pin your address': 'انقر في أي مكان على الخريطة لتثبيت عنوانك',
+ 'Select This Location': 'تحديد هذا الموقع',
+ 'Please fill in all required address fields.': 'يرجى ملء جميع حقول العنوان المطلوبة.',
+ 'Please enter a valid phone number for the selected country.':
+ 'يرجى إدخال رقم هاتف صالح للدولة المحددة.',
+ 'Failed to save address. Please try again.': 'فشل حفظ العنوان. يرجى المحاولة مرة أخرى.',
+ 'Saving...': 'جاري الحفظ...',
+ 'Save Changes': 'حفظ التغييرات',
+ 'Save Address': 'حفظ العنوان',
+ 'Phone number': 'رقم الهاتف',
+ 'Select country code': 'اختر رمز الدولة',
+ 'Select Country Code': 'اختر رمز الدولة',
+ 'Close country selector': 'إغلاق محدد الدولة',
+ 'Search country name or code (+1, +98...)': 'ابحث عن اسم الدولة أو الرمز (+1، +98...)',
+ 'Search country name or code': 'ابحث عن اسم الدولة أو الرمز',
+ 'No countries found.': 'لم يتم العثور على دول.',
+ 'Enter a valid phone number': 'أدخل رقم هاتف صالحاً',
+
+ // Account, Language, Addresses & Provider Request
+ 'Accunt detail': 'تفاصيل الحساب',
+ 'Account Details': 'تفاصيل الحساب',
+ 'Name, contact number, email, etc.': 'الاسم، رقم التواصل، البريد الإلكتروني، إلخ.',
+ Adresses: 'العناوين',
+ '1 adress': 'عنوان واحد',
+ Bookmarks: 'المحفوظات',
+ FAQ: 'الأسئلة الشائعة',
+ FAQs: 'الأسئلة الشائعة',
+ 'Support & Requests': 'الدعم والطلبات',
+ 'About us': 'من نحن',
+ Notifications: 'الإشعارات',
+ Notes: 'الملاحظات',
+ 'Program Access and Permissions': 'صلاحيات وأذونات البرنامج',
+ 'Azan Setting': 'إعدادات الأذان',
+ Location: 'الموقع',
+ 'In Progress': 'قيد التنفيذ',
+ Returned: 'مرتجع',
+ 'Your Inventory': 'رصيدك',
+ 'Buy Coins': 'شراء عملات',
+ 'My Wallet ($24)': 'محفظتي ($24)',
+ 'My Wallet ($0)': 'محفظتي ($0)',
+ 'income from Habib': 'الدخل من حبيب',
+ 'Under Review': 'قيد المراجعة',
+ 'Request Denied': 'تم رفض الطلب',
+ 'Provider in': 'مزود في',
+ 'Select Shop Language': 'اختر لغة المتجر',
+ Default: 'افتراضي',
+ 'Saved Addresses': 'العناوين المحفوظة',
+ 'Date of Birth': 'تاريخ الميلاد',
+ 'Select date': 'اختر التاريخ',
+ 'Whatsapp Number': 'رقم واتساب',
+ Submit: 'إرسال',
+ 'Change Picture': 'تغيير الصورة',
+ Balance: 'الرصيد',
+ Donate: 'تبرع',
+ 'Donate Habib': 'تبرع لحبيب',
+ "Help Habib's Large-Scale project": 'ساهم في مشروع حبيب الكبير',
+ 'My Orders': 'طلباتي',
+ 'Full Name': 'الاسم الكامل',
+ Email: 'البريد الإلكتروني',
+ Language: 'اللغة',
+ 'Profile Saved!': 'تم حفظ الملف الشخصي!',
+ 'Apply as Provider': 'التقديم كمزود',
+ 'My Adresses': 'عناويني',
+ 'My Addresses': 'عناويني',
+ 'No saved addresses yet. Add your first delivery address below.':
+ 'لا توجد عناوين محفوظة بعد. أضف عنوان التوصيل الأول أدناه.',
+ Wishlist: 'المفضلة',
+ 'Saved products': 'المنتجات المحفوظة',
+ 'No saved products in your wishlist yet.': 'لا توجد منتجات محفوظة في المفضلة بعد.',
+ Remove: 'حذف',
+ 'Request to be a Provider': 'طلب الانضمام كمزود',
+ 'Open a booth and sell your products': 'افتح متجرك وبع منتجاتك',
+ 'Support & Tickets': 'الدعم والتذاكر',
+ 'Contact Us': 'اتصل بنا',
+ 'Terms & Privacy': 'الشروط والخصوصية',
+ 'Terms of Service & Privacy Policy': 'شروط الخدمة وسياسة الخصوصية',
+ 'Open Your Store on Habib': 'افتح متجرك على حبيب',
+ 'Reach global customers & grow your business with us':
+ 'صل إلى عملاء عالميين ونمِّ أعمالك معنا',
+ 'Zero Setup Fee': 'بدون رسوم تأسيس',
+ 'Direct Chat with Buyers': 'محادثة مباشرة مع المشترين',
+ 'Store Information': 'معلومات المتجر',
+ 'Store / Booth Name': 'اسم المتجر / الجناح',
+ 'Product Category': 'فئة المنتجات',
+ 'Select Category': 'اختر الفئة',
+ 'Country / City': 'الدولة / المدينة',
+ 'Contact Number': 'رقم التواصل',
+ 'Instagram or Website Link': 'رابط إنستغرام أو الموقع الإلكتروني',
+ 'Tell us about your products, craftsmanship, and story...':
+ 'أخبرنا عن منتجاتك وحرفتك وقصتك...',
+ 'Product Samples': 'عينات المنتجات',
+ 'Upload 3-5 photos of your best products': 'ارفع من 3 إلى 5 صور لأفضل منتجاتك',
+ 'PNG, JPG up to 10MB': 'PNG, JPG بحد أقصى 10 ميجابايت',
+ 'I agree to Habib ': 'أوافق على ',
+ 'Seller Terms & Guidelines': 'شروط وإرشادات البائعين في حبيب',
+ 'Application Submitted!': 'تم إرسال الطلب!',
+ 'Submitting...': 'جاري الإرسال...',
+ 'Submit Application': 'إرسال الطلب',
+ 'Please enter your store or booth name.': 'يرجى إدخال اسم المتجر أو الجناح.',
+ 'Please select a product category.': 'يرجى اختيار فئة المنتج.',
+ 'Please enter your country and city.': 'يرجى إدخال الدولة والمدينة.',
+ 'Please enter a valid contact phone number.': 'يرجى إدخال رقم هاتف تواصل صالح.',
+ 'Please accept the Seller Terms & Guidelines.':
+ 'يرجى الموافقة على شروط وإرشادات البائعين.',
+ 'Failed to upload image. Please try another file.':
+ 'فشل رفع الصورة. يرجى تجربة ملف آخر.',
+ 'Unable to submit application. Please check your inputs.':
+ 'تعذر إرسال الطلب. يرجى التحقق من المدخلات.',
+
+ // Orders, Tracking & Support
+ Current: 'الحالية',
+ Canceled: 'الملغاة',
+ 'All Orders': 'كل الطلبات',
+ Processing: 'قيد المعالجة',
+ Shipped: 'تم الشحن',
+ Delivered: 'تم التوصيل',
+ Packed: 'تم التجهيز',
+ Delivery: 'التوصيل',
+ 'Tracking code': 'رمز التتبع',
+ 'View Details': 'عرض التفاصيل',
+ 'No orders found in this category.': 'لم يتم العثور على طلبات في هذه الفئة.',
+ 'View Order Details': 'عرض تفاصيل الطلب',
+ 'Order Details': 'تفاصيل الطلب',
+ 'Orders Detail': 'تفاصيل الطلب',
+ 'Order support': 'دعم الطلبات',
+ 'Cancel Order': 'إلغاء الطلب',
+ 'Canceling...': 'جاري الإلغاء...',
+ 'report an issue': 'الإبلاغ عن مشكلة',
+ 'Track Shipment': 'تتبع الشحنة',
+ 'Shipment Tracking': 'تتبع الشحنة',
+ 'Close tracking': 'إغلاق التتبع',
+ 'Loading live tracking checkpoints...': 'جاري تحميل نقاط التتبع المباشر...',
+ 'Live Tracking': 'تتبع مباشر',
+ 'Order Shipped': 'تم شحن الطلب',
+ 'Shipment Processed': 'تمت معالجة الشحنة',
+ 'In Transit': 'في الطريق',
+ 'Unable to load live tracking details.': 'تعذر تحميل تفاصيل التتبع المباشر.',
+ Carrier: 'شركة الشحن',
+ 'Pending Assignment': 'في انتظار التعيين',
+ 'Tracking Number': 'رقم التتبع',
+ 'Awaiting Carrier Scan': 'في انتظار مسح الناقل',
+ 'Copied!': 'تم النسخ!',
+ Copy: 'نسخ',
+ 'Estimated Delivery': 'التوصيل المتوقع',
+ 'Track on Carrier Website': 'تتبع على موقع شركة الشحن',
+ 'Tracking Checkpoints': 'نقاط التتبع',
+ 'Order Confirmed': 'تم تأكيد الطلب',
+ 'Processing at Booth': 'قيد التجهيز في المتجر',
+ 'Handed to Carrier': 'تم التسليم لشركة الشحن',
+ 'We’ve received your support request and will follow up on it. Rest assured, our team will take care of it.':
+ 'لقد تلقينا طلب الدعم الخاص بك وسنقوم بمتابعته. كن مطمئناً، سيتولى فريقنا الأمر.',
+ 'Request Subject': 'موضوع الطلب',
+ 'Not Received': 'لم يتم الاستلام',
+ Damaged: 'تالف',
+ 'Wrong Item': 'منتج خاطئ',
+ 'Delivery Issue': 'مشكلة توصيل',
+ 'Counterfeit Item': 'منتج مقلد',
+ Other: 'أخرى',
+ 'No support subjects available.': 'لا توجد مواضيع دعم متاحة.',
+ 'Write here...': 'اكتب هنا...',
+ 'Add Evidence or Image(Optional)': 'إضافة دليل أو صورة (اختياري)',
+ 'Attachment ready (tap to replace)': 'المرفق جاهز (انقر للاستبدال)',
+ 'Uploading...': 'جاري الرفع...',
+ '+ Upload Image': '+ رفع صورة',
+ 'Submit Order': 'إرسال الطلب',
+ 'Habib Shop Support Desk': 'مكتب دعم متجر حبيب',
+ 'Evidence attached': 'تم إرفاق الدليل',
+ 'Please enter a description for your support request':
+ 'يرجى إدخال وصف لطلب الدعم الخاص بك',
+ 'Could not submit request': 'تعذر إرسال الطلب',
+ 'How can we help you?': 'كيف يمكننا مساعدتك؟',
+ 'Select the topic related to your issue and send us the details.':
+ 'اختر الموضوع المتعلق بمشكلتك وأرسل لنا التفاصيل.',
+ 'Select Subject': 'اختر الموضوع',
+ 'Damaged Item': 'منتج تالف',
+ 'Wrong Product': 'منتج خاطئ',
+ 'Shipping Delay': 'تأخر الشحن',
+ 'Missing Parts': 'أجزاء مفقودة',
+ 'Payment / Refund': 'الدفع / الاسترداد',
+ 'Other Issue': 'مشكلة أخرى',
+ 'Describe Your Issue': 'اشرح مشكلتك',
+ 'Please describe what happened in detail so our support team can resolve it quickly...':
+ 'يرجى وصف ما حدث بالتفصيل حتى يتمكن فريق الدعم لدينا من حله بسرعة...',
+ Attachments: 'المرفقات',
+ Optional: 'اختياري',
+ 'Upload photos or video of the package/item': 'ارفع صوراً أو فيديو للطرد/المنتج',
+ 'PNG, JPG, MP4 up to 20MB': 'PNG, JPG, MP4 بحد أقصى 20 ميجابايت',
+ 'Please describe your issue before submitting.': 'يرجى وصف مشكلتك قبل الإرسال.',
+ 'Failed to upload attachment. Please try again.':
+ 'فشل رفع المرفق. يرجى المحاولة مرة أخرى.',
+ 'Unable to submit support ticket. Please try again.':
+ 'تعذر إرسال تذكرة الدعم. يرجى المحاولة مرة أخرى.',
+ 'Ticket Submitted!': 'تم إرسال التذكرة!',
+ 'Submit Ticket': 'إرسال التذكرة',
+
+ // Chat
+ Online: 'متصل',
+ Offline: 'غير متصل',
+ Report: 'إبلاغ',
+ Guidelines: 'الإرشادات',
+ 'Try Again': 'حاول مجدداً',
+ Yesterday: 'أمس',
+ Today: 'اليوم',
+ 'Today ': 'اليوم',
+ 'No messages yet. Say hello to start the conversation.':
+ 'لا توجد رسائل بعد. قل مرحباً لبدء المحادثة.',
+ 'Ready to send': 'جاهز للإرسال',
+ Done: 'تم',
+ Messages: 'الرسائل...',
+ 'Switch Conversation': 'تبديل المحادثة',
+ TODAY: 'اليوم',
+ Read: 'مقروء',
+ Sent: 'تم الإرسال',
+ 'Type a message ...': 'اكتب رسالة...',
+ 'Attach image': 'إرفاق صورة',
+ 'Send message': 'إرسال الرسالة',
+ 'Shared an image': 'تمت مشاركة صورة',
+
+ // Colors & Common Values
+ Red: 'أحمر',
+ Black: 'أسود',
+ Brown: 'بني',
+ Grey: 'رمادي',
+ White: 'أبيض',
+ Blue: 'أزرق',
+ Green: 'أخضر',
+ Gold: 'ذهبي',
+ Standard: 'قياسي',
+
+ // Additional UI & Empty-State Labels
+ 'Add sample item': 'إضافة عنصر تجريبي',
+ 'No saved delivery addresses yet.': 'لا توجد عناوين توصيل محفوظة بعد.',
+ 'No delivery methods available.': 'لا توجد طرق توصيل متاحة.',
+ 'No delivery address selected.': 'لم يتم تحديد عنوان توصيل.',
+ 'Order receipt not found.': 'لم يتم العثور على إيصال الطلب.',
+ 'Habib shoper': 'متسوق حبيب',
+ 'Habib Shopper': 'متسوق حبيب',
+ Guest: 'زائر',
+ 'Verified Habib Account': 'حساب حبيب موثق',
+ 'Sign in with your Habib account': 'سجل الدخول باستخدام حساب حبيب الخاص بك',
+ '0 adress': '0 عنوان',
+ 'Sign in to manage addresses': 'سجل الدخول لإدارة العناوين',
+ '(People will see this)': '(سيظهر هذا للآخرين)',
+ 'Sample: +77 2350654': 'مثال: +77 2350654',
+ 'For iOS users': 'لمستخدمي iOS',
+ 'Provider request on Habib Meet': 'طلب مزود في حبيب ميت',
+ 'Provider request on Habib Talk': 'طلب مزود في حبيب توك',
+ Pending: 'قيد الانتظار',
+ rejected: 'مرفوض',
+ Rejected: 'مرفوض',
+ Approved: 'مقبول',
+ approved: 'مقبول',
+ 'Not set': 'غير محدد',
+ 'No provider requests yet.': 'لا توجد طلبات مزود بعد.',
+ 'No saved delivery addresses yet. Tap below to add your first address.':
+ 'لا توجد عناوين توصيل محفوظة بعد. اضغط أدناه لإضافة عنوانك الأول.',
+ 'Diverse stores, products, and cultures united in one shared marketplace.':
+ 'متاجر ومنتجات وثقافات متنوعة تجتمع في سوق مشترك واحد.',
+ 'Curated books, handicrafts, modest fashion, and home essentials worldwide.':
+ 'كتب مختارة، حرف يدوية، أزياء محتشمة، ومستلزمات منزلية من جميع أنحاء العالم.',
+ 'Could not load live marketplace feed. Tap Retry to refresh.':
+ 'تعذر تحميل موجز السوق المباشر. اضغط على إعادة المحاولة للتحديث.',
+ 'Could not load categories. Tap Retry to refresh.':
+ 'تعذر تحميل الفئات. اضغط على إعادة المحاولة للتحديث.',
+ 'No categories found.': 'لم يتم العثور على فئات.',
+ 'No categories available.': 'لا توجد فئات متاحة.',
+ 'Could not load products. Tap Retry to refresh.':
+ 'تعذر تحميل المنتجات. اضغط على إعادة المحاولة للتحديث.',
+ 'No products available.': 'لا توجد منتجات متاحة.',
+ 'No saved items yet. Tap the bookmark icon on any product to save it here.':
+ 'لا توجد عناصر محفوظة بعد. اضغط على أيقونة الحفظ على أي منتج لحفظه هنا.',
+ 'No matching products found.': 'لم يتم العثور على منتجات مطابقة.',
+ 'Could not load product details. Tap Retry to refresh.':
+ 'تعذر تحميل تفاصيل المنتج. اضغط على إعادة المحاولة للتحديث.',
+ 'Product not found.': 'لم يتم العثور على المنتج.',
+ 'Leather accessories and supplies / Leather bags': 'إكسسوارات ومستلزمات جلدية / حقائب جلدية',
+ '2–3 Days': '2-3 أيام',
+ '2-3 Days': '2-3 أيام',
+ Store: 'المتجر',
+ 'Could not load store booth details. Tap Retry to refresh.':
+ 'تعذر تحميل تفاصيل المتجر. اضغط على إعادة المحاولة للتحديث.',
+ 'Store booth not found.': 'لم يتم العثور على المتجر.',
+ '+1 year membership': '+1 سنة عضوية',
+ '+60 sales': '+60 مبيعات',
+ 'No products in this store yet.': 'لا توجد منتجات في هذا المتجر بعد.',
+ 'Could not load orders. Tap Retry to refresh.':
+ 'تعذر تحميل الطلبات. اضغط على إعادة المحاولة للتحديث.',
+ 'No current orders': 'لا توجد طلبات حالية',
+ 'No delivered orders': 'لا توجد طلبات مستلمة',
+ 'No canceled orders': 'لا توجد طلبات ملغاة',
+ 'Could not load order details. Tap Retry to refresh.':
+ 'تعذر تحميل تفاصيل الطلب. اضغط على إعادة المحاولة للتحديث.',
+ 'Order not found.': 'لم يتم العثور على الطلب.',
+ 'No shipments for this order yet.': 'لا توجد شحنات لهذا الطلب بعد.',
+ 'Connecting...': 'جاري الاتصال...',
+ 'Verified Booth': 'متجر موثق',
+ 'More options': 'خيارات إضافية',
+ 'Attached image': 'صورة مرفقة',
+ 'Voice message': 'رسالة صوتية',
+};
+
+export function tr(text: string, lang?: string | null): string {
+ if (!text) return text;
+ const norm = normalizeLanguage(lang ?? readRawUserLanguage());
+ if (norm === 'en') return text;
+
+ const dict = norm === 'fa' ? FA_DICTIONARY : AR_DICTIONARY;
+ if (dict[text] !== undefined) {
+ return dict[text];
+ }
+ const trimmed = text.trim();
+ if (dict[trimmed] !== undefined) {
+ return dict[trimmed];
+ }
+
+ // Dynamic patterns
+ let m: RegExpMatchArray | null = null;
+
+ if ((m = trimmed.match(/^Total\s+(\d+)\s+items?$/i))) {
+ return norm === 'fa' ? `مجموع ${m[1]} کالا` : `إجمالي ${m[1]} عنصر`;
+ }
+ if ((m = trimmed.match(/^Items\s*\((\d+)\)$/i))) {
+ return norm === 'fa' ? `اقلام (${m[1]})` : `العناصر (${m[1]})`;
+ }
+ if ((m = trimmed.match(/^Review\s*\((\d+)\)$/i))) {
+ return norm === 'fa' ? `نظرات (${m[1]})` : `التقييمات (${m[1]})`;
+ }
+ if ((m = trimmed.match(/^Customer Reviews\s*\((\d+)\)$/i))) {
+ return norm === 'fa' ? `نظرات خریداران (${m[1]})` : `تقييمات العملاء (${m[1]})`;
+ }
+ if ((m = trimmed.match(/^(\d+)\s+Reviews?$/i))) {
+ return norm === 'fa' ? `${m[1]} دیدگاه` : `${m[1]} تقييم`;
+ }
+ if ((m = trimmed.match(/^Uploaded\s*\((\d+)\)$/i))) {
+ return norm === 'fa' ? `آپلود شده (${m[1]})` : `تم الرفع (${m[1]})`;
+ }
+ if ((m = trimmed.match(/^Saved Addresses\s*\((\d+)\)$/i))) {
+ return norm === 'fa' ? `آدرسهای ذخیرهشده (${m[1]})` : `العناوين المحفوظة (${m[1]})`;
+ }
+ if ((m = trimmed.match(/^My Wallet\s*\((.+)\)$/i))) {
+ return norm === 'fa' ? `کیف پول من (${m[1]})` : `محفظتي (${m[1]})`;
+ }
+ if ((m = trimmed.match(/^(\d+)\s+Habib Coins?$/i))) {
+ return norm === 'fa' ? `${m[1]} سکه حبیب` : `${m[1]} عملة حبيب`;
+ }
+ if ((m = trimmed.match(/^Provider request on\s+(.+)$/i))) {
+ return norm === 'fa' ? `درخواست غرفهداری در ${m[1]}` : `طلب مزود في ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Results for "(.+)"$/i))) {
+ return norm === 'fa' ? `نتایج برای «${m[1]}»` : `نتائج البحث عن "${m[1]}"`;
+ }
+ if ((m = trimmed.match(/^Online\s*·\s*Avg\.\s*reply\s*(.+)$/i))) {
+ return norm === 'fa' ? `آنلاین · میانگین پاسخگویی ${m[1]}` : `متصل · متوسط الرد ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Voice message\s*\((.+)\)$/i))) {
+ return norm === 'fa' ? `پیام صوتی (${m[1]})` : `رسالة صوتية (${m[1]})`;
+ }
+ if ((m = trimmed.match(/^(\d+)\s+Orders?$/i))) {
+ return norm === 'fa' ? `${m[1]} سفارش` : `${m[1]} طلبات`;
+ }
+ if ((m = trimmed.match(/^(\d+)\s+(?:address|addresses|adress|adresses)$/i))) {
+ return norm === 'fa' ? `${m[1]} آدرس` : `${m[1]} عنوان`;
+ }
+ if ((m = trimmed.match(/^(\d+)\s+items?$/i))) {
+ return norm === 'fa' ? `${m[1]} کالا` : `${m[1]} عنصر`;
+ }
+ if ((m = trimmed.match(/^(\d+)\s+shops?$/i))) {
+ return norm === 'fa' ? `${m[1]} غرفه` : `${m[1]} متجر`;
+ }
+ if ((m = trimmed.match(/^(\d+)\s*\/\s*(\d+)\s+Delivery$/i))) {
+ return norm === 'fa' ? `${m[1]} / ${m[2]} تحویل` : `${m[1]} / ${m[2]} توصيل`;
}
+ if ((m = trimmed.match(/^(\d+)\s+saved product\(s\)$/i))) {
+ return norm === 'fa' ? `${m[1]} محصول ذخیرهشده` : `${m[1]} منتج محفوظ`;
+ }
+ if ((m = trimmed.match(/^(\d+)\s+(?:items?|Products?)\s+from\s+(\d+)\s+Shops?$/i))) {
+ return norm === 'fa' ? `${m[1]} کالا از ${m[2]} غرفه` : `${m[1]} عنصر من ${m[2]} متاجر`;
+ }
+ if ((m = trimmed.match(/^Since\s+(.+)$/i))) {
+ return norm === 'fa' ? `از سال ${m[1]}` : `منذ عام ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Order\s+([A-Za-z0-9-]+)$/i))) {
+ return norm === 'fa' ? `سفارش ${m[1]}` : `الطلب ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Recording\s+(.+)$/i))) {
+ return norm === 'fa' ? `در حال ضبط ${m[1]}` : `جاري التسجيل ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Shipment\s+(\d+)\s*\((.+)\)$/i))) {
+ return norm === 'fa' ? `مرسوله ${m[1]} (${m[2]})` : `الشحنة ${m[1]} (${m[2]})`;
+ }
+ if ((m = trimmed.match(/^Shipment\s+(\d+)$/i))) {
+ return norm === 'fa' ? `مرسوله ${m[1]}` : `الشحنة ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Store\s*:\s*(.+)$/i))) {
+ return norm === 'fa' ? `فروشگاه : ${m[1]}` : `المتجر : ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Color:\s*(.+)$/i))) {
+ const val = tr(m[1].trim(), norm);
+ return norm === 'fa' ? `رنگ: ${val}` : `اللون: ${val}`;
+ }
+ if ((m = trimmed.match(/^Quantity:\s*(.+)$/i))) {
+ return norm === 'fa' ? `تعداد: ${m[1]}` : `الكمية: ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Balance\s*:\s*(\d+)\s*Coins\s*\((.+)\)$/i))) {
+ return norm === 'fa'
+ ? `موجودی : ${m[1]} سکه (${m[2]})`
+ : `الرصيد : ${m[1]} عملة (${m[2]})`;
+ }
+ if ((m = trimmed.match(/^(\d+[-–]\d+)\s+business days?$/i))) {
+ return norm === 'fa' ? `${m[1]} روز کاری` : `${m[1]} أيام عمل`;
+ }
+ if ((m = trimmed.match(/^Delivered on\s+(.+)$/i))) {
+ return norm === 'fa' ? `تحویل شده در ${m[1]}` : `تم التوصيل في ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Est\.\s*Delivery:\s*(.+)$/i))) {
+ return norm === 'fa' ? `تحویل تخمینی: ${m[1]}` : `التوصيل المتوقع: ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Expected Dispatch:\s*(.+)$/i))) {
+ return norm === 'fa' ? `ارسال تخمینی: ${m[1]}` : `الشحن المتوقع: ${m[1]}`;
+ }
+ if (
+ (m = trimmed.match(
+ /^Order\s+(.+)\s+is Confirmed\.\s*You will Receive an Email confirmation Shortly\.?$/i
+ ))
+ ) {
+ return norm === 'fa'
+ ? `سفارش ${m[1]} تأیید شد. بهزودی ایمیل تأییدیه دریافت خواهید کرد`
+ : `تم تأكيد الطلب ${m[1]}. ستتلقى رسالة تأكيد عبر البريد الإلكتروني قريباً`;
+ }
+ if ((m = trimmed.match(/^No products matched "(.+)"\.?$/i))) {
+ return norm === 'fa'
+ ? `محصولی مشابه «${m[1]}» یافت نشد.`
+ : `لا توجد منتجات تطابق "${m[1]}".`;
+ }
+ if ((m = trimmed.match(/^No categories matched "(.+)"\.?$/i))) {
+ return norm === 'fa'
+ ? `دستهبندی مشابه «${m[1]}» یافت نشد.`
+ : `لا توجد فئات تطابق "${m[1]}".`;
+ }
+ if ((m = trimmed.match(/^Application Status:\s*(.+)$/i))) {
+ const statusText = tr(m[1].trim(), norm);
+ return norm === 'fa' ? `وضعیت درخواست: ${statusText}` : `حالة الطلب: ${statusText}`;
+ }
+ if ((m = trimmed.match(/^Language (?:switched|set) to\s+(.+)$/i))) {
+ return norm === 'fa' ? `زبان به ${m[1]} تغییر یافت` : `تم تغيير اللغة إلى ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^(\d+)\s*\+\s*Years$/i))) {
+ return norm === 'fa' ? `${m[1]}+ سال` : `+${m[1]} سنوات`;
+ }
+ if ((m = trimmed.match(/^Support ticket\s+(.+)\s+submitted$/i))) {
+ return norm === 'fa' ? `تیکت پشتیبانی ${m[1]} ثبت شد` : `تم إرسال تذكرة الدعم ${m[1]}`;
+ }
+ if ((m = trimmed.match(/^Please sign in to (.+)\.?$/i))) {
+ const feat = tr(m[1].trim(), norm);
+ return norm === 'fa'
+ ? `لطفاً برای ${feat} وارد حساب کاربری خود شوید.`
+ : `يرجى تسجيل الدخول من أجل ${feat}.`;
+ }
+
+ return text;
+}
+
+if (typeof document !== 'undefined') {
+ applyDocumentLanguage();
}
diff --git a/src/lib/routes.ts b/src/lib/routes.ts
index bf6a24c..9535f0d 100644
--- a/src/lib/routes.ts
+++ b/src/lib/routes.ts
@@ -31,7 +31,6 @@ export const ROUTES = {
addresses: '/account/addresses',
profile: '/account/profile',
settings: '/account/settings',
- test: '/test',
} as const;
export const USE_MOCK_DATA =
diff --git a/src/pages/account/LanguageSettingPage.tsx b/src/pages/account/LanguageSettingPage.tsx
index bc851e0..0d888a8 100644
--- a/src/pages/account/LanguageSettingPage.tsx
+++ b/src/pages/account/LanguageSettingPage.tsx
@@ -8,6 +8,7 @@ import { useShopApp } from '../../context/ShopAppContext';
import { useAnimatedPresence } from '../../hooks/use-animated-presence';
import { useHardwareBackHandler } from '../../hooks/use-hardware-back-handler';
import { useSmartBack } from '../../hooks/useSmartBack';
+import { isRtlLanguage, tr } from '../../lib/cookies';
import { resolveMediaUrl } from '../../lib/http';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
import {
@@ -123,6 +124,7 @@ export const LanguageSettingPage: React.FC = () => {
changeLanguage,
showToast,
} = useShopApp();
+ const isRtl = isRtlLanguage(language);
const [habibCoinsBalance, setHabibCoinsBalance] = useState(() =>
typeof window !== 'undefined' && typeof window.HABIB_COINS === 'number'
@@ -278,7 +280,7 @@ export const LanguageSettingPage: React.FC = () => {
type="button"
className="habib-icon-btn"
onClick={() => (bare ? navigate('/shop-account') : smartBack(ROUTES.account))}
- aria-label="Back"
+ aria-label={tr('Back')}
style={{
width: 40,
height: 40,
@@ -299,6 +301,7 @@ export const LanguageSettingPage: React.FC = () => {
style={{
width: 18.22,
height: 15.21,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -444,7 +447,7 @@ export const LanguageSettingPage: React.FC = () => {
wordBreak: 'break-word',
}}
>
- {pRow.label}
+ {tr(pRow.label)}
@@ -479,7 +482,7 @@ export const LanguageSettingPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- {pRow.statusText}
+ {tr(pRow.statusText)}
@@ -531,7 +534,7 @@ export const LanguageSettingPage: React.FC = () => {
color: '#ffffff',
}}
>
- Donate Habib
+ {tr('Donate Habib')}
{
color: 'rgba(255, 255, 255, 0.6)',
}}
>
- Help Habib's Large-Scale project
+ {tr("Help Habib's Large-Scale project")}
@@ -577,7 +580,7 @@ export const LanguageSettingPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- Donate
+ {tr('Donate')}
@@ -618,7 +621,7 @@ export const LanguageSettingPage: React.FC = () => {
color: '#73889d',
}}
>
- Your Inventory
+ {tr('Your Inventory')}
{
color: '#151c31',
}}
>
- {bare ? '21 Habib Coins' : `${habibCoinsBalance} Habib Coins`}
+ {tr(bare ? '21 Habib Coins' : `${habibCoinsBalance} Habib Coins`)}
@@ -661,7 +664,7 @@ export const LanguageSettingPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- Buy Coins
+ {tr('Buy Coins')}
@@ -714,7 +717,7 @@ export const LanguageSettingPage: React.FC = () => {
color: '#111111',
}}
>
- Apply as Provider
+ {tr('Apply as Provider')}
@@ -776,7 +779,7 @@ export const LanguageSettingPage: React.FC = () => {
color: '#111111',
}}
>
- {useMockFallback ? 'My Wallet ($24)' : 'My Wallet ($0)'}
+ {tr(useMockFallback ? 'My Wallet ($24)' : 'My Wallet ($0)')}
{
color: '#73889d',
}}
>
- income from Habib
+ {tr('income from Habib')}
{
width: 5,
height: 10,
flexShrink: 0,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -869,13 +873,13 @@ export const LanguageSettingPage: React.FC = () => {
color: '#111111',
}}
>
- Select Shop Language
+ {tr('Select Shop Language')}
setLangSheetOpen(false)}
- aria-label="Close"
+ aria-label={tr('Close')}
style={{
width: 24,
height: 24,
diff --git a/src/pages/account/ProviderRequestPage.tsx b/src/pages/account/ProviderRequestPage.tsx
index 43dd1e7..51e457b 100644
--- a/src/pages/account/ProviderRequestPage.tsx
+++ b/src/pages/account/ProviderRequestPage.tsx
@@ -1,9 +1,9 @@
import React, { useEffect, useRef, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { MobileShell } from '../../components/layout/MobileShell';
-import { InlineSpinner } from '../../components/common/ShimmerSkeletons';
import { useShopApp } from '../../context/ShopAppContext';
import { useSmartBack } from '../../hooks/useSmartBack';
+import { isRtlLanguage, tr } from '../../lib/cookies';
import { resolveMediaUrl } from '../../lib/http';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
import { useUpdateProfileMutation } from '../../lib/shopQueries';
@@ -24,9 +24,10 @@ export const ProviderRequestPage: React.FC = () => {
isUserAuthenticated,
requireAuth,
profile,
- isProfileLoading,
+ language,
showToast,
} = useShopApp();
+ const isRtl = isRtlLanguage(language);
const updateProfileMutation = useUpdateProfileMutation();
const savingProfile = updateProfileMutation.isPending;
@@ -54,25 +55,6 @@ export const ProviderRequestPage: React.FC = () => {
? resolveMediaUrl(profile.avatar_url)
: '';
- const avatarImgRef = useRef(null);
- const [loadedAvatarUrl, setLoadedAvatarUrl] = useState('');
- const [erroredAvatarUrl, setErroredAvatarUrl] = useState('');
-
- useEffect(() => {
- if (!avatarUrl) return;
- const img = avatarImgRef.current;
- if (img && img.complete && img.naturalWidth > 0) {
- setLoadedAvatarUrl(avatarUrl);
- }
- }, [avatarUrl]);
-
- const hasValidAvatarUrl =
- Boolean(avatarUrl) && erroredAvatarUrl !== avatarUrl;
- const isAvatarImageLoading =
- hasValidAvatarUrl && loadedAvatarUrl !== avatarUrl;
- const showAvatarSpinner =
- !bare && isUserAuthenticated && (isProfileLoading || isAvatarImageLoading);
-
const headerEmailText = bare
? 'Ahdart14@gmail.com'
: email.trim() ||
@@ -148,7 +130,7 @@ export const ProviderRequestPage: React.FC = () => {
onClick={() =>
bare ? navigate('/shop-account') : smartBack(ROUTES.account)
}
- aria-label="Back"
+ aria-label={tr('Back')}
style={{
width: 40,
height: 40,
@@ -169,6 +151,7 @@ export const ProviderRequestPage: React.FC = () => {
style={{
width: 18.21,
height: 14.56,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -183,7 +166,7 @@ export const ProviderRequestPage: React.FC = () => {
textAlign: 'center',
}}
>
- Accunt detail
+ {tr('Accunt detail')}
@@ -207,7 +190,6 @@ export const ProviderRequestPage: React.FC = () => {
>
{
overflow: 'hidden',
}}
>
- {hasValidAvatarUrl && (
+ {avatarUrl ? (
setLoadedAvatarUrl(avatarUrl)}
- onError={() => setErroredAvatarUrl(avatarUrl)}
style={{
width: '100%',
height: '100%',
objectFit: 'cover',
- opacity: isAvatarImageLoading ? 0 : 1,
}}
/>
- )}
- {showAvatarSpinner ? (
-
-
-
- ) : !hasValidAvatarUrl ? (
+ ) : (
{
height: 33.04,
}}
/>
- ) : null}
+ )}
{
{
lineHeight: '20px',
color: '#d78e06',
textAlign: 'center',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
}}
>
- {!bare && isUserAuthenticated && isProfileLoading ? (
-
- ) : (
- headerEmailText
- )}
+ {headerEmailText}
@@ -317,9 +272,9 @@ export const ProviderRequestPage: React.FC = () => {
color: '#151c31',
}}
>
- Full Name* {' '}
+ {tr('Full Name')}* {' '}
- (People will see this)
+ {tr('(People will see this)')}
{
color: '#111111',
}}
>
- Date of Birth*
+ {tr('Date of Birth')}*
{
@@ -422,7 +377,7 @@ export const ProviderRequestPage: React.FC = () => {
color: '#36363c',
}}
>
- {birthdate || 'Select date'}
+ {birthdate || tr('Select date')}
{
onFocus={() => setFocusedField('birthdate')}
onBlur={() => setFocusedField(null)}
onChange={(e) => setBirthdate(e.target.value)}
- aria-label="Date of Birth"
+ aria-label={tr('Date of Birth')}
style={{
position: 'absolute',
inset: 0,
@@ -465,7 +420,7 @@ export const ProviderRequestPage: React.FC = () => {
color: '#111111',
}}
>
- Whatsapp Number
*
+ {tr('Whatsapp Number')}
*
{
onFocus={() => setFocusedField('waNumber')}
onBlur={() => setFocusedField(null)}
onChange={(e) => setWaNumber(e.target.value)}
- placeholder="Sample: +77 2350654"
+ placeholder={tr('Sample: +77 2350654')}
style={{
width: '100%',
height: 55,
@@ -515,7 +470,7 @@ export const ProviderRequestPage: React.FC = () => {
color: '#111111',
}}
>
- Email
+ {tr('Email')}
{
onFocus={() => setFocusedField('email')}
onBlur={() => setFocusedField(null)}
onChange={(e) => setEmail(e.target.value)}
- placeholder="For iOS users"
+ placeholder={tr('For iOS users')}
style={{
width: '100%',
height: 55,
@@ -570,7 +525,7 @@ export const ProviderRequestPage: React.FC = () => {
color: '#fbfbfc',
}}
>
- {savingProfile ? 'Saving...' : 'Submit'}
+ {savingProfile ? tr('Saving...') : tr('Submit')}
diff --git a/src/pages/account/ShopAccountPage.tsx b/src/pages/account/ShopAccountPage.tsx
index 499128e..58a0de9 100644
--- a/src/pages/account/ShopAccountPage.tsx
+++ b/src/pages/account/ShopAccountPage.tsx
@@ -1,10 +1,9 @@
-import React, { useEffect, useMemo, useRef, useState } from 'react';
+import React, { useMemo } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { MobileShell } from '../../components/layout/MobileShell';
import { BottomNavBar } from '../../components/layout/BottomNavBar';
import { OrderCounterCard } from '../../components/account/OrderCounterCard';
import { AccountMenuRow } from '../../components/account/AccountMenuRow';
-import { InlineSpinner } from '../../components/common/ShimmerSkeletons';
import {
ACCOUNT_ORDER_COUNTERS,
type AccountMenuRowItem,
@@ -12,6 +11,7 @@ import {
} from '../../data/accountData';
import { useShopApp } from '../../context/ShopAppContext';
import { resolveMediaUrl } from '../../lib/http';
+import { tr } from '../../lib/cookies';
import { formatPhoneForDisplay } from '../../lib/phone';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
@@ -29,7 +29,6 @@ export const ShopAccountPage: React.FC = () => {
openLoginModal,
requireAuth,
profile,
- isProfileLoading,
orderCounters,
addresses,
selectedAddress,
@@ -164,25 +163,6 @@ export const ShopAccountPage: React.FC = () => {
? resolveMediaUrl(profile.avatar_url)
: '';
- const avatarImgRef = useRef
(null);
- const [loadedAvatarUrl, setLoadedAvatarUrl] = useState('');
- const [erroredAvatarUrl, setErroredAvatarUrl] = useState('');
-
- useEffect(() => {
- if (!avatarUrl) return;
- const img = avatarImgRef.current;
- if (img && img.complete && img.naturalWidth > 0) {
- setLoadedAvatarUrl(avatarUrl);
- }
- }, [avatarUrl]);
-
- const hasValidAvatarUrl =
- Boolean(avatarUrl) && erroredAvatarUrl !== avatarUrl;
- const isAvatarImageLoading =
- hasValidAvatarUrl && loadedAvatarUrl !== avatarUrl;
- const showAvatarSpinner =
- !bare && isUserAuthenticated && (isProfileLoading || isAvatarImageLoading);
-
const handleProtectedNavigate = (targetRoute: string, featureName: string) => {
if (bare) {
navigate(targetRoute);
@@ -217,7 +197,6 @@ export const ShopAccountPage: React.FC = () => {
{/* Avatar Circle (4215:11560) */}
{
overflow: 'hidden',
}}
>
- {hasValidAvatarUrl && (
+ {avatarUrl ? (
setLoadedAvatarUrl(avatarUrl)}
- onError={() => setErroredAvatarUrl(avatarUrl)}
style={{
width: '100%',
height: '100%',
objectFit: 'cover',
- opacity: isAvatarImageLoading ? 0 : 1,
}}
/>
- )}
- {showAvatarSpinner ? (
-
-
-
- ) : !hasValidAvatarUrl ? (
+ ) : (
{
height: 33.04,
}}
/>
- ) : null}
+ )}
- {!bare && isUserAuthenticated && isProfileLoading ? (
-
-
-
- ) : (
- <>
- {/* User Name "Habib shoper" (4214:366) */}
-
- {displayName}
-
+ {/* User Name "Habib shoper" (4214:366) */}
+
+ {tr(displayName)}
+
- {/* Phone "09102036523" (4214:367) */}
-
- {displaySub}
-
- >
- )}
+ {/* Phone "09102036523" (4214:367) */}
+
+ {tr(displaySub)}
+
{/* 3 Order Status Counter Cards (4215:11563) */}
@@ -454,7 +396,7 @@ export const ShopAccountPage: React.FC = () => {
color: bare ? '#d44747' : '#d78e06',
}}
>
- {bare ? 'Sign out' : 'Log in with Habib'}
+ {tr(bare ? 'Sign out' : 'Log in with Habib')}
{
color: '#8b8b8b',
}}
>
- {bare ? 'sign out from account' : 'connect your Habib account'}
+ {tr(bare ? 'sign out from account' : 'connect your Habib account')}
diff --git a/src/pages/account/ShopAddressPage.tsx b/src/pages/account/ShopAddressPage.tsx
index 49e48f8..74b8321 100644
--- a/src/pages/account/ShopAddressPage.tsx
+++ b/src/pages/account/ShopAddressPage.tsx
@@ -9,6 +9,7 @@ import {
import { AddressFormSheet } from '../../components/modals/AddressFormSheet';
import { BUY01_ADDRESSES } from '../../data/checkoutData';
import { useShopApp } from '../../context/ShopAppContext';
+import { tr } from '../../lib/cookies';
import { mapAddressToOption } from '../../lib/mappers';
import { isBareMode, ROUTES } from '../../lib/routes';
import type { ApiAddress } from '../../lib/shopApi';
@@ -100,7 +101,7 @@ export const ShopAddressPage: React.FC = () => {
color: '#73889d',
}}
>
- No saved delivery addresses yet. Tap below to add your first address.
+ {tr('No saved delivery addresses yet. Tap below to add your first address.')}
)}
diff --git a/src/pages/catalog/ShopBoothPage.tsx b/src/pages/catalog/ShopBoothPage.tsx
index 6c0e449..fd0f0b2 100644
--- a/src/pages/catalog/ShopBoothPage.tsx
+++ b/src/pages/catalog/ShopBoothPage.tsx
@@ -11,6 +11,7 @@ import {
import { TWO_COLUMN_GRID_PRODUCTS } from '../../data/catalogData';
import { useShopApp } from '../../context/ShopAppContext';
import { useSmartBack } from '../../hooks/useSmartBack';
+import { isRtlLanguage, tr } from '../../lib/cookies';
import { resolveMediaUrl } from '../../lib/http';
import { mapProductToGridItem } from '../../lib/mappers';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
@@ -27,7 +28,8 @@ export const ShopBoothPage: React.FC = () => {
const useMockFallback = isBare || USE_MOCK_DATA;
const { storeId } = useParams<{ storeId?: string }>();
const smartBack = useSmartBack(ROUTES.home);
- const { isBookmarked, toggleBookmark, showToast } = useShopApp();
+ const { isBookmarked, toggleBookmark, showToast, language } = useShopApp();
+ const isRtl = isRtlLanguage(language);
const resolvedSlug = storeId || 'tashakol-farzandan-rohhallah';
const storeQuery = useStoreDetailQuery(resolvedSlug, !isBare);
@@ -112,7 +114,7 @@ export const ShopBoothPage: React.FC = () => {
smartBack(ROUTES.home)}
- aria-label="Back"
+ aria-label={tr('Back')}
style={{
width: 40,
height: 40,
@@ -132,6 +134,7 @@ export const ShopBoothPage: React.FC = () => {
style={{
width: 18.22,
height: 14.56,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -209,18 +212,19 @@ export const ShopBoothPage: React.FC = () => {
) : (
-
+ <>
+
{/* Circular Store Avatar */}
{
whiteSpace: 'nowrap',
}}
>
- {liveStore?.membership_label || '+1 year membership'}
+ {tr(liveStore?.membership_label || '+1 year membership')}
{
whiteSpace: 'nowrap',
}}
>
- {liveStore?.sales_label || '+60 sales'}
+ {tr(liveStore?.sales_label || '+60 sales')}
@@ -446,7 +450,7 @@ export const ShopBoothPage: React.FC = () => {
textOverflow: 'ellipsis',
}}
>
- Avg. Response
+ {tr('Avg. Response')}
@@ -503,7 +507,7 @@ export const ShopBoothPage: React.FC = () => {
textOverflow: 'ellipsis',
}}
>
- On-time Delivery
+ {tr('On-time Delivery')}
@@ -560,7 +564,7 @@ export const ShopBoothPage: React.FC = () => {
textOverflow: 'ellipsis',
}}
>
- Satisfaction
+ {tr('Satisfaction')}
@@ -584,7 +588,7 @@ export const ShopBoothPage: React.FC = () => {
color: '#292a2e',
}}
>
- About
+ {tr('About')}
{
{liveStore?.description ||
(useMockFallback
? 'In this room, we are going to talk about raising children from the perspective of Islam In this room, we are going to talk about raising children from the perspective of Islam of Islam In this room, we are going to talk about raising children from about the perspective talk about of Islam room.'
- : 'No description available.')}
+ : tr('No description available.'))}
@@ -622,7 +626,7 @@ export const ShopBoothPage: React.FC = () => {
color: '#292a2e',
}}
>
- Products
+ {tr('Products')}
{liveStore?.products?.length ? (
@@ -650,6 +654,78 @@ export const ShopBoothPage: React.FC = () => {
)}
+
+ {/* Bottom Sticky Seller Chat Bar (Option 2: Full-Width Gold CTA in White Sticky Sheet) */}
+
+
{
+ const target = ROUTES.chatThread(liveStore?.slug || resolvedSlug);
+ navigate(target);
+ }}
+ style={{
+ width: '100%',
+ height: 52,
+ borderRadius: 11,
+ backgroundColor: '#d78e06',
+ border: 'none',
+ padding: '0 16px',
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ gap: 8,
+ }}
+ >
+
+
+
+
+
+ {tr('Chat with Seller')}
+
+
+
+ >
)}
);
diff --git a/src/pages/catalog/ShopCatItemsPage.tsx b/src/pages/catalog/ShopCatItemsPage.tsx
index 9888989..9b84204 100644
--- a/src/pages/catalog/ShopCatItemsPage.tsx
+++ b/src/pages/catalog/ShopCatItemsPage.tsx
@@ -11,6 +11,7 @@ import {
} from '../../components/common/ShimmerSkeletons';
import { TWO_COLUMN_GRID_PRODUCTS } from '../../data/catalogData';
import { useShopApp } from '../../context/ShopAppContext';
+import { tr } from '../../lib/cookies';
import { mapProductToGridItem } from '../../lib/mappers';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
import {
@@ -170,9 +171,11 @@ export const ShopCatItemsPage: React.FC = ({
fontWeight: 600,
}}
>
- {mode === 'bookmarks'
- ? 'No saved items yet. Tap the bookmark icon on any product to save it here.'
- : 'No matching products found.'}
+ {tr(
+ mode === 'bookmarks'
+ ? 'No saved items yet. Tap the bookmark icon on any product to save it here.'
+ : 'No matching products found.'
+ )}
)
) : (
diff --git a/src/pages/catalog/ShopCategoryPage.tsx b/src/pages/catalog/ShopCategoryPage.tsx
index cbbe545..ecbb55c 100644
--- a/src/pages/catalog/ShopCategoryPage.tsx
+++ b/src/pages/catalog/ShopCategoryPage.tsx
@@ -9,6 +9,7 @@ import {
RetryBanner,
} from '../../components/common/ShimmerSkeletons';
import { CATEGORY_GRID_TILES } from '../../data/catalogData';
+import { useShopApp } from '../../context/ShopAppContext';
import { mapCategoryToTile } from '../../lib/mappers';
import { isBareMode, USE_MOCK_DATA } from '../../lib/routes';
import { useCategoriesQuery } from '../../lib/shopQueries';
@@ -18,6 +19,8 @@ import { useCategoriesQuery } from '../../lib/shopQueries';
*/
export const ShopCategoryPage: React.FC = () => {
const location = useLocation();
+ const { language } = useShopApp();
+ void language;
const isBare = isBareMode(location.search);
const useMockFallback = isBare || USE_MOCK_DATA;
const [searchQuery, setSearchQuery] = useState('');
diff --git a/src/pages/catalog/ShopSinglePage.tsx b/src/pages/catalog/ShopSinglePage.tsx
index a1bed11..481244d 100644
--- a/src/pages/catalog/ShopSinglePage.tsx
+++ b/src/pages/catalog/ShopSinglePage.tsx
@@ -12,6 +12,7 @@ import {
import { HOME_POPULAR_PRODUCTS } from '../../data/catalogData';
import { useShopApp } from '../../context/ShopAppContext';
import { useSmartBack } from '../../hooks/useSmartBack';
+import { isRtlLanguage, tr } from '../../lib/cookies';
import { resolveMediaUrl } from '../../lib/http';
import { mapProductToCompactItem } from '../../lib/mappers';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
@@ -65,8 +66,10 @@ export const ShopSinglePage: React.FC = () => {
isCartBusy,
isBookmarked,
toggleBookmark,
+ language,
showToast,
} = useShopApp();
+ const isRtl = isRtlLanguage(language);
const [activeTab, setActiveTab] = useState<'info' | 'review'>('info');
const [reviewRating, setReviewRating] = useState(5);
@@ -209,7 +212,7 @@ export const ShopSinglePage: React.FC = () => {
type="button"
className="habib-icon-btn"
onClick={() => smartBack(ROUTES.home)}
- aria-label="Back"
+ aria-label={tr('Back')}
style={{
width: 40,
height: 40,
@@ -229,6 +232,7 @@ export const ShopSinglePage: React.FC = () => {
style={{
width: 18.22,
height: 14.56,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -372,8 +376,10 @@ export const ShopSinglePage: React.FC = () => {
cursor: liveProduct?.category_slug ? 'pointer' : undefined,
}}
>
- {liveProduct?.breadcrumb ||
- 'Leather accessories and supplies / Leather bags'}
+ {tr(
+ liveProduct?.breadcrumb ||
+ 'Leather accessories and supplies / Leather bags'
+ )}
{
color: '#747474',
}}
>
- {isBare
- ? '0 Reviews'
- : `${displayReviews.length} ${
- displayReviews.length === 1 ? 'Review' : 'Reviews'
- }`}
+ {tr(
+ isBare
+ ? '0 Reviews'
+ : `${displayReviews.length} ${
+ displayReviews.length === 1 ? 'Review' : 'Reviews'
+ }`
+ )}
@@ -559,7 +567,7 @@ export const ShopSinglePage: React.FC = () => {
textOverflow: 'ellipsis',
}}
>
- Product Condition
+ {tr('Product Condition')}
{
whiteSpace: 'nowrap',
}}
>
- {liveProduct?.condition_label || (inStock ? 'In Stock' : 'Out of Stock')}
+ {tr(
+ liveProduct?.condition_label ||
+ (inStock ? 'In Stock' : 'Out of Stock')
+ )}
@@ -618,7 +629,7 @@ export const ShopSinglePage: React.FC = () => {
textOverflow: 'ellipsis',
}}
>
- Processing Time
+ {tr('Processing Time')}
{
whiteSpace: 'nowrap',
}}
>
- {liveProduct?.processing_time_label || '2–3 Days'}
+ {tr(liveProduct?.processing_time_label || '2–3 Days')}
@@ -660,7 +671,7 @@ export const ShopSinglePage: React.FC = () => {
textOverflow: 'ellipsis',
}}
>
- Product Type
+ {tr('Product Type')}
{
whiteSpace: 'nowrap',
}}
>
- {liveProduct?.product_type_label || 'Bag'}
+ {tr(liveProduct?.product_type_label || 'Bag')}
@@ -719,7 +730,7 @@ export const ShopSinglePage: React.FC = () => {
>
{storeDetail?.name ||
liveProduct?.store_name ||
- (useMockFallback ? 'Al-Hujjah Books' : 'Store')}
+ (useMockFallback ? 'Al-Hujjah Books' : tr('Store'))}
{
width: 14,
height: 14,
flexShrink: 0,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -799,7 +811,7 @@ export const ShopSinglePage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- ({storeDetail?.since_label || 'Since 2008'})
+ ({tr(storeDetail?.since_label || 'Since 2008')})
)}
@@ -808,7 +820,7 @@ export const ShopSinglePage: React.FC = () => {
{/* Tabs: "Information" & "Review(N)" */}
{
transition: 'color 200ms cubic-bezier(0.22, 1, 0.36, 1)',
}}
>
- Information
+ {tr('Information')}
{
transition: 'color 200ms cubic-bezier(0.22, 1, 0.36, 1)',
}}
>
- Review({displayReviews.length})
+ {tr(`Review(${displayReviews.length})`)}
{/* Active Tab Indicator Bar */}
{
color: '#3d3d3d',
}}
>
- Category
+ {tr('Category')}
{
color: '#747474',
}}
>
- {liveProduct?.category_title || 'Art & Handicrafts'}
+ {tr(liveProduct?.category_title || 'Art & Handicrafts')}
@@ -926,7 +944,7 @@ export const ShopSinglePage: React.FC = () => {
color: '#3d3d3d',
}}
>
- Introduction
+ {tr('Introduction')}
{
{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.'
- : 'No description available.')}
+ : tr('No description available.'))}
@@ -949,7 +967,7 @@ export const ShopSinglePage: React.FC = () => {
@@ -970,7 +988,7 @@ export const ShopSinglePage: React.FC = () => {
color: '#3d3d3d',
}}
>
- Customer Reviews ({displayReviews.length})
+ {tr(`Customer Reviews (${displayReviews.length})`)}
{
color: '#111111',
}}
>
- Write a Review
+ {tr('Write a Review')}
{[1, 2, 3, 4, 5].map((star) => (
@@ -1067,7 +1085,7 @@ export const ShopSinglePage: React.FC = () => {
rows={2}
value={reviewComment}
onChange={(e) => setReviewComment(e.target.value)}
- placeholder="Share your experience with this product..."
+ placeholder={tr('Share your experience with this product...')}
style={{
width: '100%',
borderRadius: 10,
@@ -1094,7 +1112,7 @@ export const ShopSinglePage: React.FC = () => {
opacity: submittingReview || !reviewComment.trim() ? 0.6 : 1,
}}
>
- {submittingReview ? 'Posting...' : 'Post Review'}
+ {submittingReview ? tr('Posting...') : tr('Post Review')}
)}
@@ -1230,7 +1248,7 @@ export const ShopSinglePage: React.FC = () => {
color: '#36363c',
}}
>
- Populars
+ {tr('Populars')}
navigate(ROUTES.search())}
@@ -1251,7 +1269,7 @@ export const ShopSinglePage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- See more
+ {tr('See more')}
{
style={{
width: 13,
height: 13,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -1415,7 +1434,7 @@ export const ShopSinglePage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- {isCartBusy ? 'Adding...' : inStock ? 'Add to Cart' : 'Sold Out'}
+ {isCartBusy ? tr('Adding...') : inStock ? tr('Add to Cart') : tr('Sold Out')}
diff --git a/src/pages/chat/ShopChatPage.tsx b/src/pages/chat/ShopChatPage.tsx
index 7d55f27..1b87a15 100644
--- a/src/pages/chat/ShopChatPage.tsx
+++ b/src/pages/chat/ShopChatPage.tsx
@@ -9,6 +9,7 @@ import {
import { useShopApp } from '../../context/ShopAppContext';
import { useHardwareBackHandler } from '../../hooks/use-hardware-back-handler';
import { useSmartBack } from '../../hooks/useSmartBack';
+import { isRtlLanguage, tr } from '../../lib/cookies';
import { resolveMediaUrl } from '../../lib/http';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
import {
@@ -235,7 +236,8 @@ export const ShopChatPage: React.FC = () => {
const { conversationId } = useParams<{ conversationId?: string }>();
const resolvedConvRef = conversationId || 'al-hujjah-books';
const smartBack = useSmartBack(ROUTES.store(resolvedConvRef));
- const { showToast } = useShopApp();
+ const { showToast, language } = useShopApp();
+ const isRtl = isRtlLanguage(language);
const [menuOpen, setMenuOpen] = useState(false);
const [messageText, setMessageText] = useState('');
@@ -661,7 +663,7 @@ export const ShopChatPage: React.FC = () => {
type="button"
className="habib-icon-btn"
onClick={() => smartBack(ROUTES.store(storeSlug))}
- aria-label="Back"
+ aria-label={tr('Back')}
style={{
width: 40,
height: 40,
@@ -682,6 +684,7 @@ export const ShopChatPage: React.FC = () => {
style={{
width: 18.22,
height: 15.21,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -726,7 +729,7 @@ export const ShopChatPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- {storeLocation}
+ {tr(storeLocation)}
@@ -735,7 +738,7 @@ export const ShopChatPage: React.FC = () => {
type="button"
className="habib-icon-btn"
onClick={() => setMenuOpen((prev) => !prev)}
- aria-label="More options"
+ aria-label={tr('More options')}
style={{
width: 40,
height: 40,
@@ -766,11 +769,18 @@ export const ShopChatPage: React.FC = () => {
className="habib-dropdown-menu"
style={{
position: 'absolute',
- right: 'var(--page-px)',
+ ...(isRtl
+ ? {
+ left: 'var(--page-px)',
+ borderRadius: '0px 15px 15px 15px',
+ }
+ : {
+ right: 'var(--page-px)',
+ borderRadius: '15px 0px 15px 15px',
+ }),
top: 'calc(69px + var(--safe-top, 0px))',
width: 132,
padding: 12,
- borderRadius: '15px 0px 15px 15px',
background: 'linear-gradient(180deg, #ffffff 0%, #f4f7f5 100%)',
border: '1px solid rgba(255, 255, 255, 0.3)',
boxShadow: '0px 4px 11px rgba(30, 30, 30, 0.19)',
@@ -812,7 +822,7 @@ export const ShopChatPage: React.FC = () => {
color: '#151c31',
}}
>
- Report
+ {tr('Report')}
@@ -847,7 +857,7 @@ export const ShopChatPage: React.FC = () => {
color: '#151c31',
}}
>
- Support
+ {tr('Support')}
@@ -896,7 +906,7 @@ export const ShopChatPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- Guidelines
+ {tr('Guidelines')}
@@ -944,7 +954,7 @@ export const ShopChatPage: React.FC = () => {
textAlign: 'center',
}}
>
- {msg.date_group}
+ {tr(msg.date_group)}
)}
@@ -1129,7 +1139,7 @@ export const ShopChatPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- Try Again
+ {tr('Try Again')}
@@ -1221,7 +1231,7 @@ export const ShopChatPage: React.FC = () => {
textAlign: 'center',
}}
>
- Yesterday
+ {tr('Yesterday')}
@@ -1372,7 +1382,7 @@ export const ShopChatPage: React.FC = () => {
textAlign: 'center',
}}
>
- {'Today '}
+ {tr('Today ')}
@@ -1646,7 +1656,7 @@ export const ShopChatPage: React.FC = () => {
textOverflow: 'ellipsis',
}}
>
- {stagedAttachment.label}
+ {tr(stagedAttachment.label)}
{
color: '#64748b',
}}
>
- Ready to send
+ {tr('Ready to send')}
>
@@ -1717,7 +1727,7 @@ export const ShopChatPage: React.FC = () => {
flexShrink: 0,
}}
>
- Cancel
+ {tr('Cancel')}
{
color: '#111111',
}}
>
- Recording {formatDurationMmSs(recordingSeconds)}
+ {tr(`Recording ${formatDurationMmSs(recordingSeconds)}`)}
@@ -1769,7 +1779,7 @@ export const ShopChatPage: React.FC = () => {
flexShrink: 0,
}}
>
- Done
+ {tr('Done')}
{
void handleSendText();
}
}}
- placeholder="Messages"
+ placeholder={tr('Messages')}
style={{
flex: 1,
minWidth: 0,
diff --git a/src/pages/checkout/ShopBuy01Page.tsx b/src/pages/checkout/ShopBuy01Page.tsx
index aa782a8..71ef6f8 100644
--- a/src/pages/checkout/ShopBuy01Page.tsx
+++ b/src/pages/checkout/ShopBuy01Page.tsx
@@ -9,6 +9,7 @@ import { AddressFormSheet } from '../../components/modals/AddressFormSheet';
import { useShopApp } from '../../context/ShopAppContext';
import { BUY01_ADDRESSES } from '../../data/checkoutData';
import { mapAddressToOption } from '../../lib/mappers';
+import { tr } from '../../lib/cookies';
import { isValidPhoneString } from '../../lib/phone';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
import type { ApiAddress } from '../../lib/shopApi';
@@ -132,7 +133,7 @@ export const ShopBuy01Page: React.FC = () => {
color: '#111111',
}}
>
- Delivery Address
+ {tr('Delivery Address')}
@@ -197,7 +198,7 @@ export const ShopBuy01Page: React.FC = () => {
color: '#111111',
}}
>
- Delivery method
+ {tr('Delivery method')}
@@ -278,7 +279,7 @@ export const ShopBuy01Page: React.FC = () => {
color: '#36363c',
}}
>
- {method.title}
+ {tr(method.title)}
{
color: '#747474',
}}
>
- {method.subtitle ||
- `${method.estimated_days_min}-${method.estimated_days_max} business days`}
+ {tr(
+ method.subtitle ||
+ `${method.estimated_days_min}-${method.estimated_days_max} business days`
+ )}
@@ -375,7 +378,7 @@ export const ShopBuy01Page: React.FC = () => {
color: '#36363c',
}}
>
- Standard shiping
+ {tr('Standard shiping')}
{
color: '#747474',
}}
>
- 2-3 business day
+ {tr('2-3 business day')}
@@ -434,7 +437,7 @@ export const ShopBuy01Page: React.FC = () => {
textAlign: 'center',
}}
>
- Your information is encrypted during transmission.
+ {tr('Your information is encrypted during transmission.')}
diff --git a/src/pages/checkout/ShopCartPage.tsx b/src/pages/checkout/ShopCartPage.tsx
index e596340..96047c2 100644
--- a/src/pages/checkout/ShopCartPage.tsx
+++ b/src/pages/checkout/ShopCartPage.tsx
@@ -10,6 +10,7 @@ import { OrderSummarySheet } from '../../components/modals/OrderSummarySheet';
import { useShopApp } from '../../context/ShopAppContext';
import { CART_ITEMS_MAIN, type CartItemData } from '../../data/checkoutData';
import { mapCartItemToCard } from '../../lib/mappers';
+import { tr } from '../../lib/cookies';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
interface InteractiveCartItem extends CartItemData {
@@ -190,7 +191,7 @@ export const ShopCartPage: React.FC = () => {
color: '#292a2e',
}}
>
- {topInfoText}
+ {tr(topInfoText)}
{!isBare && isCartBusy && }
@@ -202,7 +203,7 @@ export const ShopCartPage: React.FC = () => {
}
}}
role="button"
- aria-label={hasAnyItems ? 'Clear all' : 'Add sample item'}
+ aria-label={tr(hasAnyItems ? 'Clear all' : 'Add sample item')}
style={{
fontFamily: 'var(--font-sans)',
fontWeight: 700,
@@ -215,7 +216,7 @@ export const ShopCartPage: React.FC = () => {
userSelect: 'none',
}}
>
- {hasAnyItems ? 'Clear all' : isBare ? 'Restore' : '+ Add Sample'}
+ {tr(hasAnyItems ? 'Clear all' : isBare ? 'Restore' : '+ Add Sample')}
)}
@@ -320,7 +321,7 @@ export const ShopCartPage: React.FC = () => {
color: '#111111',
}}
>
- Your cart is empty
+ {tr('Your cart is empty')}
{
color: '#747474',
}}
>
- Browse verified Muslim booths and add products to start your order.
+ {tr('Browse verified Muslim booths and add products to start your order.')}
{
cursor: 'pointer',
}}
>
- Browse Shop
+ {tr('Browse Shop')}
{
cursor: 'pointer',
}}
>
- Explore Categories
+ {tr('Explore Categories')}
diff --git a/src/pages/checkout/ShopOrderSummaryPage.tsx b/src/pages/checkout/ShopOrderSummaryPage.tsx
index 8bf3415..00db660 100644
--- a/src/pages/checkout/ShopOrderSummaryPage.tsx
+++ b/src/pages/checkout/ShopOrderSummaryPage.tsx
@@ -5,13 +5,17 @@ import { BottomNavBar } from '../../components/layout/BottomNavBar';
import { StickyFooterBar } from '../../components/layout/StickyFooterBar';
import { OrderSummaryBgItemCard } from '../../components/checkout/CartItemCard';
import { OrderSummaryRows } from '../../components/checkout/OrderSummaryRows';
+import { useShopApp } from '../../context/ShopAppContext';
import { ORDER_SUMMARY_BG_ITEMS } from '../../data/checkoutData';
+import { tr } from '../../lib/cookies';
/**
* Node 4154:20497 — `shop-order summery` (Order Summary Bottom Sheet Modal over Cart, 375×814)
*/
export const ShopOrderSummaryPage: React.FC = () => {
const navigate = useNavigate();
+ const { language } = useShopApp();
+ void language;
return (
@@ -35,7 +39,7 @@ export const ShopOrderSummaryPage: React.FC = () => {
textAlign: 'center',
}}
>
- Cart
+ {tr('Cart')}
{
textAlign: 'center',
}}
>
- 3 Products from 2 Shops
+ {tr('3 Products from 2 Shops')}
{
color: '#111111',
}}
>
- Orded Summery
+ {tr('Orded Summery')}
navigate('/shop-cart')}
- aria-label="Close"
+ aria-label={tr('Close')}
style={{
width: 24,
height: 24,
@@ -181,7 +185,7 @@ export const ShopOrderSummaryPage: React.FC = () => {
color: '#fbfbfc',
}}
>
- Got it
+ {tr('Got it')}
diff --git a/src/pages/checkout/ShopPayResultPage.tsx b/src/pages/checkout/ShopPayResultPage.tsx
index ef8e669..5b9bf03 100644
--- a/src/pages/checkout/ShopPayResultPage.tsx
+++ b/src/pages/checkout/ShopPayResultPage.tsx
@@ -3,6 +3,8 @@ import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { MobileShell } from '../../components/layout/MobileShell';
import { StandardPageHeader } from '../../components/layout/TopHeader';
import { EmptyStateBox, ShimmerBox } from '../../components/common/ShimmerSkeletons';
+import { useShopApp } from '../../context/ShopAppContext';
+import { tr } from '../../lib/cookies';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
import { useOrderReceiptQuery } from '../../lib/shopQueries';
@@ -12,6 +14,8 @@ import { useOrderReceiptQuery } from '../../lib/shopQueries';
export const ShopPayResultPage: React.FC = () => {
const navigate = useNavigate();
const location = useLocation();
+ const { language } = useShopApp();
+ void language;
const isBare = isBareMode(location.search);
const useMockFallback = isBare || USE_MOCK_DATA;
const { orderId } = useParams<{ orderId?: string }>();
@@ -70,7 +74,7 @@ export const ShopPayResultPage: React.FC = () => {
>
{
color: '#0eb13c',
}}
>
- Payment Successful
+ {tr('Payment Successful')}
{
textAlign: 'center',
}}
>
- Thank you for your purchase. your order has been places and is now being processed
+ {tr('Thank you for your purchase. your order has been places and is now being processed')}
@@ -160,7 +164,7 @@ export const ShopPayResultPage: React.FC = () => {
color: '#292a2e',
}}
>
- Total Paid
+ {tr('Total Paid')}
@@ -220,7 +224,7 @@ export const ShopPayResultPage: React.FC = () => {
color: '#747474',
}}
>
- Order Code
+ {tr('Order Code')}
@@ -280,7 +284,7 @@ export const ShopPayResultPage: React.FC = () => {
color: '#747474',
}}
>
- Payment method
+ {tr('Payment method')}
@@ -296,7 +300,7 @@ export const ShopPayResultPage: React.FC = () => {
color: '#292a2e',
}}
>
- {!isBare && receipt ? receipt.paymentMethodLabel : 'PayPal'}
+ {tr(!isBare && receipt ? receipt.paymentMethodLabel : 'PayPal')}
)}
@@ -330,7 +334,7 @@ export const ShopPayResultPage: React.FC = () => {
color: '#747474',
}}
>
- Order Date
+ {tr('Order Date')}
@@ -392,7 +396,7 @@ export const ShopPayResultPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- track Order
+ {tr('track Order')}
@@ -437,7 +441,7 @@ export const ShopPayResultPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- Continue Shoping
+ {tr('Continue Shoping')}
diff --git a/src/pages/checkout/ShopPaymentMethodsPage.tsx b/src/pages/checkout/ShopPaymentMethodsPage.tsx
index a69f894..6f8ed4f 100644
--- a/src/pages/checkout/ShopPaymentMethodsPage.tsx
+++ b/src/pages/checkout/ShopPaymentMethodsPage.tsx
@@ -9,12 +9,16 @@ 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 (
@@ -39,7 +43,7 @@ export const ShopPaymentMethodsPage: React.FC = () => {
textAlign: 'center',
}}
>
- Cart
+ {tr('Cart')}
{
textAlign: 'center',
}}
>
- 3 Products from 2 Shops
+ {tr('3 Products from 2 Shops')}
{
color: '#111111',
}}
>
- Payment methos
+ {tr('Payment methos')}
navigate('/shop-payment')}
- aria-label="Close"
+ aria-label={tr('Close')}
style={{
width: 24,
height: 24,
@@ -219,7 +223,7 @@ export const ShopPaymentMethodsPage: React.FC = () => {
color: '#fbfbfc',
}}
>
- Purchase
+ {tr('Purchase')}
@@ -227,7 +231,7 @@ export const ShopPaymentMethodsPage: React.FC = () => {
{
color: '#111111',
}}
>
- Review items
+ {tr('Review items')}
@@ -253,7 +254,7 @@ export const ShopPaymentPage: React.FC = () => {
color: '#111111',
}}
>
- Delivery Address
+ {tr('Delivery Address')}
@@ -268,7 +269,7 @@ export const ShopPaymentPage: React.FC = () => {
cursor: 'pointer',
}}
>
- Edit
+ {tr('Edit')}
)}
@@ -366,7 +367,7 @@ export const ShopPaymentPage: React.FC = () => {
color: '#111111',
}}
>
- Orded Summery
+ {tr('Orded Summery')}
diff --git a/src/pages/home/ShopHomePage.tsx b/src/pages/home/ShopHomePage.tsx
index 2b2a033..b78badc 100644
--- a/src/pages/home/ShopHomePage.tsx
+++ b/src/pages/home/ShopHomePage.tsx
@@ -15,6 +15,7 @@ import {
} from '../../data/catalogData';
import { useShopApp } from '../../context/ShopAppContext';
import { useSmartBack } from '../../hooks/useSmartBack';
+import { isRtlLanguage, tr } from '../../lib/cookies';
import { resolveMediaUrl } from '../../lib/http';
import { mapProductToCompactItem } from '../../lib/mappers';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
@@ -65,8 +66,9 @@ export const ShopHomePage: React.FC = () => {
const location = useLocation();
const isBare = isBareMode(location.search);
const useMockFallback = isBare || USE_MOCK_DATA;
- const smartBack = useSmartBack(ROUTES.test);
- const { isBookmarked, toggleBookmark } = useShopApp();
+ const smartBack = useSmartBack(ROUTES.home);
+ const { isBookmarked, toggleBookmark, language } = useShopApp();
+ const isRtl = isRtlLanguage(language);
const homeQuery = useHomeFeedQuery(!isBare);
const feed = homeQuery.data ?? null;
@@ -373,7 +375,7 @@ export const ShopHomePage: React.FC = () => {
smartBack()}
- aria-label="Back"
+ aria-label={tr('Back')}
style={{
width: 40,
height: 40,
@@ -394,6 +396,7 @@ export const ShopHomePage: React.FC = () => {
style={{
width: 18.22,
height: 15.18,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -408,13 +411,13 @@ export const ShopHomePage: React.FC = () => {
textAlign: 'center',
}}
>
- Shop
+ {tr('Shop')}
navigate(ROUTES.orders())}
- aria-label="Notifications"
+ aria-label={tr('Notifications')}
style={{
width: 40,
height: 40,
@@ -492,6 +495,7 @@ export const ShopHomePage: React.FC = () => {
}
}}
style={{
+ direction: 'ltr',
display: 'flex',
width: '100%',
height: '100%',
@@ -509,6 +513,7 @@ export const ShopHomePage: React.FC = () => {
{
color: '#caaf7f',
}}
>
- {slide.tag}
+ {tr(slide.tag)}
{
WebkitTextFillColor: 'transparent',
}}
>
- {slide.title}
+ {tr(slide.title)}
{
color: '#afcdb6',
}}
>
- {slide.subtitle}
+ {tr(slide.subtitle)}
@@ -614,7 +619,7 @@ export const ShopHomePage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- {slide.ctaLabel}
+ {tr(slide.ctaLabel)}
@@ -714,7 +719,7 @@ export const ShopHomePage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- {cat.label}
+ {tr(cat.label)}
))}
@@ -740,7 +745,7 @@ export const ShopHomePage: React.FC = () => {
color: '#36363c',
}}
>
- Populars
+ {tr('Populars')}
navigate(ROUTES.search())}
@@ -761,7 +766,7 @@ export const ShopHomePage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- See more
+ {tr('See more')}
{
style={{
width: 13,
height: 13,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
@@ -825,7 +831,7 @@ export const ShopHomePage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- New Stores
+ {tr('New Stores')}
navigate(featuredStoreRoute)}
@@ -846,7 +852,7 @@ export const ShopHomePage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- See more
+ {tr('See more')}
{
style={{
width: 13,
height: 13,
+ transform: isRtl ? 'scaleX(-1)' : undefined,
}}
/>
diff --git a/src/pages/orders/ShopOrderDetailPage.tsx b/src/pages/orders/ShopOrderDetailPage.tsx
index c8e336a..66d49cf 100644
--- a/src/pages/orders/ShopOrderDetailPage.tsx
+++ b/src/pages/orders/ShopOrderDetailPage.tsx
@@ -13,6 +13,7 @@ import { ShipmentTrackingSheet } from '../../components/modals/ShipmentTrackingS
import { useShopApp } from '../../context/ShopAppContext';
import { ORDER_DETAIL_SHIPMENTS } from '../../data/ordersData';
import { mapShipmentToCardData } from '../../lib/mappers';
+import { tr } from '../../lib/cookies';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
import type { ApiShipment } from '../../lib/shopApi';
import {
@@ -237,7 +238,7 @@ export const ShopOrderDetailPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- {liveOrder ? `${liveOrder.items_count} item` : '3 item'}
+ {tr(liveOrder ? `${liveOrder.items_count} item` : '3 item')}
@@ -271,7 +272,7 @@ export const ShopOrderDetailPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- {liveOrder ? `${liveOrder.shops_count} shop` : '1 shop'}
+ {tr(liveOrder ? `${liveOrder.shops_count} shop` : '1 shop')}
@@ -316,14 +317,16 @@ export const ShopOrderDetailPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- {liveOrder
- ? liveOrder.status === 'canceled'
- ? 'Canceled'
- : `${liveOrder.delivered_shipments_count} / ${Math.max(
- 1,
- liveOrder.total_shipments_count
- )} Delivery`
- : '1 / 3 Delivery'}
+ {tr(
+ liveOrder
+ ? liveOrder.status === 'canceled'
+ ? 'Canceled'
+ : `${liveOrder.delivered_shipments_count} / ${Math.max(
+ 1,
+ liveOrder.total_shipments_count
+ )} Delivery`
+ : '1 / 3 Delivery'
+ )}
@@ -394,7 +397,7 @@ export const ShopOrderDetailPage: React.FC = () => {
}}
>
{canceling && }
- {canceling ? 'Canceling...' : 'Cancel Order'}
+ {canceling ? tr('Canceling...') : tr('Cancel Order')}
)}
@@ -446,7 +449,7 @@ export const ShopOrderDetailPage: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- Order support
+ {tr('Order support')}
diff --git a/src/pages/orders/ShopOrdersPage.tsx b/src/pages/orders/ShopOrdersPage.tsx
index 8e0ee05..d933b65 100644
--- a/src/pages/orders/ShopOrdersPage.tsx
+++ b/src/pages/orders/ShopOrdersPage.tsx
@@ -16,6 +16,7 @@ import {
type OrderFilterTabItem,
} from '../../data/ordersData';
import { mapOrderToCardData } from '../../lib/mappers';
+import { tr } from '../../lib/cookies';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
import { useOrdersQuery } from '../../lib/shopQueries';
@@ -143,7 +144,7 @@ export const ShopOrdersPage: React.FC = () => {
color: '#111111',
}}
>
- {`No ${activeTabId} orders`}
+ {tr(`No ${activeTabId} orders`)}
{
cursor: 'pointer',
}}
>
- Browse Shop
+ {tr('Browse Shop')}
)
diff --git a/src/pages/orders/ShopSupportPage.tsx b/src/pages/orders/ShopSupportPage.tsx
index 86acc72..c1f6078 100644
--- a/src/pages/orders/ShopSupportPage.tsx
+++ b/src/pages/orders/ShopSupportPage.tsx
@@ -6,6 +6,7 @@ import { EmptyStateBox } from '../../components/common/ShimmerSkeletons';
import { useShopApp } from '../../context/ShopAppContext';
import { SUPPORT_SUBJECT_OPTIONS } from '../../data/ordersData';
import { resolveMediaUrl } from '../../lib/http';
+import { tr } from '../../lib/cookies';
import { isBareMode, ROUTES, USE_MOCK_DATA } from '../../lib/routes';
import {
useCreateSupportTicketMutation,
@@ -235,11 +236,13 @@ export const ShopSupportPage: React.FC = () => {
}}
>
{firstItem?.title_snapshot ||
- (orderId
- ? `Order ${orderId}`
- : isBare
- ? 'Islam in the Bible Book'
- : 'Habib Shop Support Desk')}
+ tr(
+ orderId
+ ? `Order ${orderId}`
+ : isBare
+ ? 'Islam in the Bible Book'
+ : 'Habib Shop Support Desk'
+ )}
{
whiteSpace: 'nowrap',
}}
>
- Order support
+ {tr('Order support')}
@@ -351,7 +354,9 @@ export const ShopSupportPage: React.FC = () => {
textAlign: 'center',
}}
>
- We’ve received your support request and will follow up on it. Rest assured, our team will take care of it.
+ {tr(
+ 'We’ve received your support request and will follow up on it. Rest assured, our team will take care of it.'
+ )}
@@ -372,7 +377,7 @@ export const ShopSupportPage: React.FC = () => {
color: '#111111',
}}
>
- Request Subject*
+ {tr('Request Subject')}*
{/* 6 Subject Tiles Grid */}
@@ -406,7 +411,7 @@ export const ShopSupportPage: React.FC = () => {
>
{
textAlign: 'center',
}}
>
- {option.label}
+ {tr(option.label)}
);
@@ -452,7 +457,7 @@ export const ShopSupportPage: React.FC = () => {
color: '#111111',
}}
>
- Description*
+ {tr('Description')}*