Quellcode durchsuchen

allow caca to test and allow collection arragment based on last updated

master
azri vor 1 Woche
Ursprung
Commit
8aec692e0f
5 geänderte Dateien mit 18 neuen und 10 gelöschten Zeilen
  1. 3
    1
      src/App.js
  2. 9
    4
      src/components/Navbar/Navbar.jsx
  3. 2
    4
      src/index.js
  4. 3
    1
      src/pages/Maintainance.jsx
  5. 1
    0
      src/services/ProductService.js

+ 3
- 1
src/App.js Datei anzeigen

@@ -16,6 +16,7 @@ import { fetchCart, createCart } from './redux/slices/cartSlice';
16 16
 import { useSelector, useDispatch } from 'react-redux';
17 17
 import Collection from './pages/Collection';
18 18
 import customerService from './services/CustomerService';
19
+import Maintainance from './pages/Maintainance';
19 20
 
20 21
 const isEmptyObject = (obj) => Object.keys(obj).length === 0 && obj.constructor === Object;
21 22
 
@@ -51,7 +52,8 @@ function App() {
51 52
       <Navbar />
52 53
       <BrowserRouter>
53 54
         <Routes>
54
-          <Route path='/' element={<Home />} />
55
+          <Route path='/' element={<Maintainance />} />
56
+          <Route path='/cacatest' element={<Home />} />
55 57
           <Route path='/login' element={<Login />} />
56 58
 
57 59
           <Route path='products'>

+ 9
- 4
src/components/Navbar/Navbar.jsx Datei anzeigen

@@ -91,10 +91,9 @@ function getUniqueCollections(data) {
91 91
   return data.map(item => {
92 92
     // Use a Map to store unique collection titles with their corresponding image
93 93
     const uniqueCollectionsMap = new Map();
94
-
95
-    item.collection.forEach(({ title, image }) => {
94
+    item.collection.forEach(({ title, image, updatedAt }) => {
96 95
       if (!uniqueCollectionsMap.has(title)) {
97
-        uniqueCollectionsMap.set(title, { title, image });
96
+        uniqueCollectionsMap.set(title, { title, image, updatedAt });
98 97
       }
99 98
     });
100 99
 
@@ -245,7 +244,13 @@ const Navbar = () => {
245 244
     }
246 245
   };
247 246
 
248
-  const displayCollectionList = (collection, productType) => {
247
+  const displayCollectionList = (collection = [], productType) => {
248
+
249
+    
250
+    collection = collection.sort((a, b) => new Date(b.updatedAt) - new Date(a.updatedAt) )
251
+    console.log(collection)
252
+    debugger
253
+
249 254
     setDisplayCollection([])
250 255
     setTimeout(() => {
251 256
       setDisplayCollection({

+ 2
- 4
src/index.js Datei anzeigen

@@ -18,22 +18,20 @@ import '@fontsource/roboto/700.css';
18 18
 
19 19
 // JS MODULE STUFF
20 20
 
21
-import Maintainance from './pages/Maintainance';
22 21
 
23 22
 /**
24 23
  * NOTE: Dear future programmer of this project, before you judge me on how fucked up this codebase is, I already take everything into consideration and 
25 24
  * this code is really the most spegatthi that you'll ever seen, I only have 2 weeks to figure everything out
26 25
  * and somehow I don't have time to refactor everything since the client and management want this project to be done as soon as possible
27 26
  * with that in mind, if you have free time, do help me refactor everything. I know I should be the one doing it, but it seems I don't have time to do it
28
- * and my mind is already elsewhere. I pray that you'll have the perservernce to deal with the refactor and wish you the best of luck, you'll might need all of it
27
+* and my mind is already elsewhere. I pray that you'll have the perservernce to deal with the refactor and wish you the best of luck, you'll might need all of it
29 28
  * TLDR: to much things to do, to little time time to refactor
30 29
  */
31 30
 
32 31
 const root = ReactDOM.createRoot(document.getElementById('root'));
33 32
 root.render(
34 33
   <Provider store={store}>
35
-    {/* <App /> */}
36
-    <Maintainance/>
34
+    <App />
37 35
   </Provider>
38 36
 );
39 37
 

+ 3
- 1
src/pages/Maintainance.jsx Datei anzeigen

@@ -8,7 +8,9 @@ const Maintainance = () => {
8 8
             sx={{
9 9
                 height:"100vh",
10 10
                 width:"100%",
11
-                display:"flex"
11
+                display:"flex",
12
+                position:"absolute",
13
+                zIndex:99999
12 14
             }}
13 15
         >
14 16
             <img src={maintananceIMage} style={{width:"100%", margin:"auto auto"}} />

+ 1
- 0
src/services/ProductService.js Datei anzeigen

@@ -46,6 +46,7 @@ const getProducts = async () => {
46 46
               image {
47 47
                 url
48 48
               }
49
+              updatedAt
49 50
             }
50 51
           }
51 52
           variants(first: 200) {

Laden…
Abbrechen
Speichern