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:
+55
-1
@@ -12,7 +12,11 @@ import {
|
||||
LinearIssue,
|
||||
LinearNotification,
|
||||
} from "./integrations/linear/types";
|
||||
import { getGoogleCalendarEventHtmlUrl, GoogleCalendarEvent } from "./integrations/google-calendar/types";
|
||||
import { getGoogleDriveCommentHtmlUrl, GoogleDriveComment } from "./integrations/google-drive/types";
|
||||
import { getGithubNotificationHtmlUrl, GithubNotification } from "./integrations/github/types";
|
||||
import { getTickTickItemHtmlUrl, TickTickItem } from "./integrations/ticktick/types";
|
||||
import { getWebPageHtmlUrl, WebPage } from "./integrations/api/types";
|
||||
import { GoogleMailThread } from "./integrations/google-mail/types";
|
||||
import { TodoistItem } from "./integrations/todoist/types";
|
||||
|
||||
@@ -28,13 +32,55 @@ export interface ThirdPartyItem {
|
||||
|
||||
export type ThirdPartyItemData =
|
||||
| { type: "TodoistItem"; content: TodoistItem }
|
||||
| { type: "TickTickItem"; content: TickTickItem }
|
||||
| { type: "SlackStar"; content: SlackStar }
|
||||
| { type: "SlackReaction"; content: SlackReaction }
|
||||
| { type: "SlackThread"; content: SlackThread }
|
||||
| { type: "LinearIssue"; content: LinearIssue }
|
||||
| { type: "LinearNotification"; content: LinearNotification }
|
||||
| { type: "GithubNotification"; content: GithubNotification }
|
||||
| { type: "GoogleMailThread"; content: GoogleMailThread };
|
||||
| { type: "GoogleMailThread"; content: GoogleMailThread }
|
||||
| { type: "GoogleCalendarEvent"; content: GoogleCalendarEvent }
|
||||
| { type: "GoogleDriveComment"; content: GoogleDriveComment }
|
||||
| { type: "WebPage"; content: WebPage };
|
||||
|
||||
/** Human-readable label for the notification's source item type (e.g. "Linear Issue", "GitHub Pull Request"). */
|
||||
export function getThirdPartyItemSourceLabel(thirdPartyItem: ThirdPartyItem): string {
|
||||
switch (thirdPartyItem.data.type) {
|
||||
case "TodoistItem":
|
||||
return "Todoist Task";
|
||||
case "TickTickItem":
|
||||
return "TickTick Task";
|
||||
case "SlackStar":
|
||||
return "Slack Star";
|
||||
case "SlackReaction":
|
||||
return "Slack Reaction";
|
||||
case "SlackThread":
|
||||
return "Slack Thread";
|
||||
case "LinearIssue":
|
||||
return "Linear Issue";
|
||||
case "LinearNotification":
|
||||
return thirdPartyItem.data.content.type === "ProjectNotification" ? "Linear Project" : "Linear Issue";
|
||||
case "GithubNotification": {
|
||||
switch (thirdPartyItem.data.content.item?.type) {
|
||||
case "GithubPullRequest":
|
||||
return "GitHub Pull Request";
|
||||
case "GithubDiscussion":
|
||||
return "GitHub Discussion";
|
||||
default:
|
||||
return "GitHub";
|
||||
}
|
||||
}
|
||||
case "GoogleMailThread":
|
||||
return "Google Mail";
|
||||
case "GoogleCalendarEvent":
|
||||
return "Google Calendar Event";
|
||||
case "GoogleDriveComment":
|
||||
return "Google Drive Comment";
|
||||
case "WebPage":
|
||||
return "Web Page";
|
||||
}
|
||||
}
|
||||
|
||||
export function getThirdPartyItemHtmlUrl(thirdPartyItem: ThirdPartyItem): string {
|
||||
switch (thirdPartyItem.data.type) {
|
||||
@@ -54,5 +100,13 @@ export function getThirdPartyItemHtmlUrl(thirdPartyItem: ThirdPartyItem): string
|
||||
return getGithubNotificationHtmlUrl(thirdPartyItem.data.content);
|
||||
case "GoogleMailThread":
|
||||
return `https://mail.google.com/mail/u/0/#inbox/${thirdPartyItem.data.content.id}`;
|
||||
case "TickTickItem":
|
||||
return getTickTickItemHtmlUrl(thirdPartyItem.data.content);
|
||||
case "GoogleCalendarEvent":
|
||||
return getGoogleCalendarEventHtmlUrl(thirdPartyItem.data.content);
|
||||
case "GoogleDriveComment":
|
||||
return getGoogleDriveCommentHtmlUrl(thirdPartyItem.data.content);
|
||||
case "WebPage":
|
||||
return getWebPageHtmlUrl(thirdPartyItem.data.content);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user