Agenda refactor
This commit is contained in:
parent
4c3e466d9f
commit
16757ea90e
@ -1149,11 +1149,21 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
|
||||
};
|
||||
|
||||
const getCalendarDisplayName = (calendar: CalendarWithMission) => {
|
||||
// If calendar is synced to an external account, always show the account name
|
||||
// (same logic as in courrier page: display_name || email)
|
||||
// If calendar is synced to an external account, show provider name + account name
|
||||
if (calendar.syncConfig?.syncEnabled && calendar.syncConfig?.mailCredential) {
|
||||
return calendar.syncConfig.mailCredential.display_name ||
|
||||
calendar.syncConfig.mailCredential.email;
|
||||
const provider = calendar.syncConfig.provider;
|
||||
const accountName = calendar.syncConfig.mailCredential.display_name ||
|
||||
calendar.syncConfig.mailCredential.email;
|
||||
|
||||
// Add provider prefix to distinguish Infomaniak from Microsoft
|
||||
if (provider === 'infomaniak') {
|
||||
return `Infomaniak (${accountName})`;
|
||||
} else if (provider === 'microsoft') {
|
||||
return `Microsoft (${accountName})`;
|
||||
} else {
|
||||
// Fallback for unknown providers
|
||||
return accountName;
|
||||
}
|
||||
}
|
||||
|
||||
// For non-synced calendars, use the calendar name
|
||||
@ -1178,13 +1188,15 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="w-3 h-3 rounded-full"
|
||||
className="w-3 h-3 rounded-full flex-shrink-0"
|
||||
style={{ backgroundColor: calendar.color }}
|
||||
/>
|
||||
<span className="flex items-center gap-1">
|
||||
{getCalendarDisplayName(calendar as CalendarWithMission)}
|
||||
<span className="flex items-center gap-1 min-w-0 flex-1">
|
||||
<span className="truncate">
|
||||
{getCalendarDisplayName(calendar as CalendarWithMission)}
|
||||
</span>
|
||||
{calendar.syncConfig?.syncEnabled && (
|
||||
<Badge variant="outline" className="text-[10px] px-1 py-0.5 border-blue-400 text-blue-600">
|
||||
<Badge variant="outline" className="text-[10px] px-1 py-0.5 border-blue-400 text-blue-600 flex-shrink-0">
|
||||
Sync
|
||||
</Badge>
|
||||
)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user