@@ -56,7 +56,7 @@ export type ResolvedToolbarItem = {
5656} ;
5757
5858export function createConfigurableToolbar ( items : ResolvedToolbarItem [ ] ) : ( props : ToolbarProps ) => ReactElement {
59- return function ConfigurableToolbar ( { label, localizer, onNavigate, onView, view, views } : ToolbarProps ) {
59+ return function ConfigurableToolbar ( { label, localizer, onNavigate, onView, view } : ToolbarProps ) {
6060 const renderButton = (
6161 key : string ,
6262 content : ReactElement | string ,
@@ -75,10 +75,6 @@ export function createConfigurableToolbar(items: ResolvedToolbarItem[]): (props:
7575 </ Button >
7676 ) ;
7777
78- const isViewEnabled = ( name : View ) : boolean => {
79- return Array . isArray ( views ) ? ( views as View [ ] ) . includes ( name ) : true ;
80- } ;
81-
8278 const groups : Record < "left" | "center" | "right" , ResolvedToolbarItem [ ] > = {
8379 left : [ ] ,
8480 center : [ ] ,
@@ -100,9 +96,10 @@ export function createConfigurableToolbar(items: ResolvedToolbarItem[]): (props:
10096 item . tooltip
10197 ) ;
10298 case "today" :
99+ // Always provide a default caption for 'today' button
103100 return renderButton (
104101 "today" ,
105- ( item . caption ?? localizer . messages . today ) as unknown as ReactElement ,
102+ ( item . caption || localizer . messages . today ) as unknown as ReactElement ,
106103 ( ) => onNavigate ( Navigate . TODAY ) ,
107104 false ,
108105 item . renderMode ,
@@ -118,6 +115,7 @@ export function createConfigurableToolbar(items: ResolvedToolbarItem[]): (props:
118115 item . tooltip
119116 ) ;
120117 case "title" :
118+ // Title always shows the formatted label, regardless of caption
121119 return (
122120 < span key = "title" className = "calendar-label" title = { item . tooltip } >
123121 { label }
@@ -129,10 +127,8 @@ export function createConfigurableToolbar(items: ResolvedToolbarItem[]): (props:
129127 case "day" :
130128 case "agenda" : {
131129 const name = item . itemType as View ;
132- if ( ! isViewEnabled ( name ) ) {
133- return null ;
134- }
135- const caption = item . caption ?? localizer . messages [ name ] ;
130+ // Provide default caption from localizer messages if not specified
131+ const caption = item . caption || localizer . messages [ name ] ;
136132 return renderButton (
137133 name ,
138134 caption as unknown as ReactElement ,
0 commit comments