From 0cff0b8ab0c18f34ca44fe51b5ecca7a57a988af Mon Sep 17 00:00:00 2001 From: Tony Vi Date: Fri, 21 Apr 2023 16:55:41 +0300 Subject: [PATCH] feat(FiltersPanel): reset button --- .../pages/GoalsPage/GoalsPage.i18n/en.json | 3 ++- .../pages/GoalsPage/GoalsPage.i18n/ru.json | 3 ++- src/components/pages/GoalsPage/GoalsPage.tsx | 7 +++++-- .../pages/ProjectPage/ProjectPage.i18n/en.json | 3 ++- .../pages/ProjectPage/ProjectPage.i18n/ru.json | 3 ++- src/components/pages/ProjectPage/ProjectPage.tsx | 7 +++++-- src/hooks/useUrlFilterParams.ts | 13 +++++++++++++ 7 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/components/pages/GoalsPage/GoalsPage.i18n/en.json b/src/components/pages/GoalsPage/GoalsPage.i18n/en.json index f4c69c8eb..c0a136331 100644 --- a/src/components/pages/GoalsPage/GoalsPage.i18n/en.json +++ b/src/components/pages/GoalsPage/GoalsPage.i18n/en.json @@ -1,5 +1,6 @@ { "title": "Taskany — Goals — Dashboard", "Dashboard": "Dashboard", - "This is your personal goals bundle": "This is your personal goals bundle. Created, owned, watching projects and goals are here." + "This is your personal goals bundle": "This is your personal goals bundle. Created, owned, watching projects and goals are here.", + "Reset": "Reset" } diff --git a/src/components/pages/GoalsPage/GoalsPage.i18n/ru.json b/src/components/pages/GoalsPage/GoalsPage.i18n/ru.json index 46bf0bc5e..8aeaf860b 100644 --- a/src/components/pages/GoalsPage/GoalsPage.i18n/ru.json +++ b/src/components/pages/GoalsPage/GoalsPage.i18n/ru.json @@ -1,5 +1,6 @@ { "title": "Taskany — Цели — Рабочий стол", "Dashboard": "Рабочий стол", - "This is your personal goals bundle": "Здесь будут все созданные вами, назначенные на вас, а также цели и проекты, за которыми вы следите." + "This is your personal goals bundle": "Здесь будут все созданные вами, назначенные на вас, а также цели и проекты, за которыми вы следите.", + "Reset": "Сбросить" } diff --git a/src/components/pages/GoalsPage/GoalsPage.tsx b/src/components/pages/GoalsPage/GoalsPage.tsx index c2c9b00cc..b162fd73d 100644 --- a/src/components/pages/GoalsPage/GoalsPage.tsx +++ b/src/components/pages/GoalsPage/GoalsPage.tsx @@ -3,7 +3,7 @@ import React, { MouseEventHandler, useCallback, useEffect, useState } from 'reac import useSWR, { unstable_serialize } from 'swr'; import dynamic from 'next/dynamic'; import { useRouter } from 'next/router'; -import { nullable } from '@taskany/bricks'; +import { nullable, Button } from '@taskany/bricks'; import { Filter, Goal, GoalsMetaOutput, Project } from '../../../../graphql/@generated/genql'; import { createFetcher, refreshInterval } from '../../../utils/createFetcher'; @@ -198,6 +198,7 @@ export const GoalsPage = ({ user, ssrTime, locale, fallback, preset }: ExternalP setOwnerFilter, setProjectFilter, setFulltextFilter, + resetQueryState, setPreset, } = useUrlFilterParams({ preset, @@ -328,7 +329,9 @@ export const GoalsPage = ({ user, ssrTime, locale, fallback, preset }: ExternalP onEstimateChange={setEstimateFilter} onPresetChange={setPreset} onFilterStar={onFilterStar} - /> + > + {Boolean(queryString) &&