-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Majorfi
committed
Oct 17, 2023
1 parent
bce898d
commit cb4561c
Showing
11 changed files
with
340 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,33 +4,34 @@ import {useSessionStorage} from '@yearn-finance/web-lib/hooks/useSessionStorage' | |
|
||
import type {ReactElement} from 'react'; | ||
|
||
export const ALL_CATEGORIES = | ||
'["Holdings","Crypto Vaults","Stables Vaults","Curve Vaults","Balancer Vaults","Boosted Vaults","Velodrome Vaults","Aerodrome Vaults"]'; | ||
export const ALL_CHAINS = '[1,10,250,8453,42161]'; | ||
export const ALL_CATEGORIES = { | ||
holdings: 'Holdings', | ||
crypto: 'Crypto Vaults', | ||
stables: 'Stables Vaults', | ||
curve: 'Curve Vaults', | ||
balancer: 'Balancer Vaults', | ||
boosted: 'Boosted Vaults', | ||
velodrome: 'Velodrome Vaults', | ||
aerodrome: 'Aerodrome Vaults' | ||
}; | ||
export const ALL_CATEGORIES_KEYS = Object.keys(ALL_CATEGORIES); | ||
export const ALL_CHAINS = [1, 10, 250, 8453, 42161]; | ||
|
||
export type TAppSettingsContext = { | ||
category: string; | ||
selectedChains: string; | ||
searchValue: string; | ||
shouldHideDust: boolean; | ||
shouldHideLowTVLVaults: boolean; | ||
onSwitchHideDust: VoidFunction; | ||
onSwitchHideLowTVLVaults: VoidFunction; | ||
set_category: (v: string) => void; | ||
set_searchValue: (v: string) => void; | ||
set_selectedChains: (v: string) => void; | ||
}; | ||
const defaultProps: TAppSettingsContext = { | ||
category: '', | ||
selectedChains: '[1]', | ||
searchValue: '', | ||
shouldHideDust: false, | ||
shouldHideLowTVLVaults: false, | ||
onSwitchHideDust: (): void => undefined, | ||
onSwitchHideLowTVLVaults: (): void => undefined, | ||
set_category: (): void => undefined, | ||
set_searchValue: (): void => undefined, | ||
set_selectedChains: (): void => undefined | ||
set_searchValue: (): void => undefined | ||
}; | ||
|
||
const AppSettingsContext = createContext<TAppSettingsContext>(defaultProps); | ||
|
@@ -43,8 +44,6 @@ export const AppSettingsContextApp = memo(function AppSettingsContextApp({ | |
* @deprecated Use use-query-params instead | ||
*/ | ||
const [searchValue, set_searchValue] = useSessionStorage('yearn.fi/[email protected]', ''); | ||
const [category, set_category] = useSessionStorage('yearn.fi/[email protected]', ALL_CATEGORIES); | ||
const [selectedChains, set_selectedChains] = useSessionStorage('yearn.fi/[email protected]', ALL_CHAINS); | ||
const [shouldHideDust, set_shouldHideDust] = useLocalStorage('yearn.fi/[email protected]', false); | ||
const [shouldHideLowTVLVaults, set_shouldHideLowTVLVaults] = useLocalStorage('yearn.fi/[email protected]', false); | ||
|
||
|
@@ -57,22 +56,14 @@ export const AppSettingsContextApp = memo(function AppSettingsContextApp({ | |
onSwitchHideDust: (): void => set_shouldHideDust(!shouldHideDust), | ||
shouldHideLowTVLVaults, | ||
onSwitchHideLowTVLVaults: (): void => set_shouldHideLowTVLVaults(!shouldHideLowTVLVaults), | ||
category, | ||
selectedChains, | ||
searchValue, | ||
set_category, | ||
set_searchValue, | ||
set_selectedChains | ||
set_searchValue | ||
}), | ||
[ | ||
shouldHideDust, | ||
shouldHideLowTVLVaults, | ||
category, | ||
selectedChains, | ||
searchValue, | ||
set_category, | ||
set_searchValue, | ||
set_selectedChains, | ||
set_shouldHideDust, | ||
set_shouldHideLowTVLVaults | ||
] | ||
|
Oops, something went wrong.