🐛(frontend) allow left panel to update on language change
- fixes a bug where after language-sync the left panel would remain in the same language as before.
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { useMemo } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { css } from 'styled-components';
|
import { css } from 'styled-components';
|
||||||
|
|
||||||
@@ -10,6 +9,7 @@ import { useLeftPanelStore } from '@/features/left-panel';
|
|||||||
|
|
||||||
export const LeftPanelTargetFilters = () => {
|
export const LeftPanelTargetFilters = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const { togglePanel } = useLeftPanelStore();
|
const { togglePanel } = useLeftPanelStore();
|
||||||
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
||||||
@@ -23,25 +23,23 @@ export const LeftPanelTargetFilters = () => {
|
|||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const defaultQueries = useMemo(() => {
|
const defaultQueries = [
|
||||||
return [
|
{
|
||||||
{
|
icon: 'apps',
|
||||||
icon: 'apps',
|
label: t('All docs'),
|
||||||
label: t('All docs'),
|
targetQuery: DocDefaultFilter.ALL_DOCS,
|
||||||
targetQuery: DocDefaultFilter.ALL_DOCS,
|
},
|
||||||
},
|
{
|
||||||
{
|
icon: 'lock',
|
||||||
icon: 'lock',
|
label: t('My docs'),
|
||||||
label: t('My docs'),
|
targetQuery: DocDefaultFilter.MY_DOCS,
|
||||||
targetQuery: DocDefaultFilter.MY_DOCS,
|
},
|
||||||
},
|
{
|
||||||
{
|
icon: 'group',
|
||||||
icon: 'group',
|
label: t('Shared with me'),
|
||||||
label: t('Shared with me'),
|
targetQuery: DocDefaultFilter.SHARED_WITH_ME,
|
||||||
targetQuery: DocDefaultFilter.SHARED_WITH_ME,
|
},
|
||||||
},
|
];
|
||||||
];
|
|
||||||
}, [t]);
|
|
||||||
|
|
||||||
const onSelectQuery = (query: DocDefaultFilter) => {
|
const onSelectQuery = (query: DocDefaultFilter) => {
|
||||||
const params = new URLSearchParams(searchParams);
|
const params = new URLSearchParams(searchParams);
|
||||||
|
|||||||
Reference in New Issue
Block a user