diff --git a/packages/ui/v2/core/Shell.tsx b/packages/ui/v2/core/Shell.tsx index 8eb538ec7b..f45489da8e 100644 --- a/packages/ui/v2/core/Shell.tsx +++ b/packages/ui/v2/core/Shell.tsx @@ -1,13 +1,13 @@ import type { User } from "@prisma/client"; +import noop from "lodash/noop"; import { signOut, useSession } from "next-auth/react"; import Link from "next/link"; import { NextRouter, useRouter } from "next/router"; -import React, { Fragment, ReactNode, useEffect, useState } from "react"; +import React, { Dispatch, Fragment, ReactNode, SetStateAction, useEffect, useState } from "react"; import { Toaster } from "react-hot-toast"; import dayjs from "@calcom/dayjs"; import { useIsEmbed } from "@calcom/embed-core/embed-iframe"; -import LicenseBanner from "@calcom/features/ee/common/components/LicenseBanner"; import TrialBanner from "@calcom/features/ee/common/components/TrialBanner"; import ImpersonatingBanner from "@calcom/features/ee/impersonation/components/ImpersonatingBanner"; import HelpMenuItem from "@calcom/features/ee/support/components/HelpMenuItem"; @@ -147,6 +147,8 @@ const Layout = (props: LayoutProps) => { ); }; +type DrawerState = [isOpen: boolean, setDrawerOpen: Dispatch>]; + type LayoutProps = { centered?: boolean; title?: string; @@ -155,7 +157,11 @@ type LayoutProps = { children: ReactNode; CTA?: ReactNode; large?: boolean; + SettingsSidebarContainer?: ReactNode; + MobileNavigationContainer?: ReactNode; SidebarContainer?: ReactNode; + TopNavContainer?: ReactNode; + drawerState?: DrawerState; HeadingLeftIcon?: ReactNode; backPath?: string; // renders back button to specified path // use when content needs to expand with flex @@ -679,17 +685,37 @@ export function ShellMain(props: LayoutProps) { ); } -function MainContainer(props: LayoutProps) { +const SettingsSidebarContainerDefault = () => null; + +function MainContainer({ + SettingsSidebarContainer: SettingsSidebarContainerProp = , + MobileNavigationContainer: MobileNavigationContainerProp = , + TopNavContainer: TopNavContainerProp = , + ...props +}: LayoutProps) { + const [sideContainerOpen, setSideContainerOpen] = props.drawerState || [false, noop]; + return (
{/* show top navigation for md and smaller (tablet and phones) */} - + {TopNavContainerProp} + {/* The following is used for settings navigation on medium and smaller screens */} +
{ + setSideContainerOpen(false); + }} + /> + {SettingsSidebarContainerProp}
{!props.withoutMain ? {props.children} : props.children} {/* show bottom navigation for md and smaller (tablet and phones) */} - + {MobileNavigationContainerProp} {/* */}
diff --git a/packages/ui/v2/core/layouts/AdminLayout.tsx b/packages/ui/v2/core/layouts/AdminLayout.tsx index cc30b81af2..48b233546e 100644 --- a/packages/ui/v2/core/layouts/AdminLayout.tsx +++ b/packages/ui/v2/core/layouts/AdminLayout.tsx @@ -9,7 +9,7 @@ export default function AdminLayout({ }: { children: React.ReactNode } & ComponentProps) { return ( -
+
{children}
diff --git a/packages/ui/v2/core/layouts/SettingsLayout.tsx b/packages/ui/v2/core/layouts/SettingsLayout.tsx index 7bb7217b11..917b94e620 100644 --- a/packages/ui/v2/core/layouts/SettingsLayout.tsx +++ b/packages/ui/v2/core/layouts/SettingsLayout.tsx @@ -1,6 +1,8 @@ -import React, { ComponentProps } from "react"; +import React, { ComponentProps, useState } from "react"; +import { classNames } from "@calcom/lib"; import { useLocale } from "@calcom/lib/hooks/useLocale"; +import Button from "@calcom/ui/v2/core/Button"; import { Icon } from "../../../Icon"; import { useMeta } from "../Meta"; @@ -10,7 +12,7 @@ import VerticalTabs, { VerticalTabItem } from "../navigation/tabs/VerticalTabs"; const tabs = [ { name: "my_account", - href: "/settings/profile", + href: "/settings/my-account", icon: Icon.FiUser, children: [ { name: "profile", href: "/settings/my-account/profile" }, @@ -19,7 +21,7 @@ const tabs = [ { name: "conferencing", href: "/settings/my-account/conferencing" }, { name: "appearance", href: "/settings/my-account/appearance" }, // TODO - { name: "referrals", href: "/settings/my-account/referrals" }, + // { name: "referrals", href: "/settings/my-account/referrals" }, ], }, { @@ -47,15 +49,16 @@ const tabs = [ icon: Icon.FiTerminal, children: [ // - { name: "webhooks", href: "/settings/developer" }, - { name: "api_keys", href: "/settings/developer" }, - { name: "embeds", href: "/settings/developer" }, + { name: "webhooks", href: "/settings/developer/webhooks" }, + { name: "api_keys", href: "/settings/developer/api_keys" }, + { name: "embeds", href: "/settings/developer/embeds" }, ], }, { name: "teams", href: "/settings/teams", icon: Icon.FiUsers, + children: [], }, { name: "admin", @@ -71,28 +74,73 @@ const tabs = [ }, ]; +const SettingsSidebarContainer = ({ className = "" }) => { + return ( + + + + ); +}; + +const MobileSettingsContainer = (props: { onSideContainerOpen?: () => void }) => { + const { t } = useLocale(); + + return ( + <> + + + ); +}; + export default function SettingsLayout({ children, ...rest }: { children: React.ReactNode } & ComponentProps) { + const state = useState(false); + const [sideContainerOpen, setSideContainerOpen] = state; return ( - - + SidebarContainer={} + drawerState={state} + MobileNavigationContainer={null} + SettingsSidebarContainer={ +
+ +
+ } + TopNavContainer={ + setSideContainerOpen(!sideContainerOpen)} /> }> -
- - {children} +
+
+ + {children} +
); @@ -104,17 +152,17 @@ function ShellHeader() { const { meta } = useMeta(); const { t, isLocaleReady } = useLocale(); return ( -
-
+
+
{meta.title && isLocaleReady ? ( -

+

{t(meta.title)}

) : (
)} {meta.description && isLocaleReady ? ( -

{t(meta.description)}

+

{t(meta.description)}

) : (
)} diff --git a/packages/ui/v2/core/navigation/tabs/VerticalTabItem.tsx b/packages/ui/v2/core/navigation/tabs/VerticalTabItem.tsx index ce05a702c0..f91447c2c5 100644 --- a/packages/ui/v2/core/navigation/tabs/VerticalTabItem.tsx +++ b/packages/ui/v2/core/navigation/tabs/VerticalTabItem.tsx @@ -68,12 +68,14 @@ const VerticalTabItem: FC = ({ name, href, tabName, info, props.textClassNames || "text-sm font-medium leading-none text-gray-600", "group flex h-14 w-64 flex-row items-center rounded-md px-3 py-[10px] hover:bg-gray-100 group-hover:text-gray-700 [&[aria-current='page']]:bg-gray-200 [&[aria-current='page']]:text-gray-900", props.disabled && "pointer-events-none !opacity-30", - (isChild || !props.icon) && "ml-9 mr-5 w-auto", + (isChild || !props.icon) && "ml-7 mr-5 w-auto", !info ? "h-9" : "h-14", props.className )} aria-current={isCurrent ? "page" : undefined}> - {props.icon && } + {props.icon && ( + + )}

{t(name)}

{info &&

{t(info)}

} diff --git a/packages/ui/v2/core/navigation/tabs/VerticalTabs.tsx b/packages/ui/v2/core/navigation/tabs/VerticalTabs.tsx index f9d71381ed..b7460070e3 100644 --- a/packages/ui/v2/core/navigation/tabs/VerticalTabs.tsx +++ b/packages/ui/v2/core/navigation/tabs/VerticalTabs.tsx @@ -16,7 +16,10 @@ export interface NavTabProps { const NavTabs: FC = ({ tabs, className = "", sticky, ...props }) => { return (