diff --git a/apps/web/public/static/locales/cs/common.json b/apps/web/public/static/locales/cs/common.json index b86eca62cd417..086f2d0b6d619 100644 --- a/apps/web/public/static/locales/cs/common.json +++ b/apps/web/public/static/locales/cs/common.json @@ -252,7 +252,7 @@ "forgot": "Zapomněli jste?", "done": "Hotovo", "all_done": "Hotovo!", - "all": "Všechny aplikace", + "all": "Všechny", "yours": "Váš účet", "available_apps": "Dostupné aplikace", "available_apps_lower_case": "Dostupné aplikace", diff --git a/apps/web/public/static/locales/de/common.json b/apps/web/public/static/locales/de/common.json index e05944ebe3114..f82f73c12d133 100644 --- a/apps/web/public/static/locales/de/common.json +++ b/apps/web/public/static/locales/de/common.json @@ -277,7 +277,7 @@ "forgot": "Vergessen?", "done": "Erledigt", "all_done": "Erledigt!", - "all": "Alle Apps", + "all": "Alle", "yours": "Ihr Konto", "available_apps": "Verfügbare Apps", "available_apps_lower_case": "Verfügbare Apps", diff --git a/apps/web/public/static/locales/es/common.json b/apps/web/public/static/locales/es/common.json index d3480724cab37..4aed24b28c63e 100644 --- a/apps/web/public/static/locales/es/common.json +++ b/apps/web/public/static/locales/es/common.json @@ -252,7 +252,7 @@ "forgot": "¿Olvidado?", "done": "Hecho", "all_done": "¡Todo listo!", - "all": "Todas las aplicaciones", + "all": "Todos", "yours": "Su cuenta", "available_apps": "Aplicaciones disponibles", "available_apps_lower_case": "Aplicaciones disponibles", diff --git a/apps/web/public/static/locales/it/common.json b/apps/web/public/static/locales/it/common.json index 63d385e45c2ed..d15879fecba3a 100644 --- a/apps/web/public/static/locales/it/common.json +++ b/apps/web/public/static/locales/it/common.json @@ -277,7 +277,7 @@ "forgot": "Dimenticato?", "done": "Fatto", "all_done": "Operazione completata!", - "all": "Tutte le app", + "all": "Tutte", "yours": "Il tuo account", "available_apps": "Applicazioni disponibili", "available_apps_lower_case": "Applicazioni disponibili", diff --git a/apps/web/public/static/locales/nl/common.json b/apps/web/public/static/locales/nl/common.json index 680ac7637c570..f6a243e59f8b3 100644 --- a/apps/web/public/static/locales/nl/common.json +++ b/apps/web/public/static/locales/nl/common.json @@ -252,7 +252,7 @@ "forgot": "Vergeten?", "done": "Voltooid", "all_done": "Helemaal klaar!", - "all": "Alle apps", + "all": "Alle", "yours": "Uw account", "available_apps": "Beschikbare apps", "available_apps_lower_case": "Beschikbare apps", diff --git a/apps/web/public/static/locales/pt-BR/common.json b/apps/web/public/static/locales/pt-BR/common.json index b784db531676d..e64c8ea91ef09 100644 --- a/apps/web/public/static/locales/pt-BR/common.json +++ b/apps/web/public/static/locales/pt-BR/common.json @@ -279,7 +279,7 @@ "forgot": "Esqueceu?", "done": "Concluído", "all_done": "Tudo pronto!", - "all": "Todos os apps", + "all": "Todos", "yours": "Sua conta", "available_apps": "Aplicativos disponíveis", "available_apps_lower_case": "Aplicativos disponíveis", diff --git a/apps/web/public/static/locales/pt/common.json b/apps/web/public/static/locales/pt/common.json index 93cfcaa5b34a5..0ae24e52e1453 100644 --- a/apps/web/public/static/locales/pt/common.json +++ b/apps/web/public/static/locales/pt/common.json @@ -277,7 +277,7 @@ "forgot": "Esqueceu-se?", "done": "Concluído", "all_done": "Tudo pronto!", - "all": "Todos as aplicações", + "all": "Todos", "yours": "A sua conta", "available_apps": "Aplicações disponíveis", "available_apps_lower_case": "Aplicações disponíveis", diff --git a/apps/web/public/static/locales/ro/common.json b/apps/web/public/static/locales/ro/common.json index fe9f6c43876cb..8978cd6623655 100644 --- a/apps/web/public/static/locales/ro/common.json +++ b/apps/web/public/static/locales/ro/common.json @@ -252,7 +252,7 @@ "forgot": "Ai uitat?", "done": "Adoptat", "all_done": "Gata!", - "all": "Toate aplicațiile", + "all": "Toate", "yours": "Contul dvs.", "available_apps": "Aplicații disponibile", "available_apps_lower_case": "Aplicații disponibile", diff --git a/apps/web/public/static/locales/ru/common.json b/apps/web/public/static/locales/ru/common.json index 96098be85366e..5cdfcffeab9e3 100644 --- a/apps/web/public/static/locales/ru/common.json +++ b/apps/web/public/static/locales/ru/common.json @@ -253,7 +253,7 @@ "forgot": "Забыли пароль?", "done": "Готово", "all_done": "Готово!", - "all": "Все приложения", + "all": "Все", "yours": "Ваш аккаунт", "available_apps": "Доступные приложения", "available_apps_lower_case": "Доступные приложения", diff --git a/apps/web/public/static/locales/sr/common.json b/apps/web/public/static/locales/sr/common.json index e3f9c877032d8..0a667ee9a10ed 100644 --- a/apps/web/public/static/locales/sr/common.json +++ b/apps/web/public/static/locales/sr/common.json @@ -252,7 +252,7 @@ "forgot": "Zaboravili ste?", "done": "Urađeno", "all_done": "Završeno!", - "all": "Sve aplikacije", + "all": "Sve", "yours": "Vaš nalog", "available_apps": "Dostupne aplikacije", "available_apps_lower_case": "Dostupne aplikacije", diff --git a/packages/features/filters/components/TeamsFilter.tsx b/packages/features/filters/components/TeamsFilter.tsx index ee04e858f4ec5..9d583d5843723 100644 --- a/packages/features/filters/components/TeamsFilter.tsx +++ b/packages/features/filters/components/TeamsFilter.tsx @@ -16,10 +16,9 @@ import { filterQuerySchema } from "../lib/getTeamsFiltersFromQuery"; export type IEventTypesFilters = RouterOutputs["viewer"]["eventTypes"]["listWithTeam"]; export type IEventTypeFilter = IEventTypesFilters[0]; -export const TEAMS_FILTER_KEY = "TEAMS_FILTER_KEY"; function useFilterQuery() { // passthrough allows additional params to not be removed - return useTypedQuery(filterQuerySchema.passthrough(), TEAMS_FILTER_KEY); + return useTypedQuery(filterQuerySchema.passthrough()); } export const TeamsFilter = ({ @@ -33,11 +32,14 @@ export const TeamsFilter = ({ }) => { const { t } = useLocale(); const session = useSession(); + const { data: query, pushItemToKey, removeItemByKeyAndValue, removeAllQueryParams } = useFilterQuery(); + const { data: teams } = trpc.viewer.teams.list.useQuery(undefined, { // Teams don't change that frequently refetchOnWindowFocus: false, }); + const getCheckedOptionsNames = () => { const checkedOptions: string[] = []; const teamIds = query.teamIds; diff --git a/packages/lib/hooks/useTypedQuery.ts b/packages/lib/hooks/useTypedQuery.ts index 24a6b01956862..c17b4afd94fca 100644 --- a/packages/lib/hooks/useTypedQuery.ts +++ b/packages/lib/hooks/useTypedQuery.ts @@ -4,7 +4,6 @@ import { usePathname, useRouter } from "next/navigation"; import { useCallback, useMemo, useEffect } from "react"; import { z } from "zod"; -import { localStorage } from "../webstorage"; import { useRouterQuery } from "./useRouterQuery"; type OptionalKeys = { @@ -33,7 +32,7 @@ export const queryStringArray = z .preprocess((a) => z.string().parse(a).split(","), z.string().array()) .or(z.string().array()); -export function useTypedQuery(schema: T, localStorageKey: string | null = null) { +export function useTypedQuery(schema: T) { type Output = z.infer; type FullOutput = Required; type OutputKeys = Required; @@ -44,7 +43,6 @@ export function useTypedQuery(schema: T, localStorageK const unparsedQuery = useRouterQuery(); const pathname = usePathname(); const parsedQuerySchema = schema.safeParse(unparsedQuery); - const useLocalStorage = !!localStorageKey; let parsedQuery: Output = useMemo(() => { return {} as Output; }, []); @@ -74,39 +72,6 @@ export function useTypedQuery(schema: T, localStorageK // eslint-disable-next-line react-hooks/exhaustive-deps [parsedQuery, router] ); - //If the value for {localStorageKey} exist in localStorage set it to queryParams - useEffect(() => { - if (!useLocalStorage) return; - const storedValueString = localStorage.getItem(localStorageKey); - if (!storedValueString || storedValueString == "{}") return; - const storedValue: Output = JSON.parse(storedValueString); - if (storedValue) { - const searchParams = new URLSearchParams(); - for (const [key, value] of Object.entries(storedValue)) { - searchParams.set(String(key), String(value)); - } - router.replace(`${pathname}?${searchParams.toString()}`); - } - }, []); - - function setLocalStorage(key: J, value: Output[J]) { - if (!useLocalStorage) return; - const storedValue: Output = JSON.parse(localStorage.getItem(localStorageKey) || "{}"); - const newValue = { ...storedValue, [key]: value }; - localStorage.setItem(localStorageKey, JSON.stringify(newValue)); - } - function removeByKeyFromLocalStorage(key: OutputOptionalKeys) { - if (!useLocalStorage) return; - const storedValue: Output = JSON.parse(localStorage.getItem(localStorageKey) || "{}"); - const newValue = storedValue; - delete newValue[key]; - localStorage.setItem(localStorageKey, JSON.stringify(newValue)); - } - //Remove {localStorageKey} from the localStorage - function removeAllValuesFromLocalStorage() { - if (!useLocalStorage) return; - localStorage.removeItem(localStorageKey); - } // Delete a key from the query function removeByKey(key: OutputOptionalKeys) { @@ -122,13 +87,9 @@ export function useTypedQuery(schema: T, localStorageK if (existingValue.includes(value)) return; // prevent adding the same value to the array // @ts-expect-error this is too much for TS it seems setQuery(key, [...existingValue, value]); - // @ts-expect-error this is too much for TS it seems - setLocalStorage(key, [...existingValue, value]); } else { // @ts-expect-error this is too much for TS it seems setQuery(key, [value]); - // @ts-expect-error this is too much for TS it seems - setLocalStorage(key, [value]); } } @@ -139,12 +100,9 @@ export function useTypedQuery(schema: T, localStorageK // @ts-expect-error this is too much for TS it seems const newValue = existingValue.filter((item) => item !== value); setQuery(key, newValue); - setLocalStorage(key, newValue); } else { // @ts-expect-error this is too much for TS it seems removeByKey(key); - //@ts-expect-error this is too much for TS it seems - removeByKeyFromLocalStorage(key); } } @@ -152,7 +110,6 @@ export function useTypedQuery(schema: T, localStorageK function removeAllQueryParams() { if (pathname !== null) { router.replace(pathname); - removeAllValuesFromLocalStorage(); } }