import { useActions, useAppState } from "../../overmind/overmind"; import { NLView } from "@newstackdev/iosdk/dist/types"; import { NewsafeAuth } from "@newstackdev/iosdk/dist/Components/NewsafeAuth"; import { Layout, Row, Col, Spin, Drawer } from "antd"; import { useOvermindRouting } from "../hooks/useOvermindRouting"; import { MainMenu } from "../../Components/MainMenu"; import useMediaQuery from "@newstackdev/iosdk/dist/hooks/useMediaQuery"; import { Hamburger } from "../../Icons/Hamburger"; import { CloseIcon } from "../../Icons/CloseIcon"; import { useEffect, useState } from "react"; import LogoIcon from "../../Icons/LogoIcon"; import { Link } from "react-router-dom"; // import { authorize } from "@newstackdev/iosdk/dist/overmind/api/actions/auth"; const { Header, Footer, Sider, Content } = Layout; export const AppLayout: NLView = ({ children }) => { const state = useAppState(); const actions = useActions(); useOvermindRouting(); const isLoggedIn = state.api.auth.user?.username; const isAllowed = state.routing.isAllowed; const isMobile = useMediaQuery("(max-width: 768px)"); return (
{state.config.settings.app.name} {isLoggedIn || "not authenticated"} {isMobile && isLoggedIn && ( )}
{isLoggedIn && !isMobile && ( )} {state.indicators.specific[ "newgraphApplication.authWithUnsid" ] ? ( ) : isLoggedIn || isAllowed ? ( children ) : ( )}
); }; const MobileDrawer = () => { const [open, setOpen] = useState(false); const showDrawer = () => { setOpen(true); }; const onClose = () => { setOpen(false); }; return ( <> {/* @ts-ignore */} } extra={} > ); };