feat: Add notification actions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Icon, Image, List } from "@raycast/api";
|
||||
import { GithubActor, getGithubActorName } from "./types";
|
||||
import { Icon, Image, List } from "@raycast/api";
|
||||
|
||||
export function getGithubActorAccessory(actor?: GithubActor): List.Item.Accessory {
|
||||
if (actor) {
|
||||
@@ -1,20 +1,24 @@
|
||||
import { Color, Icon, List } from "@raycast/api";
|
||||
import { NotificationActions } from "../../../NotificationActions";
|
||||
import { Notification } from "../../../types";
|
||||
import { getGithubActorAccessory } from "../misc";
|
||||
import { GithubDiscussion, GithubDiscussionStateReason } from "../types";
|
||||
import { GithubDiscussionPreview } from "../preview/GithubDiscussionPreview";
|
||||
import { NotificationActions } from "../../../action/NotificationActions";
|
||||
import { GithubDiscussion, GithubDiscussionStateReason } from "../types";
|
||||
import { getGithubActorAccessory } from "../accessories";
|
||||
import { Notification } from "../../../notification";
|
||||
import { Color, Icon, List } from "@raycast/api";
|
||||
import { MutatePromise } from "@raycast/utils";
|
||||
import { Page } from "../../../types";
|
||||
|
||||
interface GithubDiscussionNotificationListItemProps {
|
||||
icon: string;
|
||||
notification: Notification;
|
||||
githubDiscussion: GithubDiscussion;
|
||||
mutate: MutatePromise<Page<Notification> | undefined>;
|
||||
}
|
||||
|
||||
export function GithubDiscussionNotificationListItem({
|
||||
icon,
|
||||
notification,
|
||||
githubDiscussion,
|
||||
mutate,
|
||||
}: GithubDiscussionNotificationListItemProps) {
|
||||
const subtitle = `${githubDiscussion.repository.name_with_owner}`;
|
||||
|
||||
@@ -48,6 +52,7 @@ export function GithubDiscussionNotificationListItem({
|
||||
<NotificationActions
|
||||
notification={notification}
|
||||
detailsTarget={<GithubDiscussionPreview notification={notification} githubDiscussion={githubDiscussion} />}
|
||||
mutate={mutate}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { GithubPullRequestNotificationListItem } from "./GithubPullRequestNotificationListItem";
|
||||
import { GithubDiscussionNotificationListItem } from "./GithubDiscussionNotificationListItem";
|
||||
import { NotificationListItemProps } from "../../../notification";
|
||||
import { environment } from "@raycast/api";
|
||||
import { useMemo } from "react";
|
||||
import { NotificationListItemProps } from "../../types";
|
||||
import { GithubDiscussionNotificationListItem } from "./listitem/GithubDiscussionNotificationListItem";
|
||||
import { GithubPullRequestNotificationListItem } from "./listitem/GithubPullRequestNotificationListItem";
|
||||
|
||||
export function GithubNotificationListItem({ notification }: NotificationListItemProps) {
|
||||
export function GithubNotificationListItem({ notification, mutate }: NotificationListItemProps) {
|
||||
const icon = useMemo(() => {
|
||||
if (environment.appearance === "dark") {
|
||||
return "github-logo-light.svg";
|
||||
@@ -19,6 +19,7 @@ export function GithubNotificationListItem({ notification }: NotificationListIte
|
||||
icon={icon}
|
||||
notification={notification}
|
||||
githubPullRequest={notification.details.content}
|
||||
mutate={mutate}
|
||||
/>
|
||||
);
|
||||
case "GithubDiscussion":
|
||||
@@ -27,6 +28,7 @@ export function GithubNotificationListItem({ notification }: NotificationListIte
|
||||
icon={icon}
|
||||
notification={notification}
|
||||
githubDiscussion={notification.details.content}
|
||||
mutate={mutate}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
@@ -1,7 +1,3 @@
|
||||
import { Color, Icon, List } from "@raycast/api";
|
||||
import { NotificationActions } from "../../../NotificationActions";
|
||||
import { Notification } from "../../../types";
|
||||
import { GithubPullRequestPreview } from "../preview/GithubPullRequestPreview";
|
||||
import {
|
||||
GithubPullRequestState,
|
||||
GithubPullRequestReviewDecision,
|
||||
@@ -11,18 +7,26 @@ import {
|
||||
GithubCheckStatusState,
|
||||
GithubCheckSuite,
|
||||
} from "../types";
|
||||
import { getGithubActorAccessory } from "../misc";
|
||||
import { GithubPullRequestPreview } from "../preview/GithubPullRequestPreview";
|
||||
import { NotificationActions } from "../../../action/NotificationActions";
|
||||
import { getGithubActorAccessory } from "../accessories";
|
||||
import { Notification } from "../../../notification";
|
||||
import { Color, Icon, List } from "@raycast/api";
|
||||
import { MutatePromise } from "@raycast/utils";
|
||||
import { Page } from "../../../types";
|
||||
|
||||
interface GithubPullRequestNotificationListItemProps {
|
||||
icon: string;
|
||||
notification: Notification;
|
||||
githubPullRequest: GithubPullRequest;
|
||||
mutate: MutatePromise<Page<Notification> | undefined>;
|
||||
}
|
||||
|
||||
export function GithubPullRequestNotificationListItem({
|
||||
icon,
|
||||
notification,
|
||||
githubPullRequest,
|
||||
mutate,
|
||||
}: GithubPullRequestNotificationListItemProps) {
|
||||
const subtitle = `${githubPullRequest.head_repository?.name_with_owner} #${githubPullRequest.number}`;
|
||||
|
||||
@@ -67,6 +71,7 @@ export function GithubPullRequestNotificationListItem({
|
||||
<NotificationActions
|
||||
notification={notification}
|
||||
detailsTarget={<GithubPullRequestPreview notification={notification} githubPullRequest={githubPullRequest} />}
|
||||
mutate={mutate}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Notification, getNotificationHtmlUrl } from "../../../notification";
|
||||
import { Detail, ActionPanel, Action } from "@raycast/api";
|
||||
import { Notification } from "../../../types";
|
||||
import { GithubDiscussion } from "../types";
|
||||
import { useMemo } from "react";
|
||||
import { getNotificationHtmlUrl } from "../../../notification";
|
||||
|
||||
interface GithubDiscussionPreviewProps {
|
||||
notification: Notification;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Notification, getNotificationHtmlUrl } from "../../../notification";
|
||||
import { Detail, ActionPanel, Action } from "@raycast/api";
|
||||
import { Notification } from "../../../types";
|
||||
import { GithubPullRequest } from "../types";
|
||||
import { useMemo } from "react";
|
||||
import { getNotificationHtmlUrl } from "../../../notification";
|
||||
|
||||
interface GithubPullRequestPreviewProps {
|
||||
notification: Notification;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { NotificationActions } from "../../action/NotificationActions";
|
||||
import { NotificationListItemProps } from "../../notification";
|
||||
import { Detail, List, environment } from "@raycast/api";
|
||||
import { useMemo } from "react";
|
||||
import { NotificationActions } from "../../NotificationActions";
|
||||
import { NotificationListItemProps } from "../../types";
|
||||
|
||||
export function GoogleMailNotificationListItem({ notification }: NotificationListItemProps) {
|
||||
export function GoogleMailNotificationListItem({ notification, mutate }: NotificationListItemProps) {
|
||||
const icon = useMemo(() => {
|
||||
if (environment.appearance === "dark") {
|
||||
return "google-mail-logo-light.svg";
|
||||
@@ -18,7 +18,11 @@ export function GoogleMailNotificationListItem({ notification }: NotificationLis
|
||||
icon={icon}
|
||||
subtitle={`#${notification.source_id}`}
|
||||
actions={
|
||||
<NotificationActions notification={notification} detailsTarget={<Detail markdown="# To be implemented 👋" />} />
|
||||
<NotificationActions
|
||||
notification={notification}
|
||||
detailsTarget={<Detail markdown="# To be implemented 👋" />}
|
||||
mutate={mutate}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { NotificationActions } from "../../action/NotificationActions";
|
||||
import { NotificationListItemProps } from "../../notification";
|
||||
import { Detail, List, environment } from "@raycast/api";
|
||||
import { useMemo } from "react";
|
||||
import { NotificationActions } from "../../NotificationActions";
|
||||
import { NotificationListItemProps } from "../../types";
|
||||
|
||||
export function LinearNotificationListItem({ notification }: NotificationListItemProps) {
|
||||
export function LinearNotificationListItem({ notification, mutate }: NotificationListItemProps) {
|
||||
const icon = useMemo(() => {
|
||||
if (environment.appearance === "dark") {
|
||||
return "linear-logo-light.svg";
|
||||
@@ -18,7 +18,11 @@ export function LinearNotificationListItem({ notification }: NotificationListIte
|
||||
icon={icon}
|
||||
subtitle={`#${notification.source_id}`}
|
||||
actions={
|
||||
<NotificationActions notification={notification} detailsTarget={<Detail markdown="# To be implemented 👋" />} />
|
||||
<NotificationActions
|
||||
notification={notification}
|
||||
detailsTarget={<Detail markdown="# To be implemented 👋" />}
|
||||
mutate={mutate}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { NotificationTaskActions } from "../../action/NotificationTaskActions";
|
||||
import { NotificationListItemProps } from "../../notification";
|
||||
import { Detail, List, environment } from "@raycast/api";
|
||||
import { useMemo } from "react";
|
||||
import { NotificationTaskActions } from "../../NotificationTaskActions";
|
||||
import { NotificationListItemProps } from "../../types";
|
||||
|
||||
export function TodoistNotificationListItem({ notification }: NotificationListItemProps) {
|
||||
export function TodoistNotificationListItem({ notification, mutate }: NotificationListItemProps) {
|
||||
const icon = useMemo(() => {
|
||||
if (environment.appearance === "dark") {
|
||||
return "todoist-icon-light.svg";
|
||||
@@ -21,6 +21,7 @@ export function TodoistNotificationListItem({ notification }: NotificationListIt
|
||||
<NotificationTaskActions
|
||||
notification={notification}
|
||||
detailsTarget={<Detail markdown="# To be implemented 👋" />}
|
||||
mutate={mutate}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user