Forum: answers to me as the only count, reply box in the branch, keyboard-safe inputs
- The "Követett" tab becomes "Válaszok": its count is the unread answers to the member (a reply to their post, a first-level reply in their thread, or a post naming them), listed on /forum/valaszok with "Mind olvasott"; the followed threads are its second view. The other counts are gone from the menu; listeners see the waiting threads on their card on the front page. - Replying to a post opens the box at the bottom of its branch and scrolls there; another branch moves it (with the text typed so far). - Phones: while typing, the forum's bottom menu and floating bars step aside and the box with its send button is scrolled above the keyboard (KeyboardSafe, site-wide; Android resizes the page for the keyboard). - The "Meghallgató" badge is now "Kísérő", with a new icon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -248,10 +248,10 @@ export function ProfileForm({ me, back }: { me: ForumMe; back: string | null })
|
||||
<label className="fprof-check">
|
||||
<input type="checkbox" checked={listener} onChange={(e) => setListener(e.target.checked)} />
|
||||
<span>
|
||||
<strong>Önkéntes meghallgató vagyok</strong>
|
||||
<strong>Önkéntes kísérő vagyok</strong>
|
||||
<span className="hint">
|
||||
A nevem mellett megjelenik a „Meghallgató” jelvény, és a menü jelzi, ha egy meghallgatást kérő szál válasz
|
||||
nélkül vár. E-mailt is kérhetsz róla lent.
|
||||
Szívesen válaszolok azoknak, akik meghallgatást kérnek. A nevem mellett megjelenik a „Kísérő” jelvény, és
|
||||
a fórum főoldalán látom, hány ilyen szál vár válaszra. E-mailt is kérhetsz róla lent.
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
@@ -315,7 +315,9 @@ export function ProfileForm({ me, back }: { me: ForumMe; back: string | null })
|
||||
</select>
|
||||
{listener && (
|
||||
<>
|
||||
<label htmlFor="fprof-mail-listener">Meghallgatóként: ha egy szál két órája válasz nélkül vár</label>
|
||||
<label htmlFor="fprof-mail-listener">
|
||||
Kísérőként: ha egy meghallgatást kérő szál két órája válasz nélkül vár
|
||||
</label>
|
||||
<select
|
||||
id="fprof-mail-listener"
|
||||
className="inp"
|
||||
@@ -340,8 +342,8 @@ export function ProfileForm({ me, back }: { me: ForumMe; back: string | null })
|
||||
</span>
|
||||
</label>
|
||||
<span className="hint">
|
||||
Ha éppen itt vagy a fórumon, nem küldünk levelet: a menü jelzi az újdonságot. A privát üzenetek szövege nem
|
||||
kerül bele a levélbe.
|
||||
Ha éppen itt vagy a fórumon, nem küldünk levelet: a válaszokat a Válaszok fülön, az üzeneteket az Üzenetek
|
||||
fülön látod. A privát üzenetek szövege nem kerül bele a levélbe.
|
||||
</span>
|
||||
</fieldset>
|
||||
|
||||
|
||||
@@ -605,3 +605,42 @@ a.fh-online-item:hover { color: var(--gold); }
|
||||
.ftopic-private svg, .ftv-private svg { width: 15px; height: 15px; flex: none; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
|
||||
.ftv-private { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; font-size: 13px; color: var(--muted); }
|
||||
.ftv-private svg { margin-top: 0; width: 13px; height: 13px; }
|
||||
|
||||
/* --- "Válaszok": answers to the member --- */
|
||||
.frep-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
|
||||
.fanswers { list-style: none; margin: 0; padding: 0; }
|
||||
.fanswers li + li { border-top: 1px solid var(--line); }
|
||||
.fanswer {
|
||||
display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: start;
|
||||
padding: 14px 16px; color: var(--ink); text-decoration: none;
|
||||
}
|
||||
.fanswer:hover { background: var(--f-hover); }
|
||||
.fanswer-new { background: var(--f-tint); }
|
||||
.fanswer-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||
.fanswer-who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 15px; }
|
||||
.fanswer-thread { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.fanswer-excerpt {
|
||||
font-size: 14px; color: var(--muted); overflow: hidden;
|
||||
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
|
||||
}
|
||||
.fanswer-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
|
||||
.fh-me-waiting { font-size: 14px; color: var(--harmonic); text-decoration: none; }
|
||||
.fh-me-waiting:hover { text-decoration: underline; }
|
||||
|
||||
/* The reply box at the bottom of a branch, where the answers to that post go. */
|
||||
.ftv-inline {
|
||||
display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px 17px; padding: 8px 0 4px 14px;
|
||||
border-left: 2px solid var(--gold); scroll-margin: 96px 0 120px;
|
||||
}
|
||||
.ftv-inline .ftv-replyto { display: flex; align-items: center; gap: 5px; margin: 0; }
|
||||
.ftv-inline .ftv-replyto svg {
|
||||
width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
|
||||
}
|
||||
|
||||
/* Phones, while typing: the bottom menu and the floating button step aside
|
||||
for the keyboard (KeyboardSafe sets kb-open), and a focused box keeps room
|
||||
around it for its send button. */
|
||||
@media (max-width: 759px) {
|
||||
.kb-open .forum-nav, .kb-open .ftv-incoming { display: none; }
|
||||
}
|
||||
.forum textarea, .forum input { scroll-margin: 88px 0 96px; }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { RepliesTabs } from "@/components/forum/RepliesTabs";
|
||||
import { ThreadList } from "@/components/forum/ThreadList";
|
||||
import type { ForumViewer, ThreadCard } from "@/lib/forum";
|
||||
import { forumGet } from "@/lib/forumServer";
|
||||
@@ -13,7 +14,8 @@ export default async function FollowedPage() {
|
||||
const { threads } = res.data;
|
||||
return (
|
||||
<div className="fh">
|
||||
<h1 className="fpage-title">Követett szálak</h1>
|
||||
<h1 className="fpage-title">Válaszok</h1>
|
||||
<RepliesTabs current="followed" />
|
||||
<p className="muted">A saját szálaid, azok, amelyekhez hozzászóltál, és amelyeket követni kezdtél.</p>
|
||||
{threads.length === 0 ? (
|
||||
<p className="fh-card fh-empty">Még nem követsz egy szálat sem.</p>
|
||||
|
||||
@@ -42,10 +42,9 @@ export default async function ForumLayout({ children }: { children: React.ReactN
|
||||
member={viewer?.member?.nickname ?? null}
|
||||
loggedIn={viewer?.logged_in ?? false}
|
||||
initial={{
|
||||
unread: nav.ok ? (nav.data.followed?.new_replies ?? 0) : 0,
|
||||
replies: nav.ok ? (nav.data.replies ?? 0) : 0,
|
||||
messages: nav.ok ? (nav.data.messages ?? 0) : 0,
|
||||
reports: nav.ok ? (nav.data.reports ?? 0) : 0,
|
||||
waiting: nav.ok ? (nav.data.waiting ?? 0) : 0,
|
||||
}}
|
||||
wsUrl={process.env.FORUM_WS_URL || "/api/v1/forum/ws"}
|
||||
/>
|
||||
|
||||
@@ -87,7 +87,7 @@ function SkyCard({ sky }: { sky: SkyNow }) {
|
||||
export default async function ForumHomePage() {
|
||||
const [home, sky] = await Promise.all([forumGet<ForumHome>("/v1/forum/home"), loadSky()]);
|
||||
if (!home.ok) notFound();
|
||||
const { viewer, followed, topics, unanswered, hot } = home.data;
|
||||
const { viewer, replies, waiting, topics, unanswered, hot } = home.data;
|
||||
|
||||
return (
|
||||
<div className="fh fh-home">
|
||||
@@ -123,17 +123,17 @@ export default async function ForumHomePage() {
|
||||
</p>
|
||||
)}
|
||||
|
||||
{followed && followed.new_replies > 0 && (
|
||||
<Link href="/forum/kovetett" className="fh-banner o-2">
|
||||
{replies !== null && replies > 0 && (
|
||||
<Link href="/forum/valaszok" className="fh-banner o-2">
|
||||
<span>
|
||||
<strong>{followed.new_replies} új válasz</strong> a követett szálaidban
|
||||
<strong>{replies === 1 ? "1 új válasz" : `${replies} új válasz`}</strong> érkezett neked
|
||||
</span>
|
||||
<span aria-hidden="true">›</span>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{unanswered.length > 0 && (
|
||||
<section className="fh-section o-4" aria-labelledby="fh-waiting">
|
||||
<section className="fh-section o-4" id="varnak" aria-labelledby="fh-waiting">
|
||||
<div className="fh-section-head">
|
||||
<h2 id="fh-waiting">Várják a válaszod</h2>
|
||||
<span className="hint">még senki nem válaszolt</span>
|
||||
@@ -267,6 +267,13 @@ export default async function ForumHomePage() {
|
||||
<RankBadge rank={viewer.member.rank} name={viewer.member.rank_name} />
|
||||
</span>
|
||||
</div>
|
||||
{waiting !== null && waiting > 0 && (
|
||||
<Link href="#varnak" className="fh-me-waiting">
|
||||
{waiting === 1
|
||||
? "1 meghallgatást kérő szál vár válaszra"
|
||||
: `${waiting} meghallgatást kérő szál vár válaszra`}
|
||||
</Link>
|
||||
)}
|
||||
<div className="fh-me-actions">
|
||||
<Link href="/forum/uj" className="btn btn-primary btn-sm">
|
||||
Új szál
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
|
||||
/** "Mind olvasott": the answers stay in the list, the count on the tab goes. */
|
||||
export function ReadAll() {
|
||||
const router = useRouter();
|
||||
const [busy, setBusy] = useState(false);
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost btn-sm"
|
||||
disabled={busy}
|
||||
onClick={async () => {
|
||||
setBusy(true);
|
||||
try {
|
||||
await api("/forum/replies/read", { method: "POST" });
|
||||
window.dispatchEvent(new Event("forum:nav"));
|
||||
router.refresh();
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Mind olvasott
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { Avatar } from "@/components/forum/Avatar";
|
||||
import { RepliesTabs } from "@/components/forum/RepliesTabs";
|
||||
import { type ReplyEntry, ago, threadHref } from "@/lib/forum";
|
||||
import { forumGet } from "@/lib/forumServer";
|
||||
|
||||
import { ReadAll } from "./ReadAll";
|
||||
|
||||
export const metadata = { title: "Válaszok", robots: { index: false } };
|
||||
|
||||
const KIND: Record<ReplyEntry["kind"], string> = {
|
||||
reply: "válaszolt neked",
|
||||
thread: "válaszolt a száladban",
|
||||
mention: "megemlített",
|
||||
};
|
||||
|
||||
/** The answers to the member, newest first; the unread ones stand out. */
|
||||
export default async function RepliesPage({ searchParams }: { searchParams: Promise<{ oldal?: string }> }) {
|
||||
const page = Math.max(1, Number((await searchParams).oldal) || 1);
|
||||
const res = await forumGet<{ replies: ReplyEntry[]; unread: number; more: boolean }>(
|
||||
`/v1/forum/replies?page=${page}`,
|
||||
);
|
||||
if (!res.ok) redirect("/belepes?vissza=/forum/valaszok");
|
||||
const { replies, unread, more } = res.data;
|
||||
return (
|
||||
<div className="fh">
|
||||
<h1 className="fpage-title">Válaszok</h1>
|
||||
<div className="frep-head">
|
||||
<RepliesTabs current="replies" />
|
||||
{unread > 0 && <ReadAll />}
|
||||
</div>
|
||||
<p className="muted">
|
||||
Ha valaki a hozzászólásodra vagy a száladban válaszol, vagy megemlít. A menüben csak ezek száma látszik.
|
||||
</p>
|
||||
{replies.length === 0 ? (
|
||||
<p className="fh-card fh-empty">Még nem válaszolt neked senki. Ha valaki ír neked, itt látod.</p>
|
||||
) : (
|
||||
<ul className="fh-card fh-flush fanswers">
|
||||
{replies.map((r) => (
|
||||
<li key={r.id}>
|
||||
<Link href={threadHref(r.thread, r.id)} className={r.unread ? "fanswer fanswer-new" : "fanswer"}>
|
||||
<Avatar avatar={r.author?.avatar} size={36} online={r.author?.online} />
|
||||
<span className="fanswer-text">
|
||||
<span className="fanswer-who">
|
||||
<strong>{r.author?.nickname ?? "Törölt tag"}</strong> {KIND[r.kind]}
|
||||
{r.unread && <span className="fa-badge fa-badge-new">új</span>}
|
||||
</span>
|
||||
<span className="fanswer-thread">{r.thread.title}</span>
|
||||
<span className="fanswer-excerpt">{r.excerpt}</span>
|
||||
</span>
|
||||
<time className="fanswer-time" suppressHydrationWarning dateTime={r.created_at}>
|
||||
{ago(r.created_at)}
|
||||
</time>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
{(page > 1 || more) && (
|
||||
<nav className="forum-pager" aria-label="Lapozás">
|
||||
{page > 1 ? <Link href={`/forum/valaszok?oldal=${page - 1}`}>‹ Újabbak</Link> : <span />}
|
||||
<span className="hint">{page}. oldal</span>
|
||||
{more ? <Link href={`/forum/valaszok?oldal=${page + 1}`}>Régebbiek ›</Link> : <span />}
|
||||
</nav>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user