Skip to content

Commit

Permalink
perf: send to todoist uses emoji for link to logseq
Browse files Browse the repository at this point in the history
  • Loading branch information
benjypng committed Nov 15, 2023
1 parent 7c85d5a commit 567ee72
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/features/send/components/SendTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { sendTask } from "..";
import { useState } from "preact/hooks";
import { getIdFromString, getNameFromString } from "../../helpers";
import "./tailwind.css";
import { ChangeEvent } from "react";

export const SendTask = ({
projects,
Expand All @@ -18,8 +19,7 @@ export const SendTask = ({
const [label, setLabel] = useState<string>("");
const [deadline, setDeadline] = useState<string>("");

//@ts-expect-error
const handleSubmit = async (event) => {
const handleSubmit = async (event: ChangeEvent<HTMLFormElement>) => {
event.preventDefault();
await sendTask(
uuid,
Expand All @@ -28,6 +28,9 @@ export const SendTask = ({
deadline,
getNameFromString(label),
);
setProjectId("");
setLabel("");
setDeadline("");
logseq.hideMainUI();
};

Expand Down
8 changes: 4 additions & 4 deletions src/features/send/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export const removeTaskFlags = (content: string): string => {
};

const parseBlkDeadline = (deadline: number): string => {
let year = deadline.toString().substring(0, 4);
let month = deadline.toString().substring(4, 6);
let day = deadline.toString().substring(6);
const year = deadline.toString().substring(0, 4);
const month = deadline.toString().substring(4, 6);
const day = deadline.toString().substring(6);
return `${year}-${month}-${day}`;
};

Expand All @@ -36,7 +36,7 @@ export const sendTask = async (
content = removeTaskFlags(content);
// Add URI if sendAppendUri is true
if (sendAppendUri) {
content = `[${content}](logseq://graph/${graphName}?block-id=${uuid})`;
content = `${content} [↗️](logseq://graph/${graphName}?block-id=${uuid})`;
}
const blk = await logseq.Editor.getBlock(uuid);
if (!blk) return;
Expand Down

0 comments on commit 567ee72

Please sign in to comment.