diff --git a/services/frontend/src/app/forum/forum.css b/services/frontend/src/app/forum/forum.css index 412bbb5..7d93ff7 100644 --- a/services/frontend/src/app/forum/forum.css +++ b/services/frontend/src/app/forum/forum.css @@ -734,3 +734,55 @@ a.fh-online-item:hover { color: var(--gold); } @media (min-width: 640px) { .fshare-drawn { flex-direction: row; align-items: center; gap: 18px; } } + +/* --- new thread: topic labels, a wish switch, one writing surface --- */ +.fnew .fnew-set legend { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 10px; } +.fnew-chips { display: flex; flex-wrap: wrap; gap: 8px; } +.fnew-chip { + display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px 0 12px; + border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); color: var(--ink-2); + font-size: 15px; cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s; +} +.fnew-chip:hover { border-color: var(--f-border-hover); color: var(--ink); } +.fnew-chip .topic-icon { + width: 18px; height: 18px; flex: none; fill: none; stroke: var(--gold); stroke-width: 1.8; + stroke-linecap: round; stroke-linejoin: round; +} +.fnew-chip:has(input:checked) { border-color: var(--gold); background: var(--f-tint-strong); color: var(--ink); font-weight: 600; } +.fnew-chip:has(input:focus-visible), .fnew-switch-opt:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; } +.fnew-note { margin: 8px 2px 0; font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; } +.fnew-audience { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); } +.fnew-audience svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; } + +.fnew-switch { display: grid; gap: 4px; padding: 4px; border-radius: 14px; background: var(--f-tint); border: 1px solid var(--line); } +.fnew-switch-opt { + display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 8px; + border-radius: 10px; color: var(--ink-2); font-size: 15px; text-align: center; cursor: pointer; + transition: background 0.15s, color 0.15s, box-shadow 0.15s; +} +.fnew-switch-opt svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; } +.fnew-switch-opt:hover { color: var(--ink); } +.fnew-switch-opt:has(input:checked) { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(27, 34, 54, 0.1); } +.fnew-switch-opt:has(input:checked) svg { color: var(--gold); } +@media (max-width: 479px) { + .fnew-switch-opt { flex-direction: column; gap: 3px; min-height: 58px; font-size: 13px; } +} + +.fnew-paper { + display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel); + overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; +} +.fnew-paper:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--f-tint-strong); } +.fnew-title { + border: 0; border-bottom: 1px solid var(--line); background: none; padding: 16px 18px 12px; color: var(--ink); + font: 600 21px/1.3 var(--font-display); outline: none; +} +.fnew-body { + border: 0; background: none; padding: 14px 18px; min-height: 200px; resize: vertical; color: var(--ink); + font: 400 16px/1.6 var(--font-body); outline: none; +} +.fnew-title::placeholder, .fnew-body::placeholder { color: var(--muted); } +.fnew-foot { + display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; + padding: 10px 12px 10px 18px; border-top: 1px solid var(--line); background: var(--f-tint); +} diff --git a/services/frontend/src/app/forum/page.tsx b/services/frontend/src/app/forum/page.tsx index eb58a0f..b10593c 100644 --- a/services/frontend/src/app/forum/page.tsx +++ b/services/frontend/src/app/forum/page.tsx @@ -4,6 +4,7 @@ import { notFound } from "next/navigation"; import { Avatar } from "@/components/forum/Avatar"; import { RankBadge } from "@/components/forum/Badges"; import { JoinTopic } from "@/components/forum/JoinTopic"; +import { TopicIcon } from "@/components/forum/TopicIcon"; import { ThreadList, WaitingCard } from "@/components/forum/ThreadList"; import { MoonPhaseIcon } from "@/components/MoonChip"; import { MOON_PHASES, SIGNS } from "@/lib/astro"; @@ -15,40 +16,6 @@ import type { SkyNow } from "@/lib/types"; export const metadata = { title: { absolute: "Fórum · Sorsfonalak" } }; -function TopicIcon({ slug }: { slug: string }) { - return ( - - {slug === "ami-a-szivemen-van" && ( - - )} - {slug === "belso-utak" && ( - <> - - - - - > - )} - {slug === "egbolt-es-kepletek" && ( - <> - - - > - )} - {slug === "torzsasztal" && ( - <> - - - - > - )} - {!["ami-a-szivemen-van", "belso-utak", "egbolt-es-kepletek", "torzsasztal"].includes(slug) && ( - - )} - - ); -} - /** "Mai égbolt": the Moon today, the same for everyone; never empty. */ function SkyCard({ sky }: { sky: SkyNow }) { const moon = sky.moon; diff --git a/services/frontend/src/app/forum/uj/NewThreadForm.tsx b/services/frontend/src/app/forum/uj/NewThreadForm.tsx index 087841a..32c76cd 100644 --- a/services/frontend/src/app/forum/uj/NewThreadForm.tsx +++ b/services/frontend/src/app/forum/uj/NewThreadForm.tsx @@ -4,13 +4,57 @@ import Link from "next/link"; import { useRouter } from "next/navigation"; import { useState } from "react"; +import { ShareCard } from "@/components/forum/ShareCard"; +import { TopicIcon } from "@/components/forum/TopicIcon"; import { api, errorText } from "@/lib/api"; import { convertEmoticons, withEmoji } from "@/lib/emoticons"; -import { ShareCard } from "@/components/forum/ShareCard"; import { type ForumTopic, type ShareCardData, threadHref } from "@/lib/forum"; type Intent = "listen" | "advice" | ""; +const INTENT_CHOICES: { value: Intent; label: string; hint: string; icon: React.ReactNode }[] = [ + { + value: "listen", + label: "Meghallgatásra", + hint: "Nem kérek tanácsot, csak jólesne, ha valaki meghallgatna.", + icon: , + }, + { + value: "advice", + label: "Véleményekre", + hint: "Kíváncsi vagyok, ti mit gondoltok, mit tennétek a helyemben.", + icon: ( + <> + + + > + ), + }, + { + value: "", + label: "Beszélgetésre", + hint: "Egy téma, egy gondolat, egy élmény, amiről jó lenne beszélgetni.", + icon: ( + <> + + + > + ), + }, +]; + +/** Who sees a topic, in a few words (members-only and restricted topics). */ +function audience(topic: ForumTopic | undefined): string | null { + if (topic?.visibility === "members") return "csak belépett tagok látják"; + if (topic?.visibility === "restricted") return "csak a zárt kör tagjai látják"; + return null; +} + +/** + * Starting a thread: the topic as a row of small labels, what the writer + * wishes for as a switch (each with its one-line meaning below), then one + * writing surface for the title and the text, with the send button at its foot. + */ export function NewThreadForm({ topics, initialTopic, @@ -24,17 +68,22 @@ export function NewThreadForm({ const router = useRouter(); const [share, setShare] = useState(initialShare ?? null); const [topic, setTopic] = useState(initialTopic); - const listening = topics.find((t) => t.slug === topic)?.listening ?? false; + const chosen = topics.find((t) => t.slug === topic); + const listening = chosen?.listening ?? false; const [intent, setIntent] = useState(listening ? "listen" : ""); const [title, setTitle] = useState(""); const [body, setBody] = useState(""); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); + // A listening topic: hearing or opinions, no small talk. + const choices = INTENT_CHOICES.filter((c) => !listening || c.value !== ""); + const intentHint = choices.find((c) => c.value === intent)?.hint; + const seenBy = audience(chosen); function pickTopic(slug: string) { setTopic(slug); const t = topics.find((x) => x.slug === slug); - if (t?.listening) setIntent("listen"); + if (t?.listening && intent === "") setIntent("listen"); } async function submit(e: React.FormEvent) { @@ -70,74 +119,82 @@ export function NewThreadForm({ )} + - Téma - + Melyik témába? + {topics.map((t) => ( - + pickTopic(t.slug)} + className="sr-only" /> - - {t.name} - {t.description} - + + {t.name} ))} + {chosen && ( + + {chosen.description} + {seenBy && ( + + + + + + {seenBy} + + )} + + )} - Mit szeretnél? - - - setIntent("listen")} /> - - Csak meghallgatást kérek - Nem kérek tanácsot, jólesne, ha valaki meghallgatna. - - - - setIntent("advice")} /> - - Tanácsot, véleményt kérek - Kíváncsi vagyok, ti mit gondoltok, mit tennétek. - - - {!listening && ( - - setIntent("")} /> - - Csak beszélgetnék - Egy téma, egy gondolat, egy élmény. - + Mire vágysz? + + {choices.map((c) => ( + + setIntent(c.value)} + className="sr-only" + /> + + {c.icon} + + {c.label} - )} + ))} + {intentHint && {intentHint}} - - Cím + + + Cím + withEmoji(e, setTitle)} maxLength={120} required - placeholder="Miről szeretnél beszélgetni?" + placeholder="Adj címet a szálnak…" /> - - - - Az első hozzászólás + + Az első hozzászólás + withEmoji(e, setBody)} @@ -145,21 +202,21 @@ export function NewThreadForm({ required placeholder={intent === "listen" ? "Írd le, ami benned van…" : "Írd le a gondolataidat…"} /> + + + Kérjük, tartsd be a házirendet. + + + {busy ? "Küldés…" : "Szál indítása"} + + - - Írás előtt érdemes elolvasni a fórum házirendjét: tisztelettel, kéretlen tanács - és hirdetés nélkül. - - {error && ( {error} )} - - {busy ? "Küldés…" : "Szál indítása"} - ); } diff --git a/services/frontend/src/components/forum/TopicIcon.tsx b/services/frontend/src/components/forum/TopicIcon.tsx new file mode 100644 index 0000000..011fe77 --- /dev/null +++ b/services/frontend/src/components/forum/TopicIcon.tsx @@ -0,0 +1,34 @@ +/** A topic's line icon (a circle for topics without one of their own). */ +export function TopicIcon({ slug }: { slug: string }) { + return ( + + {slug === "ami-a-szivemen-van" && ( + + )} + {slug === "belso-utak" && ( + <> + + + + + > + )} + {slug === "egbolt-es-kepletek" && ( + <> + + + > + )} + {slug === "torzsasztal" && ( + <> + + + + > + )} + {!["ami-a-szivemen-van", "belso-utak", "egbolt-es-kepletek", "torzsasztal"].includes(slug) && ( + + )} + + ); +}
+ {chosen.description} + {seenBy && ( + + + + + + {seenBy} + + )} +
{intentHint}
- Írás előtt érdemes elolvasni a fórum házirendjét: tisztelettel, kéretlen tanács - és hirdetés nélkül. -
{error}