From 2c2e4495973faa227dfd3d091d9054a0acff255e Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 25 Jun 2024 17:42:12 +0800 Subject: [PATCH 1/2] Use web return on logo click --- .../components/elements/images/OmnivoreLogoBase.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/web/components/elements/images/OmnivoreLogoBase.tsx b/packages/web/components/elements/images/OmnivoreLogoBase.tsx index ad827f9a8..605e7c632 100644 --- a/packages/web/components/elements/images/OmnivoreLogoBase.tsx +++ b/packages/web/components/elements/images/OmnivoreLogoBase.tsx @@ -21,10 +21,16 @@ export function OmnivoreLogoBase(props: OmnivoreLogoBaseProps): JSX.Element { alignItems: 'center', }} onClick={(event) => { + const navReturn = window.localStorage.getItem('nav-return') + if (navReturn) { + window.location.assign(navReturn) + return + } const query = window.sessionStorage.getItem('q') if (query) { - router.push(`/home?${query}`) - event.preventDefault() + window.location.assign(`/l/home?${query}`) + } else { + window.location.replace(`/l/home`) } }} tabIndex={-1} From dd44322db790b8b2dabf2694fd5f4e0e635d5bd7 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 25 Jun 2024 17:54:30 +0800 Subject: [PATCH 2/2] set nav-return more often --- .../web/components/templates/library/LibraryContainer.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/web/components/templates/library/LibraryContainer.tsx b/packages/web/components/templates/library/LibraryContainer.tsx index b10024ad0..569c03937 100644 --- a/packages/web/components/templates/library/LibraryContainer.tsx +++ b/packages/web/components/templates/library/LibraryContainer.tsx @@ -162,6 +162,10 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element { // eslint-disable-next-line react-hooks/exhaustive-deps }, [setQueryInputs, router.isReady, router.query]) + useEffect(() => { + window.localStorage.setItem('nav-return', router.asPath) + }, [router.asPath]) + const hasMore = useMemo(() => { if (!itemsPages) { return false