From dde98bb5986c0c488c41324e2ebfefb047813a99 Mon Sep 17 00:00:00 2001 From: alma Date: Fri, 2 May 2025 10:41:16 +0200 Subject: [PATCH] courrier msft oauth --- app/[section]/page.tsx | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/app/[section]/page.tsx b/app/[section]/page.tsx index 527a8ada..2dc1195e 100644 --- a/app/[section]/page.tsx +++ b/app/[section]/page.tsx @@ -4,35 +4,53 @@ import { authOptions } from '@/app/api/auth/[...nextauth]/route'; import { ResponsiveIframe } from '@/app/components/responsive-iframe'; import { redirect } from 'next/navigation'; -const menuItems = { +// Use environment variables for real service URLs +const menuItems: Record = { + parole: process.env.NEXT_PUBLIC_IFRAME_PAROLE_URL || '', + alma: process.env.NEXT_PUBLIC_IFRAME_AI_ASSISTANT_URL || '', + crm: process.env.NEXT_PUBLIC_IFRAME_MEDIATIONS_URL || '', + vision: process.env.NEXT_PUBLIC_IFRAME_CONFERENCE_URL || '', + showcase: process.env.NEXT_PUBLIC_IFRAME_SHOWCASE_URL || '', + agilite: process.env.NEXT_PUBLIC_IFRAME_AGILITY_URL || '', + dossiers: process.env.NEXT_PUBLIC_IFRAME_DRIVE_URL || '', + 'the-message': process.env.NEXT_PUBLIC_IFRAME_THEMESSAGE_URL || '', + qg: process.env.NEXT_PUBLIC_IFRAME_MISSIONVIEW_URL || '', + // Keep any existing custom ones board: "https://example.com/board", chapter: "https://example.com/chapter", flow: "https://example.com/flow", design: "https://example.com/design", gitlab: "https://gitlab.com", - crm: "https://example.com/crm", missions: "https://example.com/missions" } -// Fix the params type issue by using generateMetadata or a different approach +// Using a different approach for metadata that doesn't directly access params.section export async function generateMetadata({ params }: { params: { section: string } }) { - return { - title: `${params.section.charAt(0).toUpperCase() + params.section.slice(1)}`, - } + // Safely handle params + const paramsObj = await Promise.resolve(params); + const sectionName = paramsObj?.section || ''; + + // Capitalize first letter + const title = sectionName ? + sectionName.charAt(0).toUpperCase() + sectionName.slice(1) : + 'Section'; + + return { title }; } -export default async function SectionPage({ params }: { params: { section: string } }) { +export default async function SectionPage(props: { params: { section: string } }) { // Ensure authentication first const session = await getServerSession(authOptions); if (!session) { redirect("/signin"); } - // Get section from params - const section = params.section; + // Safely extract section using await Promise.resolve + const params = await Promise.resolve(props.params); + const section = params?.section || ''; // Check if section exists in our menu items - if (!(section in menuItems)) { + if (!section || !(section in menuItems)) { notFound(); }