[#30] changed logic to load datas to get all events from calendars
This commit is contained in:
@@ -17,4 +17,5 @@ export interface CalendarEvent {
|
||||
color?: string;
|
||||
allday?: Boolean;
|
||||
error?: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
@@ -18,18 +18,24 @@ export default function ImportAlert() {
|
||||
return (
|
||||
<>
|
||||
{Object.keys(calendars).map((calendarId) =>
|
||||
calendars[calendarId].events
|
||||
.filter((event) => event.error)
|
||||
.map((event) => {
|
||||
const isVisible = visibleAlerts[event.uid] ?? true; // default to visible
|
||||
Object.keys(calendars[calendarId].events)
|
||||
.filter((id) => calendars[calendarId].events[id].error)
|
||||
.map((id) => {
|
||||
const isVisible =
|
||||
visibleAlerts[calendars[calendarId].events[id].uid] ?? true; // default to visible
|
||||
|
||||
return (
|
||||
<Collapse in={isVisible} key={event.uid}>
|
||||
<Collapse
|
||||
in={isVisible}
|
||||
key={calendars[calendarId].events[id].uid}
|
||||
>
|
||||
<Alert
|
||||
severity="error"
|
||||
onClose={() => toggleEventAlert(event.uid)}
|
||||
onClose={() =>
|
||||
toggleEventAlert(calendars[calendarId].events[id].uid)
|
||||
}
|
||||
>
|
||||
{event.error}
|
||||
{calendars[calendarId].events[id].error}
|
||||
</Alert>
|
||||
</Collapse>
|
||||
);
|
||||
|
||||
@@ -9,6 +9,7 @@ export function parseCalendarEvent(
|
||||
calendarid: string
|
||||
): CalendarEvent {
|
||||
const event: Partial<CalendarEvent> = { color, attendee: [] };
|
||||
let recurrenceId;
|
||||
|
||||
for (const [key, params, type, value] of data) {
|
||||
switch (key.toLowerCase()) {
|
||||
@@ -61,8 +62,16 @@ export function parseCalendarEvent(
|
||||
case "sequence":
|
||||
event.sequence = Number(value);
|
||||
break;
|
||||
case "recurrence-id":
|
||||
recurrenceId = value;
|
||||
break;
|
||||
case "status":
|
||||
event.status = String(value);
|
||||
}
|
||||
}
|
||||
if (recurrenceId && event.uid) {
|
||||
event.uid = `${event.uid}/${recurrenceId}`;
|
||||
}
|
||||
|
||||
if (!event.uid || !event.start) {
|
||||
console.error(
|
||||
|
||||
Reference in New Issue
Block a user