diff --git a/app/(authentication)/admin/superguide/page.tsx b/app/(authentication)/admin/superguide/page.tsx index 2e7a9389..cc12f9ab 100644 --- a/app/(authentication)/admin/superguide/page.tsx +++ b/app/(authentication)/admin/superguide/page.tsx @@ -2,8 +2,9 @@ import { Container } from '@/components/Container' import { Button } from '@/components/Button' -import React from 'react' +import React, { useState, useEffect } from 'react' import Link from 'next/link' +import BroadcastFormModal from '@/components/BroadcastFormModal' const openNewYearForm = async () => { // Show loading message @@ -108,13 +109,71 @@ const openNewYearForm = async () => { const adminHelp = () => { const currentYear = new Date().getFullYear(); + const [showBroadcastModal, setShowBroadcastModal] = useState(false); + const [userInfo, setUserInfo] = useState<{userId: number, userRoles: string[]} | null>(null); + + // Get user info from cookies on component mount + useEffect(() => { + const getUserInfo = () => { + // Get user info from cookies (this should match your authentication system) + const userIdCookie = document.cookie + .split('; ') + .find(row => row.startsWith('userId=')) + ?.split('=')[1]; + + const userRolesCookie = document.cookie + .split('; ') + .find(row => row.startsWith('userRoles=')) + ?.split('=')[1]; + + if (userIdCookie && userRolesCookie) { + try { + const roles = JSON.parse(decodeURIComponent(userRolesCookie)); + setUserInfo({ + userId: parseInt(userIdCookie), + userRoles: roles + }); + } catch (error) { + console.error('Failed to parse user info from cookies:', error); + } + } + }; + + getUserInfo(); + }, []); + return ( <>

Admin Help

- - - +
+
+ + + + + {/* New Broadcast Button - Only show for super admins */} + {userInfo && userInfo.userRoles.includes('1') && ( + + )} +
+ + {/* Info box for broadcast feature */} + {userInfo && userInfo.userRoles.includes('1') && ( +
+

📧 Form Broadcasting System

+

+ Use "Open Forms & Broadcast" to create a new form session, open all library forms for editing (62-day period), + and automatically send notification emails to all CEAL members. +

+
+ )} +