Share reward and less robot load on shared links
The first visit of a shared link by someone else earns the sharer one free natal analysis, once per user. The share page reports visits from the visitor's browser; robots, the logged-in sharer and the address the link was made at do not count. The share button is a proper card that says so in small print; /v1/me tells whether the reward is used up. Robots: reading a share writes nothing (view_count counts people only), the frontend keeps shared content for five minutes (cleared when a link is revoked), and robots.txt turns away the known AI crawlers while leaving the link preview robots alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -9,8 +9,23 @@ interface Share {
|
||||
url: string;
|
||||
}
|
||||
|
||||
/** Share link of a chart with its short summary: copy, Facebook, the phone's share menu, revoke. */
|
||||
export function ShareChart({ chartId }: { chartId: string }) {
|
||||
function ShareIcon() {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" fill="none" stroke="currentColor" strokeWidth="1.8">
|
||||
<circle cx="18" cy="5" r="2.6" />
|
||||
<circle cx="6" cy="12" r="2.6" />
|
||||
<circle cx="18" cy="19" r="2.6" />
|
||||
<path d="M8.3 10.8l7.4-4.4M8.3 13.2l7.4 4.4" strokeLinecap="round" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Share link of a chart with its short summary: copy, Facebook, the phone's
|
||||
* share menu, revoke. The first visit by someone else earns one free natal
|
||||
* analysis, once per user (`rewardGranted`: already received).
|
||||
*/
|
||||
export function ShareChart({ chartId, rewardGranted = false }: { chartId: string; rewardGranted?: boolean }) {
|
||||
const [share, setShare] = useState<Share | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [copied, setCopied] = useState(false);
|
||||
@@ -67,8 +82,18 @@ export function ShareChart({ chartId }: { chartId: string }) {
|
||||
if (!share) {
|
||||
return (
|
||||
<div className="share">
|
||||
<button type="button" className="btn btn-sm" onClick={open} disabled={busy}>
|
||||
{busy ? "Link készül…" : "Megosztás"}
|
||||
<button type="button" className="share-button" onClick={open} disabled={busy} aria-busy={busy}>
|
||||
<span className="share-icon">
|
||||
<ShareIcon />
|
||||
</span>
|
||||
<span className="share-button-text">
|
||||
<strong>{busy ? "Link készül…" : "Oszd meg a képleted"}</strong>
|
||||
<small>
|
||||
{rewardGranted
|
||||
? "Küldd el a barátaidnak, vagy tedd ki Facebookra"
|
||||
: "+1 ajándék elemzés jár érte, ha valaki megnézi"}
|
||||
</small>
|
||||
</span>
|
||||
</button>
|
||||
{revoked && <p className="hint">A linket visszavontad.</p>}
|
||||
{error && (
|
||||
@@ -87,6 +112,11 @@ export function ShareChart({ chartId }: { chartId: string }) {
|
||||
A linken a képleted rajza és ez az összefoglaló látszik, név és születési adatok nélkül. Bárki megnyithatja,
|
||||
akinek elküldöd.
|
||||
</p>
|
||||
<p className="share-fine">
|
||||
{rewardGranted
|
||||
? "Az ajándék elemzést már megkaptad. Köszönjük, hogy megosztottad!"
|
||||
: "Ajándék képletelemzés egyszer jár: amikor valaki más először megnyitja a linkedet. A saját megnyitásod nem számít."}
|
||||
</p>
|
||||
<div className="share-link">
|
||||
<input
|
||||
className="inp"
|
||||
|
||||
Reference in New Issue
Block a user