refactor(navigation): clear params from editor drawer

This commit is contained in:
Carlos Valente
2026-07-17 15:33:21 +02:00
committed by Carlos Valente
parent 6911e37c18
commit c191786e50
2 changed files with 16 additions and 8 deletions
@@ -11,6 +11,7 @@ import {
} from '../../../stores/savedViewParams'; } from '../../../stores/savedViewParams';
import { handleLinks } from '../../../utils/linkUtils'; import { handleLinks } from '../../../utils/linkUtils';
import IconButton from '../../buttons/IconButton'; import IconButton from '../../buttons/IconButton';
import Tooltip from '../../tooltip/Tooltip';
import NavigationMenuItem from '../navigation-menu-item/NavigationMenuItem'; import NavigationMenuItem from '../navigation-menu-item/NavigationMenuItem';
import style from './ClientLink.module.scss'; import style from './ClientLink.module.scss';
@@ -105,16 +106,20 @@ function BrowserNavigationItem({ current, to, postAction, children }: PropsWithC
{isCustomised && ( {isCustomised && (
<span className={style.trailing}> <span className={style.trailing}>
<span className={style.indicator} aria-hidden data-testid='client-link__saved-indicator' /> <span className={style.indicator} aria-hidden data-testid='client-link__saved-indicator' />
<IconButton <Tooltip
variant='ghosted-white' text='Reset to default'
size='small' render={
className={style.clear} <IconButton
aria-label='Clear saved view settings' variant='ghosted-white'
title='Clear saved view settings' size='small'
onClick={clearViewSettings} className={style.clear}
aria-label='Reset to default'
onClick={clearViewSettings}
/>
}
> >
<IoCloseOutline /> <IoCloseOutline />
</IconButton> </Tooltip>
</span> </span>
)} )}
</NavigationMenuItem> </NavigationMenuItem>
@@ -6,6 +6,7 @@ import { useSearchParams } from 'react-router';
import useViewSettings from '../../hooks-query/useViewSettings'; import useViewSettings from '../../hooks-query/useViewSettings';
import { useIsSmallScreen } from '../../hooks/useIsSmallScreen'; import { useIsSmallScreen } from '../../hooks/useIsSmallScreen';
import { useSavedViewParams } from '../../stores/savedViewParams';
import Button from '../buttons/Button'; import Button from '../buttons/Button';
import IconButton from '../buttons/IconButton'; import IconButton from '../buttons/IconButton';
import Info from '../info/Info'; import Info from '../info/Info';
@@ -27,6 +28,7 @@ function ViewParamsEditor({ target, viewOptions }: EditFormDrawerProps) {
const [searchParams, setSearchParams] = useSearchParams(); const [searchParams, setSearchParams] = useSearchParams();
const { data: viewSettings } = useViewSettings(); const { data: viewSettings } = useViewSettings();
const { isOpen, close } = useViewParamsEditorStore(); const { isOpen, close } = useViewParamsEditorStore();
const clearSavedParams = useSavedViewParams((store) => store.clear);
const isSmallScreen = useIsSmallScreen(); const isSmallScreen = useIsSmallScreen();
const getPreservedParams = () => getPreservedSearchParams(searchParams, viewOptions); const getPreservedParams = () => getPreservedSearchParams(searchParams, viewOptions);
@@ -36,6 +38,7 @@ function ViewParamsEditor({ target, viewOptions }: EditFormDrawerProps) {
}; };
const resetParams = () => { const resetParams = () => {
clearSavedParams(target);
setSearchParams(getPreservedParams()); setSearchParams(getPreservedParams());
}; };