feat: Add Google Mail thread list item
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { GithubDiscussion, GithubPullRequest } from "./integrations/github/types";
|
||||
import { GoogleMailThread } from "./integrations/google-mail/types";
|
||||
import { LinearNotification } from "./integrations/linear/types";
|
||||
import { MutatePromise } from "@raycast/utils";
|
||||
import { match, P } from "ts-pattern";
|
||||
import { Page } from "./types";
|
||||
@@ -18,11 +20,14 @@ export interface Notification {
|
||||
details?: NotificationDetails;
|
||||
}
|
||||
|
||||
export type NotificationMetadata = {
|
||||
type: "Github" | "Linear" | "GoogleMail" | "Todoist";
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
content: any;
|
||||
};
|
||||
export type NotificationMetadata =
|
||||
| {
|
||||
type: "Github" | "Todoist";
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
content: any;
|
||||
}
|
||||
| { type: "Linear"; content: LinearNotification }
|
||||
| { type: "GoogleMail"; content: GoogleMailThread };
|
||||
|
||||
export type NotificationDetails =
|
||||
| { type: "GithubPullRequest"; content: GithubPullRequest }
|
||||
@@ -43,8 +48,8 @@ export type NotificationListItemProps = {
|
||||
export function getNotificationHtmlUrl(notification: Notification) {
|
||||
return match(notification)
|
||||
.with(
|
||||
{ details: { type: P.union("GithubPullRequest", "GithubDiscussion") } },
|
||||
() => notification.details.content.url,
|
||||
{ details: { type: P.union("GithubPullRequest", "GithubDiscussion"), content: P.select() } },
|
||||
(notificationDetails) => notificationDetails.url,
|
||||
)
|
||||
.with(
|
||||
{ metadata: { type: "Linear", content: { type: "IssueNotification", content: P.select() } } },
|
||||
@@ -54,6 +59,13 @@ export function getNotificationHtmlUrl(notification: Notification) {
|
||||
{ metadata: { type: "Linear", content: { type: "ProjectNotification", content: P.select() } } },
|
||||
(linearProjectNotification) => linearProjectNotification.project.url,
|
||||
)
|
||||
.with(
|
||||
{ metadata: { type: "GoogleMail", content: P.select() } },
|
||||
(googleMailThread) =>
|
||||
`https://mail.google.com/mail/u/${googleMailThread.user_email_address}/#inbox/${googleMailThread.id}`,
|
||||
)
|
||||
.with({ metadata: { type: "Todoist", content: P.select() } }, () => "")
|
||||
.with({ metadata: { type: "Github" } }, () => "https://github.com")
|
||||
.exhaustive();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user