|
191 | 191 |
|
192 | 192 | // Task history state |
193 | 193 | interface TimelineEvent { |
194 | | - type: 'jat_event' | 'agent_mail'; |
| 194 | + type: 'jat_event' | 'agent_mail' | 'status_change'; |
195 | 195 | event: string; |
196 | 196 | timestamp: string; |
197 | 197 | description: string; |
|
205 | 205 | count: { |
206 | 206 | total: number; |
207 | 207 | jat_events: number; |
| 208 | + status_changes: number; |
208 | 209 | agent_mail: number; |
209 | 210 | }; |
210 | 211 | timestamp: string; |
|
863 | 864 | const filteredTimeline = $derived((): TimelineEvent[] => { |
864 | 865 | if (!taskHistory?.timeline) return []; |
865 | 866 | if (timelineFilter === 'all') return taskHistory.timeline; |
866 | | - if (timelineFilter === 'tasks') return taskHistory.timeline.filter(e => e.type === 'jat_event'); |
| 867 | + if (timelineFilter === 'tasks') return taskHistory.timeline.filter(e => e.type === 'jat_event' || e.type === 'status_change'); |
867 | 868 | return taskHistory.timeline.filter(e => e.type === 'agent_mail'); |
868 | 869 | }); |
869 | 870 |
|
|
4969 | 4970 | class="tab {timelineFilter === 'tasks' ? 'tab-active' : ''}" |
4970 | 4971 | onclick={() => timelineFilter = 'tasks'} |
4971 | 4972 | > |
4972 | | - Tasks ({taskHistory?.count?.jat_events || 0}) |
| 4973 | + Tasks ({(taskHistory?.count?.jat_events || 0) + (taskHistory?.count?.status_changes || 0)}) |
4973 | 4974 | </button> |
4974 | 4975 | <button |
4975 | 4976 | class="tab {timelineFilter === 'messages' ? 'tab-active' : ''}" |
|
5011 | 5012 | <li style="grid-template-columns: 30% min-content 1fr;"> |
5012 | 5013 | <!-- Top connector (skip for first item) --> |
5013 | 5014 | {#if i > 0} |
5014 | | - <hr class="{event.type === 'jat_event' ? 'bg-info' : 'bg-warning'}" /> |
| 5015 | + <hr class="{event.type === 'jat_event' || event.type === 'status_change' ? (event.event === 'task_accepted' ? 'bg-success' : event.type === 'status_change' ? 'bg-error' : 'bg-info') : 'bg-warning'}" /> |
5015 | 5016 | {/if} |
5016 | 5017 |
|
5017 | | - {#if event.type === 'jat_event'} |
| 5018 | + {#if event.type === 'status_change'} |
| 5019 | + <!-- Accept/reject decision on LEFT side --> |
| 5020 | + {@const isAccepted = event.event === 'task_accepted'} |
| 5021 | + <div class="timeline-start timeline-box text-xs mb-4 {isAccepted ? 'border-success/30 bg-success/5' : 'border-error/30 bg-error/5'}"> |
| 5022 | + <div class="font-semibold text-base-content"> |
| 5023 | + {event.description} |
| 5024 | + </div> |
| 5025 | + <div class="text-base-content/60 mt-1"> |
| 5026 | + {formatDate(event.timestamp)} |
| 5027 | + </div> |
| 5028 | + {#if event.metadata.author} |
| 5029 | + <div class="text-base-content/50 mt-1 text-xs">by {event.metadata.author}</div> |
| 5030 | + {/if} |
| 5031 | + </div> |
| 5032 | + <div class="timeline-middle"> |
| 5033 | + <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 {isAccepted ? 'text-success' : 'text-error'}" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 5034 | + {#if isAccepted} |
| 5035 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /> |
| 5036 | + {:else} |
| 5037 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" /> |
| 5038 | + {/if} |
| 5039 | + </svg> |
| 5040 | + </div> |
| 5041 | + <div class="timeline-end"></div> |
| 5042 | + {:else if event.type === 'jat_event'} |
5018 | 5043 | <!-- Task events on LEFT side (timeline-start) --> |
5019 | 5044 | <div class="timeline-start timeline-box text-xs mb-4 border-info/30 bg-info/5"> |
5020 | 5045 | <!-- Event description --> |
|
5134 | 5159 |
|
5135 | 5160 | <!-- Bottom connector (skip for last item) --> |
5136 | 5161 | {#if i < filteredTimeline().length - 1} |
5137 | | - <hr class="{filteredTimeline()[i + 1]?.type === 'jat_event' ? 'bg-info' : 'bg-warning'}" /> |
| 5162 | + {@const nextEvent = filteredTimeline()[i + 1]} |
| 5163 | + <hr class="{nextEvent?.type === 'status_change' ? (nextEvent.event === 'task_accepted' ? 'bg-success' : 'bg-error') : nextEvent?.type === 'jat_event' ? 'bg-info' : 'bg-warning'}" /> |
5138 | 5164 | {/if} |
5139 | 5165 | </li> |
5140 | 5166 | {/each} |
|
0 commit comments