From 675f4f2c42b3d67c2b8059d3b25d27ccb391c3b4 Mon Sep 17 00:00:00 2001 From: zadit <75159257+insvrgent@users.noreply.github.com> Date: Fri, 27 Dec 2024 08:02:11 +0700 Subject: [PATCH] ok --- src/App.css | 4 +- src/components/ButtonWithReplica.css | 4 +- src/components/Header.js | 6 +- src/components/Item.module.css | 10 +-- src/components/ItemLister.module.css | 8 +-- src/components/ItemType.module.css | 2 +- src/components/ItemTypeLister.css | 2 +- src/pages/Cart.module.css | 4 +- src/pages/CreateClerk.js | 8 ++- src/pages/Dashboard.js | 95 +++++++++++++++++++--------- src/pages/Invoice.module.css | 10 +-- src/pages/LinktreePage.module.css | 73 ++++++++++++++++++--- src/pages/Transactions.module.css | 14 ++-- 13 files changed, 168 insertions(+), 72 deletions(-) diff --git a/src/App.css b/src/App.css index 801f01c..3cc1c42 100644 --- a/src/App.css +++ b/src/App.css @@ -1,4 +1,4 @@ -@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"); +@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@200;300;400;500;600;700;800&ital,wght@0,200..800;1,200..800&display=swap"); html, body { -ms-overflow-style: none; /* IE and Edge */ @@ -36,7 +36,7 @@ body { } .title { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size: 28px; diff --git a/src/components/ButtonWithReplica.css b/src/components/ButtonWithReplica.css index 9f8872b..4b5ca07 100644 --- a/src/components/ButtonWithReplica.css +++ b/src/components/ButtonWithReplica.css @@ -9,7 +9,7 @@ position: relative; z-index: 201; /* Make sure the button is above the replica */ - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size: 70%; /* Adjusted for better readability */ @@ -125,7 +125,7 @@ .ClaimButton.active { visibility: visible; - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size: 70%; /* Adjusted for better readability */ diff --git a/src/components/Header.js b/src/components/Header.js index bb44734..617a8ff 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -17,7 +17,7 @@ const HeaderBar = styled.div` const Title = styled.h2` margin: 0; - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size:${(props) => (props.HeaderSize)}; @@ -26,7 +26,7 @@ const Title = styled.h2` const ProfileName = styled.h2` position: absolute; - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size: 30px; @@ -197,7 +197,7 @@ const Child = styled.div` border-top-left-radius: 5px; border-bottom-left-radius: 5px; padding-left: 5px; - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; diff --git a/src/components/Item.module.css b/src/components/Item.module.css index 3f16f41..f3b86c1 100644 --- a/src/components/Item.module.css +++ b/src/components/Item.module.css @@ -96,7 +96,7 @@ } .itemName { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; width: calc(100% - 15px); /* Adjust the width to prevent overflow */ font-size: 1.4rem; @@ -124,7 +124,7 @@ } .itemPrice { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; font-weight: 600; width: calc(100% - 15px); /* Adjust the width to prevent overflow */ @@ -136,7 +136,7 @@ } .itemPriceInvoice { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; font-weight: 600; width: calc(100% - 15px); /* Adjust the width to prevent overflow */ @@ -158,7 +158,7 @@ } .itemQtyValue { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; font-weight: 600; margin-top: 19px; @@ -169,7 +169,7 @@ } .itemQtyInput { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; font-weight: 600; width: 30px; /* Adjust the width to prevent overflow */ diff --git a/src/components/ItemLister.module.css b/src/components/ItemLister.module.css index 8314b00..841975a 100644 --- a/src/components/ItemLister.module.css +++ b/src/components/ItemLister.module.css @@ -35,7 +35,7 @@ .title { background-color: transparent; - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size: 20px; @@ -119,7 +119,7 @@ justify-content: space-between; width: 80vw; margin: 0 auto; - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 600; font-style: normal; font-size: 1.5em; @@ -131,7 +131,7 @@ justify-content: space-between; width: 80vw; margin: 0 auto; - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 600; font-style: normal; font-size: 0.9em; @@ -139,7 +139,7 @@ margin-bottom: 17px; } .PayButton { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size: 32px; diff --git a/src/components/ItemType.module.css b/src/components/ItemType.module.css index ef5a5e7..edd7836 100644 --- a/src/components/ItemType.module.css +++ b/src/components/ItemType.module.css @@ -43,7 +43,7 @@ } .item-type-name { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size: 14px; diff --git a/src/components/ItemTypeLister.css b/src/components/ItemTypeLister.css index b311d46..a0692e0 100644 --- a/src/components/ItemTypeLister.css +++ b/src/components/ItemTypeLister.css @@ -56,7 +56,7 @@ align-self: center; /* Center the button horizontally */ } .item-type-name { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; height: 20vw; font-size: 1.5rem; diff --git a/src/pages/Cart.module.css b/src/pages/Cart.module.css index 261d8c4..9d40667 100644 --- a/src/pages/Cart.module.css +++ b/src/pages/Cart.module.css @@ -9,7 +9,7 @@ } .Cart-title { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size: 32px; @@ -85,7 +85,7 @@ margin-bottom: 17px; } .CheckoutButton { - font-family: "Poppins", sans-serif; + font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; font-style: normal; font-size: 32px; diff --git a/src/pages/CreateClerk.js b/src/pages/CreateClerk.js index 297da62..12836b1 100644 --- a/src/pages/CreateClerk.js +++ b/src/pages/CreateClerk.js @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import { createClerks } from '../helpers/userHelpers'; // Adjust the import path as needed +import { useLocation } from "react-router-dom"; const CreateClerk = ({ shopId }) => { const [username, setUsername] = useState(''); @@ -7,6 +8,11 @@ const CreateClerk = ({ shopId }) => { const [loading, setLoading] = useState(false); const [message, setMessage] = useState(''); + const location = useLocation(); + + const queryParams = new URLSearchParams(location.search); + const cafeIdParam = queryParams.get("cafeId"); + const handleSubmit = async (event) => { event.preventDefault(); setLoading(true); @@ -20,7 +26,7 @@ const CreateClerk = ({ shopId }) => { } try { - const create = await createClerks(shopId, username, password); + const create = await createClerks(shopId || cafeIdParam, username, password); if (create) setMessage('Clerk created successfully'); else setMessage('Failed to create clerk'); diff --git a/src/pages/Dashboard.js b/src/pages/Dashboard.js index 42ffc65..0e6481c 100644 --- a/src/pages/Dashboard.js +++ b/src/pages/Dashboard.js @@ -43,6 +43,23 @@ const LinktreePage = ({ user, setModal }) => { }, [location]); + useEffect(() => { + const url = new URL(window.location.href); // Get the current URL + const searchParams = new URLSearchParams(url.search); // Get the query parameters + console.log(selectedItemId) + if (selectedItemId != 0 && selectedItemId != -1) { + // Add cafeId to the query parameter + searchParams.set('cafeId', selectedItemId); + } else { + // Remove cafeId from the query parameter + searchParams.delete('cafeId'); + } + + // Update the URL with the modified query params + window.history.replaceState(null, '', `${url.pathname}?${searchParams.toString()}`); + }, [selectedItemId]); + + // Handle user transactions const handleMyTransactions = async () => { try { @@ -148,26 +165,23 @@ const LinktreePage = ({ user, setModal }) => { }; const colors = [ - // Complementary (for contrast with olive green) - "#FF6347", // Tomato red (complementary to olive green) - "#FF4500", // Orange red (complementary to olive green) - - // Analogous to olive green - "#D0E14F", // Light green-yellow - "#A9C96E", // Muted olive green (your bg color itself) - "#A5B24F", // Earthy olive green - - - // Triadic (balanced and vibrant palette) - "#FF00FF", // Magenta (triadic color) - "#1E90FF", // Dodger blue (triadic color) - "#32CD32", // Lime green (triadic color) - - // Neutral tones - "#FFDAB9", // Peach (light neutral tone) - "#4B0082", // Indigo (dark neutral tone) - "#8B4513", // Saddle brown (earthy neutral) + // Strong contrasting colors for visibility on white background + "#333333", // Dark Gray (great contrast for legibility) + "#555555", // Medium Gray (slightly lighter, still legible) + + // Subtle accent colors (not too bright, but distinct) + "#4B9F8D", // Muted Teal (offers a soft contrast) + "#7F7F7F", // Slate Gray (elegant and balanced) + + // Softer neutral colors (for less emphasis) + "#B0B0B0", // Light Gray (gentle tone for subtle slices) + "#D3D3D3", // Silver Gray (light, but still visible on white background) + + // A touch of color for balance (but still muted) + "#9C6E5C", // Muted Brown (earthy, grounded tone) + "#A1A1A1", // Silver (neutral highlight) ]; + const selectedItems = items.items?.find(item => (item.userId || item.cafeId) === selectedItemId); @@ -268,8 +282,8 @@ const sortedMaterials = allMaterials.sort((a, b) => new Date(a.date) - new Date( 1 -205 -24 -27 -69 -23 -89 7 -20 31 -17 172 5 198 17 22 59 22 83 0z"/> -
Total pemasukan
{items?.totalIncome}
+pemasukan
Total keuntungan
+keuntungan
{items?.totalIncome * 0.02}
{selectedItems?.totalIncome * 0.02}
{filteredItems.name}
@@ -462,8 +477,8 @@ const sortedMaterials = allMaterials.sort((a, b) => new Date(a.date) - new Date( 1 -205 -24 -27 -69 -23 -89 7 -20 31 -17 172 5 198 17 22 59 22 83 0z"/> -Total pemasukan
{formatIncome(items?.totalIncome)}
+pemasukan
Total pengeluaran
{formatIncome(items?.totalOutcome)}
+pengeluaran
Total tanggungan
{formatIncome(items?.totalIncome * 0.02)}
+tanggungan
{selectedItems?.name}
@@ -664,7 +680,7 @@ const sortedMaterials = allMaterials.sort((a, b) => new Date(a.date) - new Date(