Files
SuperCharged-Claude-Code-Up…/public/claude-ide/components/approval-card.css
uroma a45b71e1e4 Implement terminal approval UI system
Phase 1: Backend approval tracking
- Add PendingApprovalsManager class to track pending approvals
- Add approval-request, approval-response, approval-expired WebSocket handlers
- Add requestApproval() method to ClaudeCodeService
- Add event forwarding for approval requests

Phase 2: Frontend approval card component
- Create approval-card.js with interactive UI
- Create approval-card.css with styled component
- Add Approve, Custom Instructions, Reject buttons
- Add expandable custom command input

Phase 3: Wire up approval flow end-to-end
- Add handleApprovalRequest, handleApprovalConfirmed, handleApprovalExpired handlers
- Add detectApprovalRequest() to parse AI approval request patterns
- Integrate approval card into WebSocket message flow
- Route approval responses based on source (server vs AI conversational)

This allows the AI agent to request command approval through a clean
UI instead of confusing conversational text responses.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-21 14:24:13 +00:00

266 lines
5.1 KiB
CSS

/* ============================================================
Approval Card Component Styles
============================================================ */
.approval-card {
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
border: 1px solid #4a9eff;
border-radius: 12px;
padding: 16px;
margin: 12px 0;
box-shadow: 0 4px 20px rgba(74, 158, 255, 0.2);
animation: approvalCardSlideIn 0.3s ease-out;
}
@keyframes approvalCardSlideIn {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Header Section */
.approval-card-header {
display: flex;
align-items: center;
gap: 8px;
padding-bottom: 12px;
border-bottom: 1px solid rgba(74, 158, 255, 0.3);
margin-bottom: 12px;
}
.approval-icon {
font-size: 20px;
animation: approvalIconPulse 2s infinite;
}
@keyframes approvalIconPulse {
0%, 100% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
}
.approval-label {
font-weight: 600;
color: #4a9eff;
font-size: 13px;
}
.approval-command {
background: rgba(0, 0, 0, 0.3);
padding: 4px 8px;
border-radius: 4px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 12px;
color: #7dd3fc;
flex: 1;
overflow-x: auto;
}
/* Explanation Section */
.approval-explanation {
display: flex;
align-items: flex-start;
gap: 8px;
padding: 10px;
background: rgba(74, 158, 255, 0.1);
border-radius: 8px;
margin-bottom: 12px;
font-size: 13px;
line-height: 1.4;
}
.explanation-icon {
font-size: 14px;
flex-shrink: 0;
}
.explanation-text {
color: #e0e0e0;
flex: 1;
}
/* Buttons Section */
.approval-buttons {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.approval-buttons button {
flex: 1;
min-width: 100px;
padding: 10px 16px;
border: none;
border-radius: 8px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-approve {
background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
color: white;
}
.btn-approve:hover {
background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}
.btn-custom {
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
color: white;
}
.btn-custom:hover {
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-reject {
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
color: white;
}
.btn-reject:hover {
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
/* Custom Instructions Section */
.approval-custom {
margin-top: 12px;
padding: 12px;
background: rgba(59, 130, 246, 0.1);
border-radius: 8px;
border: 1px solid rgba(59, 130, 246, 0.3);
}
.custom-label {
display: block;
font-size: 12px;
color: #94a3b8;
margin-bottom: 6px;
}
.custom-input {
width: 100%;
padding: 10px 12px;
background: rgba(0, 0, 0, 0.3);
border: 1px solid rgba(74, 158, 255, 0.3);
border-radius: 6px;
color: #e0e0e0;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 13px;
outline: none;
transition: all 0.2s ease;
}
.custom-input:focus {
border-color: #4a9eff;
box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}
.custom-input::placeholder {
color: #64748b;
}
.custom-buttons {
display: flex;
gap: 8px;
margin-top: 10px;
}
.btn-approve-small,
.btn-cancel-small {
flex: 1;
padding: 8px 12px;
border: none;
border-radius: 6px;
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-approve-small {
background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
color: white;
}
.btn-approve-small:hover {
background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}
.btn-cancel-small {
background: rgba(100, 116, 139, 0.2);
color: #94a3b8;
}
.btn-cancel-small:hover {
background: rgba(100, 116, 139, 0.3);
}
/* Responsive Design */
@media (max-width: 600px) {
.approval-buttons {
flex-direction: column;
}
.approval-buttons button {
width: 100%;
}
}
/* Loading/Disabled States */
.approval-card.loading {
opacity: 0.6;
pointer-events: none;
}
.approval-card.loading .approval-icon {
animation: approvalIconSpin 1s infinite linear;
}
@keyframes approvalIconSpin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* Expired State */
.approval-card.expired {
opacity: 0.5;
border-color: #ff6b6b;
}
/* Success State */
.approval-card.success {
border-color: #22c55e;
animation: approvalCardSuccess 0.5s ease-out;
}
@keyframes approvalCardSuccess {
0% {
background: rgba(34, 197, 94, 0.1);
}
100% {
background: transparent;
}
}