-
- {dueDisplay}
-
+{#if displayDue}
+
+
+
- {/if}
- {#if params.mode !== 'single-line'}
-
|
- {/if}
+ {#if taskSyncManager.getTaskCardStatus('dueStatus') === 'editing'}
+
adjustWidthForInput(inputElement)}
+ bind:value={dueString}
+ bind:this={inputElement}
+ class="task-card-due"
+ />
+ {:else}
+
+ {/if}
+
{/if}
diff --git a/src/ui/LabelInput.svelte b/src/ui/LabelInput.svelte
index 2f10b88..68bd80a 100644
--- a/src/ui/LabelInput.svelte
+++ b/src/ui/LabelInput.svelte
@@ -7,7 +7,6 @@
export let finishLabelEditing;
export let inputElement: HTMLInputElement;
-
setTimeout(() => {
if (inputElement) {
inputElement.focus(); // Focus on the input element
@@ -41,7 +40,7 @@
}
.task-card-label-input-left-part {
- background-color: var(--background-secondary);
+ background-color: var(--background-primary);
border-top-left-radius: 2em;
border-bottom-left-radius: 2em;
border-top-right-radius: var(--radius-s);
@@ -59,6 +58,7 @@
.task-card-label-input {
display: inline-block;
+ background-color: var(--background-primary-alt);
padding: var(--tag-padding-y) var(--tag-padding-x);
font-size: var(--tag-size);
color: var(--text-muted);
diff --git a/src/ui/Labels.svelte b/src/ui/Labels.svelte
index 18595c2..b776f37 100644
--- a/src/ui/Labels.svelte
+++ b/src/ui/Labels.svelte
@@ -152,6 +152,7 @@ button.label-plus-button {
color: var(--tag-color);
background-color: var(--tag-background);
border-radius: 50%;
+ padding-top: 3px;
}
button.label-plus-button:hover {
diff --git a/src/ui/TaskCard.svelte b/src/ui/TaskCard.svelte
index 0949194..3f07b46 100644
--- a/src/ui/TaskCard.svelte
+++ b/src/ui/TaskCard.svelte
@@ -17,6 +17,7 @@
import { SettingStore } from '../settings';
import { DescriptionParser } from '../taskModule/description';
import CircularProgressBar from '../components/CircularProgressBar.svelte';
+ import Duration from './Duration.svelte';
export let taskSyncManager: ObsidianTaskSyncManager;
export let plugin: TaskCardPlugin;
@@ -186,6 +187,8 @@
cardMenu.showAtPosition({ x: event.clientX, y: event.clientY });
}
+ let displayDue: boolean = taskSyncManager.obsidianTask.hasDue() || taskSyncManager.getTaskCardStatus('dueStatus') === 'editing';
+ let displayDuration: boolean = taskSyncManager.obsidianTask.hasDuration() || taskSyncManager.getTaskCardStatus('durationStatus') === 'editing';
@@ -237,9 +240,15 @@
- {#if taskSyncManager.obsidianTask.hasDue() || taskSyncManager.getTaskCardStatus('dueStatus') === 'editing'}
+ {#if displayDue}
{/if}
+ {#if displayDuration}
+
+ {/if}
+ {#if displayDue || displayDuration}
+
+ {/if}
diff --git a/styles.css b/styles.css
index 0780a31..b277380 100644
--- a/styles.css
+++ b/styles.css
@@ -82,6 +82,7 @@
display: flex;
flex-direction: row;
align-items: center; /* Vertically center the children */
+ align-self: center;
}
.task-card-checkbox-wrapper {
@@ -140,8 +141,11 @@
.task-card-attribute-separator {
flex-shrink: 0; /* Prevents shrinking */
margin: 0 4px;
- color: var(--color-base-50);
- font-size: var(--font-ui-medium);
+ margin-top: 3px;
+ border-left: 1px solid var(--interactive-hover);
+ height: 13px;
+ align-items: center;
+ align-self: center;
}
.task-card-icon {
From 32c70f663ccccb13e95806ab014935fbce382ea5 Mon Sep 17 00:00:00 2001
From: terryli710
Date: Thu, 5 Oct 2023 10:53:22 -0700
Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20=20debug=20duration?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/taskModule/taskParser.ts | 1 -
src/ui/Due.svelte | 1 -
src/ui/Duration.svelte | 4 +---
src/ui/TaskCard.svelte | 24 ++++++++++++++++++++++--
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/taskModule/taskParser.ts b/src/taskModule/taskParser.ts
index eb1dda4..f952946 100644
--- a/src/taskModule/taskParser.ts
+++ b/src/taskModule/taskParser.ts
@@ -430,7 +430,6 @@ export class TaskParser {
parseDuration(durationString: string): Duration | null {
const durationInMinutes = parse(durationString, 'm');
- logger.debug(`durationInMinutes: ${durationInMinutes}`);
// Convert the difference to hours and minutes
const hours = Math.floor(durationInMinutes / 60);
const minutes = durationInMinutes % 60;
diff --git a/src/ui/Due.svelte b/src/ui/Due.svelte
index 546dec3..cbdb8f0 100644
--- a/src/ui/Due.svelte
+++ b/src/ui/Due.svelte
@@ -136,7 +136,6 @@
{#if taskSyncManager.getTaskCardStatus('dueStatus') === 'editing'}
adjustWidthForInput(inputElement)}
bind:value={dueString}
bind:this={inputElement}
diff --git a/src/ui/Duration.svelte b/src/ui/Duration.svelte
index 99967e6..525ad75 100644
--- a/src/ui/Duration.svelte
+++ b/src/ui/Duration.svelte
@@ -11,7 +11,7 @@
export let taskSyncManager: ObsidianTaskSyncManager;
- export let plugin: TaskCardPlugin;
+ // export let plugin: TaskCardPlugin;
export let params: TaskDisplayParams;
let duration: Duration | null;
duration = taskSyncManager.obsidianTask.hasDuration() ? taskSyncManager.obsidianTask.duration : null;
@@ -61,7 +61,6 @@
}
async function toggleDurationEditMode(event: KeyboardEvent | MouseEvent) {
- logger.debug(`duration status: ${taskSyncManager.taskCardStatus.durationStatus}`);
if (taskSyncManager.taskCardStatus.durationStatus === 'done') {
enableDurationEditMode(event);
} else {
@@ -142,7 +141,6 @@
{#if taskSyncManager.getTaskCardStatus('durationStatus') === 'editing'}
{
item.setTitle('Add Description');
@@ -124,6 +124,7 @@
item.setIcon('plus');
item.onClick((evt) => {
taskSyncManager.taskCardStatus.dueStatus = 'editing';
+ displayDue = taskSyncManager.obsidianTask.hasDue() || taskSyncManager.getTaskCardStatus('dueStatus') === 'editing';
});
});
} else {
@@ -136,6 +137,25 @@
});
}
+ if (!taskSyncManager.obsidianTask.hasDuration()) {
+ cardMenu.addItem((item) => {
+ item.setTitle('Add Duration');
+ item.setIcon('plus');
+ item.onClick((evt) => {
+ taskSyncManager.taskCardStatus.durationStatus = 'editing';
+ displayDuration = taskSyncManager.obsidianTask.hasDue() || taskSyncManager.getTaskCardStatus('dueStatus') === 'editing';
+ });
+ });
+ } else {
+ cardMenu.addItem((item) => {
+ item.setTitle('Delete Duration');
+ item.setIcon('trash');
+ item.onClick((evt) => {
+ taskSyncManager.updateObsidianTaskAttribute('duration', null);
+ });
+ });
+ }
+
// Separator
cardMenu.addSeparator();
@@ -244,7 +264,7 @@
{/if}
{#if displayDuration}
-
+
{/if}
{#if displayDue || displayDuration}