diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 0cf129f..2cbe053 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -1,8 +1,21 @@ import React from 'react'; -import { Link, Outlet } from 'react-router-dom'; +import { Link, Outlet, useSearchParams } from 'react-router-dom'; import { Navigation } from './Navigation'; export function Layout() { + const [searchParams] = useSearchParams(); + const isIframe = searchParams.get('iframe') === '1'; + + if (isIframe) { + return ( +
+
+ +
+
+ ); + } + return (
diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index 44d369f..10e7f90 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -1,18 +1,21 @@ import React, { useState } from 'react'; -import { Link, useLocation, useNavigate } from 'react-router-dom'; +import { Link, useLocation, useNavigate, useSearchParams } from 'react-router-dom'; import { Flame, Menu, X } from 'lucide-react'; import { useStore } from '../store/useStore'; export function Navigation() { const location = useLocation(); const navigate = useNavigate(); + const [searchParams] = useSearchParams(); const { user, setUser } = useStore(); const [isMenuOpen, setIsMenuOpen] = useState(false); + const isIframe = searchParams.get('iframe') === '1'; const handleLogout = () => { setUser(null); setIsMenuOpen(false); - navigate('/login', { replace: true }); // Use replace to prevent going back to dashboard + const newPath = '/login' + (isIframe ? '?iframe=1' : ''); + navigate(newPath, { replace: true }); }; const handleMenuClick = () => { @@ -23,11 +26,16 @@ export function Navigation() { setIsMenuOpen(false); }; + // Helper function to add iframe parameter to paths + const getPath = (path: string) => { + return isIframe ? `${path}?iframe=1` : path; + }; + return (