diff --git a/package.json b/package.json index d9bba0210..8d92d425c 100644 --- a/package.json +++ b/package.json @@ -160,6 +160,7 @@ "@testing-library/react": "^14.0.0", "@testing-library/react-hooks": "^8.0.1", "@testing-library/user-event": "^14.5.1", + "@types/swiper": "^6.0.0", "@typescript-eslint/eslint-plugin": "^7.0.0", "@typescript-eslint/parser": "^7.0.0", "@vitejs/plugin-react-swc": "^3.7.2", diff --git a/src/features/explorer/components/explorer-cards.tsx b/src/features/explorer/components/explorer-cards.tsx index 3beb7bc8a..1c6592040 100644 --- a/src/features/explorer/components/explorer-cards.tsx +++ b/src/features/explorer/components/explorer-cards.tsx @@ -23,14 +23,14 @@ const ExplorerCards = () => { const handleClick = () => { setIsOpen((prev) => { const newValue = !prev; - localStorage.setItem('soapbox:explorer:card', JSON.stringify(!isOpen)); + localStorage.setItem('soapbox:explorer:card:status', JSON.stringify(!isOpen)); return newValue; }); }; useEffect( () => { - const value = localStorage.getItem('soapbox:explorer:card'); + const value = localStorage.getItem('soapbox:explorer:card:status'); if (value !== null) { setIsOpen(JSON.parse(value)); } diff --git a/src/features/explorer/components/explorerFilter.tsx b/src/features/explorer/components/explorerFilter.tsx index f7bd7d727..c2cebbf29 100644 --- a/src/features/explorer/components/explorerFilter.tsx +++ b/src/features/explorer/components/explorerFilter.tsx @@ -12,7 +12,6 @@ import { CreateFilter, LanguageFilter, MediaFilter, - PersistentFilter, PlatformFilters, ToggleRepliesFilter, generateFilter, @@ -49,7 +48,7 @@ const ExplorerFilter = () => { const handleClick = () => { setIsOpen((prev) => { const newValue = !prev; - localStorage.setItem('soapbox:explorer:filter', JSON.stringify(newValue)); + localStorage.setItem('soapbox:explorer:filter:status', JSON.stringify(newValue)); return newValue; }); }; @@ -58,7 +57,7 @@ const ExplorerFilter = () => { () => { const value = formatFilters(filters); - sessionStorage.setItem('reduxFilterState', JSON.stringify(filters)); + localStorage.setItem('soapbox:explorer:filters', JSON.stringify(filters)); dispatch(changeSearch(value)); dispatch(submitSearch(undefined, value)); @@ -67,7 +66,7 @@ const ExplorerFilter = () => { useEffect( () => { - const isOpenStatus = localStorage.getItem('soapbox:explorer:filter'); + const isOpenStatus = localStorage.getItem('soapbox:explorer:filter:status'); if (isOpenStatus !== null) { setIsOpen(JSON.parse(isOpenStatus)); } @@ -116,7 +115,6 @@ const ExplorerFilter = () => { {/* Reset your filters */} - diff --git a/src/features/explorer/components/filters.tsx b/src/features/explorer/components/filters.tsx index ebed21e76..f26b77a44 100644 --- a/src/features/explorer/components/filters.tsx +++ b/src/features/explorer/components/filters.tsx @@ -1,3 +1,4 @@ +import refreshIcon from '@tabler/icons/outline/refresh.svg'; import searchIcon from '@tabler/icons/outline/search.svg'; import xIcon from '@tabler/icons/outline/x.svg'; import clsx from 'clsx'; @@ -27,7 +28,7 @@ const messages = defineMessages({ language: { id: 'column.explorer.filters.language', defaultMessage: 'Language:' }, platforms: { id: 'column.explorer.filters.platforms', defaultMessage: 'Platforms:' }, createYourFilter: { id: 'column.explorer.filters.create_your_filter', defaultMessage: 'Create your filter' }, - filterPersistence: { id: 'column.explorer.filters.filter_persistence', defaultMessage: 'Filter persistence:' }, + resetFilter: { id: 'column.explorer.filters.reset', defaultMessage: 'Reset Filters' }, filterByWords: { id: 'column.explorer.filters.filter_by_words', defaultMessage: 'Filter by this/these words' }, include: { id: 'column.explorer.filters.include', defaultMessage: 'Include' }, exclude: { id: 'column.explorer.filters.exclude', defaultMessage: 'Exclude' }, @@ -164,38 +165,6 @@ const PlatformFilters = () => { }; -const PersistentFilter = () => { - const intl = useIntl(); - const dispatch = useAppDispatch(); - const filters = useAppSelector((state) => state.search_filter); - - - const handleSalveFilter = () => { - localStorage.setItem('reduxFilterState', JSON.stringify(filters)); - }; - - const handleReset = () => { - dispatch(resetFilters()); - localStorage.removeItem('reduxFilterState'); - }; - - - return ( - - - {intl.formatMessage(messages.filterPersistence)} - - - -