Forum: typing notices, smileys to emoji while typing, no emoji tray

"Holdfény gépel…" shows in threads and private conversations: the page
says over the live connection (every few seconds while typing) that its
member types, and the forum service passes it to those who may see that
place, never back to the typer. The emoji tray is gone (phones have their
emoji keyboard); character smileys turn into emoji as they are typed,
from a longer list shared with the server (which also converts titles
now; <3 is a red heart). Emoji show in colour: the forum's font stack
names the systems' colour emoji fonts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-26 11:50:09 +00:00
co-authored by Claude Opus 5.5
parent 2cf7266fc1
commit ee16974c77
15 changed files with 402 additions and 159 deletions
@@ -6,6 +6,7 @@ import { useEffect, useState } from "react";
import { AVATAR_COLOURS, AVATAR_GLYPHS, Avatar, GLYPH_NAMES } from "@/components/forum/Avatar";
import { signsText } from "@/components/forum/AuthorLine";
import { api, errorText } from "@/lib/api";
import { withEmoji } from "@/lib/emoticons";
import { type ChartShare, type EmailSettings, type ForumMe, banText, memberHref } from "@/lib/forum";
const SHARE_LEVELS: { value: ChartShare; label: string }[] = [
@@ -144,7 +145,7 @@ export function ProfileForm({ me, back }: { me: ForumMe; back: string | null })
rows={4}
maxLength={500}
value={bio}
onChange={(e) => setBio(e.target.value)}
onChange={(e) => withEmoji(e, setBio)}
placeholder="Pár mondat magadról, ha szeretnéd."
/>
<span className="hint">{bio.length}/500 · link nem tehető bele</span>
+12 -10
View File
@@ -6,6 +6,9 @@
/* --- themes --- */
.forum {
/* Colour emoji wherever the system has them (no monochrome symbol fonts). */
--font-body: var(--font-inter), Inter, system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
font-family: var(--font-body);
--f-hover: rgba(255, 255, 255, 0.04);
--f-tint: rgba(217, 180, 106, 0.1);
--f-tint-strong: rgba(217, 180, 106, 0.14);
@@ -395,16 +398,6 @@ body:has(.forum[data-theme="light"]) .site-footer { background: #0d1220; }
}
.fc-icon-btn:hover, .fc-icon-btn[aria-expanded="true"] { color: var(--gold); background: var(--f-tint); }
.fc-icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.fc-tray {
display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 2px; padding: 8px;
border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel-2);
}
.fc-emoji {
width: 100%; height: 42px; border: 0; border-radius: 8px; background: none; color: var(--ink);
font-size: 22px; cursor: pointer; font-family: var(--font-symbols), sans-serif;
}
.fc-emoji:hover { background: var(--f-hover); }
/* --- new thread and profile forms --- */
.fnew, .fprof { display: flex; flex-direction: column; gap: 22px; width: 100%; max-width: 760px; }
.fnew-set { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@@ -503,3 +496,12 @@ body:has(.forum[data-theme="light"]) .site-footer { background: #0d1220; }
.fprof-mail { display: grid; gap: 6px; }
.fprof-mail label { font-size: 14px; font-weight: 500; margin-top: 8px; }
.fprof-mail label:first-child { margin-top: 0; }
/* --- "… gépel" --- */
.ftyping { min-height: 22px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: 0; }
.ftyping-dots { display: inline-flex; gap: 3px; }
.ftyping-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: ftyping 1.2s infinite ease-in-out; }
.ftyping-dots span:nth-child(2) { animation-delay: 0.15s; }
.ftyping-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ftyping { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .ftyping-dots span { animation: none; opacity: 0.6; } }
@@ -5,6 +5,7 @@ import { useRouter } from "next/navigation";
import { useState } from "react";
import { api, errorText } from "@/lib/api";
import { withEmoji } from "@/lib/emoticons";
import type { MemberRelation } from "@/lib/forum";
const INTRO_MAX = 200;
@@ -74,7 +75,7 @@ export function RequestPanel({ nickname, relation }: { nickname: string; relatio
rows={3}
maxLength={INTRO_MAX}
value={intro}
onChange={(e) => setIntro(e.target.value)}
onChange={(e) => withEmoji(e, setIntro)}
placeholder="Szia! Olvastam a hozzászólásodat a…"
/>
<span className="hint">
@@ -5,7 +5,8 @@ import { useRouter } from "next/navigation";
import { useState } from "react";
import { api, errorText } from "@/lib/api";
import { EMOJI, type ForumTopic, threadHref } from "@/lib/forum";
import { convertEmoticons, withEmoji } from "@/lib/emoticons";
import { type ForumTopic, threadHref } from "@/lib/forum";
type Intent = "listen" | "advice" | "";
@@ -16,7 +17,6 @@ export function NewThreadForm({ topics, initialTopic }: { topics: ForumTopic[];
const [intent, setIntent] = useState<Intent>(listening ? "listen" : "");
const [title, setTitle] = useState("");
const [body, setBody] = useState("");
const [tray, setTray] = useState(false);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -32,7 +32,12 @@ export function NewThreadForm({ topics, initialTopic }: { topics: ForumTopic[];
setError(null);
try {
const created = await api<{ id: number; slug: string }>("/forum/threads", {
body: { topic, title, body, intent: intent || null },
body: {
topic,
title: convertEmoticons(title, title.length, true).text,
body: convertEmoticons(body, body.length, true).text,
intent: intent || null,
},
});
router.push(threadHref(created));
router.refresh();
@@ -100,7 +105,7 @@ export function NewThreadForm({ topics, initialTopic }: { topics: ForumTopic[];
id="fnew-title"
className="inp"
value={title}
onChange={(e) => setTitle(e.target.value)}
onChange={(e) => withEmoji(e, setTitle)}
maxLength={120}
required
placeholder="Miről szeretnél beszélgetni?"
@@ -114,44 +119,15 @@ export function NewThreadForm({ topics, initialTopic }: { topics: ForumTopic[];
className="fc-text"
rows={8}
value={body}
onChange={(e) => setBody(e.target.value)}
onChange={(e) => withEmoji(e, setBody)}
maxLength={10000}
required
placeholder={intent === "listen" ? "Írd le, ami benned van…" : "Írd le a gondolataidat…"}
/>
<div className="fc-actions">
<button
type="button"
className="fc-icon-btn"
aria-label="Emoji"
aria-expanded={tray}
onClick={() => setTray((t) => !t)}
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<circle cx="12" cy="12" r="9" />
<path d="M8.5 14.5a4 4 0 0 0 7 0" />
<path d="M9 9.5h.01M15 9.5h.01" strokeWidth="2.6" />
</svg>
</button>
<span className="hint">
Szöveg és emoji. Képet és videót nem lehet beilleszteni, a linkek sima szövegként látszanak.
</span>
</div>
{tray && (
<div className="fc-tray" role="group" aria-label="Emoji">
{EMOJI.map((em) => (
<button
key={em}
type="button"
className="fc-emoji"
onClick={() => setBody((b) => b + em)}
aria-label={`${em} beszúrása`}
>
{em}
</button>
))}
</div>
)}
<span className="hint">
Szöveg és emoji: a :) és a {"<3"} magától emojivá alakul. Képet és videót nem lehet beilleszteni, a linkek
sima szövegként látszanak.
</span>
</div>
<p className="hint">
@@ -9,6 +9,7 @@ import { Composer } from "@/components/forum/Composer";
import { PostBody } from "@/components/forum/PostBody";
import type { LiveNotice } from "@/components/forum/ForumNav";
import { ReportButton } from "@/components/forum/ReportButton";
import { TypingLine, useTypingSender, useTypingWatch } from "@/components/forum/typing";
import { api, errorText } from "@/lib/api";
import { type ChatMessage, type ConversationPage, memberHref } from "@/lib/forum";
@@ -36,6 +37,8 @@ export function Chat({ initial }: { initial: ConversationPage }) {
const base = `/forum/conversations/${c.id}`;
const lastId = messages.length ? messages[messages.length - 1].id : 0;
const other = c.other?.nickname ?? "Törölt tag";
const typingNow = useTypingWatch("conversation", initial.conversation.id);
const imTyping = useTypingSender("conversation", initial.conversation.id);
useEffect(() => {
if (lastId) api(`${base}/read`, { body: { message_id: lastId } }).catch(() => {});
@@ -190,6 +193,7 @@ export function Chat({ initial }: { initial: ConversationPage }) {
))}
</ol>
)}
{c.state === "accepted" && <TypingLine text={typingNow} />}
<div ref={bottom} />
{error && (
@@ -200,7 +204,15 @@ export function Chat({ initial }: { initial: ConversationPage }) {
{c.state === "accepted" && (
<div className="fchat-compose">
<Composer id="uzenet" label="Üzeneted" placeholder="Írj üzenetet…" rows={2} busy={busy} onSubmit={send} />
<Composer
onTyping={imTyping}
id="uzenet"
label="Üzeneted"
placeholder="Írj üzenetet…"
rows={2}
busy={busy}
onSubmit={send}
/>
<p className="hint">
Csak szöveg és emoji. A linkek nem kattinthatók. A moderátorok csak jelentett üzenetet látnak.
</p>