Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into issue-#1648
Browse files Browse the repository at this point in the history
  • Loading branch information
GrandSchtroumpf committed Feb 6, 2025
2 parents d3ed148 + 8d231e3 commit 556538d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/core/menu/mainMenu/MainMenuCart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export const MainMenuCart = () => {
return () => window.removeEventListener('storage', handler);
});

if (!user) return;

return (
<Link
id="menu-cart-link"
Expand Down
8 changes: 7 additions & 1 deletion src/libs/routing/routes/cart.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { createRoute } from '@tanstack/react-router';
import { createRoute, redirect } from '@tanstack/react-router';
import { rootRoute } from 'libs/routing/routes/root';
import { CartPage } from 'pages/cart';
import config from 'config';

export const cartPage = createRoute({
getParentRoute: () => rootRoute,
path: '/cart',
component: CartPage,
loader: () => {
if (!config.ui.showCart) {
throw redirect({ to: '/' });
}
},
});
5 changes: 2 additions & 3 deletions src/libs/routing/routes/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { rootRoute } from './root';
import { createRoute, redirect } from '@tanstack/react-router';
import { InferSearch, searchValidator, validNumber } from '../utils';
import { activityValidators } from 'components/activity/utils';
import { defaultEnd, defaultStart } from 'components/strategies/common/utils';
import * as v from 'valibot';

const schema = {
...activityValidators,
priceStart: v.optional(validNumber, defaultStart().toString()),
priceEnd: v.optional(validNumber, defaultEnd().toString()),
priceStart: v.optional(validNumber),
priceEnd: v.optional(validNumber),
hideIndicators: v.optional(v.boolean()),
};

Expand Down
2 changes: 0 additions & 2 deletions src/pages/cart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ export const CartPage = () => {
}
};

if (!config.ui.showCart) return;

if (!strategies.length) {
return (
<section className="px-content pb-30 xl:px-50 mx-auto grid max-w-[1280px] flex-grow content-start gap-16 pt-20">
Expand Down

0 comments on commit 556538d

Please sign in to comment.