Spaces:
Running
Ich sehe die offenen Aufgaben immernoch nicht, obwohl sie vorhanden sind.
Browse filesSo sieht es aus:
```html
<div class="bg-gray-800 rounded-xl shadow-lg">
<div class="p-4 border-b border-gray-700">
<h3 class="text-lg font-semibold flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle text-orange-500 mr-2"><circle cx="12" cy="12" r="10"></circle></svg>
Offene Aufgaben (<span id="open-count">3</span>)
</h3>
</div>
<div id="open-tasks" class="p-4 space-y-3 max-h-96 overflow-y-auto"><task-item task-id="1764499641261" completed="false"></task-item><task-item task-id="1764499848322" completed="false"></task-item><task-item task-id="1764500031386" completed="false"></task-item></div>
</div>
```
In der Konsole steht (manches kommt von Extensions):
```sh
cdn.tailwindcss.com should not be used in production. To use Tailwind CSS in production, install it as a PostCSS plugin or use the Tailwind CLI: https://tailwindcss.com/docs/installation cdn.tailwindcss.com:64:1711
feather: 'focus' is not a valid icon 2 feather-icons:12:5197
Content script loaded, initializing... content.js:1719:13
Eine Notification-Anfrage kann nur aus einem kurz laufenden Benutzer-generierten Ereignis-Handler aufgerufen werden. index.html
Error parsing watch history: SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
loadWatchHistory moz-extension://fbbd56d3-98cc-4e3b-a6f1-5229548dd187/content.js:794
content.js:848:17
Initial watch history loaded. content.js:936:13
Could not extract video UUID from URL content.js:1684:21
SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data content.js:574:73
[PeerTube Companion] Retrieved item "getUrlService-fadikkop-taskforge-pro.static.hf.space" from cache redirection-content-script.f3b7260b.js:1:21789
Source-Map-Fehler: Error: request failed with status 404
Stack in the worker:networkRequest@resource://devtools/client/shared/source-map-loader/utils/network-request.js:43:9
Ressourcen-Adresse: https://unpkg.com/feather-icons
Source-Map-Adresse: feather.min.js.map
Source-Map-Fehler: request failed with status 404
Ressourcen-Adresse: https://unpkg.com/feather-icons
Source-Map-Adresse: feather.min.js.map
Source-Map-Fehler: Error: request failed with status 404
Stack in the worker:networkRequest@resource://devtools/client/shared/source-map-loader/utils/network-request.js:43:9
Ressourcen-Adresse: https://unpkg.com/feather-icons
Source-Map-Adresse: feather.min.js.map
```
Überlege, wie man dafür sorgen kann, dass die offenen Aufgaben geladen angezeigt werden und fixe das!
- components/task-item.js +26 -17
- script.js +12 -15
|
@@ -4,8 +4,10 @@ class TaskItem extends HTMLElement {
|
|
| 4 |
super();
|
| 5 |
this.attachShadow({ mode: 'open' });
|
| 6 |
}
|
| 7 |
-
|
| 8 |
connectedCallback() {
|
|
|
|
|
|
|
|
|
|
| 9 |
this.render();
|
| 10 |
this.setupEventListeners();
|
| 11 |
}
|
|
@@ -14,26 +16,35 @@ class TaskItem extends HTMLElement {
|
|
| 14 |
return ['task-id', 'completed'];
|
| 15 |
}
|
| 16 |
|
| 17 |
-
attributeChangedCallback() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
this.render();
|
| 19 |
}
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
render() {
|
| 22 |
-
const taskId = this.getAttribute('task-id');
|
| 23 |
-
const completed = this.getAttribute('completed') === 'true';
|
| 24 |
if (!this.task) {
|
| 25 |
-
|
| 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);
|
| 33 |
return tag ? `<span class="tag-badge" style="background-color: ${tag.color}20; color: ${tag.color}">${tag.name}</span>` : '';
|
| 34 |
}).join('');
|
| 35 |
-
|
| 36 |
-
this.shadowRoot.innerHTML = `
|
| 37 |
<style>
|
| 38 |
:host {
|
| 39 |
display: block;
|
|
@@ -203,11 +214,10 @@ const { title, estimatedTime, spentTime, tags } = this.task;
|
|
| 203 |
background: #4b5563;
|
| 204 |
}
|
| 205 |
</style>
|
| 206 |
-
|
| 207 |
<div class="task-header">
|
| 208 |
-
<input type="checkbox" class="task-checkbox" ${completed ? 'checked' : ''}
|
| 209 |
@change="${this.handleToggleComplete}">
|
| 210 |
-
|
| 211 |
<div class="task-actions">
|
| 212 |
<button class="task-action" @click="${this.handleFocus}" title="Fokus-Modus">
|
| 213 |
<i data-feather="focus"></i>
|
|
@@ -247,9 +257,8 @@ const { title, estimatedTime, spentTime, tags } = this.task;
|
|
| 247 |
</div>
|
| 248 |
</div>
|
| 249 |
`;
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
this.classList.add('completed');
|
| 253 |
} else {
|
| 254 |
this.classList.remove('completed');
|
| 255 |
}
|
|
|
|
| 4 |
super();
|
| 5 |
this.attachShadow({ mode: 'open' });
|
| 6 |
}
|
|
|
|
| 7 |
connectedCallback() {
|
| 8 |
+
this.taskId = this.getAttribute('task-id');
|
| 9 |
+
this.completed = this.getAttribute('completed') === 'true';
|
| 10 |
+
this.loadTaskData();
|
| 11 |
this.render();
|
| 12 |
this.setupEventListeners();
|
| 13 |
}
|
|
|
|
| 16 |
return ['task-id', 'completed'];
|
| 17 |
}
|
| 18 |
|
| 19 |
+
attributeChangedCallback(name, oldValue, newValue) {
|
| 20 |
+
if (name === 'task-id' && oldValue !== newValue) {
|
| 21 |
+
this.taskId = newValue;
|
| 22 |
+
this.loadTaskData();
|
| 23 |
+
} else if (name === 'completed') {
|
| 24 |
+
this.completed = newValue === 'true';
|
| 25 |
+
}
|
| 26 |
this.render();
|
| 27 |
}
|
| 28 |
|
| 29 |
+
loadTaskData() {
|
| 30 |
+
if (!window.state || !window.state.tasks) return;
|
| 31 |
+
|
| 32 |
+
this.task = window.state.tasks.find(t => t.id === this.taskId);
|
| 33 |
+
this.tags = window.state.tags || [];
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
render() {
|
|
|
|
|
|
|
| 37 |
if (!this.task) {
|
| 38 |
+
this.shadowRoot.innerHTML = `<div class="loading" data-task-id="${this.taskId}">Lädt...</div>`;
|
|
|
|
| 39 |
return;
|
| 40 |
}
|
| 41 |
+
const { title, estimatedTime, spentTime, tags } = this.task;
|
| 42 |
+
const progress = estimatedTime > 0 ? (spentTime / estimatedTime) * 100 : 0;
|
| 43 |
+
const tagElements = (tags || []).map(tagId => {
|
| 44 |
const tag = this.tags?.find(t => t.id === tagId);
|
| 45 |
return tag ? `<span class="tag-badge" style="background-color: ${tag.color}20; color: ${tag.color}">${tag.name}</span>` : '';
|
| 46 |
}).join('');
|
| 47 |
+
this.shadowRoot.innerHTML = `
|
|
|
|
| 48 |
<style>
|
| 49 |
:host {
|
| 50 |
display: block;
|
|
|
|
| 214 |
background: #4b5563;
|
| 215 |
}
|
| 216 |
</style>
|
|
|
|
| 217 |
<div class="task-header">
|
| 218 |
+
<input type="checkbox" class="task-checkbox" ${this.completed ? 'checked' : ''}
|
| 219 |
@change="${this.handleToggleComplete}">
|
| 220 |
+
<span class="task-title">${title}</span>
|
| 221 |
<div class="task-actions">
|
| 222 |
<button class="task-action" @click="${this.handleFocus}" title="Fokus-Modus">
|
| 223 |
<i data-feather="focus"></i>
|
|
|
|
| 257 |
</div>
|
| 258 |
</div>
|
| 259 |
`;
|
| 260 |
+
if (this.completed) {
|
| 261 |
+
this.classList.add('completed');
|
|
|
|
| 262 |
} else {
|
| 263 |
this.classList.remove('completed');
|
| 264 |
}
|
|
@@ -1,8 +1,7 @@
|
|
| 1 |
// TaskForge Pro - Main JavaScript
|
| 2 |
-
|
| 3 |
// State management
|
| 4 |
-
|
| 5 |
-
|
| 6 |
tags: [],
|
| 7 |
currentView: 'home',
|
| 8 |
focusTask: null,
|
|
@@ -358,29 +357,27 @@ function renderTasks() {
|
|
| 358 |
if (openTasks.length === 0) {
|
| 359 |
openContainer.innerHTML = '<div class="empty-state"><i data-feather="inbox"></i><p>Keine offenen Aufgaben</p></div>';
|
| 360 |
} else {
|
| 361 |
-
openContainer.innerHTML =
|
|
|
|
| 362 |
const taskElement = document.createElement('task-item');
|
| 363 |
taskElement.setAttribute('task-id', task.id);
|
| 364 |
taskElement.setAttribute('completed', 'false');
|
| 365 |
-
taskElement
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
}).join('');
|
| 369 |
-
}
|
| 370 |
|
| 371 |
// Render completed tasks
|
| 372 |
if (completedTasks.length === 0) {
|
| 373 |
completedContainer.innerHTML = '<div class="empty-state"><i data-feather="check-circle"></i><p>Keine erledigten Aufgaben</p></div>';
|
| 374 |
} else {
|
| 375 |
-
completedContainer.innerHTML =
|
|
|
|
| 376 |
const taskElement = document.createElement('task-item');
|
| 377 |
taskElement.setAttribute('task-id', task.id);
|
| 378 |
taskElement.setAttribute('completed', 'true');
|
| 379 |
-
taskElement
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
}).join('');
|
| 383 |
-
}
|
| 384 |
|
| 385 |
document.getElementById('open-count').textContent = openTasks.length;
|
| 386 |
document.getElementById('completed-count').textContent = completedTasks.length;
|
|
|
|
| 1 |
// TaskForge Pro - Main JavaScript
|
|
|
|
| 2 |
// State management
|
| 3 |
+
window.state = {
|
| 4 |
+
tasks: [],
|
| 5 |
tags: [],
|
| 6 |
currentView: 'home',
|
| 7 |
focusTask: null,
|
|
|
|
| 357 |
if (openTasks.length === 0) {
|
| 358 |
openContainer.innerHTML = '<div class="empty-state"><i data-feather="inbox"></i><p>Keine offenen Aufgaben</p></div>';
|
| 359 |
} else {
|
| 360 |
+
openContainer.innerHTML = '';
|
| 361 |
+
openTasks.forEach(task => {
|
| 362 |
const taskElement = document.createElement('task-item');
|
| 363 |
taskElement.setAttribute('task-id', task.id);
|
| 364 |
taskElement.setAttribute('completed', 'false');
|
| 365 |
+
openContainer.appendChild(taskElement);
|
| 366 |
+
});
|
| 367 |
+
}
|
|
|
|
|
|
|
| 368 |
|
| 369 |
// Render completed tasks
|
| 370 |
if (completedTasks.length === 0) {
|
| 371 |
completedContainer.innerHTML = '<div class="empty-state"><i data-feather="check-circle"></i><p>Keine erledigten Aufgaben</p></div>';
|
| 372 |
} else {
|
| 373 |
+
completedContainer.innerHTML = '';
|
| 374 |
+
completedTasks.forEach(task => {
|
| 375 |
const taskElement = document.createElement('task-item');
|
| 376 |
taskElement.setAttribute('task-id', task.id);
|
| 377 |
taskElement.setAttribute('completed', 'true');
|
| 378 |
+
completedContainer.appendChild(taskElement);
|
| 379 |
+
});
|
| 380 |
+
}
|
|
|
|
|
|
|
| 381 |
|
| 382 |
document.getElementById('open-count').textContent = openTasks.length;
|
| 383 |
document.getElementById('completed-count').textContent = completedTasks.length;
|