@@ -10,7 +10,7 @@ import type { EventResizeDoneArg } from '@fullcalendar/interaction';
1010import interactionPlugin from '@fullcalendar/interaction' ;
1111import FullCalendar from '@fullcalendar/react' ;
1212import { FieldKeyType } from '@teable/core' ;
13- import { ChevronLeft , ChevronRight , Calendar as CalendarIcon } from '@teable/icons' ;
13+ import { ChevronLeft , ChevronRight , Calendar as CalendarIcon , Loader2 } from '@teable/icons' ;
1414import { updateRecord } from '@teable/openapi' ;
1515import { AppContext , CalendarDailyCollectionContext } from '@teable/sdk/context' ;
1616import { useTableId } from '@teable/sdk/hooks' ;
@@ -25,6 +25,7 @@ import {
2525 PopoverContent ,
2626 PopoverTrigger ,
2727 Calendar as DatePicker ,
28+ cn ,
2829} from '@teable/ui-lib/shadcn' ;
2930import { addDays , format } from 'date-fns' ;
3031import { enUS , zhCN , ja , ru , fr } from 'date-fns/locale' ;
@@ -34,7 +35,7 @@ import { tableConfig } from '@/features/i18n/table.config';
3435import { EventListContainer } from '../components/EventListContainer' ;
3536import { EventMenu } from '../components/EventMenu' ;
3637import { useCalendar , useEventMenuStore } from '../hooks' ;
37- import { getColorByConfig } from '../util' ;
38+ import { getColorByConfig , getEventTitle } from '../util' ;
3839
3940const ADD_EVENT_BUTTON_CLASS_NAME = 'calendar-add-event-button' ;
4041const MORE_LINK_TEXT_CLASS_NAME = 'calendar-custom-more-link-text' ;
@@ -203,6 +204,7 @@ export const Calendar = (props: ICalendarProps) => {
203204 } ) ;
204205 } ;
205206
207+ const isLoading = ! calendarDailyCollection ;
206208 const { countMap, records = [ ] } = calendarDailyCollection ?? { } ;
207209
208210 const events = useMemo ( ( ) => {
@@ -222,8 +224,12 @@ export const Calendar = (props: ICalendarProps) => {
222224
223225 return {
224226 id : r . id ,
225- title : titleField . cellValue2String ( title ) || t ( 'untitled' ) ,
226- start : startDateField . cellValue2String ( start ) ,
227+ title : getEventTitle (
228+ titleField . cellValue2String ( title ) || t ( 'sdk:common.unnamedRecord' ) ,
229+ start as string ,
230+ startDateField
231+ ) ,
232+ start,
227233 end : end ? addDays ( new Date ( end as string ) , 1 ) . toISOString ( ) : undefined ,
228234 textColor,
229235 backgroundColor,
@@ -372,8 +378,14 @@ export const Calendar = (props: ICalendarProps) => {
372378 < div className = "relative flex size-full flex-col overflow-hidden p-4 pt-2" ref = { containerRef } >
373379 < div className = "mb-2 flex items-center justify-between" >
374380 < div className = "flex items-center gap-2" >
375- < h2 className = "text-xl font-semibold" >
381+ < h2 className = "flex items-center text-xl font-semibold" >
376382 { title || calendarRef . current ?. getApi ( ) . view . title }
383+ < Loader2
384+ className = { cn (
385+ 'ml-1 size-5 animate-spin transition-opacity duration-1000' ,
386+ isLoading ? 'opacity-100' : 'opacity-0'
387+ ) }
388+ />
377389 </ h2 >
378390 </ div >
379391 < div className = "flex items-center gap-2" >
0 commit comments