From 4435ff120ba7011c50ccc6bb22e2b26fedd4e878 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Tue, 11 Jun 2024 15:13:04 +0200 Subject: [PATCH] fix bugs --- .../board-buttons/board-buttons.tsx | 34 ++++++++++++++++--- src/components/catalog-row/catalog-row.tsx | 2 +- src/lib/utils/view-utils.ts | 4 ++- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/components/board-buttons/board-buttons.tsx b/src/components/board-buttons/board-buttons.tsx index e4928b7e..8edccd0e 100644 --- a/src/components/board-buttons/board-buttons.tsx +++ b/src/components/board-buttons/board-buttons.tsx @@ -17,10 +17,22 @@ interface BoardButtonsProps { const CatalogButton = ({ address, isInAllView, isInSubscriptionsView }: BoardButtonsProps) => { const { t } = useTranslation(); - const link = isInAllView ? `/p/all/catalog` : isInSubscriptionsView ? `/p/subscriptions/catalog` : `/p/${address}/catalog`; + const params = useParams(); + + const createCatalogLink = () => { + if (isInAllView) { + if (params?.timeFilterName) return `/p/all/catalog/${params.timeFilterName}`; + return `/p/all/catalog`; + } else if (isInSubscriptionsView) { + if (params?.timeFilterName) return `/p/subscriptions/catalog/${params.timeFilterName}`; + return `/p/subscriptions/catalog`; + } + return `/p/${address}/catalog`; + }; + return ( ); }; @@ -38,10 +50,22 @@ const SubscribeButton = ({ address }: BoardButtonsProps) => { const ReturnButton = ({ address, isInAllView, isInSubscriptionsView }: BoardButtonsProps) => { const { t } = useTranslation(); - const link = isInAllView ? `/p/all` : isInSubscriptionsView ? `/p/subscriptions` : `/p/${address}`; + const params = useParams(); + + const createReturnLink = () => { + if (isInAllView) { + if (params?.timeFilterName) return `/p/all/${params.timeFilterName}`; + return `/p/all`; + } else if (isInSubscriptionsView) { + if (params?.timeFilterName) return `/p/subscriptions/${params.timeFilterName}`; + return `/p/subscriptions`; + } + return `/p/${address}`; + }; + return ( ); }; @@ -66,7 +90,7 @@ const SortOptions = () => { }; return ( <> - {t('sort_by')}:  + {t('sort_by')}