Forum: whom a reply answers, icon badges, the new features on the pages
- Replies stay two levels deep, but a reply to a reply says whom it is
for ("↪ Holdfény"): posts.reply_to_id.
- The question stands apart on its own card; the listening reminder above
the reply box is gone.
- Every rank and badge has its own line icon (Vándor, Kereső, Fonó,
Csillagfonó, Sorsfonó; Moderátor, Meghallgató, Támogató, Szálindító).
- Pages for the new features: own avatar upload and the moderator's reset,
the listener and supporter switches, mention and weekly summary e-mails
(the weekly one off by default), "@" suggestions and mention links, the
daily sky thread by "Sorsfonalak", "Most itt vannak", joining restricted
topics, and the moderators' Témák tab (requests; topics for the admin).
- Members-only topics say so to members too.
- The privacy notice (HU, EN) and point 8.1 of the terms cover own
pictures, badges, mentions, restricted topics and the weekly summary;
the data export and account deletion include them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -4,6 +4,7 @@ import { POINTS, SIGNS } from "@/lib/astro";
|
||||
import { type ForumAuthor, ago, memberHref } from "@/lib/forum";
|
||||
|
||||
import { Avatar } from "./Avatar";
|
||||
import { Badge, RankBadge } from "./Badges";
|
||||
|
||||
/** "☉ Halak · ☽ Rák · Asz Szűz": the signs a member chose to share. */
|
||||
export function signsText(signs: Record<string, string> | null | undefined): string | null {
|
||||
@@ -100,8 +101,10 @@ export function AuthorLine({
|
||||
{author.nickname}
|
||||
</Link>
|
||||
{author.online && <span className="sr-only">(online)</span>}
|
||||
<span className="fa-rank">{author.rank_name}</span>
|
||||
{author.moderator && <span className="fa-badge fa-badge-mod">Moderátor</span>}
|
||||
<RankBadge rank={author.rank} name={author.rank_name} />
|
||||
{author.moderator && <Badge kind="mod" />}
|
||||
{author.listener && <Badge kind="listener" />}
|
||||
{author.supporter && <Badge kind="supporter" />}
|
||||
{badges}
|
||||
</span>
|
||||
{(shown || time) && (
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// a pale tint in the light one (forum.css: .av-<colour>). With `online`, the
|
||||
// green dot.
|
||||
|
||||
import { uploadedAvatar } from "@/lib/forum";
|
||||
|
||||
export const AVATAR_GLYPHS = ["hold", "csillag", "nap", "hullam", "level", "lotusz", "kristaly", "toll"] as const;
|
||||
export const AVATAR_COLOURS = ["ejkek", "lila", "tenger", "borostyan", "rozsa", "erdo"] as const;
|
||||
|
||||
@@ -78,6 +80,16 @@ export function Avatar({
|
||||
size?: number;
|
||||
online?: boolean;
|
||||
}) {
|
||||
const picture = uploadedAvatar(avatar);
|
||||
if (picture) {
|
||||
return (
|
||||
<span className="av av-picture" style={{ width: size, height: size }}>
|
||||
{/* A member's own picture, served by the forum (already small and square). */}
|
||||
<img src={picture} alt="" width={size} height={size} loading="lazy" />
|
||||
{online && <span className="av-online" title="Most online" />}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
const [glyph, colour] = (avatar ?? "hold-ejkek").split("-");
|
||||
const known = (AVATAR_COLOURS as readonly string[]).includes(colour) ? colour : "ejkek";
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
// The small labels next to a nickname, each with its own line icon: the rank
|
||||
// (from Vándor to Sorsfonó, a thread being spun), and the badges.
|
||||
|
||||
import type { Rank } from "@/lib/forum";
|
||||
|
||||
const RANK_ICONS: Record<Rank, React.ReactNode> = {
|
||||
// Vándor: on the way (a path from a starting point).
|
||||
vandor: (
|
||||
<>
|
||||
<circle cx="5.5" cy="18.5" r="1.8" />
|
||||
<path d="M8 17.5c3-1 2.5-4.5 6-5.5s3.5-3.5 5-6" strokeDasharray="2.2 2.6" />
|
||||
</>
|
||||
),
|
||||
// Kereső: a compass.
|
||||
kereso: (
|
||||
<>
|
||||
<circle cx="12" cy="12" r="8.5" />
|
||||
<path d="M14.8 9.2l-1.6 4-4 1.6 1.6-4z" />
|
||||
</>
|
||||
),
|
||||
// Fonó: a spool with thread.
|
||||
fono: (
|
||||
<>
|
||||
<path d="M6.5 4.5h11M6.5 19.5h11" />
|
||||
<path d="M8.5 4.5v15M15.5 4.5v15" />
|
||||
<path d="M8.5 8.5l7 2.5M8.5 13l7 2.5" />
|
||||
</>
|
||||
),
|
||||
// Csillagfonó: a star with a thread from it.
|
||||
csillagfono: (
|
||||
<>
|
||||
<path d="M10 3.5l1.5 4 4 1.5-4 1.5-1.5 4-1.5-4-4-1.5 4-1.5z" />
|
||||
<path d="M14 15c2.5 0 3.5 1.5 3.5 3s-1.5 2.5-3 2" />
|
||||
</>
|
||||
),
|
||||
// Sorsfonó: the thread of fate around the circle (the site's mark).
|
||||
sorsfono: (
|
||||
<>
|
||||
<circle cx="12" cy="12" r="7" />
|
||||
<path d="M4.5 16.5c4.5-.5 6-7 11-8.5" />
|
||||
<circle cx="18.5" cy="6" r="1.4" />
|
||||
</>
|
||||
),
|
||||
};
|
||||
|
||||
export type BadgeKind = "mod" | "listener" | "supporter" | "starter" | "sky";
|
||||
|
||||
const BADGES: Record<BadgeKind, { label: string; title: string; icon: React.ReactNode }> = {
|
||||
// A shield with a tick.
|
||||
mod: {
|
||||
label: "Moderátor",
|
||||
title: "A fórum moderátora",
|
||||
icon: (
|
||||
<>
|
||||
<path d="M12 3.5l7 2.5v5.5c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z" />
|
||||
<path d="M9 12l2.2 2.2L15.5 10" />
|
||||
</>
|
||||
),
|
||||
},
|
||||
// An ear.
|
||||
listener: {
|
||||
label: "Meghallgató",
|
||||
title: "Önkéntes meghallgató: szívesen meghallgat",
|
||||
icon: (
|
||||
<>
|
||||
<path d="M7 9.5a5 5 0 0 1 10 0c0 3-2.5 4-3 6s-1.5 4-3.8 4A2.7 2.7 0 0 1 7.5 17" />
|
||||
<path d="M10 10a2 2 0 0 1 4 0c0 1.3-1.2 1.7-1.6 2.6" />
|
||||
</>
|
||||
),
|
||||
},
|
||||
// A gem.
|
||||
supporter: {
|
||||
label: "Támogató",
|
||||
title: "Vásárlásával támogatja a Sorsfonalakat",
|
||||
icon: (
|
||||
<>
|
||||
<path d="M7.5 5h9l3.5 4.5L12 19.5 4 9.5z" />
|
||||
<path d="M4 9.5h16M10 5l-1.5 4.5L12 19.5l3.5-10L14 5" />
|
||||
</>
|
||||
),
|
||||
},
|
||||
// A quill.
|
||||
starter: {
|
||||
label: "Szálindító",
|
||||
title: "Ő indította a szálat",
|
||||
icon: (
|
||||
<>
|
||||
<path d="M19.5 4.5c-6 .5-10.5 4.5-11.5 11l-1.5 4" />
|
||||
<path d="M8.3 13.5c4.5 0 8.5-3 11.2-9" />
|
||||
</>
|
||||
),
|
||||
},
|
||||
// A crescent Moon.
|
||||
sky: {
|
||||
label: "napi égbolt",
|
||||
title: "A Sorsfonalak napi szála az égboltról",
|
||||
icon: <path d="M19 14.5A7.5 7.5 0 0 1 9.5 5a7.5 7.5 0 1 0 9.5 9.5z" />,
|
||||
},
|
||||
};
|
||||
|
||||
function Icon({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<svg className="fa-icon" viewBox="0 0 24 24" aria-hidden="true">
|
||||
{children}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
/** The member's rank, with its icon. */
|
||||
export function RankBadge({ rank, name }: { rank: Rank; name: string }) {
|
||||
return (
|
||||
<span className={`fa-rank fa-rank-${rank}`} title={`Rang: ${name}`}>
|
||||
<Icon>{RANK_ICONS[rank] ?? RANK_ICONS.vandor}</Icon>
|
||||
{name}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** A badge (Moderátor, Meghallgató, Támogató, Szálindító, napi égbolt), with its icon. */
|
||||
export function Badge({ kind }: { kind: BadgeKind }) {
|
||||
const b = BADGES[kind];
|
||||
return (
|
||||
<span className={`fa-badge fa-badge-${kind === "sky" ? "starter" : kind}`} title={b.title}>
|
||||
<Icon>{b.icon}</Icon>
|
||||
{b.label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +1,26 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
import { convertEmoticons, withEmoji } from "@/lib/emoticons";
|
||||
import type { ForumAuthor } from "@/lib/forum";
|
||||
|
||||
import { Avatar } from "./Avatar";
|
||||
|
||||
/** "@Ho" right before the caret: what was typed after the "@", and where it starts. */
|
||||
function mentionAt(text: string, caret: number): { query: string; start: number } | null {
|
||||
const before = text.slice(0, caret);
|
||||
const match = /(?:^|\s)@([^\s@]{1,24})$/.exec(before);
|
||||
if (!match) return null;
|
||||
return { query: match[1], start: caret - match[1].length - 1 };
|
||||
}
|
||||
|
||||
/**
|
||||
* The text box and the send button. Character smileys (`:)`, `<3`) turn into
|
||||
* emoji as they are typed; phones bring their own emoji keyboard.
|
||||
* `onTyping`: called on every keystroke (the "… gépel" notice).
|
||||
* `mentions`: typing "@Ho" offers the members whose nickname starts so.
|
||||
*/
|
||||
export function Composer({
|
||||
id,
|
||||
@@ -19,6 +32,7 @@ export function Composer({
|
||||
onSubmit,
|
||||
onCancel,
|
||||
onTyping,
|
||||
mentions = false,
|
||||
rows = 3,
|
||||
autoFocus = false,
|
||||
}: {
|
||||
@@ -31,16 +45,54 @@ export function Composer({
|
||||
onSubmit: (text: string) => Promise<boolean>;
|
||||
onCancel?: () => void;
|
||||
onTyping?: () => void;
|
||||
mentions?: boolean;
|
||||
rows?: number;
|
||||
autoFocus?: boolean;
|
||||
}) {
|
||||
const [text, setText] = useState(initial);
|
||||
const [suggest, setSuggest] = useState<{ query: string; start: number; members: ForumAuthor[] } | null>(null);
|
||||
const area = useRef<HTMLTextAreaElement>(null);
|
||||
const timer = useRef<number | undefined>(undefined);
|
||||
|
||||
useEffect(() => () => window.clearTimeout(timer.current), []);
|
||||
|
||||
function lookUp(value: string, caret: number) {
|
||||
window.clearTimeout(timer.current);
|
||||
const at = mentions ? mentionAt(value, caret) : null;
|
||||
if (!at) {
|
||||
setSuggest(null);
|
||||
return;
|
||||
}
|
||||
timer.current = window.setTimeout(() => {
|
||||
api<{ members: ForumAuthor[] }>(`/forum/members/search?q=${encodeURIComponent(at.query)}`)
|
||||
.then((res) => setSuggest(res.members.length ? { ...at, members: res.members } : null))
|
||||
.catch(() => setSuggest(null));
|
||||
}, 200);
|
||||
}
|
||||
|
||||
function pick(nickname: string) {
|
||||
if (!suggest) return;
|
||||
const el = area.current;
|
||||
const caret = el?.selectionStart ?? text.length;
|
||||
const inserted = `@${nickname} `;
|
||||
const next = text.slice(0, suggest.start) + inserted + text.slice(caret);
|
||||
setText(next);
|
||||
setSuggest(null);
|
||||
requestAnimationFrame(() => {
|
||||
el?.focus();
|
||||
const at = suggest.start + inserted.length;
|
||||
el?.setSelectionRange(at, at);
|
||||
});
|
||||
}
|
||||
|
||||
async function submit(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
if (!text.trim() || busy) return;
|
||||
const final = convertEmoticons(text, text.length, true).text;
|
||||
if (await onSubmit(final)) setText("");
|
||||
if (await onSubmit(final)) {
|
||||
setText("");
|
||||
setSuggest(null);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -50,17 +102,40 @@ export function Composer({
|
||||
</label>
|
||||
<textarea
|
||||
id={id}
|
||||
ref={area}
|
||||
className="fc-text"
|
||||
rows={rows}
|
||||
placeholder={placeholder}
|
||||
value={text}
|
||||
onChange={(e) => {
|
||||
withEmoji(e, setText);
|
||||
lookUp(e.target.value, e.target.selectionStart ?? e.target.value.length);
|
||||
onTyping?.();
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Escape") setSuggest(null);
|
||||
}}
|
||||
maxLength={10000}
|
||||
autoFocus={autoFocus}
|
||||
aria-autocomplete={mentions ? "list" : undefined}
|
||||
/>
|
||||
{suggest && (
|
||||
<div className="fc-suggest" role="listbox" aria-label="Tagok">
|
||||
{suggest.members.map((m) => (
|
||||
<button
|
||||
key={m.nickname}
|
||||
type="button"
|
||||
role="option"
|
||||
aria-selected="false"
|
||||
className="fc-suggest-item"
|
||||
onClick={() => pick(m.nickname)}
|
||||
>
|
||||
<Avatar avatar={m.avatar} size={24} online={m.online} />
|
||||
{m.nickname}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className="fc-actions">
|
||||
<span className="fc-spacer" />
|
||||
{onCancel && (
|
||||
|
||||
@@ -12,6 +12,8 @@ export interface NavCounts {
|
||||
unread: number;
|
||||
messages: number;
|
||||
reports: number;
|
||||
/** Listeners: threads waiting for a first reply. */
|
||||
waiting: number;
|
||||
}
|
||||
|
||||
/** The live notice a page listens to (`window` event `forum:live`). */
|
||||
@@ -27,7 +29,12 @@ export interface LiveNotice {
|
||||
const POLL_MS = 30_000;
|
||||
|
||||
function counts(data: ForumNavData): NavCounts {
|
||||
return { unread: data.followed?.new_replies ?? 0, messages: data.messages ?? 0, reports: data.reports ?? 0 };
|
||||
return {
|
||||
unread: data.followed?.new_replies ?? 0,
|
||||
messages: data.messages ?? 0,
|
||||
reports: data.reports ?? 0,
|
||||
waiting: data.waiting ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +158,7 @@ export function ForumNav({
|
||||
wsUrl: string;
|
||||
}) {
|
||||
const path = usePathname();
|
||||
const [{ unread, messages, reports }, setCounts] = useState(initial);
|
||||
const [{ unread, messages, reports, waiting }, setCounts] = useState(initial);
|
||||
const refresh = useCallback(() => {
|
||||
api<ForumNavData>("/forum/nav")
|
||||
.then((data) => setCounts(counts(data)))
|
||||
@@ -173,6 +180,8 @@ export function ForumNav({
|
||||
label: "Fórum",
|
||||
icon: "forum" as const,
|
||||
current: path === "/forum" || path.startsWith("/forum/szal"),
|
||||
// Listeners: what waits for a first reply.
|
||||
badge: waiting,
|
||||
},
|
||||
{
|
||||
href: loggedIn ? "/forum/kovetett" : "/belepes?vissza=/forum/kovetett",
|
||||
@@ -213,7 +222,7 @@ export function ForumNav({
|
||||
<>
|
||||
{reports > 0 && (
|
||||
<Link href="/forum/moderalas" className="forum-modchip">
|
||||
Jelentés: {reports}
|
||||
Moderálás: {reports}
|
||||
</Link>
|
||||
)}
|
||||
<nav className="forum-nav" aria-label="Fórum menü">
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
import { api, errorText } from "@/lib/api";
|
||||
|
||||
/** A restricted topic: asking to join it (a moderator decides), or the request waiting. */
|
||||
export function JoinTopic({ slug, pending }: { slug: string; pending: boolean }) {
|
||||
const router = useRouter();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [note, setNote] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [sent, setSent] = useState(pending);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
if (sent) return <span className="hint">Jelentkezésed elküldve, egy moderátor dönt róla.</span>;
|
||||
|
||||
async function send(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
await api(`/forum/topics/${slug}/join`, { body: { note } });
|
||||
setSent(true);
|
||||
router.refresh();
|
||||
} catch (err) {
|
||||
setError(errorText(err));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!open) {
|
||||
return (
|
||||
<button type="button" className="btn btn-sm" onClick={() => setOpen(true)}>
|
||||
Csatlakozás kérése
|
||||
</button>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<form className="fjoin" onSubmit={send}>
|
||||
<label htmlFor={`join-${slug}`} className="hint">
|
||||
Pár szó, miért szeretnél csatlakozni (nem kötelező)
|
||||
</label>
|
||||
<textarea
|
||||
id={`join-${slug}`}
|
||||
className="fc-text"
|
||||
rows={2}
|
||||
maxLength={300}
|
||||
value={note}
|
||||
onChange={(e) => setNote(e.target.value)}
|
||||
/>
|
||||
{error && (
|
||||
<p className="msg msg-error" role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
<div className="fc-actions">
|
||||
<span className="fc-spacer" />
|
||||
<button type="button" className="btn btn-ghost btn-sm" onClick={() => setOpen(false)}>
|
||||
Mégse
|
||||
</button>
|
||||
<button type="submit" className="btn btn-primary btn-sm" disabled={busy}>
|
||||
Jelentkezem
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,33 @@
|
||||
/** A post's text: paragraphs and line breaks as typed; links stay plain text. */
|
||||
export function PostBody({ text }: { text: string }) {
|
||||
import Link from "next/link";
|
||||
|
||||
import { memberHref } from "@/lib/forum";
|
||||
|
||||
/** "@Holdfény" as a link to the profile, for the nicknames the post names. */
|
||||
function withMentions(line: string, mentions: string[]): React.ReactNode[] {
|
||||
if (mentions.length === 0) return [line];
|
||||
const escaped = [...mentions]
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
||||
const pattern = new RegExp(`@(${escaped.join("|")})`, "gi");
|
||||
const out: React.ReactNode[] = [];
|
||||
let last = 0;
|
||||
for (const match of line.matchAll(pattern)) {
|
||||
const at = match.index ?? 0;
|
||||
if (at > last) out.push(line.slice(last, at));
|
||||
const nickname = mentions.find((n) => n.toLowerCase() === match[1].toLowerCase()) ?? match[1];
|
||||
out.push(
|
||||
<Link key={at} href={memberHref(nickname)} className="fp-mention">
|
||||
@{match[1]}
|
||||
</Link>,
|
||||
);
|
||||
last = at + match[0].length;
|
||||
}
|
||||
if (last < line.length) out.push(line.slice(last));
|
||||
return out;
|
||||
}
|
||||
|
||||
/** A post's text: paragraphs and line breaks as typed; links stay plain text; mentions link to profiles. */
|
||||
export function PostBody({ text, mentions = [] }: { text: string; mentions?: string[] }) {
|
||||
return (
|
||||
<div className="fp-body">
|
||||
{text.split(/\n{2,}/).map((para, i) => (
|
||||
@@ -7,7 +35,7 @@ export function PostBody({ text }: { text: string }) {
|
||||
{para.split("\n").map((line, j) => (
|
||||
<span key={j}>
|
||||
{j > 0 && <br />}
|
||||
{line}
|
||||
{withMentions(line, mentions)}
|
||||
</span>
|
||||
))}
|
||||
</p>
|
||||
|
||||
@@ -32,7 +32,7 @@ export function ThreadList({ threads, showTopic = true }: { threads: ThreadCard[
|
||||
<span className="ft-meta">
|
||||
{t.author && <Avatar avatar={t.author.avatar} size={20} online={t.author.online} />}
|
||||
<span>
|
||||
{t.author?.nickname ?? "Törölt tag"}
|
||||
{t.system ? "Sorsfonalak" : (t.author?.nickname ?? "Törölt tag")}
|
||||
{showTopic && ` · ${t.topic.name}`}
|
||||
<span className="ft-m-narrow">
|
||||
{" "}
|
||||
|
||||
@@ -14,6 +14,7 @@ import type { LiveNotice } from "./ForumNav";
|
||||
import { ReactionIcon } from "./ReactionIcon";
|
||||
import { ReportForm } from "./ReportButton";
|
||||
import { TypingLine, useTypingSender, useTypingWatch } from "./typing";
|
||||
import { Badge, RankBadge } from "./Badges";
|
||||
|
||||
/** How often the open thread looks for new replies (while the page is in front). */
|
||||
const POLL_MS = 30_000;
|
||||
@@ -154,6 +155,21 @@ function Popover({
|
||||
);
|
||||
}
|
||||
|
||||
/** The site's own mark as an avatar (the daily sky thread). */
|
||||
function SiteMark({ size }: { size: number }) {
|
||||
return (
|
||||
<span className="av av-site" style={{ width: size, height: size }}>
|
||||
<svg viewBox="0 0 64 64" width={size} height={size} aria-hidden="true">
|
||||
<circle cx="32" cy="32" r="32" className="av-bg" />
|
||||
<g fill="none" strokeWidth="4.5" strokeLinecap="round" className="av-site-mark">
|
||||
<circle cx="32" cy="32" r="18" />
|
||||
<path d="M15 43 C 26 42, 30 25, 42 21" />
|
||||
</g>
|
||||
</svg>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function PostCard({
|
||||
post,
|
||||
page,
|
||||
@@ -210,7 +226,9 @@ function PostCard({
|
||||
return (
|
||||
<article className={classes} id={`h${post.id}`}>
|
||||
<span className="fp-av">
|
||||
{author ? (
|
||||
{post.system ? (
|
||||
<SiteMark size={size} />
|
||||
) : author ? (
|
||||
<Link href={memberHref(author.nickname)} tabIndex={-1} aria-hidden="true">
|
||||
<Avatar avatar={author.avatar} size={size} online={author.online} />
|
||||
</Link>
|
||||
@@ -220,17 +238,32 @@ function PostCard({
|
||||
</span>
|
||||
<div className="fp-head">
|
||||
<span className="fp-names">
|
||||
{author ? (
|
||||
{post.system ? (
|
||||
<span className="fa-name">Sorsfonalak</span>
|
||||
) : author ? (
|
||||
<Link href={memberHref(author.nickname)} className="fa-name">
|
||||
{author.nickname}
|
||||
</Link>
|
||||
) : (
|
||||
<span className="fa-name muted">Törölt tag</span>
|
||||
)}
|
||||
{post.reply_to?.nickname && nested && (
|
||||
<span className="fp-replyto" title={`Válasz neki: ${post.reply_to.nickname}`}>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M9 14L4 9l5-5" />
|
||||
<path d="M4 9h10a6 6 0 0 1 6 6v4" />
|
||||
</svg>
|
||||
<span className="sr-only">válasz neki:</span>
|
||||
{post.reply_to.nickname}
|
||||
</span>
|
||||
)}
|
||||
{author?.online && <span className="sr-only">(online)</span>}
|
||||
{author && <span className="fa-rank">{author.rank_name}</span>}
|
||||
{author?.moderator && <span className="fa-badge fa-badge-mod">Moderátor</span>}
|
||||
{starter && !post.is_opening && <span className="fa-badge fa-badge-starter">Szálindító</span>}
|
||||
{author && <RankBadge rank={author.rank} name={author.rank_name} />}
|
||||
{post.system && <Badge kind="sky" />}
|
||||
{author?.moderator && <Badge kind="mod" />}
|
||||
{author?.listener && <Badge kind="listener" />}
|
||||
{author?.supporter && <Badge kind="supporter" />}
|
||||
{starter && !post.is_opening && <Badge kind="starter" />}
|
||||
{isNew && <span className="fa-badge fa-badge-new">új</span>}
|
||||
{glyphs && !nested && (
|
||||
<span className="fp-signs sym" title={glyphs.title}>
|
||||
@@ -261,6 +294,7 @@ function PostCard({
|
||||
</button>
|
||||
) : editing ? (
|
||||
<Composer
|
||||
mentions
|
||||
id={`szerk-${post.id}`}
|
||||
label="Hozzászólás szerkesztése"
|
||||
initial={post.body ?? ""}
|
||||
@@ -275,7 +309,7 @@ function PostCard({
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
post.body !== null && <PostBody text={post.body} />
|
||||
post.body !== null && <PostBody text={post.body} mentions={post.mentions} />
|
||||
)}
|
||||
</div>
|
||||
{!editing && (!post.deleted || menuItems.length > 0) && (
|
||||
@@ -529,6 +563,22 @@ export function ThreadView({ initial }: { initial: ThreadPage }) {
|
||||
<Link href="/forum">Fórum</Link>
|
||||
<span aria-hidden="true">›</span>
|
||||
<Link href={`/forum/${thread.topic.slug}`}>{thread.topic.name}</Link>
|
||||
{thread.topic.visibility !== "public" && (
|
||||
<span
|
||||
className="ftv-private"
|
||||
title={
|
||||
thread.topic.visibility === "members"
|
||||
? "Csak belépett tagok látják, a keresők sem"
|
||||
: "Zárt kör: csak a jóváhagyott tagok látják"
|
||||
}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<rect x="5" y="11" width="14" height="9" rx="2" />
|
||||
<path d="M8 11V8a4 4 0 0 1 8 0v3" />
|
||||
</svg>
|
||||
{thread.topic.visibility === "members" ? "csak tagoknak" : "zárt kör"}
|
||||
</span>
|
||||
)}
|
||||
</nav>
|
||||
|
||||
<div className="ftv-toolbar">
|
||||
@@ -649,12 +699,6 @@ export function ThreadView({ initial }: { initial: ThreadPage }) {
|
||||
<p className="ftv-gate">Ez a szál le van zárva, új hozzászólás nem írható.</p>
|
||||
) : (
|
||||
<>
|
||||
{thread.intent === "listen" && (
|
||||
<p className="ftv-hint">
|
||||
{starter} meghallgatást kér: tanács helyett írd le, ha veled is történt hasonló, vagy csak azt, hogy itt
|
||||
vagy.
|
||||
</p>
|
||||
)}
|
||||
{replyTo && (
|
||||
<p className="ftv-replyto">
|
||||
Válasz neki: <strong>{replyTo.author?.nickname ?? "Törölt tag"}</strong>
|
||||
@@ -669,6 +713,7 @@ export function ThreadView({ initial }: { initial: ThreadPage }) {
|
||||
</p>
|
||||
)}
|
||||
<Composer
|
||||
mentions
|
||||
onTyping={imTyping}
|
||||
id="valasz-szoveg"
|
||||
label="Válaszod"
|
||||
|
||||
Reference in New Issue
Block a user