feat: Display Linear notification reason
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Icon, Image, List } from "@raycast/api";
|
||||
import { getAvatarIcon } from "@raycast/utils";
|
||||
import { LinearUser } from "./types";
|
||||
import { match } from "ts-pattern";
|
||||
|
||||
export function getLinearUserAccessory(user?: LinearUser): List.Item.Accessory {
|
||||
if (user) {
|
||||
@@ -11,3 +12,27 @@ export function getLinearUserAccessory(user?: LinearUser): List.Item.Accessory {
|
||||
}
|
||||
return { icon: Icon.Person, tooltip: "Unknown" };
|
||||
}
|
||||
|
||||
export function getLinearNotificationReasonAccessory(notification_type: string): List.Item.Accessory {
|
||||
const reason = match(notification_type)
|
||||
.with("")
|
||||
.with("issueAddedToTriage", () => "Added To Triage")
|
||||
.with("issueAddedToView", () => "Added To View")
|
||||
.with("issueAssignedToYou", () => "Assigned To You")
|
||||
.with("issueBlocking", () => "Blocked")
|
||||
.with("issueCommentMention", () => "Comment Mention")
|
||||
.with("issueCommentReaction", () => "Comment Reaction")
|
||||
.with("issueCreated", () => "Created")
|
||||
.with("issueDue", () => "Due")
|
||||
.with("issueEmojiReaction", () => "Reaction")
|
||||
.with("issueMention", () => "Mention")
|
||||
.with("issueNewComment", () => "New Comment")
|
||||
.with("issueStatusChanged", () => "Status Changed")
|
||||
.with("issueUnassignedFromYou", () => "Unassigned From You")
|
||||
.with("projectAddedAsLead", () => "Added As Lead")
|
||||
.with("projectAddedAsMember", () => "Added As Member")
|
||||
.with("projectUpdateCreated", () => "Update Created")
|
||||
.with("projectUpdateMentionPrompt", () => "Update Mention")
|
||||
.otherwise(() => notification_type);
|
||||
return { tag: { value: reason } };
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { LinearWorkflowStateType, LinearIssueNotification, LinearWorkflowState } from "../types";
|
||||
import { getLinearNotificationReasonAccessory, getLinearUserAccessory } from "../accessories";
|
||||
import { NotificationActions } from "../../../action/NotificationActions";
|
||||
import { LinearIssuePreview } from "../preview/LinearIssuePreview";
|
||||
import { getLinearUserAccessory } from "../accessories";
|
||||
import { Notification } from "../../../notification";
|
||||
import { MutatePromise } from "@raycast/utils";
|
||||
import { Page } from "../../../types";
|
||||
@@ -23,8 +23,10 @@ export function LinearIssueNotificationListItem({
|
||||
|
||||
const state = getLinearIssueStateAccessory(linearIssueNotification.issue.state);
|
||||
const assignee = getLinearUserAccessory(linearIssueNotification.issue.assignee);
|
||||
const reason = getLinearNotificationReasonAccessory(linearIssueNotification.type);
|
||||
|
||||
const accessories: List.Item.Accessory[] = [
|
||||
reason,
|
||||
state,
|
||||
assignee,
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getLinearNotificationReasonAccessory, getLinearUserAccessory } from "../accessories";
|
||||
import { LinearProjectNotification, LinearProjectState, LinearProject } from "../types";
|
||||
import { NotificationActions } from "../../../action/NotificationActions";
|
||||
import { LinearProjectPreview } from "../preview/LinearProjectPreview";
|
||||
import { getLinearUserAccessory } from "../accessories";
|
||||
import { Notification } from "../../../notification";
|
||||
import { MutatePromise } from "@raycast/utils";
|
||||
import { List, Color } from "@raycast/api";
|
||||
@@ -23,8 +23,10 @@ export function LinearProjectNotificationListItem({
|
||||
|
||||
const state = getLinearProjectStateAccessory(linearProjectNotification.project);
|
||||
const lead = getLinearUserAccessory(linearProjectNotification.project.lead);
|
||||
const reason = getLinearNotificationReasonAccessory(linearProjectNotification.type);
|
||||
|
||||
const accessories: List.Item.Accessory[] = [
|
||||
reason,
|
||||
state,
|
||||
lead,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user