update iframe rules mail 3

This commit is contained in:
Alma 2025-04-09 16:14:56 +02:00
parent 4aaf1029da
commit b1df9ec38e
2 changed files with 20 additions and 6 deletions

View File

@ -10,11 +10,16 @@ export default async function Page() {
redirect("/signin"); redirect("/signin");
} }
const mailUrl = process.env.NEXT_PUBLIC_IFRAME_MAIL_URL;
if (!mailUrl) {
console.warn("NEXT_PUBLIC_IFRAME_MAIL_URL is not defined in environment variables");
}
return ( return (
<main className="w-full h-screen bg-[#1E1E1E]"> <main className="w-full h-screen bg-[#1E1E1E]">
<div className="w-full h-full px-4 pt-12 pb-4"> <div className="w-full h-full px-4 pt-12 pb-4">
<ResponsiveIframe <ResponsiveIframe
src={process.env.NEXT_PUBLIC_IFRAME_MAIL_URL || 'https://mail.slm-lab.net'} src={mailUrl || 'https://mail.slm-lab.net'}
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
className="relative" className="relative"
style={{ style={{

View File

@ -35,6 +35,15 @@ interface SidebarProps {
onClose: () => void; onClose: () => void;
} }
interface MenuItem {
title: string;
icon: any;
href: string;
iframe?: string;
external?: boolean;
requiredRole?: string;
}
export function Sidebar({ isOpen, onClose }: SidebarProps) { export function Sidebar({ isOpen, onClose }: SidebarProps) {
const { data: session } = useSession(); const { data: session } = useSession();
const router = useRouter(); const router = useRouter();
@ -57,7 +66,7 @@ export function Sidebar({ isOpen, onClose }: SidebarProps) {
}; };
// Base menu items (available for everyone) // Base menu items (available for everyone)
const baseMenuItems = [ const baseMenuItems: MenuItem[] = [
{ {
title: "Diary", title: "Diary",
icon: BookOpen, icon: BookOpen,
@ -71,9 +80,9 @@ export function Sidebar({ isOpen, onClose }: SidebarProps) {
external: false, external: false,
}, },
{ {
title: "Mail", title: "Email",
icon: Mail, icon: Mail,
href: "/mail", href: "/email",
iframe: process.env.NEXT_PUBLIC_IFRAME_MAIL_URL, iframe: process.env.NEXT_PUBLIC_IFRAME_MAIL_URL,
}, },
{ {
@ -121,7 +130,7 @@ export function Sidebar({ isOpen, onClose }: SidebarProps) {
]; ];
// Role-specific menu items // Role-specific menu items
const roleSpecificItems = [ const roleSpecificItems: MenuItem[] = [
{ {
title: "Artlab", title: "Artlab",
icon: Palette, icon: Palette,
@ -159,7 +168,7 @@ export function Sidebar({ isOpen, onClose }: SidebarProps) {
]; ];
const handleNavigation = (href: string, external?: boolean) => { const handleNavigation = (href: string, external?: boolean) => {
if (external) { if (external && href) {
window.open(href, "_blank"); window.open(href, "_blank");
} else { } else {
router.push(href); router.push(href);