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 { Providers } from "@/components/providers";
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"] });
@ -15,21 +19,26 @@ export default async function RootLayout({
children: React.ReactNode;
}) {
const session = await getServerSession(authOptions);
const headersList = headers();
const pathname = headersList.get("x-pathname") || "";
const isSignInPage = pathname === "/signin";
if (!session) {
redirect("/signin");
}
return (
<html lang="fr">
<body className={inter.className}>
<Providers>
<LayoutWrapper
isSignInPage={isSignInPage}
isAuthenticated={!!session}
>
<html lang="fr" suppressHydrationWarning>
<body>
<ThemeProvider
attribute="class"
defaultTheme="dark"
enableSystem
disableTransitionOnChange
>
<div className="min-h-screen bg-black">
<Navbar />
{children}
</LayoutWrapper>
</Providers>
</div>
<Toaster />
</ThemeProvider>
</body>
</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";
import { IframeContainer } from "@/components/shared/iframe-container";
export function FlowFrame() {
return (
<div className="w-full h-[calc(100vh-8rem)]">
<iframe
src="https://agilite.slm-lab.net/oidc/login"
className="w-full h-full border-none"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</div>
<IframeContainer
src="https://lab.slm-lab.net/flow"
title="Flow Dashboard"
/>
);
}

View File

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

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>
);
}