import { ActivityStream } from "../Components/ActivityStream"; import { AuthWidget } from "../Pages/AuthWidget"; import { Burger } from "../Components/Icons/Burger"; import { Header as ADHeader, Content } from "antd/lib/layout/layout"; import { Layout as AntdLayout, Col, Dropdown, Menu, Row } from "antd"; import { IOView, NLView } from "../types"; import { Link } from "react-router-dom"; import { ReactElement, useState } from "react"; import { useActions, useAppState } from "../overmind"; import { DAO } from "../Components/Icons/DAO"; import { LargeArrowBack } from "../Components/Icons/LargeArrowBack"; import { NLFooter } from "./NLFooter"; import { SearchWidget } from "../Pages/Search/SearchWidget"; import { Spin } from "../Components/Spin"; import { showPopUp } from "../utils/popup"; import Explore from "../Components/Icons/Explore"; import Logo from "../Components/Icons/Logo"; import NavbarUpload from "../Components/Icons/NavbarUpload"; import NewsafeLogo from "../Components/Icons/NewsafeLogo"; import Notifications from "../Components/Icons/Notifications"; const WHITE_BORDER = "0px white solid"; const DEBUG = false; const ifDebug = (v: string) => (DEBUG ? v : ""); const ThreeBody: NLView<{ left?: ReactElement | string; mid?: ReactElement | string; right?: ReactElement | string; allBorders?: boolean; }> = ({ left, mid, right }) => { const centerWidth = "min(60vw,935px)"; const colWidth = "auto"; const mix = { paddingLeft: 6, paddingRight: 6, }; return (
{left || ifDebug("left")}
{mid && ( {mid || ifDebug("mid")} )} {right || ifDebug("right")}
); }; export const Header: IOView = () => { const state = useAppState(); if (!state.ux.layout.headerShown) return <>; return (
); }; export const XTopMenu = () => { const state = useAppState(); const [search, setSearch] = useState(false); return (
Newlife.IO
{/* */} {state.api.auth.authorized ? : ""} {/* */} {/* My moods */} {/* M */} }>
// ); }; export const TopMenu: NLView = () => { const state = useAppState(); const [selection, setSelection] = useState(""); // const [search, setSearch] = useState(false); const actions = useActions(); const isAuthorized = state.api.auth.authorized; // const setVisible = (v: boolean) => // actions.flows.userJourney.setFlag({ // flag: "walletShown", // value: v ? "true" : "", // }); // const walletShown = !!state.flows.userJourney.flags.walletShown; const routes = state.flows.user.create.isLegacyUpdateOngoing ? [...state.config.routes.noBackButton, "/signup/create"] : state.config.routes.noBackButton; const isAllowedPath = !routes.find((r) => state.routing.location.includes(r)); return ( } mode="horizontal">
Newlife.IO
{isAllowedPath && isAuthorized && }
{isAllowedPath && }
{/* */} {/*
setSearch(!search)}>
*/} {/*
setSearch(!search)}>
*/} {isAuthorized ? ( <> Upload DAO showPopUp(`https://auth${state.config.env.env == "dev" ? "-dev" : ""}.newsafe.org/wallet`, "__NEWSAFE__") } > {/* Wallet */} {/* */} ) : ( <> )} {/* My moods */}
); }; const Main: NLView = ({ children }) => { const state = useAppState(); return (
{state.auth.initialized && state.routing.isAllowed ? <>{children} : }
); }; export const Layout: NLView = ({ children }) => { const state = useAppState(); return (
{/* !{JSON.stringify(state.api.auth.user?.status)} */}
{children}
{state.ux.layout.footerShown && } ); };