mirror of
https://github.com/plebbit/seedit.git
synced 2026-06-12 18:15:57 -04:00
fix perf
This commit is contained in:
@@ -240,24 +240,24 @@ const Profile = () => {
|
||||
const { t } = useTranslation();
|
||||
const account = useAccount();
|
||||
const isMobile = useWindowWidth() < 640;
|
||||
const [showInfobar, setShowInfobar] = useState(false);
|
||||
// Show infobar for first 3 visits if account wasn't imported
|
||||
const [showInfobar, setShowInfobar] = useState(() => {
|
||||
const profileVisits = parseInt(localStorage.getItem('profileVisits') || '0');
|
||||
const importedAccountAddress = localStorage.getItem('importedAccountAddress');
|
||||
const shouldShow = profileVisits < 4 && importedAccountAddress !== account?.author?.address;
|
||||
|
||||
if (shouldShow) {
|
||||
localStorage.setItem('profileVisits', (profileVisits + 1).toString());
|
||||
}
|
||||
|
||||
return shouldShow;
|
||||
});
|
||||
|
||||
const profileTitle = account?.author?.displayName ? `${account?.author?.displayName} (u/${account?.author?.shortAddress})` : `u/${account?.author?.shortAddress}`;
|
||||
useEffect(() => {
|
||||
document.title = profileTitle + ' - Seedit';
|
||||
}, [t, profileTitle]);
|
||||
|
||||
// Show infobar for first 3 visits if account wasn't imported
|
||||
useEffect(() => {
|
||||
const profileVisits = parseInt(localStorage.getItem('profileVisits') || '0');
|
||||
const importedAccountAddress = localStorage.getItem('importedAccountAddress');
|
||||
|
||||
if (profileVisits < 4 && importedAccountAddress !== account?.author?.address) {
|
||||
setShowInfobar(true);
|
||||
localStorage.setItem('profileVisits', (profileVisits + 1).toString());
|
||||
}
|
||||
}, [account?.author?.address]);
|
||||
|
||||
const handleCloseInfobar = useCallback(() => {
|
||||
setShowInfobar(false);
|
||||
localStorage.setItem('profileVisits', '4');
|
||||
|
||||
Reference in New Issue
Block a user