Iframe Correction

This commit is contained in:
Alma 2025-04-08 17:59:33 +02:00
parent af23cc7c10
commit e8182fc943
5 changed files with 66 additions and 29 deletions

View File

@ -6,6 +6,10 @@ import { getServerSession } from "next-auth/next";
import { authOptions } from "@/app/api/auth/[...nextauth]/route"; import { authOptions } from "@/app/api/auth/[...nextauth]/route";
import { Providers } from "@/components/providers"; import { Providers } from "@/components/providers";
import { LayoutWrapper } from "@/components/layout/layout-wrapper"; import { LayoutWrapper } from "@/components/layout/layout-wrapper";
import { Navbar } from "@/components/navbar";
import { ThemeProvider } from "@/components/theme-provider";
import { Toaster } from "@/components/ui/toaster";
import { redirect } from "next/navigation";
const inter = Inter({ subsets: ["latin"] }); const inter = Inter({ subsets: ["latin"] });
@ -15,21 +19,26 @@ export default async function RootLayout({
children: React.ReactNode; children: React.ReactNode;
}) { }) {
const session = await getServerSession(authOptions); const session = await getServerSession(authOptions);
const headersList = headers();
const pathname = headersList.get("x-pathname") || ""; if (!session) {
const isSignInPage = pathname === "/signin"; redirect("/signin");
}
return ( return (
<html lang="fr"> <html lang="fr" suppressHydrationWarning>
<body className={inter.className}> <body>
<Providers> <ThemeProvider
<LayoutWrapper attribute="class"
isSignInPage={isSignInPage} defaultTheme="dark"
isAuthenticated={!!session} enableSystem
> disableTransitionOnChange
>
<div className="min-h-screen bg-black">
<Navbar />
{children} {children}
</LayoutWrapper> </div>
</Providers> <Toaster />
</ThemeProvider>
</body> </body>
</html> </html>
); );

View File

@ -0,0 +1,12 @@
"use client";
import { IframeContainer } from "@/components/shared/iframe-container";
export function CrmFrame() {
return (
<IframeContainer
src="https://crm.slm-lab.net"
title="CRM Dashboard"
/>
);
}

View File

@ -1,14 +1,12 @@
"use client"; "use client";
import { IframeContainer } from "@/components/shared/iframe-container";
export function FlowFrame() { export function FlowFrame() {
return ( return (
<div className="w-full h-[calc(100vh-8rem)]"> <IframeContainer
<iframe src="https://lab.slm-lab.net/flow"
src="https://agilite.slm-lab.net/oidc/login" title="Flow Dashboard"
className="w-full h-full border-none" />
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</div>
); );
} }

View File

@ -1,14 +1,12 @@
"use client"; "use client";
export function GitLabFrame() { import { IframeContainer } from "@/components/shared/iframe-container";
export function GitlabFrame() {
return ( return (
<div className="w-full h-[calc(100vh-8rem)]"> <IframeContainer
<iframe src="https://git.slm-lab.net"
src="https://gite.slm-lab.net/user/oauth2/cube" title="GitLab"
className="w-full h-full border-none" />
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</div>
); );
} }

View File

@ -0,0 +1,20 @@
"use client";
interface IframeContainerProps {
src: string;
title: string;
}
export function IframeContainer({ src, title }: IframeContainerProps) {
return (
<div className="h-[calc(100vh-6rem)] w-full mt-0">
<iframe
src={src}
className="w-full h-full border-0"
allow="fullscreen"
title={title}
style={{ display: 'block' }}
/>
</div>
);
}