Add TickTick, Google Calendar, Google Drive and API (WebPage) notification types, which the backend already supported but the extension ignored. Fill the previously empty notification previews with content modeled on the web app: a metadata sidebar (status, priority, assignee, labels, dates, channel, etc.) plus a markdown body and comment/message threads. Add shared helpers: PreviewDetail wrapper, TaskMetadata, Slack mrkdwn renderer, GitHub check/review emoji, and date/HTML utils (cleanHtml strips raw HTML from GitHub bodies). The preview metadata "Type" row shows the source item type (Linear Issue, GitHub Pull Request, Slack Thread, etc.). Swap list-screen shortcuts: Enter shows details, Cmd+Enter opens in browser.
60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
import { GoogleCalendarEventPreview } from "../preview/GoogleCalendarEventPreview";
|
|
import { GoogleCalendarEvent, getEventStartDisplay, getMeetLink } from "../types";
|
|
import { NotificationActions } from "../../../action/NotificationActions";
|
|
import { NotificationListItemProps } from "../../../notification";
|
|
import { Icon, Color, List } from "@raycast/api";
|
|
|
|
export function GoogleCalendarNotificationListItem({ notification, mutate }: NotificationListItemProps) {
|
|
if (notification.source_item.data.type !== "GoogleCalendarEvent") return null;
|
|
|
|
const event: GoogleCalendarEvent = notification.source_item.data.content;
|
|
const subtitle = getEventStartDisplay(event);
|
|
const meetLink = getMeetLink(event);
|
|
|
|
const accessories: List.Item.Accessory[] = [
|
|
{
|
|
date: new Date(notification.updated_at),
|
|
tooltip: `Updated at ${notification.updated_at}`,
|
|
},
|
|
];
|
|
|
|
if (event.attendees.length > 0) {
|
|
accessories.unshift({
|
|
text: `${event.attendees.length}`,
|
|
icon: Icon.Person,
|
|
tooltip: `${event.attendees.length} attendee(s)`,
|
|
});
|
|
}
|
|
|
|
if (meetLink) {
|
|
accessories.unshift({
|
|
icon: { source: Icon.Video, tintColor: Color.Green },
|
|
tooltip: "Google Meet link available",
|
|
});
|
|
}
|
|
|
|
if (event.status === "cancelled") {
|
|
accessories.unshift({
|
|
icon: { source: Icon.XMarkCircle, tintColor: Color.Red },
|
|
tooltip: "Cancelled",
|
|
});
|
|
}
|
|
|
|
return (
|
|
<List.Item
|
|
key={notification.id}
|
|
title={notification.title}
|
|
icon={Icon.Calendar}
|
|
subtitle={subtitle}
|
|
accessories={accessories}
|
|
actions={
|
|
<NotificationActions
|
|
notification={notification}
|
|
detailsTarget={<GoogleCalendarEventPreview notification={notification} event={event} />}
|
|
mutate={mutate}
|
|
/>
|
|
}
|
|
/>
|
|
);
|
|
}
|