import "./Layout.css"; import { useCallback, useEffect, useMemo, useState } from "react"; import { Outlet, useLocation } from "react-router-dom"; import Icon from "@/Icons/Icon"; import useLogin from "@/Hooks/useLogin"; import { isFormElement } from "@/SnortUtils"; import Toaster from "@/Toaster"; import { useTheme } from "@/Hooks/useTheme"; import { useLoginRelays } from "@/Hooks/useLoginRelays"; import { LoginUnlock } from "@/Element/PinPrompt"; import useKeyboardShortcut from "@/Hooks/useKeyboardShortcut"; import { LoginStore } from "@/Login"; import NavSidebar from "./NavSidebar"; import NotificationsHeader from "./NotificationsHeader"; import RightColumn from "./RightColumn"; import { LogoHeader } from "./LogoHeader"; import useLoginFeed from "@/Feed/LoginFeed"; import ErrorBoundary from "@/Element/ErrorBoundary"; import Footer from "@/Pages/Layout/Footer"; export default function Index() { const location = useLocation(); const { id, stalker } = useLogin(s => ({ id: s.id, stalker: s.stalker ?? false })); useTheme(); useLoginRelays(); useLoginFeed(); const hideHeaderPaths = ["/login", "/new"]; const shouldHideFooter = location.pathname.startsWith("/messages/"); const shouldHideHeader = hideHeaderPaths.some(path => location.pathname.startsWith(path)); const handleKeyboardShortcut = useCallback(event => { if (event.target && !isFormElement(event.target as HTMLElement)) { event.preventDefault(); window.scrollTo({ top: 0, behavior: "instant" }); } }, []); useKeyboardShortcut(".", handleKeyboardShortcut); const isStalker = !!stalker; return (
{!shouldHideHeader &&
}
{isStalker && } {!shouldHideFooter &&
); } function Header() { return (
); } function StalkerModal({ id }) { return (
LoginStore.removeSession(id)}>
); }