feat(chat): extract and render action buttons from task cards (Cancel, Review Changes)
This commit is contained in:
@@ -433,6 +433,14 @@ body {
|
||||
padding: 8px 14px 10px;
|
||||
}
|
||||
|
||||
.msg-card-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
padding: 8px 14px;
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.msg-step {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
@@ -173,6 +173,35 @@ class ChatPanel {
|
||||
});
|
||||
}
|
||||
|
||||
// 카드 내부 액션 버튼 (Cancel, Review Changes 등)
|
||||
if (msg.actions && msg.actions.length > 0) {
|
||||
const actionsDiv = document.createElement('div');
|
||||
actionsDiv.className = 'msg-card-actions';
|
||||
|
||||
for (const btn of msg.actions) {
|
||||
const el = document.createElement('button');
|
||||
el.className = 'msg-action-btn';
|
||||
el.textContent = btn.label;
|
||||
|
||||
if (['Proceed', 'Approve', 'Accept', 'Yes', 'Allow'].some(k => btn.label.includes(k))) {
|
||||
el.classList.add('msg-action-primary');
|
||||
}
|
||||
|
||||
if (btn.x && btn.y) {
|
||||
el.style.cursor = 'pointer';
|
||||
el.addEventListener('click', (e) => {
|
||||
e.stopPropagation(); // 카드 토글 방지
|
||||
if (this.onActionClick) {
|
||||
this.onActionClick({ label: btn.label, x: btn.x, y: btn.y });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
actionsDiv.appendChild(el);
|
||||
}
|
||||
card.appendChild(actionsDiv);
|
||||
}
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user