feat: Add Todoist notification list item
This commit is contained in:
@@ -1,21 +1,11 @@
|
||||
import { GoogleMailThreadListItem } from "./GoogleMailThreadListItem";
|
||||
import { NotificationListItemProps } from "../../../notification";
|
||||
import { environment } from "@raycast/api";
|
||||
import { useMemo } from "react";
|
||||
|
||||
export function GoogleMailNotificationListItem({ notification, mutate }: NotificationListItemProps) {
|
||||
const icon = useMemo(() => {
|
||||
if (environment.appearance === "dark") {
|
||||
return "google-mail-logo-light.svg";
|
||||
}
|
||||
return "google-mail-logo-dark.svg";
|
||||
}, [environment]);
|
||||
|
||||
if (notification.metadata.type !== "GoogleMail") return null;
|
||||
|
||||
return (
|
||||
<GoogleMailThreadListItem
|
||||
icon={icon}
|
||||
notification={notification}
|
||||
googleMailThread={notification.metadata.content}
|
||||
mutate={mutate}
|
||||
|
||||
@@ -8,18 +8,12 @@ import { GoogleMailThread } from "../types";
|
||||
import { Page } from "../../../types";
|
||||
|
||||
interface GoogleMailThreadListItemProps {
|
||||
icon: string;
|
||||
notification: Notification;
|
||||
googleMailThread: GoogleMailThread;
|
||||
mutate: MutatePromise<Page<Notification> | undefined>;
|
||||
}
|
||||
|
||||
export function GoogleMailThreadListItem({
|
||||
icon,
|
||||
notification,
|
||||
googleMailThread,
|
||||
mutate,
|
||||
}: GoogleMailThreadListItemProps) {
|
||||
export function GoogleMailThreadListItem({ notification, googleMailThread, mutate }: GoogleMailThreadListItemProps) {
|
||||
const isStarred = googleMailThread.messages.some((message) => message.labelIds?.includes("STARRED"));
|
||||
const isImportant = googleMailThread.messages.some((message) => message.labelIds?.includes("IMPORTANT"));
|
||||
const fromAddress = googleMailThread.messages[0].payload.headers.find((header) => header.name === "From")?.value;
|
||||
@@ -50,7 +44,7 @@ export function GoogleMailThreadListItem({
|
||||
<List.Item
|
||||
key={notification.id}
|
||||
title={notification.title}
|
||||
icon={icon}
|
||||
icon={{ source: { light: "google-mail-logo-dark.svg", dark: "google-mail-logo-light.svg" } }}
|
||||
accessories={accessories}
|
||||
subtitle={subtitle}
|
||||
actions={
|
||||
|
||||
Reference in New Issue
Block a user