Skip to content

Commit 5446cf7

Browse files
committed
Add thread types
1 parent 94769df commit 5446cf7

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

.changeset/thread-type.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: `ThreadType` type and `type` field on `Thread`, `NewThread`, and `ThreadUpdate` for setting thread sub-type/category

twister/src/plot.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,21 @@ export type ThreadMeta = {
336336
[key: string]: JSONValue;
337337
};
338338

339+
/**
340+
* Thread sub-type that determines the thread's icon and category.
341+
* Available types depend on whether the priority is shared:
342+
* - Private priorities: "notes" (default), "idea", "goal", "decision"
343+
* - Shared priorities: all above plus "discussion" (default), "announcement", "ask"
344+
*/
345+
export type ThreadType =
346+
| "notes"
347+
| "idea"
348+
| "goal"
349+
| "decision"
350+
| "discussion"
351+
| "announcement"
352+
| "ask";
353+
339354
/**
340355
* Tags on an item, along with the actors who added each tag.
341356
*/
@@ -379,6 +394,8 @@ type ThreadFields = ThreadCommon & {
379394
title: string;
380395
/** The priority context this thread belongs to */
381396
priority: Priority;
397+
/** The thread's sub-type/category. Determines the displayed icon. */
398+
type: ThreadType | null;
382399
/** The schedule associated with this thread, if any */
383400
schedule?: Schedule;
384401
/** Source-specific metadata from the thread's link, populated on callbacks */
@@ -467,6 +484,12 @@ export type NewThread = Partial<
467484
*/
468485
tags?: NewTags;
469486

487+
/**
488+
* The thread's sub-type/category. Sets the thread's icon.
489+
* If omitted, defaults to "notes" (private) or "discussion" (shared).
490+
*/
491+
type?: ThreadType;
492+
470493
/**
471494
* Whether the thread should be marked as unread for users.
472495
* - undefined/omitted (default): Thread is unread for users, except auto-marked
@@ -533,6 +556,11 @@ type ThreadSingleUpdateFields = ThreadBulkUpdateFields & {
533556
*/
534557
twistTags?: Partial<Record<Tag, boolean>>;
535558

559+
/**
560+
* Update the thread's sub-type/category.
561+
*/
562+
type?: ThreadType;
563+
536564
/**
537565
* Optional preview content for the thread. Can be Markdown formatted.
538566
* The preview will be automatically generated from this content (truncated to 100 chars).

0 commit comments

Comments
 (0)