From 0d4d447569aa3d36fcd9d60965ea8de1a2e7fb38 Mon Sep 17 00:00:00 2001 From: WilliamSoderberg Date: Sun, 19 Apr 2026 13:28:13 +0200 Subject: [PATCH] Updated so that the rules and class text can be updated through the admin page --- app/admin/AdminForm.tsx | 32 +++++++++++++++++++++++----- app/admin/actions.ts | 5 ++++- app/beach/BeachClientPage.tsx | 27 ++++++++++++----------- app/beach/BeachRegistrationForm.tsx | 11 +++++----- app/beach/actions.ts | 2 +- app/components/Header.tsx | 11 ++++++---- app/components/HomeClientContent.tsx | 7 ++++-- app/components/Modals/Member.tsx | 4 +++- app/lib/config.ts | 23 ++++++++++++++++++-- app/login/actions.ts | 2 +- data/site-config.json.example | 18 +++++++++++----- 11 files changed, 103 insertions(+), 39 deletions(-) diff --git a/app/admin/AdminForm.tsx b/app/admin/AdminForm.tsx index 5ad4829..df37517 100644 --- a/app/admin/AdminForm.tsx +++ b/app/admin/AdminForm.tsx @@ -5,8 +5,9 @@ import { useActionState, useEffect, useState } from 'react'; import { FaPlus, FaTrash, FaArrowUp, FaArrowDown } from 'react-icons/fa'; // Importera pilarna import { saveConfigAction } from './actions'; +import { SiteConfig } from '../lib/config'; -export default function AdminForm({ initialConfig }: { initialConfig: any }) { +export default function AdminForm({ initialConfig }: { initialConfig: SiteConfig }) { const [state, formAction, isPending] = useActionState(saveConfigAction, null); const [showToast, setShowToast] = useState(false); @@ -49,9 +50,12 @@ export default function AdminForm({ initialConfig }: { initialConfig: any }) { useEffect(() => { if (state?.success) { - setShowToast(true); - const timer = setTimeout(() => setShowToast(false), 3000); - return () => clearTimeout(timer); + const showTimer = setTimeout(() => setShowToast(true), 0); + const hideTimer = setTimeout(() => setShowToast(false), 3000); + return () => { + clearTimeout(showTimer); + clearTimeout(hideTimer); + }; } }, [state]); @@ -87,9 +91,17 @@ export default function AdminForm({ initialConfig }: { initialConfig: any }) { +
+ +

+ Du kan använda {"text"} för länkar och {"text"} för kursiv text. +

+