diff --git a/frontend/src/components/item-card/item-card.jsx b/frontend/src/components/item-card/item-card.jsx index dd00834..4433f25 100644 --- a/frontend/src/components/item-card/item-card.jsx +++ b/frontend/src/components/item-card/item-card.jsx @@ -59,6 +59,7 @@ const ItemCard = ({ startDate, endDate, presenterName, + finished, level, cost = 50000, purchaseState = 0, // 0 -> not purchased, 1 -> in cart, 2 -> purchased @@ -169,6 +170,12 @@ const ItemCard = ({ {levelComponentMapping[level]} {!hasBought && } {!hasBought && shouldShowFullCapacity && } + {finished &&
Finished!
} addToCart({ id: item.id, diff --git a/frontend/src/pages/workshops/useWorkshopsPage.js b/frontend/src/pages/workshops/useWorkshopsPage.js index 58b9d62..19b0c3d 100644 --- a/frontend/src/pages/workshops/useWorkshopsPage.js +++ b/frontend/src/pages/workshops/useWorkshopsPage.js @@ -41,7 +41,6 @@ export default function useWorkshopsPage() { const handleCheckbox = useCallback(e => { setRadioSelectedItem(e.target.value) - console.log(e.target.value) }, []) useEffect(() => { @@ -113,6 +112,7 @@ export default function useWorkshopsPage() { item['capacity'] = workshop.capacity; item['cost'] = workshop.cost; item['remaining_capacity'] = workshop.remaining_capacity + item['finished'] = false return item; }) .filter((e) => e != null); @@ -120,32 +120,31 @@ export default function useWorkshopsPage() { const now = removeEverythingFromDateString(new Date().toLocaleString('fa-IR-u-nu-latn')) let index = -1 - console.log("now:", now) for (const item of parsedData) { const itemDate = removeEverythingFromDateString(new Date(item.start_date).toLocaleString('fa-IR-u-nu-latn')) - console.log(itemDate, now, itemDate > now) index++ if (itemDate > now) break + item['finished'] = true } const notEligibleItems = parsedData.slice(0, index) parsedData = parsedData.slice(index) parsedData.push(...notEligibleItems) - console.log(parsedData) - console.log(index) setParsedItemsList(parsedData); setFileteredItems(parsedData); function removeEverythingFromDateString(str) { - const splittedStr = str.split('/') - if (splittedStr[1].length === 1) - splittedStr[1] = '0' + splittedStr[1] - const secondSplittedStr = splittedStr[2].split(",") - if (secondSplittedStr[0].length === 1) - splittedStr[2] = "0" + secondSplittedStr.join(",") - str = splittedStr.join('/') - console.log(str) + const splitStr = str.split('/') + if (splitStr[1].length === 1) + splitStr[1] = '0' + splitStr[1] + const secondSplitStr = splitStr[2].split(",") + if (secondSplitStr[0].length === 1) + splitStr[2] = "0" + secondSplitStr.join(",") + const timeSplitStr = splitStr[2].split(",")[1].split(":")[0].trim() + if (timeSplitStr.length === 1) + splitStr[2] = splitStr[2].split(",")[0] + "0" + splitStr[2].split(",")[1].split(":")[0].trim() + str = splitStr.join('/') return str .replaceAll("/", '') .replaceAll(" ", '') diff --git a/frontend/src/providers/APIProvider/APIProvider.jsx b/frontend/src/providers/APIProvider/APIProvider.jsx index 1f6c9f2..db7a528 100644 --- a/frontend/src/providers/APIProvider/APIProvider.jsx +++ b/frontend/src/providers/APIProvider/APIProvider.jsx @@ -49,7 +49,6 @@ export function APIProvider({ children }) { .catch((error) => { if (error == null) return; - console.log(error); if (error.response.status === 401) { localStorage.removeItem('user'); window.location.reload(); diff --git a/frontend/src/providers/config-provider/ConfigProvider.jsx b/frontend/src/providers/config-provider/ConfigProvider.jsx index c4136cd..b302a45 100644 --- a/frontend/src/providers/config-provider/ConfigProvider.jsx +++ b/frontend/src/providers/config-provider/ConfigProvider.jsx @@ -30,14 +30,12 @@ export function ConfigProvider({ children }) { if (!currentPath) return; switch ('/' + currentPath) { case ROUTES.myAccount.path: - console.log('myacc'); if (!accessToken) { window.location.replace(ROUTES.signup.path); // navigate(ROUTES.signup.path) } break; case ROUTES.signup.path: - console.log('sign'); if (accessToken) { window.location.replace(ROUTES.myAccount.path); // navigate(ROUTES.myAccount.path)