Skip to content

Commit

Permalink
floating checkmark, closes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Exr0n committed Sep 10, 2024
1 parent 783af05 commit 17df1df
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/components/task.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.task {
position: relative;
}

.task-cm > .cm-mountpoint {
padding: 0;
}
Expand Down Expand Up @@ -33,6 +37,11 @@
margin-right: 0 !important;
}

.floating-task-action {
position: absolute;
transform: translateX(-18px) scale(0.8);
}

.task-action:hover {
color: var(--foreground-color);
}
Expand Down
16 changes: 15 additions & 1 deletion src/components/task.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function Task( { task, initialFocus, onFocusChange } ) {
const deffered = (task.start && new Date(task.start) > today);

return (
<div className="task" ref={wrapperRef}>
<div className="task group" ref={wrapperRef}>
<DateModal
initialDate={task.schedule ? new Date(task.schedule) : null}
onDate={(d) => {
Expand All @@ -107,6 +107,20 @@ export default function Task( { task, initialFocus, onFocusChange } ) {
}}
onClose={() => setDeferOpen(false)}
ref={deferRef} />

<div className="task-action floating-task-action opacity-0 group-hover:opacity-100 transition-opacity" data-tooltip-id={hasFocus? "rootp" : "notp"} data-tooltip-content={task.completed ? strings.TOOLTIPS.UNCOMPLETE : strings.TOOLTIPS.COMPLETE} data-tooltip-place={"bottom"}
onClick={() => {
// TODO completing tasks is a bit of a thing so
// TODO supporting repeating tasks, etc.
dispatch(edit({id: task.id, completed: !task.completed}));
setHasFocus(false);
}}
>
<i className={task.completed ? "task-action fa-solid fa-circle-check" : "task-action fa-solid fa-check" } style={{transform: "translateY(-4px)"}} />
</div>



<div className={"task-cm"+(task.start && deffered ? " deferred" : "")+(task.completed ? " completed" : "")+(dueSoon && !overdue ? " due-soon" : "")+(overdue ? " overdue" : "")}>
<Editor
strike={task.completed}
Expand Down

0 comments on commit 17df1df

Please sign in to comment.