feat: add missing integrations and rich notification previews
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.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { getNotificationHtmlUrl, Notification } from "../notification";
|
||||
import { getThirdPartyItemSourceLabel } from "../third_party_item";
|
||||
import { Detail, ActionPanel, Action } from "@raycast/api";
|
||||
import { ReactNode, useMemo } from "react";
|
||||
|
||||
interface PreviewDetailProps {
|
||||
notification: Notification;
|
||||
markdown: string;
|
||||
/** Inner `Detail.Metadata.*` items — rendered below the notification Type row. */
|
||||
metadata?: ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shared wrapper for every notification preview: renders a `Detail` with the
|
||||
* standard "Open in Browser" action, and a metadata sidebar whose first row is
|
||||
* always the notification type, followed by the preview-specific `metadata`.
|
||||
*/
|
||||
export function PreviewDetail({ notification, markdown, metadata }: PreviewDetailProps) {
|
||||
const notificationHtmlUrl = useMemo(() => getNotificationHtmlUrl(notification), [notification]);
|
||||
|
||||
return (
|
||||
<Detail
|
||||
markdown={markdown}
|
||||
metadata={
|
||||
<Detail.Metadata>
|
||||
<Detail.Metadata.Label title="Type" text={getThirdPartyItemSourceLabel(notification.source_item)} />
|
||||
{metadata ? <Detail.Metadata.Separator /> : null}
|
||||
{metadata}
|
||||
</Detail.Metadata>
|
||||
}
|
||||
actions={
|
||||
<ActionPanel>
|
||||
<Action.OpenInBrowser url={notificationHtmlUrl} />
|
||||
</ActionPanel>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user