No browser storage for referrals; the birth chart opens at the drawn chart
The share page stores nothing in the browser any more: the shared link that brought a visitor travels in its login link (/belepes?ref=...) to the Google, Apple and password sign-up. The backend counts the same visitor of a link once in half an hour, instead of a sessionStorage flag. The public birth chart scrolls to the drawn chart after a calculation and when coming back to the page. Tabs scrolled to themselves on every re-render of their parent when the address had a tab (#bolygok); they now react only to the tab ids and hash changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -52,11 +52,14 @@ export function GoogleLogin({
|
||||
clientId,
|
||||
target,
|
||||
inviteToken = null,
|
||||
referral = null,
|
||||
}: {
|
||||
clientId: string;
|
||||
target: string;
|
||||
/** From an invitation link: lets in any Google account. */
|
||||
inviteToken?: string | null;
|
||||
/** The shared link the visitor came from (in the login link: `?ref=`), for the sharer's reward. */
|
||||
referral?: string | null;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const slot = useRef<HTMLDivElement>(null);
|
||||
@@ -72,18 +75,7 @@ export function GoogleLogin({
|
||||
setError(null);
|
||||
setUninvited(null);
|
||||
try {
|
||||
let referral: string | null = null;
|
||||
try {
|
||||
referral = localStorage.getItem("sf_ref");
|
||||
} catch {
|
||||
// storage blocked
|
||||
}
|
||||
await api("/auth/google", { body: { id_token: response.credential, invite_token: inviteToken, referral } });
|
||||
try {
|
||||
localStorage.removeItem("sf_ref");
|
||||
} catch {
|
||||
// storage blocked
|
||||
}
|
||||
router.replace(target);
|
||||
router.refresh();
|
||||
} catch (e) {
|
||||
@@ -92,7 +84,7 @@ export function GoogleLogin({
|
||||
setBusy(false);
|
||||
}
|
||||
},
|
||||
[router, target, inviteToken],
|
||||
[router, target, inviteToken, referral],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user