Share rewards: a question for a visit, an analysis for a new user
A click proves little, so the first visit of a shared link now earns a question (once per user) instead of a natal analysis. A natal analysis is earned by bringing a new user: the share page remembers the link, the Google sign-up sends it, and when that user makes their own chart the sharer gets one, at most three (referrals table, referral_reward). This is off until sign-up opens (REFERRAL_REWARDS, default false). The share button and its small print follow; /v1/me tells what was earned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -72,7 +72,18 @@ export function GoogleLogin({
|
||||
setError(null);
|
||||
setUninvited(null);
|
||||
try {
|
||||
await api("/auth/google", { body: { id_token: response.credential, invite_token: inviteToken } });
|
||||
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) {
|
||||
|
||||
@@ -78,6 +78,8 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri
|
||||
detailedDone={detailed?.status === "done"}
|
||||
isAdmin={me.user.roles.includes("admin")}
|
||||
shareRewardGranted={me.share_reward_granted}
|
||||
referralOpen={config?.referral_rewards ?? false}
|
||||
referralsLeft={me.referral_rewards.limit - me.referral_rewards.earned}
|
||||
/>
|
||||
<BigThree chart={chart} />
|
||||
{(elements || modalities || phase) && (
|
||||
|
||||
Reference in New Issue
Block a user