Improve Activity panel + task tracking rules
- Activity loads from tasks.json dynamically - Added task tracking workflow in AGENTS.md - Notes UI improvements - Renamed recipe with date prefix
This commit is contained in:
@@ -996,15 +996,56 @@
|
||||
}
|
||||
|
||||
async function loadActivity() {
|
||||
// For now, show static data. TODO: fetch from API
|
||||
activityData = [
|
||||
{ type: 'done', text: 'Răspuns întrebare D101', agent: 'Echo Work', time: '15:10' },
|
||||
{ type: 'done', text: 'Propunere dashboard v2', agent: 'Echo Work', time: '15:23' },
|
||||
{ type: 'done', text: 'Fix notes.html loading', agent: 'Echo Work', time: '17:39' }
|
||||
];
|
||||
try {
|
||||
// Fetch from tasks.json
|
||||
const response = await fetch('tasks.json?t=' + Date.now());
|
||||
const data = await response.json();
|
||||
|
||||
// Collect all tasks from all columns with their status
|
||||
let allTasks = [];
|
||||
data.columns.forEach(col => {
|
||||
col.tasks.forEach(task => {
|
||||
const timestamp = task.completed || task.created || '';
|
||||
allTasks.push({
|
||||
type: col.id === 'done' ? 'done' : (col.id === 'in-progress' ? 'running' : 'pending'),
|
||||
text: task.title,
|
||||
agent: task.agent || 'Echo',
|
||||
time: formatActivityTime(timestamp),
|
||||
timestamp: new Date(timestamp).getTime() || 0
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Sort descending by timestamp (newest first)
|
||||
allTasks.sort((a, b) => b.timestamp - a.timestamp);
|
||||
|
||||
// Take only recent items (last 20)
|
||||
activityData = allTasks.slice(0, 20);
|
||||
|
||||
} catch (e) {
|
||||
console.error('Failed to load activity:', e);
|
||||
activityData = [];
|
||||
}
|
||||
|
||||
renderActivity();
|
||||
document.getElementById('activityCount').textContent = activityData.length;
|
||||
}
|
||||
|
||||
function formatActivityTime(timestamp) {
|
||||
if (!timestamp) return '';
|
||||
const date = new Date(timestamp);
|
||||
if (isNaN(date.getTime())) return timestamp;
|
||||
|
||||
const now = new Date();
|
||||
const isToday = date.toDateString() === now.toDateString();
|
||||
|
||||
if (isToday) {
|
||||
return date.toLocaleTimeString('ro-RO', { hour: '2-digit', minute: '2-digit' });
|
||||
} else {
|
||||
return date.toLocaleDateString('ro-RO', { day: 'numeric', month: 'short' }) +
|
||||
' ' + date.toLocaleTimeString('ro-RO', { hour: '2-digit', minute: '2-digit' });
|
||||
}
|
||||
}
|
||||
|
||||
function refreshActivity() {
|
||||
loadActivity();
|
||||
|
||||
Reference in New Issue
Block a user