Files
tom goriunovandGitHub 1c025b26fb Add possibility to change timestamp format (#3201)
* 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
2026-01-05 13:19:47 +01:00

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);