This commit is contained in:
Tom (plebeius.eth)
2024-12-19 14:56:26 +01:00
parent ee1c38d1ee
commit 7730f64a4e

View File

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