import { Badge, Group, Text, Tooltip } from "@mantine/core"; import classes from "./app-header.module.css"; import React from "react"; import TopMenu from "@/components/layouts/global/top-menu.tsx"; import { Link } from "react-router-dom"; import APP_ROUTE from "@/lib/app-route.ts"; import { useAtom } from "jotai"; import { desktopSidebarAtom, mobileSidebarAtom, } from "@/components/layouts/global/hooks/atoms/sidebar-atom.ts"; import { useToggleSidebar } from "@/components/layouts/global/hooks/hooks/use-toggle-sidebar.ts"; import SidebarToggle from "@/components/ui/sidebar-toggle-button.tsx"; import { useTranslation } from "react-i18next"; import useTrial from "@/ee/hooks/use-trial.tsx"; import { isCloud } from "@/lib/config.ts"; import { SearchControl, SearchMobileControl, } from "@/features/search/components/search-control.tsx"; import { searchSpotlight, shareSearchSpotlight, } from "@/features/search/constants.ts"; import { NotificationPopover } from "@/features/notification/components/notification-popover.tsx"; const links = [{ link: APP_ROUTE.HOME, label: "Home" }]; export function AppHeader() { const { t } = useTranslation(); const [mobileOpened] = useAtom(mobileSidebarAtom); const toggleMobile = useToggleSidebar(mobileSidebarAtom); const [desktopOpened] = useAtom(desktopSidebarAtom); const toggleDesktop = useToggleSidebar(desktopSidebarAtom); const { isTrial, trialDaysLeft } = useTrial(); const isHomeRoute = location.pathname.startsWith("/home"); const isSpacesRoute = location.pathname === "/spaces"; const hideSidebar = isHomeRoute || isSpacesRoute; const items = links.map((link) => ( {t(link.label)} )); return ( <> {!hideSidebar && ( <> )} Docmost {items}
{isCloud() && isTrial && trialDaysLeft !== 0 && ( {trialDaysLeft === 1 ? "1 day left" : `${trialDaysLeft} days left`} )}
); }