Skip to content

Commit

Permalink
Merge pull request #75 from CSCE331-Fall2024/Vincent_Bug_Fixes
Browse files Browse the repository at this point in the history
Fix routing on caShier
  • Loading branch information
VinceDaPrince45 authored Dec 8, 2024
2 parents ac74c08 + ec11448 commit 2e66e24
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/app/Customer/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,21 @@ export default function CustomerPage() {
/>
) : selectedCategory === "drinks" ? (
<DrinksPage
user="customer"
category={selectedCategory}
setSelectedCategory={setSelectedCategory}
addComboToCart={addComboToCart}
/>
) : selectedCategory === "appetizers" ? (
<SidesPage
user="customer"
category={selectedCategory}
setSelectedCategory={setSelectedCategory}
addComboToCart={addComboToCart}
/>
) : selectedCategory === "entrees" ? (
<EntreesPage
user="customer"
category={selectedCategory}
setSelectedCategory={setSelectedCategory}
addComboToCart={addComboToCart}
Expand Down
8 changes: 7 additions & 1 deletion src/app/_components/drinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ interface Drink {
* @returns {JSX.Element} The rendered DrinksPage component.
*/
export default function DrinksPage({
user,
category,
setSelectedCategory,
addComboToCart,
}: {
user: string;
category: string;
setSelectedCategory: (category: string | null) => void;
addComboToCart: (
Expand Down Expand Up @@ -101,7 +103,11 @@ export default function DrinksPage({
});

setSelectedCategory(null);
router.push("/Customer");
if (user.toLowerCase() === "customer") {
router.push("/Customer");
} else if (user.toLowerCase() === "cashier") {
router.push("/cashier");
}
};

return (
Expand Down
8 changes: 7 additions & 1 deletion src/app/_components/entrees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ interface Entree {
* @returns {JSX.Element} The rendered EntreesPage component.
*/
export default function EntreesPage({
user,
category,
setSelectedCategory,
addComboToCart,
}: {
user: string;
category: string;
setSelectedCategory: (category: string | null) => void;
addComboToCart: (comboName: string, comboItems: Record<string, { id: number; name: string }[]>) => void;
Expand Down Expand Up @@ -112,7 +114,11 @@ export default function EntreesPage({
});

setSelectedCategory(null);
router.push("/Customer");
if (user.toLowerCase() === "customer") {
router.push("/Customer");
} else if (user.toLowerCase() === "cashier") {
router.push("/cashier");
}
};

return (
Expand Down
8 changes: 7 additions & 1 deletion src/app/_components/sides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ interface Appetizer {
* @returns {JSX.Element} The rendered SidesPage component.
*/
export default function SidesPage({
user,
category,
setSelectedCategory,
addComboToCart,
}: {
user: string;
category: string;
setSelectedCategory: (category: string | null) => void;
addComboToCart: (comboName: string, comboItems: Record<string, { id: number; name: string }[]>) => void;
Expand Down Expand Up @@ -111,7 +113,11 @@ export default function SidesPage({
});

setSelectedCategory(null);
router.push("/Customer");
if (user.toLowerCase() === "customer") {
router.push("/Customer");
} else if (user.toLowerCase() === "cashier") {
router.push("/cashier");
}
};

return (
Expand Down
3 changes: 3 additions & 0 deletions src/app/cashier/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,21 @@ export default function CustomerPage() {
/>
) : selectedCategory === "drinks" ? (
<DrinksPage
user="cashier"
category={selectedCategory}
setSelectedCategory={setSelectedCategory}
addComboToCart={addComboToCart}
/>
) : selectedCategory === "appetizers" ? (
<SidesPage
user="cashier"
category={selectedCategory}
setSelectedCategory={setSelectedCategory}
addComboToCart={addComboToCart}
/>
) : selectedCategory === "entrees" ? (
<EntreesPage
user="cashier"
category={selectedCategory}
setSelectedCategory={setSelectedCategory}
addComboToCart={addComboToCart}
Expand Down

0 comments on commit 2e66e24

Please sign in to comment.