mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* add global setting to change between local and utc time * add control to change time format on detailed views * tweaks * adapt uptime graphs to work with utc time from settings * fix tests * add maxDiffPixels for SearchResults test * fix test
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
|
|
import config from 'configs/app';
|
|
import { useAppContext } from 'lib/contexts/app';
|
|
import * as cookies from 'lib/cookies';
|
|
import { Switch } from 'toolkit/chakra/switch';
|
|
|
|
const SettingsScamTokens = () => {
|
|
const { cookies: appCookies } = useAppContext();
|
|
|
|
const initialValue = cookies.get(cookies.NAMES.SHOW_SCAM_TOKENS, appCookies);
|
|
|
|
const [ isChecked, setIsChecked ] = React.useState(initialValue !== 'true');
|
|
|
|
const handleChange = React.useCallback(() => {
|
|
setIsChecked(prev => {
|
|
const nextValue = !prev;
|
|
cookies.set(cookies.NAMES.SHOW_SCAM_TOKENS, nextValue ? 'false' : 'true');
|
|
return nextValue;
|
|
});
|
|
window.location.reload();
|
|
}, []);
|
|
|
|
if (!config.UI.views.token.hideScamTokensEnabled) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Switch
|
|
id="scam-tokens"
|
|
checked={ isChecked }
|
|
onChange={ handleChange }
|
|
direction="rtl"
|
|
justifyContent="space-between"
|
|
w="100%"
|
|
minH="34px"
|
|
>
|
|
Hide scam tokens
|
|
</Switch>
|
|
);
|
|
};
|
|
|
|
export default React.memo(SettingsScamTokens);
|