shanshel6 commited on
Commit
f35dfab
·
1 Parent(s): da31912

feat:consolidate-updates-optimize-gitignore

Browse files
.gitattributes CHANGED
@@ -1,2 +1,3 @@
1
  *.png filter=lfs diff=lfs merge=lfs -text
2
  *.traineddata filter=lfs diff=lfs merge=lfs -text
 
 
1
  *.png filter=lfs diff=lfs merge=lfs -text
2
  *.traineddata filter=lfs diff=lfs merge=lfs -text
3
+ *.aab filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -28,6 +28,10 @@ server/*.log
28
  # Database
29
  *.db
30
  *.sqlite
 
 
 
 
31
  server/*.db
32
  server/prisma/*.db
33
  server/prisma/dev.db
 
28
  # Database
29
  *.db
30
  *.sqlite
31
+ *.mdb
32
+ data.ms/
33
+ meilisearch.exe
34
+ chrome_data_pdd_persistent/
35
  server/*.db
36
  server/prisma/*.db
37
  server/prisma/dev.db
android/app/build.gradle CHANGED
@@ -7,8 +7,8 @@ android {
7
  applicationId "com.chinak.app"
8
  minSdkVersion rootProject.ext.minSdkVersion
9
  targetSdkVersion rootProject.ext.targetSdkVersion
10
- versionCode 44
11
- versionName "1.0.34"
12
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13
  }
14
 
 
7
  applicationId "com.chinak.app"
8
  minSdkVersion rootProject.ext.minSdkVersion
9
  targetSdkVersion rootProject.ext.targetSdkVersion
10
+ versionCode 47
11
+ versionName "1.0.37"
12
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13
  }
14
 
package.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "name": "project",
3
  "private": true,
4
- "version": "1.0.34",
5
  "type": "module",
6
  "scripts": {
7
  "dev": "concurrently \"npm run dev:frontend\" \"npm run dev:backend\"",
 
1
  {
2
  "name": "project",
3
  "private": true,
4
+ "version": "1.0.37",
5
  "type": "module",
6
  "scripts": {
7
  "dev": "concurrently \"npm run dev:frontend\" \"npm run dev:backend\"",
src/components/BottomNav.tsx CHANGED
@@ -15,7 +15,8 @@ const BottomNav: React.FC<BottomNavProps> = ({ className = '' }) => {
15
 
16
  const navItems = [
17
  { id: 'home', label: 'الرئيسية', icon: Home, path: '/' },
18
- { id: 'orders', label: 'طلباتي', icon: ShoppingBag, path: '/orders' },
 
19
  { id: 'favorites', label: 'المفضلة', icon: Heart, path: '/favorites' },
20
  { id: 'profile', label: 'حسابي', icon: User, path: '/profile' },
21
  ];
@@ -25,146 +26,50 @@ const BottomNav: React.FC<BottomNavProps> = ({ className = '' }) => {
25
  return location.pathname.startsWith(path);
26
  };
27
 
28
- const leftItems = navItems.slice(0, 2);
29
- const rightItems = navItems.slice(2);
30
-
31
  return (
32
  <nav
33
- className={`fixed bottom-3 left-0 right-0 z-50 px-4 transition-transform duration-500 cubic-bezier(0.32, 0.72, 0, 1) translate-y-0 ${className}`}
34
  >
35
- <div className="mx-auto w-full max-w-md rounded-[20px] border border-slate-200/60 bg-white/75 px-2.5 pt-0.5 pb-[calc(env(safe-area-inset-bottom)+0.35rem)] backdrop-blur-2xl shadow-[0_8px_22px_rgba(0,0,0,0.10)] dark:border-slate-800/60 dark:bg-slate-900/70 overflow-visible">
36
- <div className="grid grid-cols-5 items-end gap-0.5">
37
- {leftItems.map((item) => {
38
- const active = isActive(item.path);
39
- const isDisabled = 'disabled' in item ? (item as any).disabled : false;
40
- const Icon = item.icon;
41
-
42
- return (
43
- <button
44
- key={item.id}
45
- onClick={() => !isDisabled && navigate(item.path)}
46
- disabled={isDisabled}
47
- className={`group relative flex w-full flex-col items-center justify-end gap-0.5 pb-0.5 transition-all duration-300 ${
48
- isDisabled ? 'opacity-30 cursor-not-allowed grayscale' : ''
49
- }`}
50
- >
51
- <div className="relative p-1">
52
- <motion.div
53
- animate={{
54
- y: active ? -2 : 0,
55
- scale: active ? 1.1 : 1,
56
- }}
57
- transition={{ type: "spring", stiffness: 300, damping: 20 }}
58
- className={`relative z-10 ${active ? 'text-primary' : 'text-slate-400 group-hover:text-slate-600 dark:text-slate-500 dark:group-hover:text-slate-300'}`}
59
- >
60
- <Icon
61
- size={24}
62
- strokeWidth={active ? 2.5 : 2}
63
- fill={active ? "currentColor" : "none"}
64
- className="transition-colors duration-300"
65
- />
66
- </motion.div>
67
-
68
- {active && (
69
- <motion.div
70
- layoutId="activeTabIndicator"
71
- className="absolute inset-0 -z-0 rounded-full bg-primary/10 dark:bg-primary/20"
72
- initial={{ opacity: 0, scale: 0.8 }}
73
- animate={{ opacity: 1, scale: 1 }}
74
- exit={{ opacity: 0, scale: 0.8 }}
75
- transition={{ type: "spring", stiffness: 300, damping: 25 }}
76
- />
77
- )}
78
- </div>
79
-
80
- <span className={`text-[9px] font-medium transition-all duration-300 ${
81
- active ? 'text-primary font-bold translate-y-0 opacity-100' : 'text-slate-400 translate-y-1 opacity-0 h-0 overflow-hidden'
82
- }`}>
83
- {item.label}
84
- </span>
85
- </button>
86
- );
87
- })}
88
- <div className="relative flex items-end justify-center h-full">
89
- <div className="absolute -top-2 left-1/2 -translate-x-1/2 z-50">
90
- <motion.button
91
- onClick={() => navigate('/cart')}
92
- whileHover={{ scale: 1.05 }}
93
- whileTap={{ scale: 0.9 }}
94
- className={`flex size-16 items-center justify-center rounded-full shadow-xl ring-[6px] ring-white/90 dark:ring-slate-900/90 backdrop-blur-md border border-slate-200/70 dark:border-slate-700/60 ${
95
- location.pathname === '/cart'
96
- ? 'bg-primary text-white shadow-primary/40 dark:bg-primary dark:text-white'
97
- : 'bg-white text-slate-700 shadow-slate-200/60 dark:bg-slate-800 dark:text-white'
98
- }`}
99
- >
100
- <ShoppingCart size={28} strokeWidth={2.5} />
101
- </motion.button>
102
- <AnimatePresence>
103
- {cartItemsCount > 0 && (
104
- <motion.span
105
- initial={{ scale: 0 }}
106
- animate={{ scale: 1 }}
107
- exit={{ scale: 0 }}
108
- className="absolute -top-0 -right-0 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 text-[10px] font-bold text-white ring-2 ring-white dark:ring-slate-900 shadow-sm"
109
- >
110
- {cartItemsCount > 99 ? '99+' : cartItemsCount}
111
- </motion.span>
112
- )}
113
- </AnimatePresence>
114
- </div>
115
- </div>
116
- {rightItems.map((item) => {
117
  const active = isActive(item.path);
118
- const isDisabled = 'disabled' in item ? (item as any).disabled : false;
119
  const Icon = item.icon;
120
 
121
  return (
122
  <button
123
  key={item.id}
124
- onClick={() => !isDisabled && navigate(item.path)}
125
- disabled={isDisabled}
126
- className={`group relative flex w-full flex-col items-center justify-end gap-0.5 pb-0.5 transition-all duration-300 ${
127
- isDisabled ? 'opacity-30 cursor-not-allowed grayscale' : ''
128
- }`}
129
  >
130
- <div className="relative p-1">
131
- <motion.div
132
- animate={{
133
- y: active ? -2 : 0,
134
- scale: active ? 1.1 : 1,
135
- }}
136
- transition={{ type: "spring", stiffness: 300, damping: 20 }}
137
- className={`relative z-10 ${active ? 'text-primary' : 'text-slate-400 group-hover:text-slate-600 dark:text-slate-500 dark:group-hover:text-slate-300'}`}
138
- >
139
- <Icon
140
- size={24}
141
- strokeWidth={active ? 2.5 : 2}
142
- fill={active ? "currentColor" : "none"}
143
- className="transition-colors duration-300"
144
- />
145
- </motion.div>
146
 
147
- {active && (
148
- <motion.div
149
- layoutId="activeTabIndicator"
150
- className="absolute inset-0 -z-0 rounded-full bg-primary/10 dark:bg-primary/20"
151
- initial={{ opacity: 0, scale: 0.8 }}
152
- animate={{ opacity: 1, scale: 1 }}
153
- exit={{ opacity: 0, scale: 0.8 }}
154
- transition={{ type: "spring", stiffness: 300, damping: 25 }}
155
- />
156
- )}
 
 
157
  </div>
158
 
159
- <span className={`text-[9px] font-medium transition-all duration-300 ${
160
- active ? 'text-primary font-bold translate-y-0 opacity-100' : 'text-slate-400 translate-y-1 opacity-0 h-0 overflow-hidden'
161
  }`}>
162
  {item.label}
163
  </span>
164
  </button>
165
  );
166
  })}
167
- </div>
168
  </div>
169
  </nav>
170
  );
 
15
 
16
  const navItems = [
17
  { id: 'home', label: 'الرئيسية', icon: Home, path: '/' },
18
+ { id: 'orders', label: 'طلباتي', icon: ShoppingBag, path: '/orders' }, // Using ShoppingBag for Orders
19
+ { id: 'cart', label: 'السلة', icon: ShoppingCart, path: '/cart', badge: cartItemsCount },
20
  { id: 'favorites', label: 'المفضلة', icon: Heart, path: '/favorites' },
21
  { id: 'profile', label: 'حسابي', icon: User, path: '/profile' },
22
  ];
 
26
  return location.pathname.startsWith(path);
27
  };
28
 
 
 
 
29
  return (
30
  <nav
31
+ className={`fixed bottom-0 left-0 right-0 z-50 bg-white border-t border-slate-100 shadow-[0_-2px_10px_rgba(0,0,0,0.03)] pb-[calc(env(safe-area-inset-bottom))] transition-transform duration-300 dark:bg-slate-900 dark:border-slate-800 ${className}`}
32
  >
33
+ <div className="mx-auto w-full max-w-md h-[60px] flex items-center justify-between px-2">
34
+ {navItems.map((item) => {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  const active = isActive(item.path);
 
36
  const Icon = item.icon;
37
 
38
  return (
39
  <button
40
  key={item.id}
41
+ onClick={() => navigate(item.path)}
42
+ className="relative flex flex-1 flex-col items-center justify-center gap-1 h-full w-full active:scale-95 transition-transform duration-200"
 
 
 
43
  >
44
+ <div className="relative">
45
+ <Icon
46
+ size={24}
47
+ strokeWidth={active ? 2.5 : 2}
48
+ className={`transition-colors duration-200 ${active ? 'text-primary fill-primary/10' : 'text-slate-500 dark:text-slate-400'}`}
49
+ />
 
 
 
 
 
 
 
 
 
 
50
 
51
+ <AnimatePresence>
52
+ {item.badge && item.badge > 0 && (
53
+ <motion.span
54
+ initial={{ scale: 0 }}
55
+ animate={{ scale: 1 }}
56
+ exit={{ scale: 0 }}
57
+ className="absolute -top-1.5 -right-2 flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-white ring-1 ring-white dark:ring-slate-900"
58
+ >
59
+ {item.badge > 99 ? '99+' : item.badge}
60
+ </motion.span>
61
+ )}
62
+ </AnimatePresence>
63
  </div>
64
 
65
+ <span className={`text-[11px] font-medium transition-colors duration-200 ${
66
+ active ? 'text-primary' : 'text-slate-500 dark:text-slate-400'
67
  }`}>
68
  {item.label}
69
  </span>
70
  </button>
71
  );
72
  })}
 
73
  </div>
74
  </nav>
75
  );
src/components/home/SearchBar.tsx CHANGED
@@ -1,16 +1,14 @@
1
  import React, { useState, useEffect } from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
4
- import { Search, Bell } from 'lucide-react';
5
 
6
  interface SearchBarProps {
7
  onNavigate: (path: string) => void;
8
- unreadNotificationsCount?: number;
9
  }
10
 
11
  const SearchBar: React.FC<SearchBarProps> = ({
12
- onNavigate,
13
- unreadNotificationsCount = 0
14
  }) => {
15
  const { t } = useTranslation();
16
  const [placeholderIndex, setPlaceholderIndex] = useState(0);
@@ -31,43 +29,29 @@ const SearchBar: React.FC<SearchBarProps> = ({
31
  }, [placeholders.length]);
32
 
33
  return (
34
- <div className="px-4 py-2 bg-transparent transition-all duration-300">
35
- <div className="flex items-center justify-center gap-2">
36
- <div
37
- onClick={() => onNavigate('/search')}
38
- className="relative flex-1 max-w-lg flex items-center group cursor-pointer"
39
- >
40
- <div className="relative flex-1 flex items-center bg-white/80 dark:bg-slate-800/80 rounded-full h-11 shadow-sm ring-1 ring-slate-200/70 dark:ring-slate-700/60 transition-all group-hover:shadow-md group-hover:ring-primary/25 backdrop-blur-xl overflow-hidden">
41
- <div className="flex items-center justify-center w-10 text-primary group-hover:scale-110 transition-transform duration-300">
42
- <Search size={18} strokeWidth={2.5} />
43
- </div>
44
-
45
- <div className="flex-1 relative h-full flex items-center overflow-hidden">
46
- <AnimatePresence mode="wait">
47
- <motion.span
48
- key={placeholderIndex}
49
- initial={{ y: 20, opacity: 0 }}
50
- animate={{ y: 0, opacity: 1 }}
51
- exit={{ y: -20, opacity: 0 }}
52
- transition={{ duration: 0.5, ease: "easeInOut" }}
53
- className="text-slate-400 text-[13px] font-semibold whitespace-nowrap"
54
- >
55
- {placeholders[placeholderIndex]}
56
- </motion.span>
57
- </AnimatePresence>
58
- </div>
59
- </div>
60
  </div>
61
 
62
- <button
63
- onClick={() => onNavigate('/notifications')}
64
- className="relative flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full bg-white/80 dark:bg-slate-800/80 shadow-sm ring-1 ring-slate-200/70 dark:ring-slate-700/60 text-slate-600 dark:text-slate-300 transition-all hover:text-primary active:scale-95 backdrop-blur-xl"
65
- >
66
- <Bell size={20} strokeWidth={2} />
67
- {unreadNotificationsCount > 0 && (
68
- <span className="absolute top-2.5 right-2.5 h-3 w-3 rounded-full bg-red-500 ring-2 ring-white dark:ring-slate-800 animate-pulse"></span>
69
- )}
70
- </button>
71
  </div>
72
  </div>
73
  );
 
1
  import React, { useState, useEffect } from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
4
+ import { Search, Camera } from 'lucide-react';
5
 
6
  interface SearchBarProps {
7
  onNavigate: (path: string) => void;
 
8
  }
9
 
10
  const SearchBar: React.FC<SearchBarProps> = ({
11
+ onNavigate
 
12
  }) => {
13
  const { t } = useTranslation();
14
  const [placeholderIndex, setPlaceholderIndex] = useState(0);
 
29
  }, [placeholders.length]);
30
 
31
  return (
32
+ <div className="sticky top-0 z-40 bg-white px-3 py-2 shadow-sm transition-all duration-300 dark:bg-slate-900">
33
+ <div
34
+ onClick={() => onNavigate('/search')}
35
+ className="relative flex h-10 w-full cursor-pointer items-center gap-2 rounded-full bg-slate-100 px-4 transition-all active:scale-[0.99] dark:bg-slate-800"
36
+ >
37
+ <Search size={18} className="text-slate-400" strokeWidth={2.5} />
38
+
39
+ <div className="relative flex flex-1 items-center overflow-hidden h-full">
40
+ <AnimatePresence mode="wait">
41
+ <motion.span
42
+ key={placeholderIndex}
43
+ initial={{ y: 20, opacity: 0 }}
44
+ animate={{ y: 0, opacity: 1 }}
45
+ exit={{ y: -20, opacity: 0 }}
46
+ transition={{ duration: 0.3 }}
47
+ className="absolute w-full truncate text-[13px] font-medium text-slate-400 text-right"
48
+ >
49
+ {placeholders[placeholderIndex]}
50
+ </motion.span>
51
+ </AnimatePresence>
 
 
 
 
 
 
52
  </div>
53
 
54
+ <Camera size={20} className="text-slate-400" strokeWidth={2} />
 
 
 
 
 
 
 
 
55
  </div>
56
  </div>
57
  );
src/components/search/SearchHeader.tsx CHANGED
@@ -1,5 +1,5 @@
1
  import React, { useEffect, useRef } from 'react';
2
- import { Home, Search, X } from 'lucide-react';
3
 
4
  interface SearchHeaderProps {
5
  query: string;
@@ -29,13 +29,13 @@ const SearchHeader: React.FC<SearchHeaderProps> = ({
29
  }, []);
30
 
31
  return (
32
- <div className="bg-transparent px-4 py-2 transition-all duration-300">
33
- <div className="flex items-center justify-center gap-4">
34
  <button
35
  onClick={onBack}
36
- className="p-2 -mr-1.5 text-slate-500 dark:text-slate-400 hover:text-slate-900 dark:hover:text-white transition-colors"
37
  >
38
- <Home size={24} />
39
  </button>
40
 
41
  <form
@@ -46,14 +46,12 @@ const SearchHeader: React.FC<SearchHeaderProps> = ({
46
  }}
47
  className="flex-1 relative group"
48
  >
49
- <div className="relative flex items-center bg-slate-100 dark:bg-slate-800 rounded-full h-10 transition-all focus-within:ring-2 focus-within:ring-primary/20 overflow-hidden">
50
- <div className="flex items-center justify-center w-10 text-slate-400">
51
- <Search size={16} strokeWidth={2.5} />
52
- </div>
53
 
54
  <input
55
  ref={inputRef}
56
- className="flex-1 bg-transparent border-none py-1.5 pr-0 pl-10 text-sm font-medium text-slate-900 dark:text-white placeholder:text-slate-400 focus:ring-0 outline-none transition-all"
57
  type="text"
58
  value={query}
59
  onChange={(e) => onQueryChange(e.target.value)}
@@ -66,7 +64,7 @@ const SearchHeader: React.FC<SearchHeaderProps> = ({
66
  <button
67
  type="button"
68
  onClick={onClear}
69
- className="absolute inset-y-0 left-3 flex items-center justify-center text-slate-400 hover:text-slate-600 dark:hover:text-slate-200 transition-colors"
70
  >
71
  <X size={16} />
72
  </button>
@@ -78,7 +76,7 @@ const SearchHeader: React.FC<SearchHeaderProps> = ({
78
  onClick={() => {
79
  if (onSubmit) onSubmit();
80
  }}
81
- className="px-4 py-1.5 bg-primary text-white text-sm font-bold rounded-full shadow-sm hover:bg-primary/90 active:scale-95 transition-all"
82
  >
83
  بحث
84
  </button>
 
1
  import React, { useEffect, useRef } from 'react';
2
+ import { ArrowRight, Search, X } from 'lucide-react';
3
 
4
  interface SearchHeaderProps {
5
  query: string;
 
29
  }, []);
30
 
31
  return (
32
+ <div className="sticky top-0 z-40 bg-white shadow-sm transition-all duration-300 dark:bg-slate-900 px-3 py-2">
33
+ <div className="flex items-center gap-2">
34
  <button
35
  onClick={onBack}
36
+ className="flex h-10 w-10 items-center justify-center text-slate-500 hover:text-slate-900 dark:text-slate-400 dark:hover:text-white transition-colors"
37
  >
38
+ <ArrowRight size={24} />
39
  </button>
40
 
41
  <form
 
46
  }}
47
  className="flex-1 relative group"
48
  >
49
+ <div className="relative flex h-10 w-full items-center gap-2 rounded-full bg-slate-100 px-4 transition-all focus-within:ring-2 focus-within:ring-primary/20 dark:bg-slate-800">
50
+ <Search size={18} className="text-slate-400" strokeWidth={2.5} />
 
 
51
 
52
  <input
53
  ref={inputRef}
54
+ className="flex-1 bg-transparent border-none p-0 text-[13px] font-medium text-slate-900 dark:text-white placeholder:text-slate-400 focus:ring-0 outline-none transition-all"
55
  type="text"
56
  value={query}
57
  onChange={(e) => onQueryChange(e.target.value)}
 
64
  <button
65
  type="button"
66
  onClick={onClear}
67
+ className="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200 transition-colors"
68
  >
69
  <X size={16} />
70
  </button>
 
76
  onClick={() => {
77
  if (onSubmit) onSubmit();
78
  }}
79
+ className="h-10 px-4 bg-primary text-white text-sm font-bold rounded-full hover:bg-primary/90 transition-colors flex items-center justify-center"
80
  >
81
  بحث
82
  </button>
src/pages/Cart.tsx CHANGED
@@ -314,7 +314,7 @@ const Cart: React.FC = () => {
314
  {/* Animated Background Indicator */}
315
  <div
316
  className={`absolute top-1.5 bottom-1.5 w-[calc(50%-6px)] bg-white dark:bg-slate-700 rounded-2xl shadow-sm transition-all duration-300 ease-[cubic-bezier(0.4,0,0.2,1)] ${
317
- activeTab === 'air' ? 'left-1.5' : 'left-[calc(50%+3px)]'
318
  }`}
319
  />
320
 
@@ -602,49 +602,71 @@ const Cart: React.FC = () => {
602
  </main>
603
 
604
  {/* Sticky Footer Checkout Button */}
605
- <div className="fixed bottom-0 left-0 right-0 z-40 w-full bg-white/95 dark:bg-slate-900/95 border-t border-slate-200 dark:border-slate-800 p-4 pb-safe backdrop-blur-md flex flex-col gap-3">
606
- {isUnderThreshold && (
607
- <div className="w-full bg-amber-500/10 dark:bg-amber-500/20 border border-amber-500/30 rounded-2xl p-4 flex items-center justify-between animate-pulse">
608
- <div className="flex items-center gap-3">
609
- <div className="size-10 rounded-full bg-amber-500 text-white flex items-center justify-center shrink-0 shadow-lg shadow-amber-500/20">
610
- <AlertCircle size={24} />
611
- </div>
612
- <div className="flex flex-col">
613
- <span className="text-sm font-black text-amber-700 dark:text-amber-400">تحتاج إضافة المزيد لإكمال الطلب</span>
614
- <span className="text-[10px] text-amber-600/70 dark:text-amber-400/70 font-bold uppercase tracking-wider">الحد الأدنى للطلب هو {MIN_ORDER_THRESHOLD.toLocaleString()} د.ع</span>
 
 
 
 
 
 
 
615
  </div>
616
- </div>
617
- <div className="text-right">
618
- <span className="block text-lg font-black text-amber-600 dark:text-amber-400">{amountNeeded.toLocaleString()} د.ع</span>
619
- <span className="text-[9px] text-amber-500/50 font-black uppercase">متبقي</span>
620
- </div>
621
- </div>
622
- )}
 
 
 
 
 
623
 
624
- <button
625
- onClick={() => !isUnderThreshold && !isSyncing && navigate('/checkout/shipping')}
626
- disabled={isUnderThreshold || isSyncing}
627
- className={`w-full h-16 rounded-2xl transition-all text-white font-bold text-base shadow-lg flex items-center justify-between px-6 mb-4 ${
628
- isUnderThreshold || isSyncing
629
- ? 'bg-slate-300 dark:bg-slate-700 cursor-not-allowed grayscale'
630
- : 'bg-primary hover:bg-primary/90 active:scale-[0.98] shadow-primary/25'
631
- }`}
632
- >
633
- <div className="flex flex-col items-start leading-tight">
634
- <span className="text-[10px] opacity-80 font-bold uppercase tracking-wider">إجمالي الدفع</span>
635
- <span className="text-xl font-black">{total.toLocaleString()} د.ع</span>
636
- </div>
637
- <div className="flex items-center gap-2">
638
- <span className="text-lg">
639
- {isSyncing ? 'جاري التحديث...' : isUnderThreshold ? 'أضف المزيد للطلب' : 'إتمام الشراء'}
640
- </span>
641
- {isSyncing ? (
642
- <RefreshCw size={22} className="animate-spin" />
643
- ) : (
644
- <ArrowRight size={22} className={isUnderThreshold ? 'opacity-30' : ''} />
645
- )}
646
- </div>
647
- </button>
 
 
 
 
 
 
 
 
 
 
648
  </div>
649
 
650
  <DiscountPopup
 
314
  {/* Animated Background Indicator */}
315
  <div
316
  className={`absolute top-1.5 bottom-1.5 w-[calc(50%-6px)] bg-white dark:bg-slate-700 rounded-2xl shadow-sm transition-all duration-300 ease-[cubic-bezier(0.4,0,0.2,1)] ${
317
+ activeTab === 'air' ? 'left-[calc(50%+3px)]' : 'left-1.5'
318
  }`}
319
  />
320
 
 
602
  </main>
603
 
604
  {/* Sticky Footer Checkout Button */}
605
+ <div className="fixed bottom-0 left-0 right-0 z-40 w-full bg-white dark:bg-slate-900 shadow-[0_-4px_20px_rgba(0,0,0,0.05)] pb-safe transition-transform duration-300">
606
+
607
+ {/* Progress Bar / Min Order Notification */}
608
+ <div className={`w-full px-4 py-3 transition-colors duration-300 ${isUnderThreshold ? 'bg-amber-50 dark:bg-amber-900/10' : 'bg-green-50 dark:bg-green-900/10'}`}>
609
+ <div className="flex items-center justify-between mb-2">
610
+ <div className="flex items-center gap-2">
611
+ {isUnderThreshold ? (
612
+ <AlertCircle size={16} className="text-amber-600 dark:text-amber-500" />
613
+ ) : (
614
+ <CheckCheck size={16} className="text-green-600 dark:text-green-500" />
615
+ )}
616
+ <span className={`text-xs font-bold ${isUnderThreshold ? 'text-amber-700 dark:text-amber-400' : 'text-green-700 dark:text-green-400'}`}>
617
+ {isUnderThreshold
618
+ ? `متبقي ${amountNeeded.toLocaleString()} د.ع للحد الأدنى`
619
+ : 'استوفيت الحد الأدنى للطلب'
620
+ }
621
+ </span>
622
  </div>
623
+ <span className={`text-xs font-black ${isUnderThreshold ? 'text-amber-700 dark:text-amber-400' : 'text-green-700 dark:text-green-400'}`}>
624
+ {Math.min(100, Math.round((total / MIN_ORDER_THRESHOLD) * 100))}%
625
+ </span>
626
+ </div>
627
+
628
+ <div className="h-2 w-full bg-slate-200 dark:bg-slate-700 rounded-full overflow-hidden">
629
+ <div
630
+ className={`h-full rounded-full transition-all duration-500 ease-out ${isUnderThreshold ? 'bg-amber-500' : 'bg-green-500'}`}
631
+ style={{ width: `${Math.min(100, (total / MIN_ORDER_THRESHOLD) * 100)}%` }}
632
+ ></div>
633
+ </div>
634
+ </div>
635
 
636
+ {/* Checkout Action Area */}
637
+ <div className="p-4 border-t border-slate-100 dark:border-slate-800 flex items-center gap-4">
638
+ <div className="flex flex-col">
639
+ <span className="text-xs text-slate-500 dark:text-slate-400 font-medium">الإجمالي</span>
640
+ <span className="text-xl font-black text-slate-900 dark:text-white leading-tight">
641
+ {total.toLocaleString()}
642
+ <span className="text-xs font-bold text-slate-400 mr-1">د.ع</span>
643
+ </span>
644
+ </div>
645
+
646
+ <button
647
+ onClick={() => !isUnderThreshold && !isSyncing && navigate('/checkout/shipping')}
648
+ disabled={isUnderThreshold || isSyncing}
649
+ className={`flex-1 h-12 rounded-xl font-bold text-sm shadow-lg flex items-center justify-center gap-2 transition-all ${
650
+ isUnderThreshold || isSyncing
651
+ ? 'bg-slate-200 dark:bg-slate-800 text-slate-400 cursor-not-allowed'
652
+ : 'bg-primary text-white hover:bg-primary/90 active:scale-[0.98] shadow-primary/25'
653
+ }`}
654
+ >
655
+ {isSyncing ? (
656
+ <>
657
+ <RefreshCw size={18} className="animate-spin" />
658
+ <span>جاري التحديث...</span>
659
+ </>
660
+ ) : isUnderThreshold ? (
661
+ <span className="opacity-80">أكمل الحد الأدنى للشراء</span>
662
+ ) : (
663
+ <>
664
+ <span>إتمام الشراء</span>
665
+ <ArrowRight size={18} />
666
+ </>
667
+ )}
668
+ </button>
669
+ </div>
670
  </div>
671
 
672
  <DiscountPopup
src/pages/Home.tsx CHANGED
@@ -2,7 +2,6 @@ import React, { useEffect, useState, useRef, useCallback } from 'react';
2
  import { useNavigate } from 'react-router-dom';
3
  import { fetchProducts } from '../services/api';
4
  import { useWishlistStore } from '../store/useWishlistStore';
5
- import { useNotificationStore } from '../store/useNotificationStore';
6
  import { usePageCacheStore } from '../store/usePageCacheStore';
7
  import Skeleton from '../components/Skeleton';
8
  import { useTranslation } from 'react-i18next';
@@ -32,7 +31,6 @@ const Home: React.FC = () => {
32
  const navigate = useNavigate();
33
  const wishlistItems = useWishlistStore((state) => state.items);
34
  const toggleWishlist = useWishlistStore((state) => state.toggleWishlist);
35
- const unreadNotificationsCount = useNotificationStore((state) => state.unreadCount);
36
 
37
  // Read initial state from store without subscribing to updates (except categoryId)
38
  const homeCategoryId = usePageCacheStore((state) => state.homeCategoryId);
@@ -284,22 +282,10 @@ const Home: React.FC = () => {
284
 
285
  return (
286
  <div className="relative flex min-h-screen w-full flex-col pb-28 pb-safe bg-background-light dark:bg-background-dark font-display text-slate-900 dark:text-white antialiased selection:bg-primary/30 rtl" dir="rtl">
287
- {/* Unified Sticky Header */}
288
- <div className="sticky top-0 z-50">
289
- {/* Search Bar - Slides up/down */}
290
- <div
291
- className="absolute top-3 left-0 right-0 w-full px-4 transition-all duration-300 ease-in-out z-20 translate-y-0 opacity-100"
292
- >
293
- <div className="mx-auto w-full max-w-md rounded-[24px] border border-slate-200/60 bg-white/75 px-2 pt-safe backdrop-blur-2xl shadow-[0_12px_30px_rgba(0,0,0,0.10)] dark:border-slate-800/60 dark:bg-slate-900/70">
294
- <SearchBar
295
- onNavigate={navigate}
296
- unreadNotificationsCount={unreadNotificationsCount}
297
- />
298
- </div>
299
- </div>
300
- </div>
301
 
302
- <div className="transition-all duration-300 pt-[calc(env(safe-area-inset-top)+70px)]"></div>
303
 
304
  {error && (
305
  <div className="mx-4 mt-4 p-4 rounded-2xl bg-red-50 dark:bg-red-900/20 border border-red-100 dark:border-red-900/30 text-red-600 dark:text-red-400 text-sm flex items-center gap-3">
 
2
  import { useNavigate } from 'react-router-dom';
3
  import { fetchProducts } from '../services/api';
4
  import { useWishlistStore } from '../store/useWishlistStore';
 
5
  import { usePageCacheStore } from '../store/usePageCacheStore';
6
  import Skeleton from '../components/Skeleton';
7
  import { useTranslation } from 'react-i18next';
 
31
  const navigate = useNavigate();
32
  const wishlistItems = useWishlistStore((state) => state.items);
33
  const toggleWishlist = useWishlistStore((state) => state.toggleWishlist);
 
34
 
35
  // Read initial state from store without subscribing to updates (except categoryId)
36
  const homeCategoryId = usePageCacheStore((state) => state.homeCategoryId);
 
282
 
283
  return (
284
  <div className="relative flex min-h-screen w-full flex-col pb-28 pb-safe bg-background-light dark:bg-background-dark font-display text-slate-900 dark:text-white antialiased selection:bg-primary/30 rtl" dir="rtl">
285
+ {/* Search Bar */}
286
+ <SearchBar onNavigate={navigate} />
 
 
 
 
 
 
 
 
 
 
 
 
287
 
288
+ <div className="transition-all duration-300"></div>
289
 
290
  {error && (
291
  <div className="mx-4 mt-4 p-4 rounded-2xl bg-red-50 dark:bg-red-900/20 border border-red-100 dark:border-red-900/30 text-red-600 dark:text-red-400 text-sm flex items-center gap-3">
src/pages/SearchResults.tsx CHANGED
@@ -289,28 +289,24 @@ const SearchResults: React.FC = () => {
289
 
290
  return (
291
  <div className="relative flex min-h-screen w-full flex-col bg-background-light dark:bg-background-dark font-display text-slate-900 dark:text-white antialiased selection:bg-primary/30 rtl overflow-visible" dir="rtl">
292
- <div className="fixed top-3 left-0 right-0 z-50 w-full px-4 transition-transform duration-300 ease-in-out translate-y-0">
293
- <div className="mx-auto w-full max-w-md rounded-[24px] border border-slate-200/60 bg-white/75 px-2 pt-safe backdrop-blur-2xl shadow-[0_12px_30px_rgba(0,0,0,0.10)] dark:border-slate-800/60 dark:bg-slate-900/70">
294
- <SearchHeader
295
- query={searchQuery}
296
- onQueryChange={(q) => {
297
- setSearchQuery(q);
298
- if (q.trim()) setIsTyping(true);
299
- }}
300
- onBack={() => navigate('/')}
301
- onFocus={() => {
302
- if (searchQuery.trim()) setIsTyping(true);
303
- }}
304
- onClear={() => {
305
- setSearchQuery('');
306
- setIsTyping(false);
307
- }}
308
- onSubmit={() => setIsTyping(false)}
309
- />
310
- </div>
311
- </div>
312
 
313
- <div className="transition-all duration-300 pt-[calc(env(safe-area-inset-top)+85px)]"></div>
314
 
315
  <main className="flex-1 p-3 pb-12">
316
  {isTyping && searchQuery.trim() && (
 
289
 
290
  return (
291
  <div className="relative flex min-h-screen w-full flex-col bg-background-light dark:bg-background-dark font-display text-slate-900 dark:text-white antialiased selection:bg-primary/30 rtl overflow-visible" dir="rtl">
292
+ <SearchHeader
293
+ query={searchQuery}
294
+ onQueryChange={(q) => {
295
+ setSearchQuery(q);
296
+ if (q.trim()) setIsTyping(true);
297
+ }}
298
+ onBack={() => navigate('/')}
299
+ onFocus={() => {
300
+ if (searchQuery.trim()) setIsTyping(true);
301
+ }}
302
+ onClear={() => {
303
+ setSearchQuery('');
304
+ setIsTyping(false);
305
+ }}
306
+ onSubmit={() => setIsTyping(false)}
307
+ />
 
 
 
 
308
 
309
+ <div className="transition-all duration-300"></div>
310
 
311
  <main className="flex-1 p-3 pb-12">
312
  {isTyping && searchQuery.trim() && (