Skip to content

Commit 05fa7bf

Browse files
committed
plugin settings: add default add task action setting
1 parent ef8eec4 commit 05fa7bf

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

plugin/src/i18n/langs/en.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ export const en: Translations = {
8787
deletedWarning: "This label no longer exists",
8888
deleted: "deleted",
8989
},
90+
defaultAddTaskAction: {
91+
label: "Default add task action",
92+
description: "The default action when clicking the Add task button",
93+
options: {
94+
add: "Add task",
95+
addCopyApp: "Add task and copy link (app)",
96+
addCopyWeb: "Add task and copy link (web)",
97+
},
98+
},
9099
},
91100
advanced: {
92101
header: "Advanced",

plugin/src/i18n/translation.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ export type Translations = {
8383
deletedWarning: string;
8484
deleted: string;
8585
};
86+
defaultAddTaskAction: {
87+
label: string;
88+
description: string;
89+
options: {
90+
add: string;
91+
addCopyApp: string;
92+
addCopyWeb: string;
93+
};
94+
};
8695
};
8796
advanced: {
8897
header: string;

plugin/src/settings.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { create } from "zustand";
22

33
export type AddPageLinkSetting = "off" | "description" | "content";
44

5+
export type AddTaskAction = "add" | "add-copy-app" | "add-copy-web";
6+
57
export type DueDateDefaultSetting = "none" | "today" | "tomorrow";
68

79
export type ProjectDefaultSetting = {
@@ -33,6 +35,8 @@ const defaultSettings: Settings = {
3335

3436
taskCreationDefaultLabels: [],
3537

38+
defaultAddTaskAction: "add",
39+
3640
debugLogging: false,
3741
};
3842

@@ -56,6 +60,8 @@ export type Settings = {
5660

5761
taskCreationDefaultLabels: LabelsDefaultSetting;
5862

63+
defaultAddTaskAction: AddTaskAction;
64+
5965
debugLogging: boolean;
6066
};
6167

plugin/src/ui/settings/index.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,33 @@ const SettingsRoot: React.FC<Props> = ({ plugin }) => {
228228
onChange={mkOptionUpdate("taskCreationDefaultLabels")}
229229
/>
230230
</Setting.Root>
231+
<Setting.Root
232+
name={i18n.taskCreation.defaultAddTaskAction.label}
233+
description={i18n.taskCreation.defaultAddTaskAction.description}
234+
>
235+
<Setting.DropdownControl
236+
value={settings.defaultAddTaskAction}
237+
options={[
238+
{
239+
label: i18n.taskCreation.defaultAddTaskAction.options.add,
240+
value: "add",
241+
},
242+
{
243+
label: i18n.taskCreation.defaultAddTaskAction.options.addCopyApp,
244+
value: "add-copy-app",
245+
},
246+
{
247+
label: i18n.taskCreation.defaultAddTaskAction.options.addCopyWeb,
248+
value: "add-copy-web",
249+
},
250+
]}
251+
onClick={async (val) => {
252+
await plugin.writeOptions({
253+
defaultAddTaskAction: val,
254+
});
255+
}}
256+
/>
257+
</Setting.Root>
231258

232259
<h2>{i18n.advanced.header}</h2>
233260
<Setting.Root

0 commit comments

Comments
 (0)