add notifications
This commit is contained in:
parent
8dc1d080d8
commit
975dd39437
|
|
@ -1,4 +1,5 @@
|
|||
local curl = require("plenary.curl")
|
||||
local notify = require("snacks.notifier").notify
|
||||
local M = {}
|
||||
|
||||
---@param data table
|
||||
|
|
@ -155,6 +156,7 @@ M._on_tempbuf_write = function(args)
|
|||
M._update_task(data)
|
||||
|
||||
vim.api.nvim_set_option_value("modified", false, { buf = args.buf })
|
||||
local notif_id = notify("updated task #" .. data.id, "info", {title="MrPy", style='fancy'})
|
||||
end
|
||||
|
||||
---@class SelectionItem
|
||||
|
|
@ -168,6 +170,7 @@ end
|
|||
|
||||
---@param item SelectionItem
|
||||
M._on_select_task = function(picker, item)
|
||||
local notif_id = notify("opening task #" .. item.id, "info", {title="MrPy", style='fancy'})
|
||||
local new_name = "[ClickUp] " .. item.name
|
||||
local new_buf_no = vim.api.nvim_create_buf(true, false)
|
||||
|
||||
|
|
@ -248,6 +251,8 @@ end
|
|||
|
||||
---@param data vim.api.keyset.create_user_command.command_args
|
||||
M.select_task = function(data)
|
||||
local notif_id = notify("fetching tasks", "warn", {timeout = 10000, title="MrPy", style='fancy'})
|
||||
vim.schedule(function()
|
||||
local tasks = M.latest_tasks()
|
||||
|
||||
---@type SelectionItem[]
|
||||
|
|
@ -283,6 +288,7 @@ M.select_task = function(data)
|
|||
end
|
||||
end
|
||||
|
||||
require("snacks.notifier").hide(notif_id)
|
||||
require("snacks.picker").pick({
|
||||
title = "Select Task",
|
||||
format = M._item_format,
|
||||
|
|
@ -290,6 +296,7 @@ M.select_task = function(data)
|
|||
confirm = M._on_select_task,
|
||||
items = items
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Reference in New Issue