Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 96a44233c0 | |||
| 191cb5cbd2 | |||
| 12e629432c | |||
| 47f0f1d786 | |||
| bf60b8b064 | |||
| b8498f47bb |
@@ -54,7 +54,7 @@ defineEmits<{
|
||||
<section class="modal-section">
|
||||
<h3 class="section-label">Live Thinking</h3>
|
||||
<div class="thinking-panel">
|
||||
<div class="thinking-stream" ref="thinkingStreamRef">
|
||||
<div class="thinking-stream">
|
||||
<div
|
||||
v-for="(msg, idx) in agent.thinkingStream"
|
||||
:key="idx"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick, watch } from 'vue'
|
||||
import { Bot, Send, LoaderCircle } from '@lucide/vue'
|
||||
import { Bot, Send, LoaderCircle, Maximize2, X } from '@lucide/vue'
|
||||
import type { ChatMessage } from '../../composables/useDashboardData'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -15,6 +15,8 @@ const emit = defineEmits<{
|
||||
|
||||
const inputText = ref('')
|
||||
const chatListRef = ref<HTMLElement | null>(null)
|
||||
const chatModalListRef = ref<HTMLElement | null>(null)
|
||||
const chatModalOpen = ref(false)
|
||||
|
||||
function sendMessage(): void {
|
||||
if (!inputText.value.trim()) return
|
||||
@@ -26,8 +28,9 @@ watch(
|
||||
() => props.messages.length,
|
||||
async () => {
|
||||
await nextTick()
|
||||
if (chatListRef.value) {
|
||||
chatListRef.value.scrollTop = chatListRef.value.scrollHeight
|
||||
const el = chatModalOpen.value ? chatModalListRef.value : chatListRef.value
|
||||
if (el) {
|
||||
el.scrollTop = el.scrollHeight
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -44,6 +47,9 @@ watch(
|
||||
<LoaderCircle :size="10" class="spin" />
|
||||
<span>Busy</span>
|
||||
</div>
|
||||
<button class="chat-expand-btn" @click="chatModalOpen = true" title="Open larger chat">
|
||||
<Maximize2 :size="14" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Focus Bar -->
|
||||
@@ -90,6 +96,68 @@ watch(
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Expanded Chat Modal -->
|
||||
<Teleport to="body">
|
||||
<div v-if="chatModalOpen" class="chat-modal-overlay" @click.self="chatModalOpen = false">
|
||||
<div class="chat-modal">
|
||||
<div class="chat-modal-header">
|
||||
<div class="chat-modal-header-left">
|
||||
<Bot :size="18" class="chat-header-icon" />
|
||||
<h2>Iris Chat</h2>
|
||||
</div>
|
||||
<div v-if="irisBusy" class="busy-badge">
|
||||
<LoaderCircle :size="10" class="spin" />
|
||||
<span>Busy</span>
|
||||
</div>
|
||||
<button class="chat-modal-close" @click="chatModalOpen = false" title="Close">
|
||||
<X :size="16" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="irisBusy && irisFocus" class="focus-bar">
|
||||
<span class="focus-label">Current Focus</span>
|
||||
<span class="focus-text">{{ irisFocus }}</span>
|
||||
</div>
|
||||
|
||||
<div ref="chatModalListRef" class="chat-modal-messages">
|
||||
<div
|
||||
v-for="msg in messages"
|
||||
:key="msg.id"
|
||||
:class="['msg-row', msg.sender === 'user' ? 'msg-user' : 'msg-iris']"
|
||||
>
|
||||
<div v-if="msg.sender === 'iris'" class="msg-avatar">
|
||||
<Bot :size="14" />
|
||||
</div>
|
||||
<div class="msg-bubble">
|
||||
<p>{{ msg.text }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="messages.length === 0" class="empty-state">
|
||||
<p>No messages yet. Start a conversation with Iris.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chat-modal-input-row">
|
||||
<input
|
||||
v-model="inputText"
|
||||
type="text"
|
||||
placeholder="Type a message..."
|
||||
@keyup.enter="sendMessage"
|
||||
/>
|
||||
<button
|
||||
class="send-btn"
|
||||
:disabled="!inputText.trim()"
|
||||
@click="sendMessage"
|
||||
aria-label="Send"
|
||||
>
|
||||
<Send :size="16" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@@ -152,6 +220,27 @@ watch(
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Expand Button */
|
||||
.chat-expand-btn {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
border-radius: 6px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
color: #6b7385;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition: all 0.2s;
|
||||
margin-left: 6px;
|
||||
}
|
||||
.chat-expand-btn:hover {
|
||||
background: rgba(167, 139, 250, 0.12);
|
||||
border-color: rgba(167, 139, 250, 0.25);
|
||||
color: #a78bfa;
|
||||
}
|
||||
|
||||
/* Focus Bar */
|
||||
.focus-bar {
|
||||
display: flex;
|
||||
@@ -293,4 +382,118 @@ watch(
|
||||
.send-btn:not(:disabled):hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
/* Chat Modal Overlay */
|
||||
.chat-modal-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
}
|
||||
.chat-modal {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 90%;
|
||||
max-width: 700px;
|
||||
height: 70vh;
|
||||
max-height: 80vh;
|
||||
background: rgba(22, 27, 34, 0.92);
|
||||
border: 1px solid rgba(139, 124, 246, 0.15);
|
||||
border-radius: 16px;
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
|
||||
overflow: hidden;
|
||||
animation: modal-in 0.2s ease-out;
|
||||
}
|
||||
@keyframes modal-in {
|
||||
from { opacity: 0; transform: scale(0.95) translateY(10px); }
|
||||
to { opacity: 1; transform: scale(1) translateY(0); }
|
||||
}
|
||||
.chat-modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
.chat-modal-header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex: 1;
|
||||
}
|
||||
.chat-modal-header h2 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #e8eaf0;
|
||||
}
|
||||
.chat-modal-close {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: #6b7385;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.chat-modal-close:hover {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
color: #e8eaf0;
|
||||
}
|
||||
|
||||
.chat-modal-messages {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 16px 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.chat-modal-messages::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
.chat-modal-messages::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
.chat-modal-messages::-webkit-scrollbar-thumb {
|
||||
background: rgba(139, 124, 246, 0.2);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.chat-modal-input-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 12px 16px;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
.chat-modal-input-row input {
|
||||
flex: 1;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-radius: 8px;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
color: #e8eaf0;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
min-width: 0;
|
||||
}
|
||||
.chat-modal-input-row input:focus {
|
||||
border-color: #a78bfa;
|
||||
}
|
||||
.chat-modal-input-row input::placeholder {
|
||||
color: #6b7385;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { ChevronLeft, ChevronRight, X } from '@lucide/vue'
|
||||
import type { FeedEntry } from '../../composables/useDashboardData'
|
||||
|
||||
const props = defineProps<{
|
||||
entries: FeedEntry[]
|
||||
modelValue: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
}>()
|
||||
|
||||
const selectedDayOffset = ref(0) // 0 = today, -1 = yesterday, etc.
|
||||
|
||||
function close() {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
|
||||
function dayLabel(offset: number): string {
|
||||
if (offset === 0) return 'Heute'
|
||||
if (offset === -1) return 'Gestern'
|
||||
if (offset === -2) return 'Vorgestern'
|
||||
const d = new Date()
|
||||
d.setDate(d.getDate() + offset)
|
||||
return d.toLocaleDateString('de-DE', { weekday: 'long', day: 'numeric', month: 'long' })
|
||||
}
|
||||
|
||||
function navigateDay(dir: -1 | 1) {
|
||||
const next = selectedDayOffset.value + dir
|
||||
if (next >= -6 && next <= 0) {
|
||||
selectedDayOffset.value = next
|
||||
}
|
||||
}
|
||||
|
||||
const filteredEntries = computed(() => {
|
||||
const targetDate = new Date()
|
||||
targetDate.setDate(targetDate.getDate() + selectedDayOffset.value)
|
||||
const targetStr = targetDate.toISOString().slice(0, 10)
|
||||
return props.entries.filter(e => e.timestamp.slice(0, 10) === targetStr)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-if="modelValue" class="feed-modal-overlay" @click.self="close">
|
||||
<div class="feed-modal-card">
|
||||
<div class="feed-modal-header">
|
||||
<h2 class="feed-modal-title">Operations Log</h2>
|
||||
<button class="feed-modal-close-btn" @click="close" aria-label="Close">
|
||||
<X :size="16" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="feed-modal-nav">
|
||||
<button
|
||||
class="feed-nav-btn"
|
||||
:disabled="selectedDayOffset <= -6"
|
||||
@click="navigateDay(-1)"
|
||||
aria-label="Previous day"
|
||||
>
|
||||
<ChevronLeft :size="14" />
|
||||
</button>
|
||||
<span class="feed-nav-label">{{ dayLabel(selectedDayOffset) }}</span>
|
||||
<button
|
||||
class="feed-nav-btn"
|
||||
:disabled="selectedDayOffset >= 0"
|
||||
@click="navigateDay(1)"
|
||||
aria-label="Next day"
|
||||
>
|
||||
<ChevronRight :size="14" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="feed-modal-entries">
|
||||
<div v-if="filteredEntries.length === 0" class="feed-modal-empty">
|
||||
Keine Einträge für diesen Tag.
|
||||
</div>
|
||||
<div
|
||||
v-for="(entry, idx) in filteredEntries"
|
||||
:key="entry.timestamp + '-' + idx"
|
||||
class="feed-modal-entry"
|
||||
>
|
||||
<span class="feed-time">{{ entry.time }}</span>
|
||||
<span class="feed-bullet">·</span>
|
||||
<span class="feed-agent" :class="'agent-' + entry.agent.toLowerCase()">
|
||||
{{ entry.agent }}
|
||||
</span>
|
||||
<span class="feed-action">{{ entry.action }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.feed-modal-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1000;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
backdrop-filter: blur(4px);
|
||||
padding: 20px;
|
||||
animation: feed-overlay-in 0.2s ease;
|
||||
}
|
||||
@keyframes feed-overlay-in {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
.feed-modal-card {
|
||||
background: #161b22;
|
||||
border: 1px solid rgba(139, 124, 246, 0.15);
|
||||
border-radius: 16px;
|
||||
padding: 24px;
|
||||
width: 100%;
|
||||
max-width: 520px;
|
||||
max-height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
|
||||
animation: feed-card-in 0.25s ease;
|
||||
}
|
||||
@keyframes feed-card-in {
|
||||
from { opacity: 0; transform: translateY(12px) scale(0.98); }
|
||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||
}
|
||||
|
||||
.feed-modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.feed-modal-title {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #e8eaf0;
|
||||
}
|
||||
.feed-modal-close-btn {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-radius: 6px;
|
||||
color: #7e8799;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.feed-modal-close-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: #e8eaf0;
|
||||
}
|
||||
|
||||
.feed-modal-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.feed-nav-btn {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border: 1px solid rgba(139, 124, 246, 0.15);
|
||||
background: rgba(139, 124, 246, 0.08);
|
||||
border-radius: 8px;
|
||||
color: #a78bfa;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.feed-nav-btn:hover:not(:disabled) {
|
||||
background: rgba(139, 124, 246, 0.16);
|
||||
border-color: rgba(139, 124, 246, 0.3);
|
||||
}
|
||||
.feed-nav-btn:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.feed-nav-label {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #d1d5db;
|
||||
min-width: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.feed-modal-entries {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
overflow-y: auto;
|
||||
max-height: 50vh;
|
||||
padding-right: 4px;
|
||||
}
|
||||
.feed-modal-empty {
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
font-size: 11px;
|
||||
color: #6b7385;
|
||||
}
|
||||
|
||||
.feed-modal-entry {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 5px 6px;
|
||||
border-radius: 6px;
|
||||
font-size: 9.5px;
|
||||
line-height: 1.3;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.feed-modal-entry:hover {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.feed-time {
|
||||
color: #6b7385;
|
||||
flex-shrink: 0;
|
||||
font-variant-numeric: tabular-nums;
|
||||
width: 32px;
|
||||
}
|
||||
.feed-bullet {
|
||||
color: #6b7385;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.feed-agent {
|
||||
font-weight: 600;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.agent-iris {
|
||||
color: #a78bfa;
|
||||
}
|
||||
.agent-developer {
|
||||
color: #3b82f6;
|
||||
}
|
||||
.agent-devops {
|
||||
color: #eab308;
|
||||
}
|
||||
.agent-researcher {
|
||||
color: #22c55e;
|
||||
}
|
||||
.agent-reviewer {
|
||||
color: #a855f7;
|
||||
}
|
||||
.feed-action {
|
||||
color: #7e8799;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { Activity, ChevronLeft, ChevronRight, X } from '@lucide/vue'
|
||||
import { Activity } from '@lucide/vue'
|
||||
import type { FeedEntry } from '../../composables/useDashboardData'
|
||||
import FeedDetailModal from './FeedDetailModal.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
entries: FeedEntry[]
|
||||
@@ -12,41 +13,10 @@ const compactEntries = computed(() => props.entries.slice(0, 5))
|
||||
|
||||
// ── Feed Detail Modal ──
|
||||
const showDetailModal = ref(false)
|
||||
const selectedDayOffset = ref(0) // 0 = today, -1 = yesterday, etc.
|
||||
|
||||
function openDetailModal() {
|
||||
selectedDayOffset.value = 0
|
||||
showDetailModal.value = true
|
||||
}
|
||||
|
||||
function closeDetailModal() {
|
||||
showDetailModal.value = false
|
||||
}
|
||||
|
||||
function dayLabel(offset: number): string {
|
||||
if (offset === 0) return 'Heute'
|
||||
if (offset === -1) return 'Gestern'
|
||||
if (offset === -2) return 'Vorgestern'
|
||||
const d = new Date()
|
||||
d.setDate(d.getDate() + offset)
|
||||
return d.toLocaleDateString('de-DE', { weekday: 'long', day: 'numeric', month: 'long' })
|
||||
}
|
||||
|
||||
function navigateDay(dir: -1 | 1) {
|
||||
const next = selectedDayOffset.value + dir
|
||||
if (next >= -6 && next <= 0) {
|
||||
selectedDayOffset.value = next
|
||||
}
|
||||
}
|
||||
|
||||
const filteredEntries = computed(() => {
|
||||
const targetDate = new Date()
|
||||
targetDate.setDate(targetDate.getDate() + selectedDayOffset.value)
|
||||
const targetStr = targetDate.toISOString().slice(0, 10)
|
||||
return props.entries.filter(e => e.timestamp.slice(0, 10) === targetStr)
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -81,55 +51,11 @@ const filteredEntries = computed(() => {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- ── Feed Detail Modal ── -->
|
||||
<Teleport to="body">
|
||||
<div v-if="showDetailModal" class="modal-overlay" @click.self="closeDetailModal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-title">Operations Log</h2>
|
||||
<button class="modal-close-btn" @click="closeDetailModal">
|
||||
<X :size="16" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-nav">
|
||||
<button
|
||||
class="nav-btn"
|
||||
:disabled="selectedDayOffset <= -6"
|
||||
@click="navigateDay(-1)"
|
||||
>
|
||||
<ChevronLeft :size="14" />
|
||||
</button>
|
||||
<span class="nav-label">{{ dayLabel(selectedDayOffset) }}</span>
|
||||
<button
|
||||
class="nav-btn"
|
||||
:disabled="selectedDayOffset >= 0"
|
||||
@click="navigateDay(1)"
|
||||
>
|
||||
<ChevronRight :size="14" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-entries">
|
||||
<div v-if="filteredEntries.length === 0" class="modal-empty">
|
||||
Keine Einträge für diesen Tag.
|
||||
</div>
|
||||
<div
|
||||
v-for="(entry, idx) in filteredEntries"
|
||||
:key="entry.timestamp + '-' + idx"
|
||||
class="feed-entry"
|
||||
>
|
||||
<span class="feed-time">{{ entry.time }}</span>
|
||||
<span class="feed-bullet">·</span>
|
||||
<span class="feed-agent" :class="'agent-' + entry.agent.toLowerCase()">
|
||||
{{ entry.agent }}
|
||||
</span>
|
||||
<span class="feed-action">{{ entry.action }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
<FeedDetailModal
|
||||
:entries="entries"
|
||||
:model-value="showDetailModal"
|
||||
@update:model-value="showDetailModal = $event"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -267,104 +193,4 @@ const filteredEntries = computed(() => {
|
||||
.feed-move {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
/* ── Modal Overlay ── */
|
||||
:global(.modal-overlay) {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1000;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
backdrop-filter: blur(4px);
|
||||
padding: 20px;
|
||||
}
|
||||
:global(.modal-content) {
|
||||
background: #161b22;
|
||||
border: 1px solid rgba(139, 124, 246, 0.15);
|
||||
border-radius: 16px;
|
||||
padding: 24px;
|
||||
width: 100%;
|
||||
max-width: 520px;
|
||||
max-height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
:global(.modal-header) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
:global(.modal-title) {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #e8eaf0;
|
||||
}
|
||||
:global(.modal-close-btn) {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-radius: 6px;
|
||||
color: #7e8799;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
:global(.modal-close-btn:hover) {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: #e8eaf0;
|
||||
}
|
||||
:global(.modal-nav) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
}
|
||||
:global(.nav-btn) {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border: 1px solid rgba(139, 124, 246, 0.15);
|
||||
background: rgba(139, 124, 246, 0.08);
|
||||
border-radius: 8px;
|
||||
color: #a78bfa;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
:global(.nav-btn:hover:not(:disabled)) {
|
||||
background: rgba(139, 124, 246, 0.16);
|
||||
border-color: rgba(139, 124, 246, 0.3);
|
||||
}
|
||||
:global(.nav-btn:disabled) {
|
||||
opacity: 0.3;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
:global(.nav-label) {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #d1d5db;
|
||||
min-width: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
:global(.modal-entries) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
overflow-y: auto;
|
||||
max-height: 50vh;
|
||||
padding-right: 4px;
|
||||
}
|
||||
:global(.modal-empty) {
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
font-size: 11px;
|
||||
color: #6b7385;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,23 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted, nextTick, computed } from 'vue'
|
||||
import { ref, computed, toRef } from 'vue'
|
||||
import { Bot, Code2, Server, Shield, Search, Terminal } from '@lucide/vue'
|
||||
|
||||
interface AgentData {
|
||||
id: string
|
||||
name: string
|
||||
role: string
|
||||
description: string
|
||||
tags: string[]
|
||||
color: string
|
||||
icon: string
|
||||
hero?: boolean
|
||||
task?: string
|
||||
runtime?: string
|
||||
model?: string
|
||||
}
|
||||
import type { AgentNodeData } from '../../composables/useDashboardData'
|
||||
import { useTeamNetworkSvg } from '../../composables/useTeamNetworkSvg'
|
||||
|
||||
const props = defineProps<{
|
||||
agents: AgentData[]
|
||||
agents: AgentNodeData[]
|
||||
heroId?: string
|
||||
activeAgents?: string[]
|
||||
}>()
|
||||
@@ -26,31 +14,27 @@ const emit = defineEmits<{
|
||||
select: [id: string]
|
||||
}>()
|
||||
|
||||
// ── Layout refs ──
|
||||
// ── Network ref ──
|
||||
const networkRef = ref<HTMLDivElement | null>(null)
|
||||
|
||||
interface CardBox {
|
||||
left: number
|
||||
right: number
|
||||
top: number
|
||||
bottom: number
|
||||
cx: number
|
||||
cy: number
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
const cardPositions = ref<Record<string, CardBox>>({})
|
||||
const svgWidth = ref(0)
|
||||
const svgHeight = ref(0)
|
||||
|
||||
// ── Computed data ──
|
||||
const hero = computed(() => props.agents.find(a => a.id === props.heroId) ?? props.agents[0])
|
||||
const childAgents = computed(() => props.agents.filter(a => a.id !== props.heroId))
|
||||
const heroId = computed(() => props.heroId ?? props.agents[0]?.id ?? '')
|
||||
|
||||
function isActive(id: string): boolean {
|
||||
return props.activeAgents?.includes(id) ?? false
|
||||
}
|
||||
|
||||
// ── SVG composable ──
|
||||
const {
|
||||
svgWidth,
|
||||
svgHeight,
|
||||
childAgents,
|
||||
connectionPaths,
|
||||
storePathRef,
|
||||
storePulseRef,
|
||||
storePulseRef2,
|
||||
} = useTeamNetworkSvg(networkRef, toRef(props, 'agents'), heroId, isActive)
|
||||
|
||||
// ── Icon resolver ──
|
||||
function resolveIcon(iconName: string) {
|
||||
switch (iconName) {
|
||||
@@ -64,225 +48,15 @@ function resolveIcon(iconName: string) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Position measurement ──
|
||||
function updatePositions() {
|
||||
if (!networkRef.value) return
|
||||
const rect = networkRef.value.getBoundingClientRect()
|
||||
svgWidth.value = rect.width
|
||||
svgHeight.value = rect.height
|
||||
|
||||
const cards = networkRef.value.querySelectorAll('[data-agent-id]')
|
||||
const positions: Record<string, CardBox> = {}
|
||||
cards.forEach(el => {
|
||||
const id = el.getAttribute('data-agent-id')
|
||||
if (!id) return
|
||||
const r = el.getBoundingClientRect()
|
||||
positions[id] = {
|
||||
left: r.left - rect.left,
|
||||
right: r.left + r.width - rect.left,
|
||||
top: r.top - rect.top,
|
||||
bottom: r.top + r.height - rect.top,
|
||||
cx: r.left + r.width / 2 - rect.left,
|
||||
cy: r.top + r.height / 2 - rect.top,
|
||||
width: r.width,
|
||||
height: r.height,
|
||||
}
|
||||
})
|
||||
cardPositions.value = positions
|
||||
// ── Runtime formatter ──
|
||||
function formatRuntime(seconds: number): string {
|
||||
const m = Math.floor(seconds / 60)
|
||||
const s = seconds % 60
|
||||
return `${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`
|
||||
}
|
||||
|
||||
// ── SVG path computation ──
|
||||
interface ConnectionPath {
|
||||
d: string
|
||||
length: number
|
||||
}
|
||||
|
||||
const connectionPaths = computed<Record<string, ConnectionPath | null>>(() => {
|
||||
const result: Record<string, ConnectionPath | null> = {}
|
||||
const pos = cardPositions.value
|
||||
const heroEntry = props.agents.find(a => a.id === props.heroId)
|
||||
const heroId = heroEntry?.id ?? ''
|
||||
const iris = heroId ? pos[heroId] : undefined
|
||||
if (!iris) return result
|
||||
|
||||
const children = childAgents.value
|
||||
const total = children.length
|
||||
if (total === 0) return result
|
||||
|
||||
for (let idx = 0; idx < total; idx++) {
|
||||
const agent = children[idx]
|
||||
const agentPos = pos[agent.id]
|
||||
if (!agentPos) {
|
||||
result[agent.id] = null
|
||||
continue
|
||||
}
|
||||
|
||||
// Spread start points across Iris bottom edge (30%-70% range)
|
||||
const t = total > 1 ? idx / (total - 1) : 0.5
|
||||
const startX = iris.left + iris.width * (0.38 + t * 0.24)
|
||||
const startY = iris.bottom - 1
|
||||
|
||||
// Determine column: left or right of Iris center
|
||||
const isLeftColumn = agentPos.cx < iris.cx
|
||||
|
||||
// End point: approach from side, 8px before card edge
|
||||
const endX = isLeftColumn ? agentPos.right - 8 : agentPos.left + 8
|
||||
const endY = agentPos.cy
|
||||
|
||||
// Bézier control points
|
||||
const cp1x = startX
|
||||
const cp1y = startY + 70
|
||||
const cp2x = endX + (isLeftColumn ? 35 : -35)
|
||||
const cp2y = endY - 10
|
||||
|
||||
const d = `M ${startX} ${startY} C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${endX} ${endY}`
|
||||
result[agent.id] = { d, length: 0 }
|
||||
}
|
||||
return result
|
||||
})
|
||||
|
||||
// ── Pulse animation (JS-driven via requestAnimationFrame) ──
|
||||
let animFrameId: number | null = null
|
||||
let lastAnimTime = 0
|
||||
|
||||
const pathElements = ref<Record<string, SVGPathElement | null>>({})
|
||||
const pulseElements = ref<Record<string, SVGPathElement | null>>({})
|
||||
const pulseOffsets = ref<Record<string, number>>({})
|
||||
|
||||
function storePathRef(id: string) {
|
||||
return (el: SVGPathElement | null) => {
|
||||
pathElements.value[id] = el
|
||||
}
|
||||
}
|
||||
|
||||
function storePulseRef(id: string) {
|
||||
return (el: SVGPathElement | null) => {
|
||||
pulseElements.value[id] = el
|
||||
}
|
||||
}
|
||||
|
||||
function refreshPathLengths() {
|
||||
for (const id of childAgents.value.map(a => a.id)) {
|
||||
const pathEl = pathElements.value[id]
|
||||
const pulseEl = pulseElements.value[id]
|
||||
const p = connectionPaths.value[id]
|
||||
if (pathEl && p) {
|
||||
p.length = pathEl.getTotalLength()
|
||||
}
|
||||
if (pulseEl && p && p.length > 0) {
|
||||
if (pulseOffsets.value[id] === undefined) {
|
||||
pulseOffsets.value[id] = 0
|
||||
}
|
||||
pulseEl.setAttribute('stroke-dasharray', `40 ${p.length}`)
|
||||
pulseEl.setAttribute('stroke-dashoffset', String(-pulseOffsets.value[id]))
|
||||
}
|
||||
const pulseEl2 = pulseElements2.value[id]
|
||||
if (pulseEl2 && p && p.length > 0) {
|
||||
if (pulseOffsets2.value[id] === undefined) {
|
||||
pulseOffsets2.value[id] = 0
|
||||
}
|
||||
pulseEl2.setAttribute('stroke-dasharray', `40 ${p.length}`)
|
||||
pulseEl2.setAttribute('stroke-dashoffset', String(-pulseOffsets2.value[id]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function startPulseAnimation() {
|
||||
const speeds: Record<string, number> = {}
|
||||
|
||||
refreshPathLengths()
|
||||
|
||||
for (const id of childAgents.value.map(a => a.id)) {
|
||||
const p = connectionPaths.value[id]
|
||||
if (p && p.length > 0) {
|
||||
speeds[id] = p.length / 3000
|
||||
if (pulseOffsets.value[id] === undefined) {
|
||||
pulseOffsets.value[id] = 0
|
||||
}
|
||||
if (pulseOffsets2.value[id] === undefined) {
|
||||
pulseOffsets2.value[id] = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastAnimTime = performance.now()
|
||||
|
||||
function tick(now: number) {
|
||||
const dt = now - lastAnimTime
|
||||
lastAnimTime = now
|
||||
|
||||
const children = childAgents.value
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const id = children[i].id
|
||||
const pathEl = pathElements.value[id]
|
||||
const pulseEl = pulseElements.value[id]
|
||||
const pulseEl2 = pulseElements2.value[id]
|
||||
const p = connectionPaths.value[id]
|
||||
if (!pathEl || !pulseEl || !p) continue
|
||||
|
||||
const len = p.length
|
||||
if (len <= 0) continue
|
||||
|
||||
const speed = speeds[id] ?? len / 3000
|
||||
const cycleLen = len + 40
|
||||
|
||||
// Pulse 1
|
||||
const currentOffset = pulseOffsets.value[id] ?? 0
|
||||
const newOffset = currentOffset + speed * dt
|
||||
pulseOffsets.value[id] = newOffset > cycleLen ? newOffset % cycleLen : newOffset
|
||||
pulseEl.setAttribute('stroke-dashoffset', String(-pulseOffsets.value[id]))
|
||||
|
||||
// Pulse 2 (offset by half cycle)
|
||||
if (pulseEl2) {
|
||||
const offset2 = (pulseOffsets.value[id] + cycleLen / 2) % cycleLen
|
||||
pulseOffsets2.value[id] = offset2
|
||||
pulseEl2.setAttribute('stroke-dashoffset', String(-offset2))
|
||||
}
|
||||
}
|
||||
|
||||
animFrameId = requestAnimationFrame(tick)
|
||||
}
|
||||
|
||||
animFrameId = requestAnimationFrame(tick)
|
||||
}
|
||||
|
||||
function stopPulseAnimation() {
|
||||
if (animFrameId !== null) {
|
||||
cancelAnimationFrame(animFrameId)
|
||||
animFrameId = null
|
||||
}
|
||||
}
|
||||
|
||||
// ── Lifecycle ──
|
||||
let resizeObserver: ResizeObserver | null = null
|
||||
|
||||
onMounted(async () => {
|
||||
await nextTick()
|
||||
updatePositions()
|
||||
|
||||
// Wait for SVG to render so path refs are populated
|
||||
await nextTick()
|
||||
updatePositions()
|
||||
refreshPathLengths()
|
||||
|
||||
startPulseAnimation()
|
||||
|
||||
resizeObserver = new ResizeObserver(() => {
|
||||
updatePositions()
|
||||
// Paths changed — recalculate lengths and dasharrays
|
||||
requestAnimationFrame(() => {
|
||||
refreshPathLengths()
|
||||
})
|
||||
})
|
||||
if (networkRef.value) {
|
||||
resizeObserver.observe(networkRef.value)
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
stopPulseAnimation()
|
||||
resizeObserver?.disconnect()
|
||||
})
|
||||
// ── Hero computed ──
|
||||
const hero = computed(() => props.agents.find(a => a.id === heroId.value) ?? props.agents[0])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -391,12 +165,12 @@ onUnmounted(() => {
|
||||
<span class="card-role-tag" :style="{ background: `${hero.color}18`, color: hero.color, borderColor: `${hero.color}30` }">{{ hero.role }}</span>
|
||||
</div>
|
||||
<p class="card-desc">{{ hero.description }}</p>
|
||||
<div v-if="hero.task" class="task-row">
|
||||
<div v-if="hero.currentTask" class="task-row">
|
||||
<span class="node-task">
|
||||
<span class="node-task-dot">●</span>
|
||||
{{ hero.task }}
|
||||
{{ hero.currentTask }}
|
||||
</span>
|
||||
<span v-if="hero.runtime" class="node-runtime">{{ hero.runtime }}</span>
|
||||
<span class="node-runtime">{{ formatRuntime(hero.runtimeSeconds) }}</span>
|
||||
<span v-if="hero.model" class="node-model">{{ hero.model }}</span>
|
||||
</div>
|
||||
<div class="card-tags">
|
||||
@@ -439,12 +213,12 @@ onUnmounted(() => {
|
||||
<span class="card-role-tag" :style="{ background: `${agent.color}18`, color: agent.color, borderColor: `${agent.color}30` }">{{ agent.role }}</span>
|
||||
</div>
|
||||
<p class="card-desc">{{ agent.description }}</p>
|
||||
<div v-if="agent.task" class="task-row">
|
||||
<div v-if="agent.currentTask" class="task-row">
|
||||
<span class="node-task">
|
||||
<span class="node-task-dot">●</span>
|
||||
{{ agent.task }}
|
||||
{{ agent.currentTask }}
|
||||
</span>
|
||||
<span v-if="agent.runtime" class="node-runtime">{{ agent.runtime }}</span>
|
||||
<span class="node-runtime">{{ formatRuntime(agent.runtimeSeconds) }}</span>
|
||||
<span v-if="agent.model" class="node-model">{{ agent.model }}</span>
|
||||
</div>
|
||||
<div class="card-tags">
|
||||
@@ -506,7 +280,7 @@ onUnmounted(() => {
|
||||
transition: border-color 0.3s, box-shadow 0.3s;
|
||||
}
|
||||
|
||||
/* ── Agent Card (inlined from old AgentCard.vue) ── */
|
||||
/* ── Agent Card ── */
|
||||
.agent-card {
|
||||
background: rgba(18, 22, 30, 0.45);
|
||||
backdrop-filter: blur(12px);
|
||||
@@ -634,7 +408,7 @@ onUnmounted(() => {
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
/* ── Hover Arrow (bottom-right) ── */
|
||||
/* ── Hover Arrow ── */
|
||||
.card-arrow {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
|
||||
@@ -8,8 +8,6 @@ export interface AgentNodeData {
|
||||
tags: string[]
|
||||
color: string
|
||||
icon: string
|
||||
task: string
|
||||
runtime: string
|
||||
model?: string
|
||||
hero?: boolean
|
||||
currentTask: string
|
||||
@@ -112,8 +110,6 @@ export function useDashboardData() {
|
||||
color: '#8b7cf6',
|
||||
icon: 'bot',
|
||||
hero: true,
|
||||
task: 'Orchestrating Nexus Dashboard redesign',
|
||||
runtime: '14:23',
|
||||
currentTask: 'Orchestrating Nexus Dashboard redesign',
|
||||
goal: 'Complete Mission Control v3',
|
||||
progress: 85,
|
||||
@@ -141,8 +137,6 @@ export function useDashboardData() {
|
||||
tags: ['Coding', 'Development', 'Builds'],
|
||||
color: '#3b82f6',
|
||||
icon: 'code',
|
||||
task: 'Building Dungeon System API endpoints',
|
||||
runtime: '01:00',
|
||||
currentTask: 'Building Dungeon System API endpoints',
|
||||
goal: 'Complete Dungeon CRUD + room generation',
|
||||
progress: 62,
|
||||
@@ -170,8 +164,6 @@ export function useDashboardData() {
|
||||
tags: ['Deployment', 'Docker', 'CI/CD'],
|
||||
color: '#eab308',
|
||||
icon: 'server',
|
||||
task: 'Optimizing Docker Compose caching',
|
||||
runtime: '00:30',
|
||||
currentTask: 'Optimizing Docker Compose caching',
|
||||
goal: 'Reduce build times by 40%',
|
||||
progress: 45,
|
||||
@@ -199,8 +191,6 @@ export function useDashboardData() {
|
||||
tags: ['Research', 'Analysis', 'Docs'],
|
||||
color: '#22c55e',
|
||||
icon: 'search',
|
||||
task: 'Analyzing WebSocket alternatives',
|
||||
runtime: '00:45',
|
||||
currentTask: 'Analyzing WebSocket alternatives',
|
||||
goal: 'Recommend real-time communication strategy',
|
||||
progress: 30,
|
||||
@@ -227,8 +217,6 @@ export function useDashboardData() {
|
||||
tags: ['Code Review', 'Testing', 'Quality'],
|
||||
color: '#a855f7',
|
||||
icon: 'shield',
|
||||
task: 'Reviewing Dungeon System PR',
|
||||
runtime: '00:15',
|
||||
currentTask: 'Reviewing Dungeon System PR',
|
||||
goal: 'Zero critical findings before merge',
|
||||
progress: 80,
|
||||
|
||||
@@ -0,0 +1,266 @@
|
||||
import { ref, computed, onMounted, onUnmounted, nextTick, type Ref } from 'vue'
|
||||
import type { AgentNodeData } from './useDashboardData'
|
||||
|
||||
export interface CardBox {
|
||||
left: number
|
||||
right: number
|
||||
top: number
|
||||
bottom: number
|
||||
cx: number
|
||||
cy: number
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
|
||||
export interface ConnectionPath {
|
||||
d: string
|
||||
length: number
|
||||
}
|
||||
|
||||
export function useTeamNetworkSvg(
|
||||
networkRef: Ref<HTMLElement | null>,
|
||||
agents: Ref<AgentNodeData[]>,
|
||||
heroId: Ref<string>,
|
||||
isActive: (id: string) => boolean,
|
||||
) {
|
||||
// ── Layout ──
|
||||
const cardPositions = ref<Record<string, CardBox>>({})
|
||||
const svgWidth = ref(0)
|
||||
const svgHeight = ref(0)
|
||||
|
||||
const childAgents = computed(() => agents.value.filter(a => a.id !== heroId.value))
|
||||
|
||||
function updatePositions() {
|
||||
const el = networkRef.value
|
||||
if (!el) return
|
||||
const rect = el.getBoundingClientRect()
|
||||
svgWidth.value = rect.width
|
||||
svgHeight.value = rect.height
|
||||
|
||||
const cards = el.querySelectorAll('[data-agent-id]')
|
||||
const positions: Record<string, CardBox> = {}
|
||||
cards.forEach(card => {
|
||||
const id = card.getAttribute('data-agent-id')
|
||||
if (!id) return
|
||||
const r = card.getBoundingClientRect()
|
||||
positions[id] = {
|
||||
left: r.left - rect.left,
|
||||
right: r.left + r.width - rect.left,
|
||||
top: r.top - rect.top,
|
||||
bottom: r.top + r.height - rect.top,
|
||||
cx: r.left + r.width / 2 - rect.left,
|
||||
cy: r.top + r.height / 2 - rect.top,
|
||||
width: r.width,
|
||||
height: r.height,
|
||||
}
|
||||
})
|
||||
cardPositions.value = positions
|
||||
}
|
||||
|
||||
// ── Connection paths ──
|
||||
const connectionPaths = computed<Record<string, ConnectionPath | null>>(() => {
|
||||
const result: Record<string, ConnectionPath | null> = {}
|
||||
const pos = cardPositions.value
|
||||
const iris = pos[heroId.value]
|
||||
if (!iris) return result
|
||||
|
||||
const children = childAgents.value
|
||||
const total = children.length
|
||||
if (total === 0) return result
|
||||
|
||||
for (let idx = 0; idx < total; idx++) {
|
||||
const agent = children[idx]
|
||||
const agentPos = pos[agent.id]
|
||||
if (!agentPos) {
|
||||
result[agent.id] = null
|
||||
continue
|
||||
}
|
||||
|
||||
// Spread start points across Iris bottom edge (30%-70% range)
|
||||
const t = total > 1 ? idx / (total - 1) : 0.5
|
||||
const startX = iris.left + iris.width * (0.38 + t * 0.24)
|
||||
const startY = iris.bottom - 1
|
||||
|
||||
// Determine column: left or right of Iris center
|
||||
const isLeftColumn = agentPos.cx < iris.cx
|
||||
|
||||
// End point: approach from side, 8px before card edge
|
||||
const endX = isLeftColumn ? agentPos.right - 8 : agentPos.left + 8
|
||||
const endY = agentPos.cy
|
||||
|
||||
// Bézier control points
|
||||
const cp1x = startX
|
||||
const cp1y = startY + 70
|
||||
const cp2x = endX + (isLeftColumn ? 35 : -35)
|
||||
const cp2y = endY - 10
|
||||
|
||||
const d = `M ${startX} ${startY} C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${endX} ${endY}`
|
||||
result[agent.id] = { d, length: 0 }
|
||||
}
|
||||
return result
|
||||
})
|
||||
|
||||
// ── Path refs (template ref functions) ──
|
||||
const pathElements = ref<Record<string, SVGPathElement | null>>({})
|
||||
const pulseElements = ref<Record<string, SVGPathElement | null>>({})
|
||||
const pulseElements2 = ref<Record<string, SVGPathElement | null>>({})
|
||||
const pulseOffsets = ref<Record<string, number>>({})
|
||||
const pulseOffsets2 = ref<Record<string, number>>({})
|
||||
|
||||
function storePathRef(id: string) {
|
||||
return (el: SVGPathElement | null) => {
|
||||
pathElements.value[id] = el
|
||||
}
|
||||
}
|
||||
|
||||
function storePulseRef(id: string) {
|
||||
return (el: SVGPathElement | null) => {
|
||||
pulseElements.value[id] = el
|
||||
}
|
||||
}
|
||||
|
||||
function storePulseRef2(id: string) {
|
||||
return (el: SVGPathElement | null) => {
|
||||
pulseElements2.value[id] = el
|
||||
}
|
||||
}
|
||||
|
||||
// ── Pulse animation ──
|
||||
let animFrameId: number | null = null
|
||||
let lastAnimTime = 0
|
||||
const speeds: Record<string, number> = {}
|
||||
|
||||
function refreshPathLengths() {
|
||||
for (const id of childAgents.value.map(a => a.id)) {
|
||||
const pathEl = pathElements.value[id]
|
||||
const pulseEl = pulseElements.value[id]
|
||||
const p = connectionPaths.value[id]
|
||||
if (pathEl && p) {
|
||||
p.length = pathEl.getTotalLength()
|
||||
}
|
||||
if (pulseEl && p && p.length > 0) {
|
||||
if (pulseOffsets.value[id] === undefined) {
|
||||
pulseOffsets.value[id] = 0
|
||||
}
|
||||
pulseEl.setAttribute('stroke-dasharray', `40 ${p.length}`)
|
||||
pulseEl.setAttribute('stroke-dashoffset', String(-pulseOffsets.value[id]))
|
||||
}
|
||||
const pulseEl2 = pulseElements2.value[id]
|
||||
if (pulseEl2 && p && p.length > 0) {
|
||||
if (pulseOffsets2.value[id] === undefined) {
|
||||
pulseOffsets2.value[id] = 0
|
||||
}
|
||||
pulseEl2.setAttribute('stroke-dasharray', `40 ${p.length}`)
|
||||
pulseEl2.setAttribute('stroke-dashoffset', String(-pulseOffsets2.value[id]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function startPulseAnimation() {
|
||||
refreshPathLengths()
|
||||
|
||||
for (const id of childAgents.value.map(a => a.id)) {
|
||||
const p = connectionPaths.value[id]
|
||||
if (p && p.length > 0) {
|
||||
speeds[id] = p.length / 3000
|
||||
if (pulseOffsets.value[id] === undefined) pulseOffsets.value[id] = 0
|
||||
if (pulseOffsets2.value[id] === undefined) pulseOffsets2.value[id] = 0
|
||||
}
|
||||
}
|
||||
|
||||
lastAnimTime = performance.now()
|
||||
|
||||
function tick(now: number) {
|
||||
const dt = now - lastAnimTime
|
||||
lastAnimTime = now
|
||||
|
||||
const children = childAgents.value
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const id = children[i].id
|
||||
const pathEl = pathElements.value[id]
|
||||
const pulseEl = pulseElements.value[id]
|
||||
const pulseEl2 = pulseElements2.value[id]
|
||||
const p = connectionPaths.value[id]
|
||||
if (!pathEl || !pulseEl || !p) continue
|
||||
|
||||
const len = p.length
|
||||
if (len <= 0) continue
|
||||
|
||||
const speed = speeds[id] ?? len / 3000
|
||||
const cycleLen = len + 40
|
||||
|
||||
// Pulse 1
|
||||
const currentOffset = pulseOffsets.value[id] ?? 0
|
||||
const newOffset = currentOffset + speed * dt
|
||||
pulseOffsets.value[id] = newOffset > cycleLen ? newOffset % cycleLen : newOffset
|
||||
pulseEl.setAttribute('stroke-dashoffset', String(-pulseOffsets.value[id]))
|
||||
|
||||
// Pulse 2 (offset by half cycle)
|
||||
if (pulseEl2) {
|
||||
const offset2 = (pulseOffsets.value[id] + cycleLen / 2) % cycleLen
|
||||
pulseOffsets2.value[id] = offset2
|
||||
pulseEl2.setAttribute('stroke-dashoffset', String(-offset2))
|
||||
}
|
||||
}
|
||||
|
||||
animFrameId = requestAnimationFrame(tick)
|
||||
}
|
||||
|
||||
animFrameId = requestAnimationFrame(tick)
|
||||
}
|
||||
|
||||
function stopPulseAnimation() {
|
||||
if (animFrameId !== null) {
|
||||
cancelAnimationFrame(animFrameId)
|
||||
animFrameId = null
|
||||
}
|
||||
}
|
||||
|
||||
// ── Lifecycle ──
|
||||
let resizeObserver: ResizeObserver | null = null
|
||||
|
||||
onMounted(async () => {
|
||||
await nextTick()
|
||||
updatePositions()
|
||||
|
||||
// Wait for SVG to render so path refs are populated
|
||||
await nextTick()
|
||||
updatePositions()
|
||||
refreshPathLengths()
|
||||
|
||||
startPulseAnimation()
|
||||
|
||||
resizeObserver = new ResizeObserver(() => {
|
||||
updatePositions()
|
||||
requestAnimationFrame(() => {
|
||||
refreshPathLengths()
|
||||
})
|
||||
})
|
||||
if (networkRef.value) {
|
||||
resizeObserver.observe(networkRef.value)
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
stopPulseAnimation()
|
||||
resizeObserver?.disconnect()
|
||||
})
|
||||
|
||||
return {
|
||||
cardPositions,
|
||||
svgWidth,
|
||||
svgHeight,
|
||||
childAgents,
|
||||
connectionPaths,
|
||||
pathElements,
|
||||
pulseElements,
|
||||
pulseElements2,
|
||||
pulseOffsets,
|
||||
pulseOffsets2,
|
||||
storePathRef,
|
||||
storePulseRef,
|
||||
storePulseRef2,
|
||||
updatePositions,
|
||||
refreshPathLengths,
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, ref } from 'vue'
|
||||
import TaskCard from '../components/dashboard/MissionCard.vue'
|
||||
import TaskCard from '../components/dashboard/TaskCard.vue'
|
||||
import OperationsFeed from '../components/dashboard/OperationsFeed.vue'
|
||||
import TeamNetwork from '../components/dashboard/TeamNetwork.vue'
|
||||
import ChatPanel from '../components/dashboard/ChatPanel.vue'
|
||||
import QueuePanel from '../components/dashboard/QueuePanel.vue'
|
||||
import AgentModal from '../components/dashboard/AgentModal.vue'
|
||||
import { useDashboardData } from '../composables/useDashboardData'
|
||||
import type { AgentNodeData } from '../../composables/useDashboardData'
|
||||
import type { AgentNodeData } from '../composables/useDashboardData'
|
||||
|
||||
const {
|
||||
agents, openTasks, feedEntries, chatMessages,
|
||||
irisBusy, irisFocus, irisRuntime, queue,
|
||||
irisBusy, irisFocus, queue,
|
||||
getAgentRuntime, startRuntime, stopRuntime,
|
||||
sendChat, removeQueueItem, moveQueueItem, changeQueuePriority,
|
||||
} = useDashboardData()
|
||||
@@ -68,9 +68,6 @@ function onQueueExecuteNow(id: string): void {
|
||||
<TeamNetwork
|
||||
hero-id="iris"
|
||||
:agents="agents"
|
||||
:iris-runtime="irisRuntime"
|
||||
:get-agent-runtime="getAgentRuntime"
|
||||
:iris-focus="irisFocus"
|
||||
@select="onAgentSelect"
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user