Forum: asking about one's own chart, forecast or comparison

- "Kérdezek róla a fórumon" on the chart, yearly forecast and comparison
  pages: after a window that says what goes out, a share link made for the
  forum (never birth data, names or a title) and a new thread in "Égbolt és
  képletek" with it attached.
- The question shows a card (Sun, Moon, Ascendant with sign, degree and
  house, the summary's title, a link to the shared page) to logged-in
  members only; visitors and search engines see only that there is one.
  The author can take it off, and deleting the question ends the link.
- The shared page (/s/...) now shows comparisons (one wheel, the aspects,
  no names) and yearly forecasts (keys, timeline, transits, the detailed
  text; without the birthday's place); the backend shares forecasts.
- The privacy notice (HU, EN) covers attached charts and muted members.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-26 14:52:00 +00:00
co-authored by Claude Opus 5.5
parent 9ca3f478be
commit 863002c1e7
24 changed files with 871 additions and 32 deletions
@@ -0,0 +1,91 @@
"use client";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { api, errorText } from "@/lib/api";
import { Modal } from "./Modal";
type Kind = "chart" | "synastry" | "forecast";
const WHAT: Record<Kind, { button: string; shown: string; extra?: string }> = {
chart: {
button: "Kérdezek róla a fórumon",
shown: "a képleted rajzát a bolygók fokaival és házaival, és a rövid összefoglalót, ha már van",
},
synastry: {
button: "Kérdezek róla a fórumon",
shown: "a két képlet közös rajzát, a köztük lévő fényszögeket és házakat",
extra: "A másik fél nevét és születési adatait sem mutatjuk, de az ő képlete is látszik.",
},
forecast: {
button: "Kérdezek róla a fórumon",
shown: "az év kulcsait, az idővonalat, a tranzitokat és a részletes előrejelzést, ha már elkészült",
extra: "Az előrejelzés éve a születésnapodon kezdődik, ezért abból a születésnapod kiderül.",
},
};
/**
* "Kérdezek róla a fórumon": a link made for the forum (no birth data, no
* names), then a new thread in "Égbolt és képletek" with it attached.
*/
export function AskOnForum({ kind, targetId }: { kind: Kind; targetId: string }) {
const router = useRouter();
const [open, setOpen] = useState(false);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const what = WHAT[kind];
async function go() {
setBusy(true);
setError(null);
try {
const share = await api<{ slug: string }>("/shares", { body: { kind, target_id: targetId, for_forum: true } });
router.push(`/forum/uj?tema=egbolt-es-kepletek&kepletkartya=${encodeURIComponent(share.slug)}`);
} catch (e) {
setError(errorText(e));
setBusy(false);
}
}
return (
<>
<button type="button" className="btn btn-sm ask-forum" onClick={() => setOpen(true)}>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M4 5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9l-4 3v-3H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" />
<path d="M20 9h1a1 1 0 0 1 1 1v8l-3-2h-6" />
</svg>
{what.button}
</button>
{open && (
<Modal title="Kérdés a fórumon" onClose={() => setOpen(false)}>
<div className="ask-forum-body">
<p>
A kérdésed mellé csatoljuk {what.shown}. A fórum belépett tagjai látják, a látogatók és a keresők nem.
</p>
<p className="hint">
Neved, születési dátumod, időd és helyed nem kerül ki.
{what.extra && ` ${what.extra}`} A fokokból egy jártas asztrológus nagyjából kiszámolhatja a születési
napot és időt. A csatolt képletet bármikor leveheted a kérdésedről, és ha törlöd a kérdést, a link is
megszűnik.
</p>
{error && (
<p className="msg msg-error" role="alert">
{error}
</p>
)}
<div className="ask-forum-actions">
<button type="button" className="btn btn-ghost" onClick={() => setOpen(false)}>
Mégse
</button>
<button type="button" className="btn btn-primary" disabled={busy} onClick={go}>
{busy ? "Egy pillanat…" : "Tovább a kérdéshez"}
</button>
</div>
</div>
</Modal>
)}
</>
);
}
@@ -0,0 +1,79 @@
import Link from "next/link";
import { POINTS, SIGNS, signName } from "@/lib/astro";
import type { ShareCardData } from "@/lib/forum";
const EYEBROW: Record<ShareCardData["kind"], string> = {
chart: "Csatolt képlet",
synastry: "Csatolt összevetés",
forecast: "Csatolt előrejelzés",
};
const POINT_LABEL: Record<string, string> = { sun: "Nap", moon: "Hold", ascendant: "Aszcendens" };
/**
* The chart, forecast or synastry a question came with: the big three with
* degrees and houses, the summary's title, and the shared page. Members only;
* a visitor sees that there is one.
*/
export function ShareCard({ share, onRemove }: { share: ShareCardData; onRemove?: () => void }) {
if (share.locked) {
return (
<div className="fshare fshare-quiet">
<span className="eyebrow">{EYEBROW[share.kind]}</span>
<span className="hint">
A kérdéshez csatolt képlet <Link href="/belepes">belépés</Link> után látható.
</span>
</div>
);
}
if (share.revoked) {
return (
<div className="fshare fshare-quiet">
<span className="eyebrow">{EYEBROW[share.kind]}</span>
<span className="hint">A szerző levette a csatolt képletet.</span>
</div>
);
}
const points = share.points ?? [];
return (
<div className="fshare">
<div className="fshare-head">
<span className="eyebrow">{EYEBROW[share.kind]}</span>
{onRemove && (
<button type="button" className="fp-link" onClick={onRemove} aria-label="Képlet levétele">
×
</button>
)}
</div>
<strong className="fshare-title">{share.title}</strong>
{share.summary && <span className="fshare-summary">„{share.summary}”</span>}
{points.length > 0 && (
<ul className="fshare-points">
{points.map((p) => (
<li key={p.id}>
<span className="sym" aria-hidden="true">
{POINTS[p.id]?.glyph ?? ""}
</span>{" "}
{POINT_LABEL[p.id] ?? p.id}{" "}
<span className="sym" aria-hidden="true">
{SIGNS[p.sign]?.glyph ?? ""}
</span>{" "}
{signName(p.sign)}
{p.degree !== null && ` ${p.degree}°`}
{p.house !== null && <span className="hint"> · {p.house}. ház</span>}
</li>
))}
</ul>
)}
{share.kind !== "synastry" && share.time_known === false && (
<span className="hint">A születési idő ismeretlen, ezért házak és Aszcendens nincsenek.</span>
)}
{share.slug && (
<Link href={`/s/${share.slug}`} className="btn btn-sm fshare-open" target="_blank" rel="noopener">
Megnyitom ›
</Link>
)}
</div>
);
}
@@ -13,6 +13,7 @@ import { PostBody } from "./PostBody";
import type { LiveNotice } from "./ForumNav";
import { ReactionIcon } from "./ReactionIcon";
import { ReportForm } from "./ReportButton";
import { ShareCard } from "./ShareCard";
import { TypingLine, useTypingSender, useTypingWatch } from "./typing";
import { Badge, RankBadge } from "./Badges";
@@ -27,6 +28,8 @@ type Actions = {
remove: (post: ForumPost) => void;
restore: (post: ForumPost) => void;
helped: (post: ForumPost) => void;
/** The author takes the shared chart off their question. */
detachShare: (post: ForumPost) => void;
/** Mute or unmute the post's author. */
mute: (post: ForumPost) => void;
};
@@ -228,6 +231,8 @@ function PostCard({
menuItems.push({ label: post.helped ? "Mégsem segített" : "Ez segített", run: () => actions.helped(post) });
}
if (post.own && writer && !thread.locked) menuItems.push({ label: "Szerkesztés", run: () => setEditing(true) });
if (post.own && post.share && !post.share.revoked)
menuItems.push({ label: "Képlet levétele", run: () => actions.detachShare(post) });
if (post.own) menuItems.push({ label: "Törlés", run: () => actions.remove(post), danger: true });
if (viewer.logged_in && !post.own) menuItems.push({ label: "Jelentés", run: () => setReporting(true) });
if (viewer.member && !post.own && author && !post.system)
@@ -328,7 +333,12 @@ function PostCard({
}}
/>
) : (
post.body !== null && <PostBody text={post.body} mentions={post.mentions} />
post.body !== null && (
<>
<PostBody text={post.body} mentions={post.mentions} />
{post.share && <ShareCard share={post.share} />}
</>
)
)}
</div>
{!editing && (!post.deleted || menuItems.length > 0) && (
@@ -534,6 +544,13 @@ export function ThreadView({ initial }: { initial: ThreadPage }) {
await api(`/forum/posts/${post.id}/restore`, { method: "POST" });
await reload();
}),
detachShare: (post) => {
if (!window.confirm("Leveszed a csatolt képletet? A kártya eltűnik, és a link sem működik többé.")) return;
void run(async () => {
await api(`/forum/posts/${post.id}/share`, { method: "DELETE" });
await reload();
});
},
mute: (post) => {
const nickname = post.author?.nickname;
if (!nickname) return;