Feedback in the system: ratings, messages, the recommendation question

- Under the summary, the detailed analyses, the forecast and tarot: "How
  tailored to you did it feel?" (1–5 stars); thumbs under answers. Only
  the owner rates, once (changeable); tags, a comment, and a permission
  to read the text; model and prompt version are kept with it
- /visszajelzes: bug, idea, question, other (the page and the browser go
  with it, 10 a day); the state and the operator's reply show there, a
  dot in the account menu marks a new reply. No e-mail, no Telegram
- One NPS question (0–10) in a bar under the header, after two finished
  contents; closing it counts
- Admin → Visszajelzések: numbers by kind, week, tags, model and prompt,
  buyers and others, NPS; ratings with filters, the text only if allowed;
  messages with state, internal note and reply; a count in the admin menu
- Nothing is public. Deleting an account keeps the stars without a name
  or comment; messages go. Privacy policy (hu, en) updated
- The admin menu no longer shows a vertical scrollbar

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-24 07:01:40 +00:00
co-authored by Claude Opus 5.5
parent 3e4653fdb2
commit 62ae4a438e
34 changed files with 3097 additions and 99 deletions
@@ -8,7 +8,11 @@ import type { AdminGift } from "@/lib/types";
const huf = (n: number) => `${n.toLocaleString("hu-HU")} Ft`;
const STORNO: Record<string, string> = { pending: "sztornó folyamatban", done: "sztornózva", failed: "sztornó hiba" };
const STORNO: Record<string, string> = {
pending: "sztornó folyamatban",
done: "sztornózva",
failed: "sztornó hiba",
};
/** The gifts with their payment, invoice and storno, and the refund button. */
export function AdminGifts() {
@@ -20,7 +24,9 @@ export function AdminGifts() {
const load = useCallback(async (search: string) => {
try {
const r = await api<{ gifts: AdminGift[] }>(`/admin/gifts${search ? `?q=${encodeURIComponent(search)}` : ""}`);
const r = await api<{ gifts: AdminGift[] }>(
`/admin/gifts${search ? `?q=${encodeURIComponent(search)}` : ""}`,
);
setGifts(r.gifts);
} catch (e) {
setError(errorText(e));
@@ -33,8 +39,12 @@ export function AdminGifts() {
}, [q, load]);
async function refund(g: AdminGift) {
const late = g.within_withdrawal ? "" : "\n\nFigyelem: a 14 napos elállási idő már letelt.";
const money = g.checkout?.amount_huf ? ` (${huf(g.checkout.amount_huf)})` : "";
const late = g.within_withdrawal
? ""
: "\n\nFigyelem: a 14 napos elállási idő már letelt.";
const money = g.checkout?.amount_huf
? ` (${huf(g.checkout.amount_huf)})`
: "";
if (
!window.confirm(
`Visszatéríted a(z) „${g.package.name}” ajándékot${money}? A ${g.code} kód érvénytelen lesz, a Stripe visszautalja az árát, a számla sztornózódik.${late}`,
@@ -103,46 +113,74 @@ export function AdminGifts() {
</td>
<td>
{g.package.name ?? g.package.id}
{g.checkout?.amount_huf ? <span className="hint">{huf(g.checkout.amount_huf)}</span> : null}
{g.checkout && g.checkout.live === false && <span className="hint">teszt fizetés</span>}
{g.checkout?.amount_huf ? (
<span className="hint">{huf(g.checkout.amount_huf)}</span>
) : null}
{g.checkout && g.checkout.live === false && (
<span className="hint">teszt fizetés</span>
)}
</td>
<td>
{g.buyer_email ?? <span className="muted">törölt fiók</span>}
{g.buyer_email ?? (
<span className="muted">törölt fiók</span>
)}
<span className="hint">
→ {g.recipient_name ?? "?"}
{g.recipient_email ? ` (${g.recipient_email})` : " (maga adja át)"}
{g.recipient_email
? ` (${g.recipient_email})`
: " (maga adja át)"}
</span>
</td>
<td className="num">{formatDate(g.paid_at, true)}</td>
<td>
{g.status === "redeemed" ? (
<>
beváltva {g.redeemed_at ? formatDate(g.redeemed_at, true) : ""}
{g.redeemed_by && <span className="hint">{g.redeemed_by}</span>}
beváltva{" "}
{g.redeemed_at ? formatDate(g.redeemed_at, true) : ""}
{g.redeemed_by && (
<span className="hint">{g.redeemed_by}</span>
)}
</>
) : g.status === "refunded" ? (
<>
{g.refund_pending ? (
<span className="msg-error">visszatérítés félbemaradt</span>
<span className="msg-error">
visszatérítés félbemaradt
</span>
) : (
"visszatérítve"
)}{" "}
{g.refunded_at ? formatDate(g.refunded_at, true) : ""}
{g.refund_pending && g.refund_error && <span className="hint">{g.refund_error}</span>}
{g.refund_pending && g.refund_error && (
<span className="hint">{g.refund_error}</span>
)}
</>
) : (
<>
<span className="promo-open">beváltatlan</span>
<span className="hint">{g.within_withdrawal ? "14 napon belül" : "14 nap letelt"}</span>
<span className="hint">
{g.within_withdrawal
? "14 napon belül"
: "14 nap letelt"}
</span>
</>
)}
</td>
<td>
{g.invoice ? (
<>
{g.invoice.number ?? (g.invoice.status === "pending" ? "kiállítás alatt" : g.invoice.status)}
{g.invoice.number ??
(g.invoice.status === "pending"
? "kiállítás alatt"
: g.invoice.status)}
{g.storno && (
<span className={g.storno.status === "failed" ? "hint msg-error" : "hint"}>
<span
className={
g.storno.status === "failed"
? "hint msg-error"
: "hint"
}
>
{STORNO[g.storno.status] ?? g.storno.status}
{g.storno.number ? `: ${g.storno.number}` : ""}
{g.storno.error ? ` – ${g.storno.error}` : ""}
@@ -161,7 +199,11 @@ export function AdminGifts() {
onClick={() => refund(g)}
disabled={busy !== null}
>
{busy === g.id ? "Folyamatban…" : g.status === "refunded" ? "Újrapróbálás" : "Visszatérítés"}
{busy === g.id
? "Folyamatban…"
: g.status === "refunded"
? "Újrapróbálás"
: "Visszatérítés"}
</button>
)}
</td>