Forum photos, a one-row bottom menu, and the site's own question windows
CI / test (push) Successful in 3m10s
CI / build (push) Skipped
CI / deploy (push) Skipped

Photos in posts and replies: a "Fotó" button in the new thread form and the
reply boxes. The browser makes the picture small before uploading it (1600
pixels at most, WebP, JPEG where WebP cannot be made); the forum checks it
is a still picture, strips its metadata and makes a square preview
(forum-photos/ in the storage). Five a member a day, five a post; one taken
off before sending is deleted and does not count. Under the post a row of
square previews; a click opens a viewer paged with arrows, swipes and keys.
Seen by whoever may read the thread (long public cache only for public
topics). Unsent photos go after a day, those of removed posts after a year;
removed with the account and listed in the data export. Terms and privacy
notice updated.

The forum's bottom menu keeps its five items in one row (the fifth wrapped
to a second row). On iPhones, when the keyboard goes away without the usual
tap (a photo picker opening over it), the page is put back in place instead
of the menu floating mid-screen over an empty strip.

The browser's own confirm() and prompt() windows (23 places: deleting,
revoking, blocking, muting, moderators' reasons, admin actions) are replaced
by a question window in the site's look, following the forum's light or
dark theme, with named buttons and a text box for reasons.

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-27 00:34:59 +00:00
co-authored by Claude Opus 5.5
parent 758c3ce7ea
commit de629a068d
38 changed files with 1536 additions and 92 deletions
+11 -4
View File
@@ -7,6 +7,7 @@ import { huf, usePackages } from "@/components/PackageCards";
import { api, errorText } from "@/lib/api";
import { ROLE_LABELS, formatDate } from "@/lib/astro";
import type { AdminUser, Package, Role } from "@/lib/types";
import { confirmDialog } from "@/components/Dialogs";
const PAGE_SIZE = 25;
const EDITABLE_ROLES: Role[] = ["user", "creator", "moderator", "admin"];
@@ -248,10 +249,16 @@ function UserDialog({
}) {
// What was chosen or typed but not sent yet (a package, a number of units).
const unsent = useRef<{ pkg: string | null; credit: string | null }>({ pkg: null, credit: null });
const canClose = () => {
const canClose = async () => {
const { pkg, credit } = unsent.current;
const what = [pkg && `a(z) ${pkg} csomag`, credit && `${credit} jóváírás`].filter(Boolean).join(" és ");
return !what || window.confirm(`Még nem küldted el: ${what}. Bezárod nélküle?`);
if (!what) return true;
return confirmDialog({
title: "Bezárod küldés nélkül?",
text: `Még nem küldted el: ${what}.`,
confirm: "Bezárás",
cancel: "Vissza",
});
};
return (
<Modal
@@ -285,8 +292,8 @@ function UserDialog({
<button
type="button"
className="btn"
onClick={() => {
if (canClose()) onClose();
onClick={async () => {
if (await canClose()) onClose();
}}
>
Bezárás
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useState } from "react";
import { api, errorText } from "@/lib/api";
import { formatDate } from "@/lib/astro";
import type { AdminGift } from "@/lib/types";
import { confirmDialog } from "@/components/Dialogs";
const huf = (n: number) => `${n.toLocaleString("hu-HU")} Ft`;
@@ -51,18 +52,23 @@ 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)})`
: "";
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}`,
)
)
return;
const money = g.checkout?.amount_huf ? ` (${huf(g.checkout.amount_huf)})` : "";
const ok = await confirmDialog({
title: `Visszatéríted a(z) „${g.package.name}” ajándékot${money}?`,
text: (
<>
<p>A {g.code} kód érvénytelen lesz, a Stripe visszautalja az árát, a számla sztornózódik.</p>
{!g.within_withdrawal && (
<p>
<strong>Figyelem:</strong> a 14 napos elállási idő már letelt.
</p>
)}
</>
),
confirm: "Visszatérítés",
danger: true,
});
if (!ok) return;
setBusy(g.id);
setError(null);
setDone(null);
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useState } from "react";
import { api, errorText } from "@/lib/api";
import { formatDate } from "@/lib/astro";
import type { GenerationError } from "@/lib/types";
import { confirmDialog } from "@/components/Dialogs";
const PAGE = 50;
@@ -83,7 +84,13 @@ export function ErrorLog() {
async function removeMatching() {
const what = source || outcome ? `a szűrésnek megfelelő ${total} bejegyzést` : `mind a ${total} bejegyzést`;
if (!window.confirm(`Biztosan törlöd ${what}? Nem vonható vissza.`)) return;
const ok = await confirmDialog({
title: `Törlöd ${what}?`,
text: "Nem vonható vissza.",
confirm: "Törlés",
danger: true,
});
if (!ok) return;
setBusy(true);
setError(null);
try {
@@ -13,6 +13,7 @@ import { objectPosition, photoSrc } from "@/lib/celebrityPhoto";
import type { AdminCelebrity, Analysis } from "@/lib/types";
import { ANALYSIS_STATUS, SubtitleField } from "../AdminCelebrities";
import { confirmDialog } from "@/components/Dialogs";
const POLL_MS = 10_000;
@@ -65,7 +66,14 @@ export function CelebrityEditor({ id, selfId, isAdmin }: { id: string; selfId: s
}
async function remove() {
if (!c || !window.confirm(`Biztosan törlöd: ${c.name}? A képlet, a portré és a fotó is törlődik.`)) return;
if (!c) return;
const ok = await confirmDialog({
title: `Törlöd: ${c.name}?`,
text: "A képlet, a portré és a fotó is törlődik.",
confirm: "Törlés",
danger: true,
});
if (!ok) return;
try {
await api(url, { method: "DELETE" });
router.push("/admin/hires-emberek");
@@ -190,7 +198,7 @@ function PhotoSection({
}
async function removePhoto() {
if (!window.confirm("Törlöd a fotót?")) return;
if (!(await confirmDialog({ title: "Törlöd a fotót?", confirm: "Törlés", danger: true }))) return;
try {
onChange(await api<AdminCelebrity>(`${url}/photo`, { method: "DELETE" }));
} catch (e) {
@@ -6,6 +6,7 @@ import { usePackages } from "@/components/PackageCards";
import { api, errorText } from "@/lib/api";
import { formatDate } from "@/lib/astro";
import type { AdminInvitation, InvitationResult } from "@/lib/types";
import { confirmDialog, copyDialog } from "@/components/Dialogs";
const MAX_MESSAGE = 300;
@@ -47,7 +48,11 @@ function CopyLink({ url }: { url: string }) {
await navigator.clipboard.writeText(url);
setCopied(true);
} catch {
window.prompt("A meghívólink:", url);
await copyDialog({
title: "A meghívólink",
text: "A böngésző nem engedte a vágólapra másolni: jelöld ki, és másold ki innen.",
value: url,
});
}
}}
>
@@ -325,7 +330,16 @@ function InvitationRow({ invitation: i, onChange }: { invitation: AdminInvitatio
const [url, setUrl] = useState<string | null>(null);
async function act(kind: "resend" | "revoke") {
if (kind === "revoke" && !window.confirm(`Visszavonod a meghívót (${i.email})?`)) return;
if (
kind === "revoke" &&
!(await confirmDialog({
title: "Visszavonod a meghívót?",
text: `${i.email}: a link ezután nem fog működni.`,
confirm: "Visszavonás",
danger: true,
}))
)
return;
setBusy(true);
setNote(null);
try {
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useState } from "react";
import { api, errorText } from "@/lib/api";
import { formatDate } from "@/lib/astro";
import type { Package, PromoCode } from "@/lib/types";
import { confirmDialog } from "@/components/Dialogs";
const PAGE = 100;
@@ -168,7 +169,13 @@ function CodeList({ packages }: { packages: Package[] }) {
}, [q]);
async function revoke(c: PromoCode) {
if (!window.confirm(`Visszavonod a(z) ${c.code} kódot? Utána nem váltható be.`)) return;
const ok = await confirmDialog({
title: `Visszavonod a(z) ${c.code} kódot?`,
text: "Utána nem váltható be.",
confirm: "Visszavonás",
danger: true,
});
if (!ok) return;
try {
await api(`/admin/promo-codes/${c.id}/revoke`, { body: {} });
load(0);