Forum design: own reaction marks, compact posts, avatars for the light theme
As on the approved canvas: reactions are the forum's own line marks (heart, lotus, two circles, star) with a count, the viewer's own filled; the big 2x2 boxes under the opening post are gone and the names live in the + menu and tooltips. A post's head is one line (avatar, name, rank, Sun/Moon/Ascendant as glyphs, time), on wide screens the text lines up under the name instead of the tall author column. "Válasz" is a small button; edit, delete, report and moderation sit in a ⋯ menu. The listening wish is a thin line under the title. In the light theme the avatars get a pale tint and a darker glyph (the night circle read as a black blot). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -17,6 +17,28 @@ export function signsText(signs: Record<string, string> | null | undefined): str
|
||||
return parts.length ? parts.join(" · ") : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The short form next to a post: Sun, Moon and Ascendant as glyphs
|
||||
* ("☉♓ ☽♋ ↑♍"), with the names in `title`. Every planet only on the profile.
|
||||
*/
|
||||
export function signGlyphs(signs: Record<string, string> | null | undefined): { text: string; title: string } | null {
|
||||
if (!signs) return null;
|
||||
const parts: string[] = [];
|
||||
const names: string[] = [];
|
||||
for (const [point, label] of [
|
||||
["sun", "Nap"],
|
||||
["moon", "Hold"],
|
||||
["ascendant", "Aszcendens"],
|
||||
] as const) {
|
||||
const sign = signs[point];
|
||||
if (!sign) continue;
|
||||
const mark = point === "ascendant" ? "↑" : (POINTS[point]?.glyph ?? "");
|
||||
parts.push(`${mark}${SIGNS[sign]?.glyph ?? ""}`);
|
||||
names.push(`${label}: ${SIGNS[sign]?.hu ?? sign}`);
|
||||
}
|
||||
return parts.length ? { text: parts.join(" "), title: names.join(", ") } : null;
|
||||
}
|
||||
|
||||
const ORDER = [
|
||||
"sun",
|
||||
"moon",
|
||||
@@ -65,7 +87,8 @@ export function AuthorLine({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const shown = signs ? signsText(author.signs) : null;
|
||||
const glyphs = signs ? signGlyphs(author.signs) : null;
|
||||
const shown = glyphs?.text ?? null;
|
||||
return (
|
||||
<div className="fa-line">
|
||||
<Link href={memberHref(author.nickname)} className="fa-avatar" tabIndex={-1} aria-hidden="true">
|
||||
@@ -83,7 +106,11 @@ export function AuthorLine({
|
||||
</span>
|
||||
{(shown || time) && (
|
||||
<span className="fa-sub">
|
||||
{shown && <span className="sym">{shown}</span>}
|
||||
{shown && (
|
||||
<span className="sym" title={glyphs?.title}>
|
||||
{shown}
|
||||
</span>
|
||||
)}
|
||||
{shown && time && " · "}
|
||||
{time && (
|
||||
<time
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
// The starter avatars: a gold glyph on a night colour, `<glyph>-<colour>`
|
||||
// (the forum service checks the same lists). With `online`, the green dot.
|
||||
// The starter avatars, `<glyph>-<colour>` (the forum service checks the same
|
||||
// lists): a gold glyph on a night colour in the dark theme, a darker glyph on
|
||||
// a pale tint in the light one (forum.css: .av-<colour>). With `online`, the
|
||||
// green dot.
|
||||
|
||||
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;
|
||||
|
||||
const BACKGROUND: Record<string, string> = {
|
||||
ejkek: "#1c2540",
|
||||
lila: "#2a2342",
|
||||
tenger: "#1d3038",
|
||||
borostyan: "#33291c",
|
||||
rozsa: "#3a2230",
|
||||
erdo: "#1f3326",
|
||||
};
|
||||
|
||||
export const GLYPH_NAMES: Record<string, string> = {
|
||||
hold: "Hold",
|
||||
csillag: "Csillag",
|
||||
@@ -86,10 +79,11 @@ export function Avatar({
|
||||
online?: boolean;
|
||||
}) {
|
||||
const [glyph, colour] = (avatar ?? "hold-ejkek").split("-");
|
||||
const known = (AVATAR_COLOURS as readonly string[]).includes(colour) ? colour : "ejkek";
|
||||
return (
|
||||
<span className="av" style={{ width: size, height: size }}>
|
||||
<span className={`av av-${known}`} style={{ width: size, height: size }}>
|
||||
<svg viewBox="0 0 40 40" width={size} height={size} aria-hidden="true">
|
||||
<circle cx="20" cy="20" r="20" fill={BACKGROUND[colour] ?? BACKGROUND.ejkek} />
|
||||
<circle cx="20" cy="20" r="20" className="av-bg" />
|
||||
<g className="av-glyph">
|
||||
<Glyph name={glyph} />
|
||||
</g>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// The forum's own reaction marks (no emoji): a heart, a lotus, two circles
|
||||
// meeting, a star. Each has its colour (forum.css: .ri-<kind>); the viewer's
|
||||
// own reaction is drawn filled.
|
||||
import type { ReactionKind } from "@/lib/forum";
|
||||
|
||||
export function ReactionIcon({
|
||||
kind,
|
||||
size = 16,
|
||||
filled = false,
|
||||
}: {
|
||||
kind: ReactionKind;
|
||||
size?: number;
|
||||
filled?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
width={size}
|
||||
height={size}
|
||||
aria-hidden="true"
|
||||
className={filled ? `ri ri-${kind} ri-filled` : `ri ri-${kind}`}
|
||||
>
|
||||
{kind === "with_you" && (
|
||||
<path d="M12 20s-7.5-4.6-7.5-10.2A4.2 4.2 0 0 1 12 7.3a4.2 4.2 0 0 1 7.5 2.5C19.5 15.4 12 20 12 20z" />
|
||||
)}
|
||||
{kind === "thanks" && (
|
||||
<>
|
||||
<path d="M12 4.5c2.3 2.7 2.3 6.6 0 9.3c-2.3-2.7-2.3-6.6 0-9.3z" />
|
||||
<path d="M12 13.8c-3.2-.5-5.9-2.6-6.8-6.1c3.2.2 5.6 2.4 6.8 6.1z" />
|
||||
<path d="M12 13.8c3.2-.5 5.9-2.6 6.8-6.1c-3.2.2-5.6 2.4-6.8 6.1z" />
|
||||
<path d="M5.5 17.5h13" className="ri-line" />
|
||||
<path d="M8.5 20.2h7" className="ri-line" />
|
||||
</>
|
||||
)}
|
||||
{kind === "me_too" && (
|
||||
<>
|
||||
<circle cx="9.3" cy="12" r="5.3" />
|
||||
<circle cx="14.7" cy="12" r="5.3" />
|
||||
</>
|
||||
)}
|
||||
{kind === "insight" && (
|
||||
<>
|
||||
<path d="M11 4l1.7 5.1 5.1 1.7-5.1 1.7L11 17.6l-1.7-5.1-5.1-1.7 5.1-1.7z" />
|
||||
<path d="M18 15.5l.6 1.6 1.6.6-1.6.6-.6 1.6-.6-1.6-1.6-.6 1.6-.6z" />
|
||||
</>
|
||||
)}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -16,11 +16,10 @@ export function CrisisHelp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* "Jelentés" on a post or a private message: what the problem is, an
|
||||
* optional note, and a thank-you (with the helpline for a crisis report).
|
||||
* The report form: what the problem is, an optional note, and a thank-you
|
||||
* (with the helpline for a crisis report). `onClose`: the form was cancelled.
|
||||
*/
|
||||
export function ReportButton({ path, className = "fp-tool" }: { path: string; className?: string }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
export function ReportForm({ path, onClose }: { path: string; onClose: () => void }) {
|
||||
const [kind, setKind] = useState<ReportKind | "">("");
|
||||
const [note, setNote] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
@@ -45,25 +44,21 @@ export function ReportButton({ path, className = "fp-tool" }: { path: string; cl
|
||||
if (done) {
|
||||
return (
|
||||
<div className="frep" role="status">
|
||||
<p>Köszönjük, a moderátorok megnézik.</p>
|
||||
<p>Köszönjük, a moderátorok megnézik. A döntésről e-mailben értesítünk.</p>
|
||||
{done.crisis && <CrisisHelp />}
|
||||
<button type="button" className="btn btn-ghost btn-sm frep-close" onClick={onClose}>
|
||||
Bezárás
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (!open) {
|
||||
return (
|
||||
<button type="button" className={className} onClick={() => setOpen(true)}>
|
||||
Jelentés
|
||||
</button>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<form className="frep" onSubmit={submit}>
|
||||
<fieldset className="fnew-set">
|
||||
<legend>Mi a gond?</legend>
|
||||
{REPORT_KINDS.map((k) => (
|
||||
<label key={k.kind} className="frep-kind">
|
||||
<input type="radio" name="report-kind" checked={kind === k.kind} onChange={() => setKind(k.kind)} />
|
||||
<input type="radio" name={`${path}-kind`} checked={kind === k.kind} onChange={() => setKind(k.kind)} />
|
||||
<span>{k.label}</span>
|
||||
</label>
|
||||
))}
|
||||
@@ -87,7 +82,8 @@ export function ReportButton({ path, className = "fp-tool" }: { path: string; cl
|
||||
</p>
|
||||
)}
|
||||
<div className="fc-actions">
|
||||
<button type="button" className="btn btn-ghost btn-sm" onClick={() => setOpen(false)}>
|
||||
<span className="fc-spacer" />
|
||||
<button type="button" className="btn btn-ghost btn-sm" onClick={onClose}>
|
||||
Mégse
|
||||
</button>
|
||||
<button type="submit" className="btn btn-primary btn-sm" disabled={busy || !kind}>
|
||||
@@ -97,3 +93,14 @@ export function ReportButton({ path, className = "fp-tool" }: { path: string; cl
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
/** "Jelentés" as a small button that opens the form in place (private messages). */
|
||||
export function ReportButton({ path, className = "fp-reply" }: { path: string; className?: string }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
if (open) return <ReportForm path={path} onClose={() => setOpen(false)} />;
|
||||
return (
|
||||
<button type="button" className={className} onClick={() => setOpen(true)}>
|
||||
Jelentés
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,14 +4,15 @@ import Link from "next/link";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { type ForumPost, INTENTS, REACTIONS, type ReactionKind, type ThreadPage, memberHref } from "@/lib/forum";
|
||||
import { type ForumPost, INTENTS, REACTIONS, type ReactionKind, type ThreadPage, ago, memberHref } from "@/lib/forum";
|
||||
|
||||
import { AuthorLine, signsText } from "./AuthorLine";
|
||||
import { signGlyphs } from "./AuthorLine";
|
||||
import { Avatar } from "./Avatar";
|
||||
import { Composer } from "./Composer";
|
||||
import { PostBody } from "./PostBody";
|
||||
import type { LiveNotice } from "./ForumNav";
|
||||
import { ReportButton } from "./ReportButton";
|
||||
import { ReactionIcon } from "./ReactionIcon";
|
||||
import { ReportForm } from "./ReportButton";
|
||||
import { TypingLine, useTypingSender, useTypingWatch } from "./typing";
|
||||
|
||||
/** How often the open thread looks for new replies (while the page is in front). */
|
||||
@@ -27,27 +28,6 @@ type Actions = {
|
||||
helped: (post: ForumPost) => void;
|
||||
};
|
||||
|
||||
function ReactionGrid({ post, enabled, onReact }: { post: ForumPost; enabled: boolean; onReact: Actions["react"] }) {
|
||||
return (
|
||||
<div className="fr-grid" role="group" aria-label="Reakciók">
|
||||
{REACTIONS.map((r) => (
|
||||
<button
|
||||
key={r.kind}
|
||||
type="button"
|
||||
className="fr-big"
|
||||
aria-pressed={post.mine === r.kind}
|
||||
disabled={!enabled}
|
||||
onClick={() => onReact(post, r.kind)}
|
||||
>
|
||||
<span aria-hidden="true">{r.emoji}</span>
|
||||
<span className="fr-big-label">{r.label}</span>
|
||||
<span className="fr-count">{post.reactions[r.kind]}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ReactionRow({
|
||||
post,
|
||||
enabled,
|
||||
@@ -69,43 +49,50 @@ function ReactionRow({
|
||||
type="button"
|
||||
className="fr-chip"
|
||||
aria-pressed={post.mine === r.kind}
|
||||
aria-label={`${r.label}, ${post.reactions[r.kind]}`}
|
||||
aria-label={`${r.label}, ${post.reactions[r.kind]}${post.mine === r.kind ? ", a tiéd" : ""}`}
|
||||
title={r.label}
|
||||
disabled={!enabled}
|
||||
onClick={() => onReact(post, r.kind)}
|
||||
>
|
||||
{r.emoji} {post.reactions[r.kind]}
|
||||
<ReactionIcon kind={r.kind} filled={post.mine === r.kind} />
|
||||
{post.reactions[r.kind]}
|
||||
</button>
|
||||
))}
|
||||
{enabled && (
|
||||
<span className="fr-more">
|
||||
<button
|
||||
type="button"
|
||||
className="fr-chip fr-add"
|
||||
aria-label="Reakció hozzáadása"
|
||||
aria-expanded={open}
|
||||
onClick={() => setOpen((o) => !o)}
|
||||
>
|
||||
+
|
||||
</button>
|
||||
{open && (
|
||||
<span className="fr-pop" role="menu">
|
||||
{REACTIONS.map((r) => (
|
||||
<button
|
||||
key={r.kind}
|
||||
type="button"
|
||||
role="menuitem"
|
||||
className="fr-pop-item"
|
||||
onClick={() => {
|
||||
setOpen(false);
|
||||
onReact(post, r.kind);
|
||||
}}
|
||||
>
|
||||
<span aria-hidden="true">{r.emoji}</span> {r.label}
|
||||
</button>
|
||||
))}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<Popover
|
||||
open={open}
|
||||
onClose={() => setOpen(false)}
|
||||
button={
|
||||
<button
|
||||
type="button"
|
||||
className="fr-chip fr-add"
|
||||
aria-label="Reakció hozzáadása"
|
||||
aria-expanded={open}
|
||||
onClick={() => setOpen((o) => !o)}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M12 6v12M6 12h12" />
|
||||
</svg>
|
||||
</button>
|
||||
}
|
||||
>
|
||||
{REACTIONS.map((r) => (
|
||||
<button
|
||||
key={r.kind}
|
||||
type="button"
|
||||
role="menuitem"
|
||||
className="fpop-item"
|
||||
aria-pressed={post.mine === r.kind}
|
||||
onClick={() => {
|
||||
setOpen(false);
|
||||
onReact(post, r.kind);
|
||||
}}
|
||||
>
|
||||
<ReactionIcon kind={r.kind} size={18} filled={post.mine === r.kind} />
|
||||
{r.label}
|
||||
</button>
|
||||
))}
|
||||
</Popover>
|
||||
)}
|
||||
{canDownvote && enabled && (
|
||||
<button
|
||||
@@ -116,44 +103,54 @@ function ReactionRow({
|
||||
title="Nem visz előre"
|
||||
onClick={() => onReact(post, "down")}
|
||||
>
|
||||
⌄
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M7 10l5 5 5-5" />
|
||||
</svg>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** The author column of wide screens: avatar, nickname, rank, badges, signs one per line. */
|
||||
function AuthorPanel({ author, starter }: { author: ForumPost["author"]; starter: boolean }) {
|
||||
if (!author) {
|
||||
return (
|
||||
<aside className="fp-author">
|
||||
<Avatar avatar={null} size={56} />
|
||||
<span className="fp-author-name muted">Törölt tag</span>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
const signs = signsText(author.signs);
|
||||
/** A small menu under a button (closes on a click elsewhere or Escape). */
|
||||
function Popover({
|
||||
open,
|
||||
onClose,
|
||||
button,
|
||||
children,
|
||||
align = "left",
|
||||
}: {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
button: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
align?: "left" | "right";
|
||||
}) {
|
||||
const box = useRef<HTMLSpanElement>(null);
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
const outside = (e: MouseEvent) => {
|
||||
if (box.current && !box.current.contains(e.target as Node)) onClose();
|
||||
};
|
||||
const escape = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
};
|
||||
document.addEventListener("mousedown", outside);
|
||||
document.addEventListener("keydown", escape);
|
||||
return () => {
|
||||
document.removeEventListener("mousedown", outside);
|
||||
document.removeEventListener("keydown", escape);
|
||||
};
|
||||
}, [open, onClose]);
|
||||
return (
|
||||
<aside className="fp-author">
|
||||
<Link href={memberHref(author.nickname)} tabIndex={-1} aria-hidden="true">
|
||||
<Avatar avatar={author.avatar} size={56} online={author.online} />
|
||||
</Link>
|
||||
<Link href={memberHref(author.nickname)} className="fp-author-name">
|
||||
{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>}
|
||||
{starter && <span className="fa-badge fa-badge-starter">Szálindító</span>}
|
||||
{signs && (
|
||||
<span className="fp-author-signs sym">
|
||||
{signs.split(" · ").map((line) => (
|
||||
<span key={line}>{line}</span>
|
||||
))}
|
||||
<span className="fpop-wrap" ref={box}>
|
||||
{button}
|
||||
{open && (
|
||||
<span className={align === "right" ? "fpop fpop-right" : "fpop"} role="menu">
|
||||
{children}
|
||||
</span>
|
||||
)}
|
||||
</aside>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -162,18 +159,25 @@ function PostCard({
|
||||
page,
|
||||
actions,
|
||||
isNew,
|
||||
nested = false,
|
||||
}: {
|
||||
post: ForumPost;
|
||||
page: ThreadPage;
|
||||
actions: Actions;
|
||||
isNew: boolean;
|
||||
nested?: boolean;
|
||||
}) {
|
||||
const [editing, setEditing] = useState(false);
|
||||
const [reporting, setReporting] = useState(false);
|
||||
const [menu, setMenu] = useState(false);
|
||||
const [showCollapsed, setShowCollapsed] = useState(false);
|
||||
const { viewer, thread, access } = page;
|
||||
const writer = viewer.member !== null && !viewer.member.banned;
|
||||
const starter = post.author !== null && post.author.nickname === thread.author?.nickname;
|
||||
const canReact = writer && !post.own && !post.deleted && !thread.locked;
|
||||
const author = post.author;
|
||||
const glyphs = signGlyphs(author?.signs);
|
||||
const size = post.is_opening ? 40 : nested ? 26 : 32;
|
||||
|
||||
if (post.deleted && !viewer.moderator) {
|
||||
return (
|
||||
@@ -188,38 +192,63 @@ function PostCard({
|
||||
);
|
||||
}
|
||||
|
||||
const menuItems: { label: string; run: () => void; danger?: boolean }[] = [];
|
||||
if (!post.deleted) {
|
||||
if (access?.is_thread_author && !post.is_opening && !post.own && writer) {
|
||||
menuItems.push({ label: post.helped ? "Mégsem segített" : "Ez segített", run: () => actions.helped(post) });
|
||||
}
|
||||
if (post.own && writer && !thread.locked) menuItems.push({ label: "Szerkesztés", run: () => setEditing(true) });
|
||||
if (post.own) menuItems.push({ label: "Törlés", run: () => actions.remove(post), danger: true });
|
||||
if (viewer.logged_in && !post.own) menuItems.push({ label: "Jelentés", run: () => setReporting(true) });
|
||||
if (viewer.moderator && !post.own)
|
||||
menuItems.push({ label: "Eltávolítás", run: () => actions.remove(post), danger: true });
|
||||
} else if (viewer.moderator) {
|
||||
menuItems.push({ label: "Visszaállítás (admin)", run: () => actions.restore(post) });
|
||||
}
|
||||
|
||||
const classes = ["fp", post.is_opening && "fp-opening", nested && "fp-nested"].filter(Boolean).join(" ");
|
||||
return (
|
||||
<article className={post.is_opening ? "fp fp-opening" : "fp"} id={`h${post.id}`}>
|
||||
{/* Wide screens: the old forums' author column. */}
|
||||
<AuthorPanel author={post.author} starter={starter && !post.is_opening} />
|
||||
<div className="fp-content">
|
||||
<div className="fp-head">
|
||||
<AuthorLine
|
||||
author={post.author}
|
||||
size={post.is_opening ? 44 : 36}
|
||||
time={post.created_at}
|
||||
edited={post.edited_at !== null}
|
||||
badges={
|
||||
<>
|
||||
{starter && !post.is_opening && <span className="fa-badge fa-badge-starter">Szálindító</span>}
|
||||
{isNew && <span className="fa-badge fa-badge-new">új</span>}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<p className="fp-when">
|
||||
<time suppressHydrationWarning dateTime={post.created_at}>
|
||||
{new Date(post.created_at).toLocaleString("hu-HU", {
|
||||
timeZone: "Europe/Budapest",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
})}
|
||||
</time>
|
||||
{post.edited_at && " · szerkesztve"}
|
||||
<article className={classes} id={`h${post.id}`}>
|
||||
<span className="fp-av">
|
||||
{author ? (
|
||||
<Link href={memberHref(author.nickname)} tabIndex={-1} aria-hidden="true">
|
||||
<Avatar avatar={author.avatar} size={size} online={author.online} />
|
||||
</Link>
|
||||
) : (
|
||||
<Avatar avatar={null} size={size} />
|
||||
)}
|
||||
</span>
|
||||
<div className="fp-head">
|
||||
<span className="fp-names">
|
||||
{author ? (
|
||||
<Link href={memberHref(author.nickname)} className="fa-name">
|
||||
{author.nickname}
|
||||
</Link>
|
||||
) : (
|
||||
<span className="fa-name muted">Törölt tag</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>}
|
||||
{isNew && <span className="fa-badge fa-badge-new">új</span>}
|
||||
</p>
|
||||
{glyphs && !nested && (
|
||||
<span className="fp-signs sym" title={glyphs.title}>
|
||||
{glyphs.text}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<time
|
||||
className="fp-time"
|
||||
suppressHydrationWarning
|
||||
dateTime={post.created_at}
|
||||
title={new Date(post.created_at).toLocaleString("hu-HU", { timeZone: "Europe/Budapest" })}
|
||||
>
|
||||
{ago(post.created_at)}
|
||||
{post.edited_at && " · szerkesztve"}
|
||||
</time>
|
||||
</div>
|
||||
<div className="fp-content">
|
||||
{post.deleted && (
|
||||
<p className="fp-mod-note">
|
||||
Eltávolítva{post.deleted.reason ? ` (ok: ${post.deleted.reason})` : " a szerző által"}. Csak a moderátorok
|
||||
@@ -248,75 +277,84 @@ function PostCard({
|
||||
) : (
|
||||
post.body !== null && <PostBody text={post.body} />
|
||||
)}
|
||||
{post.helped && (
|
||||
<p className="fp-helped">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M5 12.5l4.5 4.5L19 7.5" />
|
||||
</svg>
|
||||
{thread.author?.nickname ?? "A szál indítója"} szerint ez segített
|
||||
</p>
|
||||
)}
|
||||
{!post.deleted && !editing && (
|
||||
<>
|
||||
{post.is_opening ? (
|
||||
<ReactionGrid post={post} enabled={canReact} onReact={actions.react} />
|
||||
) : (
|
||||
<div className="fp-actions">
|
||||
<ReactionRow
|
||||
post={post}
|
||||
enabled={canReact}
|
||||
canDownvote={access?.can_downvote ?? false}
|
||||
onReact={actions.react}
|
||||
/>
|
||||
<span className="fp-spacer" />
|
||||
{access?.can_reply && writer && (
|
||||
<button type="button" className="fp-link" onClick={() => actions.replyTo(post)}>
|
||||
Válasz
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className="fp-tools">
|
||||
{access?.is_thread_author && !post.is_opening && !post.own && writer && (
|
||||
</div>
|
||||
{!editing && (!post.deleted || menuItems.length > 0) && (
|
||||
<div className="fp-actions">
|
||||
{post.helped && (
|
||||
<span className="fp-helped" title={`${thread.author?.nickname ?? "A szál indítója"} szerint ez segített`}>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M5 12.5l4.5 4.5L19 7.5" />
|
||||
</svg>
|
||||
Segített
|
||||
</span>
|
||||
)}
|
||||
{!post.deleted && (
|
||||
<ReactionRow
|
||||
post={post}
|
||||
enabled={canReact}
|
||||
canDownvote={access?.can_downvote ?? false}
|
||||
onReact={actions.react}
|
||||
/>
|
||||
)}
|
||||
<span className="fp-spacer" />
|
||||
{viewer.moderator && typeof post.down === "number" && post.down > 0 && (
|
||||
<span className="hint" title="Nem visz előre jelzések (csak moderátoroknak)">
|
||||
⌄ {post.down}
|
||||
</span>
|
||||
)}
|
||||
{!post.deleted && access?.can_reply && writer && !post.is_opening && (
|
||||
<button type="button" className="fp-reply" onClick={() => actions.replyTo(post)}>
|
||||
<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>
|
||||
Válasz
|
||||
</button>
|
||||
)}
|
||||
{menuItems.length > 0 && (
|
||||
<Popover
|
||||
open={menu}
|
||||
onClose={() => setMenu(false)}
|
||||
align="right"
|
||||
button={
|
||||
<button
|
||||
type="button"
|
||||
className="fp-tool"
|
||||
onClick={() => actions.helped(post)}
|
||||
aria-pressed={post.helped}
|
||||
className="fp-more"
|
||||
aria-label="Továbbiak"
|
||||
aria-expanded={menu}
|
||||
onClick={() => setMenu((m) => !m)}
|
||||
>
|
||||
{post.helped ? "Segített ✓" : "Ez segített"}
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<circle cx="5.5" cy="12" r="1.6" />
|
||||
<circle cx="12" cy="12" r="1.6" />
|
||||
<circle cx="18.5" cy="12" r="1.6" />
|
||||
</svg>
|
||||
</button>
|
||||
)}
|
||||
{post.own && writer && !thread.locked && (
|
||||
<button type="button" className="fp-tool" onClick={() => setEditing(true)}>
|
||||
Szerkesztés
|
||||
}
|
||||
>
|
||||
{menuItems.map((item) => (
|
||||
<button
|
||||
key={item.label}
|
||||
type="button"
|
||||
role="menuitem"
|
||||
className={item.danger ? "fpop-item fpop-danger" : "fpop-item"}
|
||||
onClick={() => {
|
||||
setMenu(false);
|
||||
item.run();
|
||||
}}
|
||||
>
|
||||
{item.label}
|
||||
</button>
|
||||
)}
|
||||
{post.own && (
|
||||
<button type="button" className="fp-tool" onClick={() => actions.remove(post)}>
|
||||
Törlés
|
||||
</button>
|
||||
)}
|
||||
{viewer.logged_in && !post.own && <ReportButton path={`/forum/posts/${post.id}/report`} />}
|
||||
{viewer.moderator && !post.own && (
|
||||
<button type="button" className="fp-tool fp-tool-mod" onClick={() => actions.remove(post)}>
|
||||
Eltávolítás
|
||||
</button>
|
||||
)}
|
||||
{viewer.moderator && typeof post.down === "number" && post.down > 0 && (
|
||||
<span className="hint">⌄ {post.down}</span>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{post.deleted && viewer.moderator && (
|
||||
<div className="fp-tools">
|
||||
<button type="button" className="fp-tool" onClick={() => actions.restore(post)}>
|
||||
Visszaállítás (admin)
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</Popover>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{reporting && (
|
||||
<div className="fp-report">
|
||||
<ReportForm path={`/forum/posts/${post.id}/report`} onClose={() => setReporting(false)} />
|
||||
</div>
|
||||
)}
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -524,24 +562,19 @@ export function ThreadView({ initial }: { initial: ThreadPage }) {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{intent && thread.intent === "listen" && (
|
||||
<div className="ftv-intent">
|
||||
<strong>{intent.label}</strong>
|
||||
<span>{starter} most nem kér tanácsot. Elég, ha jelen vagy, és leírod, ha veled is történt hasonló.</span>
|
||||
</div>
|
||||
)}
|
||||
{intent && thread.intent === "advice" && (
|
||||
<div className="ftv-intent ftv-intent-advice">
|
||||
<strong>{intent.label}</strong>
|
||||
<span>{starter} kíváncsi a véleményetekre és a tapasztalataitokra.</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<h1 className="ftv-title">
|
||||
{thread.pinned && <span className="ft-pin">Kitűzve</span>}
|
||||
{thread.locked && <span className="ft-pin">Lezárva</span>}
|
||||
{thread.title}
|
||||
</h1>
|
||||
{intent && (
|
||||
<p className="ftv-intent-line">
|
||||
<span className={`ft-intent ft-intent-${thread.intent}`}>{intent.label}</span>
|
||||
{thread.intent === "listen"
|
||||
? "tanács helyett elég, ha jelen vagy, és leírod, ha veled is történt hasonló"
|
||||
: `${starter} kíváncsi a véleményetekre és a tapasztalataitokra`}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{opening && <PostCard post={opening} page={page} actions={actions} isNew={false} />}
|
||||
|
||||
@@ -570,6 +603,7 @@ export function ThreadView({ initial }: { initial: ThreadPage }) {
|
||||
{childrenOf(top.id).map((child) => (
|
||||
<PostCard
|
||||
key={child.id}
|
||||
nested
|
||||
post={child}
|
||||
page={page}
|
||||
actions={actions}
|
||||
|
||||
Reference in New Issue
Block a user