/* Build fancy Adaptive Card report with icons and status */ function getTitle(item) { if (item.json.Name && item.json.Name.title && Array.isArray(item.json.Name.title) && item.json.Name.title.length > 0) { return item.json.Name.title[0].plain_text; } if (item.json.title && Array.isArray(item.json.title) && item.json.title.length > 0) { return item.json.title[0].plain_text; } return "Untitled"; } const items = $input.all(); const taskBlocks = []; if (items.length === 0) { taskBlocks.push({ type: 'TextBlock', text: 'No tasks were completed today. 💤', color: 'warning', weight: 'Bolder' }); } else { items.forEach((item, index) => { const projectType = item.json.ProjectType || ''; const priority = item.json.Priority || ''; const taskName = getTitle(item); const description = item.json.Description || 'No description provided.'; const status = item.json.Status || ''; const prefix = [projectType, priority].filter(Boolean).join('-'); const title = prefix ? `[${prefix}]: ${taskName}` : taskName; // Determine status icon and color let statusIcon = 'https://cdn-icons-png.flaticon.com/512/190/190411.png'; let statusColor = 'Good'; let statusText = 'DONE'; if (status === 'In Progress') { statusIcon = 'https://cdn-icons-png.flaticon.com/512/992/992697.png'; statusColor = 'Accent'; statusText = 'IN PROGRESS'; } else if (status === 'Pending' || status === '') { statusIcon = 'https://cdn-icons-png.flaticon.com/512/1828/1828645.png'; statusColor = 'Default'; statusText = 'PENDING'; } taskBlocks.push({ type: 'ColumnSet', spacing: 'Medium', separator: true, columns: [ { type: 'Column', width: 'auto', verticalContentAlignment: 'Center', items: [ { type: 'Image', url: statusIcon, width: '24px', altText: statusText } ] }, { type: 'Column', width: 'stretch', items: [ { type: 'TextBlock', text: title, size: 'Medium', weight: 'Bolder', color: statusColor, wrap: true }, { type: 'TextBlock', text: description, isSubtle: true, size: 'Small', wrap: true, spacing: 'None' } ] } ] }); }); } return [{ json: { type: 'message', attachments: [{ contentType: 'application/vnd.microsoft.card.adaptive', content: { $schema: 'http://adaptivecards.io/schemas/adaptive-card.json', type: 'AdaptiveCard', version: '1.4', body: [ { type: 'ColumnSet', style: 'emphasis', columns: [ { type: 'Column', width: 'auto', items: [ { type: 'Image', url: 'https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/godot.png', width: '40px', altText: 'Godot Logo' } ] }, { type: 'Column', width: 'stretch', verticalContentAlignment: 'Center', items: [ { type: 'TextBlock', text: 'ADT Report : Tekton Dash', weight: 'Bolder', size: 'Large', color: 'Accent' }, { type: 'TextBlock', text: new Date().toLocaleDateString(), isSubtle: true, size: 'Small', spacing: 'None' } ] } ] }, ...taskBlocks, { type: 'ActionSet', actions: [ { type: 'Action.OpenUrl', title: 'Open PR Game Dev', url: 'https://www.notion.so/danchiego-game/36433be43b29800c8422ed5bdd65671b?v=36433be43b2980de8635000c0a910a0d', style: 'positive' } ] } ] } }] } }];