66 useOrgBranding ,
77 type OrganizationBranding ,
88} from "@calcom/features/ee/organizations/context/provider" ;
9+ import { useMobileMoreItems } from "./useMobileMoreItems" ;
910import { useIsStandalone } from "@calcom/lib/hooks/useIsStandalone" ;
1011import classNames from "@calcom/ui/classNames" ;
1112import { useHasPaidPlan } from "@calcom/web/modules/billing/hooks/useHasPaidPlan" ;
@@ -14,7 +15,11 @@ import UnconfirmedBookingBadge from "../../bookings/components/UnconfirmedBookin
1415import { KBarTrigger } from "../Kbar" ;
1516import { TeamInviteBadge } from "../TeamInviteBadge" ;
1617import type { NavigationItemType } from "./NavigationItem" ;
17- import { NavigationItem , MobileNavigationItem , MobileNavigationMoreItem } from "./NavigationItem" ;
18+ import {
19+ NavigationItem ,
20+ MobileNavigationItem ,
21+ MobileNavigationMoreItem ,
22+ } from "./NavigationItem" ;
1823
1924export const MORE_SEPARATOR_NAME = "more" ;
2025
@@ -63,7 +68,10 @@ const getNavigationItems = (
6368 moreOnMobile : true ,
6469 isCurrent : ( { pathname : path , item } ) => {
6570 // During Server rendering path is /v2/apps but on client it becomes /apps(weird..)
66- return ( path ?. startsWith ( item . href ) ?? false ) && ! ( path ?. includes ( "routing-forms/" ) ?? false ) ;
71+ return (
72+ ( path ?. startsWith ( item . href ) ?? false ) &&
73+ ! ( path ?. includes ( "routing-forms/" ) ?? false )
74+ ) ;
6775 } ,
6876 child : [
6977 {
@@ -109,7 +117,8 @@ const getNavigationItems = (
109117 name : "insights" ,
110118 href : "/insights" ,
111119 icon : "chart-bar" ,
112- isCurrent : ( { pathname : path , item } ) => path ?. startsWith ( item . href ) ?? false ,
120+ isCurrent : ( { pathname : path , item } ) =>
121+ path ?. startsWith ( item . href ) ?? false ,
113122 moreOnMobile : true ,
114123 child : hasAllInsightsAccess
115124 ? [
@@ -121,18 +130,21 @@ const getNavigationItems = (
121130 {
122131 name : "routing" ,
123132 href : "/insights/routing" ,
124- isCurrent : ( { pathname : path } ) => path ?. startsWith ( "/insights/routing" ) ?? false ,
133+ isCurrent : ( { pathname : path } ) =>
134+ path ?. startsWith ( "/insights/routing" ) ?? false ,
125135 } ,
126136 {
127137 name : "router_position" ,
128138 href : "/insights/router-position" ,
129- isCurrent : ( { pathname : path } ) => path ?. startsWith ( "/insights/router-position" ) ?? false ,
139+ isCurrent : ( { pathname : path } ) =>
140+ path ?. startsWith ( "/insights/router-position" ) ?? false ,
130141 } ,
131142 {
132143 name : "call_history" ,
133144 href : "/insights/call-history" ,
134145 // icon: "phone",
135- isCurrent : ( { pathname : path } ) => path ?. startsWith ( "/insights/call-history" ) ?? false ,
146+ isCurrent : ( { pathname : path } ) =>
147+ path ?. startsWith ( "/insights/call-history" ) ?? false ,
136148 } ,
137149 ]
138150 : [
@@ -205,19 +217,34 @@ const useNavigationItems = (isPlatformNavigation = false) => {
205217 ? getNavigationItems ( orgBranding , hasAllInsightsAccess )
206218 : platformNavigationItems ;
207219
208- const desktopNavigationItems = items . filter ( ( item ) => item . name !== MORE_SEPARATOR_NAME ) ;
220+ const desktopNavigationItems = items . filter (
221+ ( item ) => item . name !== MORE_SEPARATOR_NAME
222+ ) ;
209223 const mobileNavigationBottomItems = items . filter (
210- ( item ) => ( ! item . moreOnMobile && ! item . onlyDesktop ) || item . name === MORE_SEPARATOR_NAME
224+ ( item ) =>
225+ ( ! item . moreOnMobile && ! item . onlyDesktop ) ||
226+ item . name === MORE_SEPARATOR_NAME
211227 ) ;
212228 const mobileNavigationMoreItems = items . filter (
213- ( item ) => item . moreOnMobile && ! item . onlyDesktop && item . name !== MORE_SEPARATOR_NAME
229+ ( item ) =>
230+ item . moreOnMobile &&
231+ ! item . onlyDesktop &&
232+ item . name !== MORE_SEPARATOR_NAME
214233 ) ;
215234
216- return { desktopNavigationItems, mobileNavigationBottomItems, mobileNavigationMoreItems } ;
235+ return {
236+ desktopNavigationItems,
237+ mobileNavigationBottomItems,
238+ mobileNavigationMoreItems,
239+ } ;
217240 } , [ hasPaidPlan , isPending , isPlatformNavigation , orgBranding ] ) ;
218241} ;
219242
220- export const Navigation = ( { isPlatformNavigation = false } : { isPlatformNavigation ?: boolean } ) => {
243+ export const Navigation = ( {
244+ isPlatformNavigation = false ,
245+ } : {
246+ isPlatformNavigation ?: boolean ;
247+ } ) => {
221248 const { desktopNavigationItems } = useNavigationItems ( isPlatformNavigation ) ;
222249
223250 return (
@@ -243,17 +270,23 @@ export function MobileNavigationContainer({
243270 return < MobileNavigation isPlatformNavigation = { isPlatformNavigation } /> ;
244271}
245272
246- const MobileNavigation = ( { isPlatformNavigation = false } : { isPlatformNavigation ?: boolean } ) => {
273+ const MobileNavigation = ( {
274+ isPlatformNavigation = false ,
275+ } : {
276+ isPlatformNavigation ?: boolean ;
277+ } ) => {
247278 const isEmbed = useIsEmbed ( ) ;
248- const { mobileNavigationBottomItems } = useNavigationItems ( isPlatformNavigation ) ;
279+ const { mobileNavigationBottomItems } =
280+ useNavigationItems ( isPlatformNavigation ) ;
249281
250282 return (
251283 < >
252284 < nav
253285 className = { classNames (
254286 "pwa:pb-[max(0.25rem,env(safe-area-inset-bottom))] pwa:-mx-2 bg-cal-muted/40 border-subtle fixed bottom-0 left-0 z-30 flex w-full border-t px-1 shadow backdrop-blur-md md:hidden" ,
255287 isEmbed && "hidden"
256- ) } >
288+ ) }
289+ >
257290 { mobileNavigationBottomItems . map ( ( item ) => (
258291 < MobileNavigationItem key = { item . name } item = { item } />
259292 ) ) }
@@ -266,10 +299,13 @@ const MobileNavigation = ({ isPlatformNavigation = false }: { isPlatformNavigati
266299
267300export const MobileNavigationMoreItems = ( ) => {
268301 const { mobileNavigationMoreItems } = useNavigationItems ( ) ;
302+ const bottomItems = useMobileMoreItems ( ) ;
303+
304+ const allItems = [ ...mobileNavigationMoreItems , ...bottomItems ] ;
269305
270306 return (
271307 < ul className = "border-subtle mt-2 rounded-md border" >
272- { mobileNavigationMoreItems . map ( ( item ) => (
308+ { allItems . map ( ( item ) => (
273309 < MobileNavigationMoreItem key = { item . name } item = { item } />
274310 ) ) }
275311 </ ul >
0 commit comments