From f9012bd12388826015630aca324ffdb3134e1587 Mon Sep 17 00:00:00 2001 From: Thibault Pouch Date: Tue, 17 Mar 2026 11:44:05 +0100 Subject: [PATCH] feat: integrate settings API to manage forum and bug reporting availability --- nest-front/src/pages/public/BugReportPage.tsx | 21 ++++++++++++++++++- nest-front/src/pages/public/ForumPage.tsx | 21 +++++++++++++++++-- nest-front/src/pages/public/StudioPage.tsx | 5 ++--- nest-front/src/utils/api.ts | 8 +++++++ 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/nest-front/src/pages/public/BugReportPage.tsx b/nest-front/src/pages/public/BugReportPage.tsx index bd78f6e..2cf538b 100644 --- a/nest-front/src/pages/public/BugReportPage.tsx +++ b/nest-front/src/pages/public/BugReportPage.tsx @@ -1,6 +1,6 @@ import { useState, useMemo, useCallback, useEffect } from 'react'; import { Link, useNavigate } from 'react-router-dom'; -import { bugsApi } from '../../utils/api'; +import { bugsApi, settingsApi } from '../../utils/api'; import { useAuth } from '../../contexts/AuthContext'; import { timeAgo } from '../../utils/format'; import type { BugReport, BugSeverity, BugStatus, BugReportFormData } from '../../types'; @@ -278,10 +278,15 @@ export default function BugReportPage() { const { user, isAuthenticated } = useAuth(); const [bugs, setBugs] = useState([]); const [loading, setLoading] = useState(true); + const [bugsEnabled, setBugsEnabled] = useState(true); const [statusFilter, setStatusFilter] = useState('all'); const [severityFilter, setSeverityFilter] = useState('all'); const [showForm, setShowForm] = useState(false); + useEffect(() => { + settingsApi.get().then((s) => setBugsEnabled(s.bugsEnabled)).catch(() => {}); + }, []); + const fetchBugs = useCallback(() => { setLoading(true); bugsApi.getBugs({ status: statusFilter, severity: severityFilter, limit: 100 }) @@ -312,6 +317,20 @@ export default function BugReportPage() { const inProgressCount = bugs.filter((b) => b.status === 'in_progress').length; const resolvedCount = bugs.filter((b) => b.status === 'resolved').length; + if (!bugsEnabled) { + return ( +
+
Issue Tracker
+

+ BUG REPORTS UNAVAILABLE +

+

+ Bug reporting has been temporarily disabled by an administrator. +

+
+ ); + } + return (
{/* Header */} diff --git a/nest-front/src/pages/public/ForumPage.tsx b/nest-front/src/pages/public/ForumPage.tsx index 530f5d2..705499c 100644 --- a/nest-front/src/pages/public/ForumPage.tsx +++ b/nest-front/src/pages/public/ForumPage.tsx @@ -1,6 +1,6 @@ import { useEffect, useMemo, useState } from 'react'; import { Link } from 'react-router-dom'; -import { forumApi } from '../../utils/api'; +import { forumApi, settingsApi } from '../../utils/api'; import { timeAgo } from '../../utils/format'; import type { ForumCategory, ForumThread } from '../../types'; @@ -132,17 +132,20 @@ export default function ForumPage() { const [threads, setThreads] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(''); + const [forumEnabled, setForumEnabled] = useState(true); useEffect(() => { let cancelled = false; setLoading(true); Promise.all([ + settingsApi.get(), forumApi.getCategories(), forumApi.getThreads({ limit: 200 }), ]) - .then(([cats, threadRes]) => { + .then(([settings, cats, threadRes]) => { if (cancelled) return; + setForumEnabled(settings.forumEnabled); setCategories(cats); setThreads(threadRes.data); }) @@ -166,6 +169,20 @@ export default function ForumPage() { ); }, [search, categories, threads]); + if (!loading && !forumEnabled) { + return ( +
+
Community
+

+ FORUM UNAVAILABLE +

+

+ The forum has been temporarily disabled by an administrator. +

+
+ ); + } + return (
{/* Header */} diff --git a/nest-front/src/pages/public/StudioPage.tsx b/nest-front/src/pages/public/StudioPage.tsx index 3bd4031..1f726ac 100644 --- a/nest-front/src/pages/public/StudioPage.tsx +++ b/nest-front/src/pages/public/StudioPage.tsx @@ -78,9 +78,9 @@ export default function StudioPage() { marginBottom: '1rem', }} > - CrowMate Studio is an independent game studio founded in 2023 by a team of six developers + CrowMate Studio is an independent game studio founded in 2026 by a team of six developers who are all new to game development and learning by building together. We are headquartered - somewhere in Europe and operate fully remote. + somewhere in France and operate arround the globe.

(

diff --git a/nest-front/src/utils/api.ts b/nest-front/src/utils/api.ts index 390dcb8..deb4a1a 100644 --- a/nest-front/src/utils/api.ts +++ b/nest-front/src/utils/api.ts @@ -190,3 +190,11 @@ export const eventsApi = { export const teamApi = { getMembers: () => apiFetch('/team'), }; + +// ── Settings API ────────────────────────────────────────────────────────────── + +export type SiteSettings = { forumEnabled: boolean; bugsEnabled: boolean }; + +export const settingsApi = { + get: () => apiFetch('/settings'), +};