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:
@@ -12,8 +12,10 @@ import type { Package, PayMethod } from "@/lib/types";
|
||||
const MAX_MESSAGE = 300;
|
||||
const MAX_NAME = 60;
|
||||
|
||||
const looksLikeEmail = (s: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim());
|
||||
const same = (a: string, b: string) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
||||
const looksLikeEmail = (s: string) =>
|
||||
/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim());
|
||||
const same = (a: string, b: string) =>
|
||||
a.trim().toLowerCase() === b.trim().toLowerCase();
|
||||
|
||||
/**
|
||||
* The gift order: which package, whom it is for and from whom, how it gets
|
||||
@@ -36,7 +38,10 @@ export function GiftForm({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const id = useId();
|
||||
const start = packages.find((p) => p.id === initial) ?? packages.find((p) => p.id === "couple") ?? packages[0];
|
||||
const start =
|
||||
packages.find((p) => p.id === initial) ??
|
||||
packages.find((p) => p.id === "couple") ??
|
||||
packages[0];
|
||||
const [pkg, setPkg] = useState(start?.id ?? "");
|
||||
const [name, setName] = useState("");
|
||||
const [byEmail, setByEmail] = useState(true);
|
||||
@@ -66,16 +71,19 @@ export function GiftForm({
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
const r = await api<{ id: string; url: string | null }>("/gifts/checkout", {
|
||||
body: {
|
||||
package: chosen.id,
|
||||
recipient_name: name.trim(),
|
||||
recipient_email: byEmail ? email.trim() : null,
|
||||
recipient_email_confirm: byEmail ? confirm.trim() : null,
|
||||
from_name: from.trim() || null,
|
||||
message: message.trim() || null,
|
||||
const r = await api<{ id: string; url: string | null }>(
|
||||
"/gifts/checkout",
|
||||
{
|
||||
body: {
|
||||
package: chosen.id,
|
||||
recipient_name: name.trim(),
|
||||
recipient_email: byEmail ? email.trim() : null,
|
||||
recipient_email_confirm: byEmail ? confirm.trim() : null,
|
||||
from_name: from.trim() || null,
|
||||
message: message.trim() || null,
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
if (r.url) {
|
||||
window.location.assign(r.url);
|
||||
return;
|
||||
@@ -93,8 +101,17 @@ export function GiftForm({
|
||||
<legend className="label">Melyik csomagot adod?</legend>
|
||||
<div className="gift-packages">
|
||||
{packages.map((p) => (
|
||||
<label key={p.id} className={p.id === pkg ? "gift-option is-chosen" : "gift-option"}>
|
||||
<input type="radio" name={`${id}-pkg`} value={p.id} checked={p.id === pkg} onChange={() => setPkg(p.id)} />
|
||||
<label
|
||||
key={p.id}
|
||||
className={p.id === pkg ? "gift-option is-chosen" : "gift-option"}
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name={`${id}-pkg`}
|
||||
value={p.id}
|
||||
checked={p.id === pkg}
|
||||
onChange={() => setPkg(p.id)}
|
||||
/>
|
||||
<span className="gift-option-head">
|
||||
<strong>{p.name}</strong>
|
||||
<span className="num">{huf(p.price_huf)}</span>
|
||||
@@ -140,16 +157,28 @@ export function GiftForm({
|
||||
<legend className="label">Hogyan kapja meg?</legend>
|
||||
<div className="gift-ways">
|
||||
<label className={byEmail ? "gift-option is-chosen" : "gift-option"}>
|
||||
<input type="radio" name={`${id}-way`} checked={byEmail} onChange={() => setByEmail(true)} />
|
||||
<input
|
||||
type="radio"
|
||||
name={`${id}-way`}
|
||||
checked={byEmail}
|
||||
onChange={() => setByEmail(true)}
|
||||
/>
|
||||
<strong>E-mailben küldjük el neki</strong>
|
||||
<span className="hint">Fizetés után azonnal megkapja a kódot, mellé az utalványt PDF-ben.</span>
|
||||
<span className="hint">
|
||||
Fizetés után azonnal megkapja a kódot, mellé az utalványt PDF-ben.
|
||||
</span>
|
||||
</label>
|
||||
<label className={!byEmail ? "gift-option is-chosen" : "gift-option"}>
|
||||
<input type="radio" name={`${id}-way`} checked={!byEmail} onChange={() => setByEmail(false)} />
|
||||
<input
|
||||
type="radio"
|
||||
name={`${id}-way`}
|
||||
checked={!byEmail}
|
||||
onChange={() => setByEmail(false)}
|
||||
/>
|
||||
<strong>Én adom át</strong>
|
||||
<span className="hint">
|
||||
Letöltöd az utalványt PDF-ben: kinyomtathatod, vagy elküldheted te magad. Később innen is kérheted, hogy
|
||||
e-mailben küldjük el.
|
||||
Letöltöd az utalványt PDF-ben: kinyomtathatod, vagy elküldheted te
|
||||
magad. Később innen is kérheted, hogy e-mailben küldjük el.
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -168,7 +197,9 @@ export function GiftForm({
|
||||
/>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label htmlFor={`${id}-confirm`}>Még egyszer, ellenőrzésképp</label>
|
||||
<label htmlFor={`${id}-confirm`}>
|
||||
Még egyszer, ellenőrzésképp
|
||||
</label>
|
||||
<input
|
||||
id={`${id}-confirm`}
|
||||
className="inp"
|
||||
@@ -180,8 +211,14 @@ export function GiftForm({
|
||||
aria-describedby={`${id}-confirm-msg`}
|
||||
required
|
||||
/>
|
||||
<span id={`${id}-confirm-msg`} className={mismatch ? "msg msg-error" : "hint"} aria-live="polite">
|
||||
{mismatch ? "A két cím nem egyezik." : "Hogy biztosan jó címre menjen."}
|
||||
<span
|
||||
id={`${id}-confirm-msg`}
|
||||
className={mismatch ? "msg msg-error" : "hint"}
|
||||
aria-live="polite"
|
||||
>
|
||||
{mismatch
|
||||
? "A két cím nem egyezik."
|
||||
: "Hogy biztosan jó címre menjen."}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -200,7 +237,8 @@ export function GiftForm({
|
||||
aria-describedby={`${id}-message-hint`}
|
||||
/>
|
||||
<span id={`${id}-message-hint`} className="hint">
|
||||
Rajta lesz az utalványon és a levélben. Link nem lehet benne. {message.length}/{MAX_MESSAGE}
|
||||
Rajta lesz az utalványon és a levélben. Link nem lehet benne.{" "}
|
||||
{message.length}/{MAX_MESSAGE}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -213,14 +251,25 @@ export function GiftForm({
|
||||
{chosen && (
|
||||
<p className="gift-total">
|
||||
<span className="muted">
|
||||
„{chosen.name}” csomag ajándékba{name.trim() ? `, ${name.trim()} részére` : ""}
|
||||
„{chosen.name}” csomag ajándékba
|
||||
{name.trim() ? `, ${name.trim()} részére` : ""}
|
||||
</span>
|
||||
<strong className="num">{huf(chosen.price_huf)}</strong>
|
||||
</p>
|
||||
)}
|
||||
{canPay ? (
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || !chosen || !emailOk || !name.trim()}>
|
||||
{busy ? (stripe ? "Átirányítás…" : "Fizetés…") : stripe ? "Tovább a fizetéshez" : "Megveszem ajándékba"}
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-primary"
|
||||
disabled={busy || !chosen || !emailOk || !name.trim()}
|
||||
>
|
||||
{busy
|
||||
? stripe
|
||||
? "Átirányítás…"
|
||||
: "Fizetés…"
|
||||
: stripe
|
||||
? "Tovább a fizetéshez"
|
||||
: "Megveszem ajándékba"}
|
||||
</button>
|
||||
) : (
|
||||
<button type="button" className="btn" disabled>
|
||||
@@ -228,22 +277,29 @@ export function GiftForm({
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{canPay === "mock" && <p className="hint">Tesztüzem: a fizetés még nincs bekötve, a gomb nem terhel semmit.</p>}
|
||||
{canPay === "mock" && (
|
||||
<p className="hint">
|
||||
Tesztüzem: a fizetés még nincs bekötve, a gomb nem terhel semmit.
|
||||
</p>
|
||||
)}
|
||||
{stripe && (
|
||||
<p className="hint">
|
||||
<span aria-hidden="true">🔒</span> A fizetés a Stripe biztonságos oldalán történik. A számlát te kapod.
|
||||
<span aria-hidden="true">🔒</span> A fizetés a Stripe biztonságos
|
||||
oldalán történik. A számlát te kapod.
|
||||
{termsConsent && (
|
||||
<>
|
||||
{" "}
|
||||
A vásárlástól számított 14 napon belül, amíg a kódot nem váltották be, elállhatsz, és visszatérítjük az
|
||||
árát. A kód beváltásával az elállási jog megszűnik. <Link href="/aszf">ÁSZF</Link>
|
||||
A vásárlástól számított 14 napon belül, amíg a kódot nem váltották
|
||||
be, elállhatsz, és visszatérítjük az árát. A kód beváltásával az
|
||||
elállási jog megszűnik. <Link href="/aszf">ÁSZF</Link>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
{canPay === "stripe_test" && (
|
||||
<p className="hint">
|
||||
Stripe tesztmód (csak adminoknak látszik): kártyaszám 4242 4242 4242 4242, bármilyen jövőbeli lejárat és CVC.
|
||||
Stripe tesztmód (csak adminoknak látszik): kártyaszám 4242 4242 4242
|
||||
4242, bármilyen jövőbeli lejárat és CVC.
|
||||
</p>
|
||||
)}
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user