Quellcode durchsuchen

feat module 5 : add specific date to hide the shop location

master
nadia vor 5 Stunden
Ursprung
Commit
a790d543c9
1 geänderte Dateien mit 9 neuen und 7 gelöschten Zeilen
  1. 9
    7
      src/pages/Home.jsx

+ 9
- 7
src/pages/Home.jsx Datei anzeigen

15
 import AmberBeautyWallpaper from "../assets/images/amberBeautyWallpaper.webp";
15
 import AmberBeautyWallpaper from "../assets/images/amberBeautyWallpaper.webp";
16
 import AmberClothing from "../assets/images/MAINHEADER-13.webp"
16
 import AmberClothing from "../assets/images/MAINHEADER-13.webp"
17
 
17
 
18
+const nowInMalaysia = () => new Date(new Date().toLocaleString("en-US", { timeZone: "Asia/Kuala_Lumpur" }))
19
+const ioiStoreHideFromDate = new Date("2026-08-01T00:00:00+08:00")
20
+
18
 const stores = [
21
 const stores = [
19
   {
22
   {
20
-    // name: "AMBER IOI STORE",
21
-    // address: "IOI City Mall",
22
     name: "IOI CITY MALL",
23
     name: "IOI CITY MALL",
23
     address: "G-67 IOI CITY MALL, PUTRAJAYA",
24
     address: "G-67 IOI CITY MALL, PUTRAJAYA",
24
     image: "/AMBERIOISTORE.jpeg",
25
     image: "/AMBERIOISTORE.jpeg",
25
-    directionUrl: "https://www.google.com/maps/search/?api=1&query=IOI%20City%20Mall%20Putrajaya"
26
+    directionUrl: "https://www.google.com/maps/search/?api=1&query=IOI%20City%20Mall%20Putrajaya",
27
+    hideAfter: ioiStoreHideFromDate
26
   },
28
   },
27
   {
29
   {
28
-    // name: "AMBER SWM STORE",
29
-    // address: "Wangsa Walk Mall",
30
     name: "WANGSA WALK MALL",
30
     name: "WANGSA WALK MALL",
31
     address: "LOT G-77, WANGSA WALK MALL, KUALA LUMPUR",
31
     address: "LOT G-77, WANGSA WALK MALL, KUALA LUMPUR",
32
     image: "/AMBERSWMSTORE.jpeg",
32
     image: "/AMBERSWMSTORE.jpeg",
35
 ]
35
 ]
36
 
36
 
37
 const Home = () => {
37
 const Home = () => {
38
+  const visibleStores = stores.filter(({ hideAfter }) => !hideAfter || nowInMalaysia() < hideAfter)
38
 
39
 
39
   React.useEffect(()=>{
40
   React.useEffect(()=>{
40
     ProductService.getProducts();
41
     ProductService.getProducts();
129
             spacing={2}
130
             spacing={2}
130
             sx={{
131
             sx={{
131
               maxWidth: 1200,
132
               maxWidth: 1200,
132
-              mx: "auto"
133
+              mx: "auto",
134
+              justifyContent: "center"
133
             }}
135
             }}
134
           >
136
           >
135
-            {stores.map(({ name, address, image, directionUrl }) => (
137
+            {visibleStores.map(({ name, address, image, directionUrl }) => (
136
               <Grid key={name} size={{ xs: 12, md: 6 }}>
138
               <Grid key={name} size={{ xs: 12, md: 6 }}>
137
                 <Box
139
                 <Box
138
                   sx={{
140
                   sx={{

Laden…
Abbrechen
Speichern