@@ -166,10 +166,32 @@ export const Filters = () => {
166166 week . currentYear ,
167167 week . currentDay ,
168168 ] ) ;
169+
170+ const setCurrent = useCallback (
171+ ( type : 'day' | 'week' | 'month' ) => ( ) => {
172+ if ( type === 'day' ) {
173+ setDay ( ) ;
174+ } else if ( type === 'week' ) {
175+ setWeek ( ) ;
176+ } else if ( type === 'month' ) {
177+ setMonth ( ) ;
178+ }
179+ } ,
180+ [
181+ week . display ,
182+ week . currentMonth ,
183+ week . currentWeek ,
184+ week . currentYear ,
185+ week . currentDay ,
186+ ]
187+ ) ;
169188 return (
170189 < div className = "text-textColor flex flex-col md:flex-row gap-[8px] items-center select-none" >
171- < div className = "flex flex-grow flex-row" >
172- < div onClick = { previous } className = "cursor-pointer text-textColor rtl:rotate-180" >
190+ < div className = "flex flex-grow flex-row items-center" >
191+ < div
192+ onClick = { previous }
193+ className = "cursor-pointer text-textColor rtl:rotate-180"
194+ >
173195 < svg
174196 xmlns = "http://www.w3.org/2000/svg"
175197 width = "20"
@@ -184,17 +206,17 @@ export const Filters = () => {
184206 </ svg >
185207 </ div >
186208 < div className = "w-[80px] text-center" >
187- { week . display === 'day'
188- ? `${ dayjs ( )
189- . month ( week . currentMonth )
190- . week ( week . currentWeek )
191- . day ( week . currentDay )
192- . format ( 'dddd' ) } `
193- : week . display === 'week'
194- ? t ( 'week_number' , 'Week {{number}}' , { number : week . currentWeek } )
195- : dayjs ( ) . month ( week . currentMonth ) . format ( 'MMMM' ) }
209+ < div
210+ onClick = { setCurrent ( week . display as 'day' | 'week' | 'month' ) }
211+ className = "bg-secondary py-[3px] rounded-[5px] hover:bg-tableBorder transition-all cursor-pointer"
212+ >
213+ Today
214+ </ div >
196215 </ div >
197- < div onClick = { next } className = "cursor-pointer text-textColor rtl:rotate-180" >
216+ < div
217+ onClick = { next }
218+ className = "cursor-pointer text-textColor rtl:rotate-180"
219+ >
198220 < svg
199221 xmlns = "http://www.w3.org/2000/svg"
200222 width = "20"
@@ -208,7 +230,17 @@ export const Filters = () => {
208230 />
209231 </ svg >
210232 </ div >
211- < div className = "flex-1" > { betweenDates } </ div >
233+ < div className = "flex-1" >
234+ { week . display === 'day'
235+ ? `${ dayjs ( )
236+ . month ( week . currentMonth )
237+ . week ( week . currentWeek )
238+ . day ( week . currentDay )
239+ . format ( 'dddd (L)' ) } `
240+ : week . display === 'week'
241+ ? betweenDates
242+ : dayjs ( ) . month ( week . currentMonth ) . format ( 'MMMM YYYY' ) }
243+ </ div >
212244 </ div >
213245 < SelectCustomer
214246 customer = { week . customer as string }
0 commit comments