import React, { useEffect, useRef, useState } from "react"; import { LogOut, Menu, Package, Plus, Shield } from "react-feather"; import { Wrench, GithubLogo, BookOpen, DiscordLogo, DotsThree, } from "@phosphor-icons/react"; // import IndexCount from "./IndexCount"; // import LLMStatus from "./LLMStatus"; import NewWorkspaceModal, { useNewWorkspaceModal, } from "../Modals/NewWorkspace"; import ActiveWorkspaces from "./ActiveWorkspaces"; import paths from "../../utils/paths"; import useUser from "../../hooks/useUser"; import { userFromStorage } from "../../utils/request"; import { AUTH_TIMESTAMP, AUTH_TOKEN, AUTH_USER, USER_BACKGROUND_COLOR, } from "../../utils/constants"; import useLogo from "../../hooks/useLogo"; export default function Sidebar() { const { logo } = useLogo(); const sidebarRef = useRef(null); const { showing: showingNewWsModal, showModal: showNewWsModal, hideModal: hideNewWsModal, } = useNewWorkspaceModal(); return ( <>
{/* Header Information */}
Logo
{/* */}
{/* Primary Body */}
{/*

Feedback form

*/} {/* Footer */}
{showingNewWsModal && } ); } export function SidebarMobileHeader() { const { logo } = useLogo(); const sidebarRef = useRef(null); const [showSidebar, setShowSidebar] = useState(false); const [showBgOverlay, setShowBgOverlay] = useState(false); const { showing: showingNewWsModal, showModal: showNewWsModal, hideModal: hideNewWsModal, } = useNewWorkspaceModal(); useEffect(() => { // Darkens the rest of the screen // when sidebar is open. function handleBg() { if (showSidebar) { setTimeout(() => { setShowBgOverlay(true); }, 300); } else { setShowBgOverlay(false); } } handleBg(); }, [showSidebar]); return ( <>
Logo
setShowSidebar(false)} />
{/* Header Information */}
Logo
{/* Primary Body */}
{/* Footer */}
{/* */}
{showingNewWsModal && }
); } function AdminHome() { const { user } = useUser(); if (!user || user?.role !== "admin") return null; return ( ); } function LogoutButton() { if (!window.localStorage.getItem(AUTH_USER)) return null; const user = userFromStorage(); if (!user.username) return null; return ( ); } function SettingsButton() { return ( ); } function ManagedHosting() { if (window.location.origin.includes(".useanything.com")) return null; return (

Managed cloud hosting

); }