Skip to content

Commit 50d4359

Browse files
committed
Add link status tags and Google Docs file types
1 parent 2f985eb commit 50d4359

7 files changed

Lines changed: 33 additions & 8 deletions

File tree

.changeset/link-status-tags.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@plotday/twister": minor
3+
---
4+
5+
Added: optional `tag` field to status definitions in `LinkTypeConfig.statuses` for propagating tags to threads (e.g., `tag: Tag.Done` marks the thread as Done)

connectors/asana/src/asana.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
type NewLinkWithNotes,
88
} from "@plotday/twister";
99
import type { NewContact } from "@plotday/twister/plot";
10+
import { Tag } from "@plotday/twister/tag";
1011
import { Connector } from "@plotday/twister/connector";
1112
import type { ToolBuilder } from "@plotday/twister/tool";
1213
import {
@@ -57,7 +58,7 @@ export class Asana extends Connector<Asana> {
5758
logoMono: "https://api.iconify.design/simple-icons/asana.svg",
5859
statuses: [
5960
{ status: "open", label: "Open" },
60-
{ status: "done", label: "Done" },
61+
{ status: "done", label: "Done", tag: Tag.Done },
6162
],
6263
},
6364
];

connectors/github/src/github.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
type ToolBuilder,
88
} from "@plotday/twister";
99
import type { NewContact } from "@plotday/twister/plot";
10+
import { Tag } from "@plotday/twister/tag";
1011
import { Options } from "@plotday/twister/options";
1112
import {
1213
AuthProvider,
@@ -114,8 +115,8 @@ export class GitHub extends Connector<GitHub> {
114115
logoMono: "https://api.iconify.design/simple-icons/github.svg",
115116
statuses: [
116117
{ status: "open", label: "Open" },
117-
{ status: "closed", label: "Closed" },
118-
{ status: "merged", label: "Merged" },
118+
{ status: "closed", label: "Closed", tag: Tag.Done },
119+
{ status: "merged", label: "Merged", tag: Tag.Done },
119120
],
120121
},
121122
{
@@ -126,7 +127,7 @@ export class GitHub extends Connector<GitHub> {
126127
logoMono: "https://api.iconify.design/simple-icons/github.svg",
127128
statuses: [
128129
{ status: "open", label: "Open" },
129-
{ status: "closed", label: "Closed" },
130+
{ status: "closed", label: "Closed", tag: Tag.Done },
130131
],
131132
},
132133
];

connectors/google-drive/src/google-drive.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ import {
4444
listSharedDrives,
4545
} from "./google-api";
4646

47+
const MIME_TO_LINK_TYPE: Record<string, string> = {
48+
"application/vnd.google-apps.document": "doc",
49+
"application/vnd.google-apps.spreadsheet": "sheet",
50+
"application/vnd.google-apps.presentation": "slide",
51+
"application/vnd.google-apps.form": "form",
52+
};
53+
4754
/**
4855
* Google Drive integration source.
4956
*
@@ -67,7 +74,13 @@ export class GoogleDrive extends Connector<GoogleDrive> {
6774

6875
readonly provider = AuthProvider.Google;
6976
readonly scopes = Integrations.MergeScopes(GoogleDrive.SCOPES, GoogleContacts.SCOPES);
70-
readonly linkTypes = [{ type: "document", label: "Document", logo: "https://api.iconify.design/logos/google-drive.svg", logoMono: "https://api.iconify.design/simple-icons/googledrive.svg" }];
77+
readonly linkTypes = [
78+
{ type: "doc", label: "Document", logo: "https://api.iconify.design/simple-icons/googledocs.svg?color=%234285F4", logoMono: "https://api.iconify.design/simple-icons/googledocs.svg" },
79+
{ type: "sheet", label: "Spreadsheet", logo: "https://api.iconify.design/simple-icons/googlesheets.svg?color=%2334A853", logoMono: "https://api.iconify.design/simple-icons/googlesheets.svg" },
80+
{ type: "slide", label: "Presentation", logo: "https://api.iconify.design/simple-icons/googleslides.svg?color=%23FBBC04", logoMono: "https://api.iconify.design/simple-icons/googleslides.svg" },
81+
{ type: "form", label: "Form", logo: "https://api.iconify.design/simple-icons/googleforms.svg?color=%23673AB7", logoMono: "https://api.iconify.design/simple-icons/googleforms.svg" },
82+
{ type: "document", label: "File", logo: "https://api.iconify.design/logos/google-drive.svg", logoMono: "https://api.iconify.design/simple-icons/googledrive.svg" },
83+
];
7184

7285
build(build: ToolBuilder) {
7386
return {
@@ -693,7 +706,7 @@ export class GoogleDrive extends Connector<GoogleDrive> {
693706

694707
const thread: NewLinkWithNotes = {
695708
source: canonicalSource,
696-
type: "document",
709+
type: MIME_TO_LINK_TYPE[file.mimeType] ?? "document",
697710
title: file.name,
698711
author,
699712
sourceUrl: file.webViewLink ?? null,

connectors/jira/src/jira.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
type NewLinkWithNotes,
77
NewContact,
88
} from "@plotday/twister";
9+
import { Tag } from "@plotday/twister/tag";
910
import { Connector } from "@plotday/twister/connector";
1011
import type { ToolBuilder } from "@plotday/twister/tool";
1112
import {
@@ -57,7 +58,7 @@ export class Jira extends Connector<Jira> {
5758
logoMono: "https://api.iconify.design/simple-icons/jira.svg",
5859
statuses: [
5960
{ status: "open", label: "Open" },
60-
{ status: "done", label: "Done" },
61+
{ status: "done", label: "Done", tag: Tag.Done },
6162
],
6263
},
6364
];

connectors/linear/src/linear.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
type NewLinkWithNotes,
1515
} from "@plotday/twister";
1616
import type { NewContact } from "@plotday/twister/plot";
17+
import { Tag } from "@plotday/twister/tag";
1718
import { Connector } from "@plotday/twister/connector";
1819
import type { ToolBuilder } from "@plotday/twister/tool";
1920
import {
@@ -74,7 +75,7 @@ export class Linear extends Connector<Linear> {
7475
logoMono: "https://api.iconify.design/simple-icons/linear.svg",
7576
statuses: [
7677
{ status: "open", label: "Open" },
77-
{ status: "done", label: "Done" },
78+
{ status: "done", label: "Done", tag: Tag.Done },
7879
],
7980
},
8081
];

twister/src/tools/integrations.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ITool,
77
Serializable,
88
} from "..";
9+
import { Tag } from "../tag";
910
import type { JSONValue } from "../utils/types";
1011
import type { Uuid } from "../utils/uuid";
1112

@@ -45,6 +46,8 @@ export type LinkTypeConfig = {
4546
status: string;
4647
/** Human-readable label (e.g., "Open", "Done") */
4748
label: string;
49+
/** Tag to propagate to thread when this status is active (e.g., Tag.Done) */
50+
tag?: Tag;
4851
}>;
4952
};
5053

0 commit comments

Comments
 (0)