* banners * useAuthHooks * fixes to redirect and banner * extract useIntercom to custom hook * use app theme * extract user-dropdown to new component * Navigation Item * navigation and profile dropdown * Fix import * navigation and sidebar * fix type errors * fix banners being an async call * fix types * fix banner prop type * fix mobile nav item import * fix banner types * (revert) layout banner render method to fix type error --------- Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
import { useSession } from "next-auth/react";
|
|
import Link from "next/link";
|
|
|
|
import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
|
|
import { KBarTrigger } from "@calcom/features/kbar/Kbar";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { Icon, Logo } from "@calcom/ui";
|
|
|
|
import { UserDropdown } from "./user-dropdown/UserDropdown";
|
|
|
|
export function TopNavContainer() {
|
|
const { status } = useSession();
|
|
if (status !== "authenticated") return null;
|
|
return <TopNav />;
|
|
}
|
|
|
|
function TopNav() {
|
|
const isEmbed = useIsEmbed();
|
|
const { t } = useLocale();
|
|
return (
|
|
<>
|
|
<nav
|
|
style={isEmbed ? { display: "none" } : {}}
|
|
className="bg-muted border-subtle sticky top-0 z-40 flex w-full items-center justify-between border-b bg-opacity-50 px-4 py-1.5 backdrop-blur-lg sm:p-4 md:hidden">
|
|
<Link href="/event-types">
|
|
<Logo />
|
|
</Link>
|
|
<div className="flex items-center gap-2 self-center">
|
|
<span className="hover:bg-muted hover:text-emphasis text-default group flex items-center rounded-full text-sm font-medium transition lg:hidden">
|
|
<KBarTrigger />
|
|
</span>
|
|
<button className="hover:bg-muted hover:text-subtle text-muted rounded-full p-1 transition focus:outline-none focus:ring-2 focus:ring-black focus:ring-offset-2">
|
|
<span className="sr-only">{t("settings")}</span>
|
|
<Link href="/settings/my-account/profile">
|
|
<Icon name="settings" className="text-default h-4 w-4" aria-hidden="true" />
|
|
</Link>
|
|
</button>
|
|
<UserDropdown small />
|
|
</div>
|
|
</nav>
|
|
</>
|
|
);
|
|
}
|