feat: Add Linear Project and Team icons

This commit is contained in:
2024-02-05 15:12:44 +01:00
parent 1084559688
commit 8a7eda4f3c
5 changed files with 27 additions and 10 deletions

View File

@@ -2,6 +2,10 @@
## [Unreleased]
### Added
- Add Linear Project and Team icons
## [0.1.3] - 2024-02-05
### Added

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "universal-inbox",
"version": "0.1.0",
"version": "0.1.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "universal-inbox",
"version": "0.1.0",
"version": "0.1.3",
"license": "MIT",
"dependencies": {
"@raycast/api": "^1.65.1",

View File

@@ -15,7 +15,6 @@ export function getLinearUserAccessory(user?: LinearUser): List.Item.Accessory {
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")

View File

@@ -5,8 +5,8 @@ import { LinearIssuePreview } from "../preview/LinearIssuePreview";
import { Notification } from "../../../notification";
import { MutatePromise } from "@raycast/utils";
import { Page } from "../../../types";
import { match, P } from "ts-pattern";
import { List } from "@raycast/api";
import { match } from "ts-pattern";
interface LinearIssueNotificationListItemProps {
notification: Notification;
@@ -19,10 +19,18 @@ export function LinearIssueNotificationListItem({
linearIssueNotification,
mutate,
}: LinearIssueNotificationListItemProps) {
const projectSubtitle = linearIssueNotification.issue.project
? `/ ${linearIssueNotification.issue.project.name} `
: "";
const subtitle = `${linearIssueNotification.issue.team.name} ${projectSubtitle}#${linearIssueNotification.issue.identifier}`;
const projectSubtitle = match(linearIssueNotification.issue.project)
.with({ name: P.select(), icon: P.nullish }, (project_name) => `/ ${project_name}`)
.with(
{ name: P.select("project_name"), icon: P.select("icon") },
({ project_name, icon }) => `/ ${icon} ${project_name}`,
)
.otherwise(() => "");
const teamSubtitle = match(linearIssueNotification.issue.team)
.with({ name: P.select(), icon: P.nullish }, (team_name) => `${team_name}`)
.with({ name: P.select("team_name"), icon: P.select("icon") }, ({ team_name, icon }) => `${icon} ${team_name}`)
.otherwise(() => "");
const subtitle = `${teamSubtitle} ${projectSubtitle} #${linearIssueNotification.issue.identifier}`;
const state = getLinearIssueStateAccessory(linearIssueNotification.issue.state);
const assignee = getLinearUserAccessory(linearIssueNotification.issue.assignee);

View File

@@ -6,7 +6,7 @@ import { Notification } from "../../../notification";
import { MutatePromise } from "@raycast/utils";
import { List, Color } from "@raycast/api";
import { Page } from "../../../types";
import { match } from "ts-pattern";
import { match, P } from "ts-pattern";
interface LinearProjectNotificationListItemProps {
notification: Notification;
@@ -19,7 +19,13 @@ export function LinearProjectNotificationListItem({
linearProjectNotification,
mutate,
}: LinearProjectNotificationListItemProps) {
const subtitle = linearProjectNotification.project.name;
const subtitle = match(linearProjectNotification.project)
.with({ name: P.select(), icon: P.nullish }, (project_name) => `${project_name}`)
.with(
{ name: P.select("project_name"), icon: P.select("icon") },
({ project_name, icon }) => `${icon} ${project_name}`,
)
.otherwise(() => "");
const state = getLinearProjectStateAccessory(linearProjectNotification.project);
const lead = getLinearUserAccessory(linearProjectNotification.project.lead);