From e1a6ab5730b3d3f3a6b0674c52a3df95084b9eee Mon Sep 17 00:00:00 2001 From: pavel444-byte Date: Sat, 17 Oct 2026 12:45:18 +0500 Subject: [PATCH] Add map community reactions, comments, and moderation --- app/community-social.css | 37 ++ app/layout.tsx | 1 + app/servers/[id]/page.tsx | 2 + components/CommunityModeration.tsx | 193 +++++++++ components/MapCommunity.tsx | 251 +++++++++++ components/Moderation.tsx | 2 + components/ReportCommunity.tsx | 133 ++++++ docs/map-community.md | 26 ++ lib/api.ts | 18 + lib/community-api.ts | 297 +++++++++++++ scripts/test-community-sql.mjs | 24 + shared/community.ts | 89 ++++ shared/database.ts | 40 ++ shared/locales/ru.json | 33 ++ .../20261017073500_map_community_features.sql | 66 +++ tests/community.test.ts | 410 ++++++++++++++++++ tests/sql/community.sql | 125 ++++++ 17 files changed, 1747 insertions(+) create mode 100644 app/community-social.css create mode 100644 components/CommunityModeration.tsx create mode 100644 components/MapCommunity.tsx create mode 100644 components/ReportCommunity.tsx create mode 100644 docs/map-community.md create mode 100644 lib/community-api.ts create mode 100644 scripts/test-community-sql.mjs create mode 100644 shared/community.ts create mode 100644 supabase/migrations/20261017073500_map_community_features.sql create mode 100644 tests/community.test.ts create mode 100644 tests/sql/community.sql diff --git a/app/community-social.css b/app/community-social.css new file mode 100644 index 0000000..c4ce639 --- /dev/null +++ b/app/community-social.css @@ -0,0 +1,37 @@ +.map-community { + margin-top: 36px; +} +.map-community .button, +.map-comment .button { + display: inline-flex; + align-items: center; + gap: 8px; +} +.map-community .button[aria-pressed="true"] { + border-color: var(--green); + background: var(--panel2); + color: var(--green); +} +.map-comments { + margin-block: 24px; +} +.map-comment { + border-top: 1px solid var(--line); + padding-block: 20px; +} +.map-comment-meta { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 8px 16px; +} +.map-comment-meta time { + font-size: 12px; +} +.community-body { + white-space: pre-wrap; + overflow-wrap: anywhere; +} +.map-community textarea { + min-height: 100px; +} diff --git a/app/layout.tsx b/app/layout.tsx index 3fed4b1..d99c058 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -18,6 +18,7 @@ import "./multiplayer.css"; import "./support.css"; import "./appearance.css"; import "./community.css"; +import "./community-social.css"; import { themeInitScript } from "@/shared/theme"; import { SiteSettingsProvider } from "@/components/SiteSettingsProvider"; import { initialSiteSettings } from "@/lib/site-settings"; diff --git a/app/servers/[id]/page.tsx b/app/servers/[id]/page.tsx index 1d4e8ba..6af96f6 100644 --- a/app/servers/[id]/page.tsx +++ b/app/servers/[id]/page.tsx @@ -10,6 +10,7 @@ import { ReportContent } from "@/components/ReportContent"; import { user } from "@/lib/supabase"; import { accountProfile } from "@/lib/profile"; import { ExportMap } from "@/components/MapTransfer"; +import { MapCommunity } from "@/components/MapCommunity"; export default async function ServerPage({ params, }: { @@ -74,6 +75,7 @@ export default async function ServerPage({ serverAddress={map.contribution_server_address} /> )} +