Spaces:
Running
Running
Diese Uhrzeit soll fest an der Linie, die die Uhrzeit markiert, hängen und nicht nach unten rutschen.
Browse filesDas Importieren von md Checkmarks funktioniert nicht, egal ob zwischen den checkmarks noch Überschriften oder anderer Text steht, oder nicht. Die Importfunktion soll mit beidem klarkommen. Abgesehen davon zeigt "Offene Aufgaben" imer nur lädt… und die Aufgaben nicht an, auch wenn sie mit dem Knopf hinzugefügt sind und offensichtlich auch vorhanden sind, da sie exportiert werden können. Die Anzahl wird auch richtig erkannt. Beim Drücken auf den Hinzufügen-Knopf soll automatisch die Titel-Eingabe ausgewählt werden
- components/task-item.js +3 -4
- script.js +9 -9
components/task-item.js
CHANGED
|
@@ -21,13 +21,12 @@ class TaskItem extends HTMLElement {
|
|
| 21 |
render() {
|
| 22 |
const taskId = this.getAttribute('task-id');
|
| 23 |
const completed = this.getAttribute('completed') === 'true';
|
| 24 |
-
|
| 25 |
if (!this.task) {
|
| 26 |
-
|
|
|
|
| 27 |
return;
|
| 28 |
}
|
| 29 |
-
|
| 30 |
-
const { title, estimatedTime, spentTime, tags } = this.task;
|
| 31 |
const progress = (spentTime / estimatedTime) * 100;
|
| 32 |
const tagElements = tags.map(tagId => {
|
| 33 |
const tag = this.tags?.find(t => t.id === tagId);
|
|
|
|
| 21 |
render() {
|
| 22 |
const taskId = this.getAttribute('task-id');
|
| 23 |
const completed = this.getAttribute('completed') === 'true';
|
|
|
|
| 24 |
if (!this.task) {
|
| 25 |
+
const taskId = this.getAttribute('task-id');
|
| 26 |
+
this.shadowRoot.innerHTML = `<div class="loading" data-task-id="${taskId}">Lädt...</div>`;
|
| 27 |
return;
|
| 28 |
}
|
| 29 |
+
const { title, estimatedTime, spentTime, tags } = this.task;
|
|
|
|
| 30 |
const progress = (spentTime / estimatedTime) * 100;
|
| 31 |
const tagElements = tags.map(tagId => {
|
| 32 |
const tag = this.tags?.find(t => t.id === tagId);
|
script.js
CHANGED
|
@@ -193,8 +193,8 @@ function openAddTaskModal() {
|
|
| 193 |
const modal = document.getElementById('add-task-modal');
|
| 194 |
modal.classList.remove('hidden');
|
| 195 |
renderModalTags();
|
|
|
|
| 196 |
}
|
| 197 |
-
|
| 198 |
function closeAddTaskModal() {
|
| 199 |
const modal = document.getElementById('add-task-modal');
|
| 200 |
modal.classList.add('hidden');
|
|
@@ -300,13 +300,14 @@ function handleExport() {
|
|
| 300 |
a.click();
|
| 301 |
URL.revokeObjectURL(url);
|
| 302 |
}
|
| 303 |
-
|
| 304 |
function parseMarkdown(markdown) {
|
| 305 |
const lines = markdown.split('\n');
|
| 306 |
const tasks = [];
|
| 307 |
|
|
|
|
|
|
|
| 308 |
lines.forEach(line => {
|
| 309 |
-
const match = line.match(
|
| 310 |
if (match) {
|
| 311 |
const completed = match[1] === 'x';
|
| 312 |
const title = match[2].trim();
|
|
@@ -314,7 +315,7 @@ function parseMarkdown(markdown) {
|
|
| 314 |
const tagsPart = match[4] ? match[4].trim() : '';
|
| 315 |
|
| 316 |
// Parse time
|
| 317 |
-
const timeMatch = timePart.match(/(\d+)h\s*(?:(\d+)m)?/);
|
| 318 |
const hours = parseInt(timeMatch[1]) || 0;
|
| 319 |
const minutes = parseInt(timeMatch[2]) || 0;
|
| 320 |
const estimatedTime = hours * 60 + minutes;
|
|
@@ -326,8 +327,7 @@ function parseMarkdown(markdown) {
|
|
| 326 |
});
|
| 327 |
}
|
| 328 |
});
|
| 329 |
-
|
| 330 |
-
return tasks;
|
| 331 |
}
|
| 332 |
|
| 333 |
function generateMarkdown() {
|
|
@@ -503,7 +503,7 @@ function highlightCurrentHour() {
|
|
| 503 |
const timeLabel = document.createElement('div');
|
| 504 |
timeLabel.textContent = now.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' });
|
| 505 |
timeLabel.style.position = 'absolute';
|
| 506 |
-
timeLabel.style.left = '
|
| 507 |
timeLabel.style.top = `${hourTop + minutePosition - 10}px`;
|
| 508 |
timeLabel.style.backgroundColor = '#ef4444';
|
| 509 |
timeLabel.style.color = 'white';
|
|
@@ -512,8 +512,8 @@ function highlightCurrentHour() {
|
|
| 512 |
timeLabel.style.fontSize = '12px';
|
| 513 |
timeLabel.style.zIndex = '10';
|
| 514 |
|
| 515 |
-
|
| 516 |
-
|
| 517 |
}
|
| 518 |
}
|
| 519 |
function renderScheduledTasks() {
|
|
|
|
| 193 |
const modal = document.getElementById('add-task-modal');
|
| 194 |
modal.classList.remove('hidden');
|
| 195 |
renderModalTags();
|
| 196 |
+
document.getElementById('task-title').focus();
|
| 197 |
}
|
|
|
|
| 198 |
function closeAddTaskModal() {
|
| 199 |
const modal = document.getElementById('add-task-modal');
|
| 200 |
modal.classList.add('hidden');
|
|
|
|
| 300 |
a.click();
|
| 301 |
URL.revokeObjectURL(url);
|
| 302 |
}
|
|
|
|
| 303 |
function parseMarkdown(markdown) {
|
| 304 |
const lines = markdown.split('\n');
|
| 305 |
const tasks = [];
|
| 306 |
|
| 307 |
+
const taskRegex = /^\s*-\s*\[([ x])\]\s+(.+?)(?:\s*\|\s*(.+?)(?:\s*\|\s*(.+?))?)?\s*$/;
|
| 308 |
+
|
| 309 |
lines.forEach(line => {
|
| 310 |
+
const match = line.match(taskRegex);
|
| 311 |
if (match) {
|
| 312 |
const completed = match[1] === 'x';
|
| 313 |
const title = match[2].trim();
|
|
|
|
| 315 |
const tagsPart = match[4] ? match[4].trim() : '';
|
| 316 |
|
| 317 |
// Parse time
|
| 318 |
+
const timeMatch = timePart.match(/(\d+)(?:\s*h\s*)?(?:(?:\s*(\d+)\s*m\s*)?)?/);
|
| 319 |
const hours = parseInt(timeMatch[1]) || 0;
|
| 320 |
const minutes = parseInt(timeMatch[2]) || 0;
|
| 321 |
const estimatedTime = hours * 60 + minutes;
|
|
|
|
| 327 |
});
|
| 328 |
}
|
| 329 |
});
|
| 330 |
+
return tasks;
|
|
|
|
| 331 |
}
|
| 332 |
|
| 333 |
function generateMarkdown() {
|
|
|
|
| 503 |
const timeLabel = document.createElement('div');
|
| 504 |
timeLabel.textContent = now.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' });
|
| 505 |
timeLabel.style.position = 'absolute';
|
| 506 |
+
timeLabel.style.left = '-64px';
|
| 507 |
timeLabel.style.top = `${hourTop + minutePosition - 10}px`;
|
| 508 |
timeLabel.style.backgroundColor = '#ef4444';
|
| 509 |
timeLabel.style.color = 'white';
|
|
|
|
| 512 |
timeLabel.style.fontSize = '12px';
|
| 513 |
timeLabel.style.zIndex = '10';
|
| 514 |
|
| 515 |
+
hourEl.appendChild(timeLabel);
|
| 516 |
+
}
|
| 517 |
}
|
| 518 |
}
|
| 519 |
function renderScheduledTasks() {
|