feat: Implement Sign Request Manager component for handling sign requests in the popup (WIP)

- Added SignRequestManager.js to manage sign requests, including UI states for keyspace lock, mismatch, and approval.
- Implemented methods for loading state, rendering UI, and handling user interactions (approve/reject requests).
- Integrated background message listeners for keyspace unlock events and request updates.
This commit is contained in:
Sameh Abouel-saad
2025-06-04 16:55:15 +03:00
parent a0622629ae
commit 580fd72dce
13 changed files with 2067 additions and 41 deletions

View File

@@ -1069,4 +1069,195 @@ input::placeholder, textarea::placeholder {
.verification-icon svg {
width: 20px;
height: 20px;
}
/* Sign Request Manager Styles */
.sign-request-manager {
margin-top: 16px;
padding: 16px;
background: var(--bg-secondary);
border-radius: 8px;
border: 1px solid var(--border-color);
}
.connection-status {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
font-size: 12px;
font-weight: 500;
}
.status-indicator {
width: 8px;
height: 8px;
border-radius: 50%;
background: #ef4444;
}
.connection-status.connected .status-indicator {
background: #10b981;
}
.no-requests {
text-align: center;
padding: 20px;
color: var(--text-secondary);
}
.unlock-prompt, .keyspace-mismatch {
text-align: center;
padding: 20px;
}
.unlock-prompt h3, .keyspace-mismatch h3 {
margin: 0 0 12px 0;
font-size: 16px;
color: var(--text-primary);
}
.unlock-prompt p, .keyspace-mismatch p {
margin: 8px 0;
color: var(--text-secondary);
font-size: 14px;
}
.hint {
font-style: italic;
font-size: 12px !important;
color: var(--text-tertiary) !important;
}
.requests-header {
margin-bottom: 12px;
}
.requests-header h3 {
margin: 0;
font-size: 16px;
color: var(--text-primary);
}
.requests-list {
display: flex;
flex-direction: column;
gap: 12px;
}
.sign-request-card {
background: var(--bg-primary);
border: 1px solid var(--border-color);
border-radius: 6px;
padding: 12px;
}
.request-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.request-id {
font-family: monospace;
font-size: 12px;
color: var(--text-secondary);
font-weight: 500;
}
.request-time {
font-size: 11px;
color: var(--text-tertiary);
}
.request-message {
margin-bottom: 12px;
}
.request-message label {
display: block;
font-size: 12px;
font-weight: 500;
color: var(--text-secondary);
margin-bottom: 4px;
}
.message-content {
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 4px;
padding: 8px;
position: relative;
}
.message-preview {
font-family: monospace;
font-size: 11px;
color: var(--text-primary);
word-break: break-all;
line-height: 1.4;
max-height: 60px;
overflow: hidden;
}
.message-content.expanded .message-preview {
max-height: none;
}
.expand-message {
position: absolute;
top: 4px;
right: 4px;
background: var(--accent-color);
color: white;
border: none;
border-radius: 3px;
padding: 2px 6px;
font-size: 10px;
cursor: pointer;
transition: background-color 0.2s;
}
.expand-message:hover {
background: var(--accent-hover);
}
.request-actions {
display: flex;
gap: 8px;
justify-content: flex-end;
}
.btn-approve, .btn-reject {
padding: 6px 12px;
border: none;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
}
.btn-approve {
background: #10b981;
color: white;
}
.btn-approve:hover:not(:disabled) {
background: #059669;
}
.btn-reject {
background: #ef4444;
color: white;
}
.btn-reject:hover:not(:disabled) {
background: #dc2626;
}
.btn-approve:disabled, .btn-reject:disabled {
opacity: 0.6;
cursor: not-allowed;
}