From c07c7b68bf306c4a61ffa96107bdce29537e1bc9 Mon Sep 17 00:00:00 2001 From: feco Date: Thu, 26 Nov 2026 17:09:10 +0000 Subject: [PATCH] Forum: a lighter new thread form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The topic is a row of small labels with the topic icons (its description and who sees it below), the wish a three-way switch (Meghallgatásra, Véleményekre, Beszélgetésre; two in a listening topic) with its meaning below, and the title and the text are one writing surface with the send button at its foot. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL --- services/frontend/src/app/forum/forum.css | 52 ++++++ services/frontend/src/app/forum/page.tsx | 35 +--- .../src/app/forum/uj/NewThreadForm.tsx | 159 ++++++++++++------ .../src/components/forum/TopicIcon.tsx | 34 ++++ 4 files changed, 195 insertions(+), 85 deletions(-) create mode 100644 services/frontend/src/components/forum/TopicIcon.tsx 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 ( - - ); -} - /** "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) => ( -
+ {chosen && ( +

+ {chosen.description} + {seenBy && ( + + + {seenBy} + + )} +

+ )}
- Mit szeretnél? -
- - - {!listening && ( -
-
- +
+ withEmoji(e, setTitle)} maxLength={120} required - placeholder="Miről szeretnél beszélgetni?" + placeholder="Adj címet a szálnak…" /> -
- -
- +