Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Todoist: Adding Complete Task shortcut preference #16633

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions extensions/todoist/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Todoist Changelog

## [Add Complete Task Shortcut Preferences] - {PR_MERGE_DATE}

- Adding in a preference to set a shortcut for completing a task.

## [Quick Add Task Improvement] - 2024-12-02

Added a pop to the root and cleared the search bar after creating a task for the `close window immediately` preference.
Expand Down
17 changes: 8 additions & 9 deletions extensions/todoist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Check your Todoist tasks from within Raycast and quickly create new ones.

## Create Tasks View

You can quickly access your `Home` command favorites views using deep-links and quick-links. Here's how:
You can quickly access your `Home` command favorites views using deep-links and quick-links. Here's how:

1. Open the `Home` command and select your view in the dropdown (e.g `All Tasks` or a specific project)
2. Search for `Create View Quicklink` in the actions (`⌘` + `K`).
3. Give the quicklink a custom name (optional) and create it (`⌘` + `⏎`).
4. Use Raycast root search to find your new quicklink and quickly access your tasks view.
1. Open the `Home` command and select your view in the dropdown (e.g `All Tasks` or a specific project)
2. Search for `Create View Quicklink` in the actions (`⌘` + `K`).
3. Give the quicklink a custom name (optional) and create it (`⌘` + `⏎`).
4. Use Raycast root search to find your new quicklink and quickly access your tasks view.

This makes it easy to access any of your views, including projects and labels!
This makes it easy to access any of your views, including projects and labels!

## Disabled Commands

Expand All @@ -22,9 +22,8 @@ This extension includes a few commands that are disabled by default. You can ena
- `Create Project`
- `Unfocus Current Task`


## Using the Extension With an API Token

In most cases, you can use OAuth to authenticate with Todoist. You'll be prompted to connect your Todoist account when using any of the extension's commands.
In most cases, you can use OAuth to authenticate with Todoist. You'll be prompted to connect your Todoist account when using any of the extension's commands.

However, if you prefer, you can also use an API token. To do so, you need to retrieve your token from the [integration settings view](https://todoist.com/app/settings/integrations) under the section called **API token**. Copy it and paste in the extension's preferences under **Todoist Token**.
However, if you prefer, you can also use an API token. To do so, you need to retrieve your token from the [integration settings view](https://todoist.com/app/settings/integrations) under the section called **API token**. Copy it and paste in the extension's preferences under **Todoist Token**.
21 changes: 20 additions & 1 deletion extensions/todoist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"gerardcs",
"prince_yadav",
"stelo",
"ridemountainpig"
"ridemountainpig",
"Rob"
],
"commands": [
{
Expand Down Expand Up @@ -245,6 +246,24 @@
"title": "Focus Label",
"description": "Shared label name to apply to your focused task. No label will be applied if left empty.",
"placeholder": "raycast-focus"
},
{
"name": "completeTaskShortcut",
"title": "Complete Task Shortcut",
"description": "Shortcut to complete the current task",
"type": "dropdown",
"required": false,
"default": "shiftCmdE",
"data": [
{
"title": "cmd + enter",
"value": "cmdE"
},
{
"title": "shift + cmd + e",
"value": "shiftCmdE"
}
]
}
],
"dependencies": {
Expand Down
34 changes: 25 additions & 9 deletions extensions/todoist/src/components/TaskActions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { Action, ActionPanel, Color, Icon, Toast, confirmAlert, showToast, useNavigation } from "@raycast/api";
import {
Action,
ActionPanel,
Color,
Icon,
Keyboard,
RobErskine marked this conversation as resolved.
Show resolved Hide resolved
Toast,
confirmAlert,
showToast,
useNavigation,
getPreferenceValues,
} from "@raycast/api";
import { Fragment } from "react";

import {
Expand Down Expand Up @@ -40,6 +51,8 @@ import TaskCommentForm from "./TaskCommentForm";
import TaskComments from "./TaskComments";
import TaskEdit from "./TaskEdit";

const preferences = getPreferenceValues<Preferences>();

type TaskActionsProps = {
task: Task;
fromDetail?: boolean;
Expand Down Expand Up @@ -200,18 +213,28 @@ export default function TaskActions({

return (
<>
<Action
title="Complete Task"
icon={Icon.Checkmark}
shortcut={
preferences.completeTaskShortcut === "shiftCmdE" ? { modifiers: ["cmd", "shift"], key: "e" } : undefined
}
onAction={() => completeTask(task)}
/>

{isTodoistInstalled ? (
<Action.Open
title="Open Task in Todoist"
target={getTaskAppUrl(task.id)}
RobErskine marked this conversation as resolved.
Show resolved Hide resolved
icon="todoist.png"
application="Todoist"
shortcut={Keyboard.Shortcut.Common.Open}
/>
) : (
<Action.OpenInBrowser
title="Open Task in Browser"
url={getTaskUrl(task.id)}
shortcut={{ modifiers: ["cmd"], key: "o" }}
shortcut={Keyboard.Shortcut.Common.Open}
/>
)}

Expand Down Expand Up @@ -245,13 +268,6 @@ export default function TaskActions({
target={<TaskEdit task={task} />}
/>

<Action
title="Complete Task"
icon={Icon.Checkmark}
shortcut={{ modifiers: ["cmd", "shift"], key: "e" }}
onAction={() => completeTask(task)}
/>

<Action.PickDate
title="Schedule Task"
type={Action.PickDate.Type.DateTime}
Expand Down
Loading