Files
wz-phone/desktop/src/style.css
Siavash Sameni 61b6e67610
Some checks failed
Build Release Binaries / build-amd64 (push) Failing after 3m38s
feat: relay server dropdown with status indicators and manage dialog
- Relay selector as dropdown with green/yellow/red status dots
  (green < 200ms, yellow > 200ms, red = offline, gray = unknown)
- All relays pinged on startup, RTT shown next to each
- "Manage Relays..." dialog: add/remove servers, see live status
- Clicking a relay in dropdown selects it, fills connect form
- Recent room chips auto-select matching relay
- Migrates old single-relay settings format automatically
- Prevents connecting to offline relays

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 12:44:19 +04:00

675 lines
12 KiB
CSS

:root {
--bg: #0f0f1a;
--surface: #1a1a2e;
--surface2: #222244;
--primary: #0f3460;
--accent: #e94560;
--text: #eee;
--text-dim: #777;
--green: #4ade80;
--red: #ef4444;
--yellow: #facc15;
--radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
user-select: none;
-webkit-user-select: none;
}
#app {
display: flex;
flex-direction: column;
min-height: 100vh;
padding: 20px;
}
.hidden { display: none !important; }
/* ── Connect screen ── */
#connect-screen {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
gap: 20px;
}
#connect-screen h1 {
font-size: 26px;
font-weight: 700;
letter-spacing: 1px;
}
.subtitle {
font-size: 13px;
color: var(--text-dim);
margin-top: -12px;
letter-spacing: 2px;
text-transform: uppercase;
}
.form {
display: flex;
flex-direction: column;
gap: 12px;
width: 100%;
max-width: 320px;
}
.form label {
display: flex;
flex-direction: column;
gap: 4px;
font-size: 11px;
color: var(--text-dim);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.form input[type="text"] {
background: var(--surface);
border: 1px solid #333;
border-radius: 8px;
padding: 10px 12px;
color: var(--text);
font-size: 15px;
outline: none;
transition: border-color 0.2s;
}
.form input[type="text"]:focus {
border-color: var(--accent);
}
/* ── Relay dropdown ── */
.relay-dropdown-wrap {
position: relative;
}
.relay-selected {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
background: var(--surface);
border: 1px solid #333;
border-radius: 8px;
padding: 10px 12px;
color: var(--text);
font-size: 14px;
cursor: pointer;
text-align: left;
transition: border-color 0.2s;
}
.relay-selected:hover { border-color: var(--accent); }
.relay-selected .dot {
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
}
.relay-selected .arrow {
margin-left: auto;
font-size: 10px;
color: var(--text-dim);
}
.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }
.dot.gray { background: #555; }
.relay-menu {
position: absolute;
top: calc(100% + 4px);
left: 0;
right: 0;
background: var(--surface);
border: 1px solid #444;
border-radius: 8px;
overflow: hidden;
z-index: 50;
box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.relay-menu-item {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
cursor: pointer;
font-size: 13px;
transition: background 0.1s;
}
.relay-menu-item:hover { background: var(--surface2); }
.relay-menu-item.active { background: var(--primary); }
.relay-menu-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.relay-menu-item .relay-info { flex: 1; min-width: 0; }
.relay-menu-item .relay-name { font-weight: 500; }
.relay-menu-item .relay-addr { font-size: 11px; color: var(--text-dim); font-family: monospace; }
.relay-menu-item .relay-rtt { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.relay-manage-btn {
display: block;
width: 100%;
padding: 10px;
background: none;
border: none;
border-top: 1px solid #333;
color: var(--accent);
font-size: 13px;
cursor: pointer;
text-align: center;
}
.relay-manage-btn:hover { background: var(--surface2); }
/* ── Relay dialog ── */
#relay-dialog {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.6);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 200;
padding: 20px;
}
.relay-dialog-card {
max-width: 420px;
}
.relay-dialog-list {
display: flex;
flex-direction: column;
gap: 6px;
max-height: 300px;
overflow-y: auto;
}
.relay-dialog-item {
display: flex;
align-items: center;
gap: 8px;
background: var(--surface);
border-radius: 8px;
padding: 8px 12px;
}
.relay-dialog-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.relay-dialog-item .relay-info { flex: 1; }
.relay-dialog-item .relay-name { font-size: 13px; font-weight: 500; }
.relay-dialog-item .relay-addr { font-size: 11px; color: var(--text-dim); font-family: monospace; }
.relay-dialog-item .relay-rtt { font-size: 11px; color: var(--text-dim); margin-right: 4px; }
.relay-dialog-item .remove {
background: none;
border: none;
color: var(--text-dim);
cursor: pointer;
font-size: 16px;
padding: 0 4px;
}
.relay-dialog-item .remove:hover { color: var(--red); }
.relay-add-row {
display: flex;
gap: 6px;
margin-top: 12px;
}
.relay-add-row input {
background: var(--surface);
border: 1px solid #333;
border-radius: 8px;
padding: 8px 10px;
color: var(--text);
font-size: 13px;
outline: none;
flex: 1;
}
.relay-add-row input:focus { border-color: var(--accent); }
.form-row {
display: flex;
gap: 16px;
align-items: center;
}
.checkbox {
flex-direction: row !important;
align-items: center;
gap: 8px !important;
cursor: pointer;
font-size: 13px !important;
}
.checkbox input { width: 16px; height: 16px; }
button.primary {
background: var(--accent);
color: white;
border: none;
border-radius: 8px;
padding: 12px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: opacity 0.2s;
margin-top: 4px;
}
button.primary:hover { opacity: 0.9; }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.error {
color: var(--red);
font-size: 13px;
min-height: 18px;
}
.identity-info {
text-align: center;
}
.fp-display {
font-family: monospace;
font-size: 11px;
color: var(--text-dim);
}
.recent-rooms {
display: flex;
flex-wrap: wrap;
gap: 8px;
justify-content: center;
max-width: 320px;
}
.recent-room {
background: var(--surface);
border: 1px solid #333;
border-radius: 16px;
padding: 4px 12px;
font-size: 12px;
color: var(--text-dim);
cursor: pointer;
transition: all 0.2s;
}
.recent-room:hover {
border-color: var(--accent);
color: var(--text);
}
/* ── Call screen ── */
#call-screen {
display: flex;
flex-direction: column;
flex: 1;
gap: 16px;
}
.call-header {
text-align: center;
padding: 8px;
}
.room-name {
font-size: 20px;
font-weight: 600;
}
.call-meta {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
margin-top: 4px;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--green);
display: inline-block;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.status-dot.reconnecting {
background: var(--yellow);
animation: blink 0.5s infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.1; }
}
.call-timer {
font-size: 14px;
color: var(--text-dim);
font-variant-numeric: tabular-nums;
}
/* ── Audio level meter ── */
.level-meter {
height: 4px;
background: var(--surface);
border-radius: 2px;
overflow: hidden;
}
.level-bar-fill {
height: 100%;
width: 0%;
background: linear-gradient(90deg, var(--green) 0%, var(--yellow) 60%, var(--red) 100%);
border-radius: 2px;
transition: width 0.1s ease-out;
}
/* ── Participants ── */
.participants {
background: var(--surface);
border-radius: var(--radius);
padding: 12px 16px;
flex: 1;
overflow-y: auto;
min-height: 80px;
}
.participants-empty {
color: var(--text-dim);
font-size: 13px;
text-align: center;
padding: 20px 0;
}
.participant {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 0;
border-bottom: 1px solid #ffffff08;
}
.participant:last-child { border-bottom: none; }
.participant .avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background: var(--primary);
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 600;
flex-shrink: 0;
}
.participant .avatar.me {
background: var(--accent);
}
.participant .info { flex: 1; min-width: 0; }
.participant .name {
font-size: 14px;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.participant .fp {
font-size: 10px;
color: var(--text-dim);
font-family: monospace;
overflow: hidden;
text-overflow: ellipsis;
}
.participant .you-badge {
font-size: 10px;
color: var(--accent);
background: #e9456020;
padding: 1px 6px;
border-radius: 8px;
}
/* ── Controls ── */
.controls {
display: flex;
justify-content: center;
gap: 24px;
padding: 12px;
}
.control-btn {
display: flex;
align-items: center;
justify-content: center;
background: var(--surface2);
color: var(--text);
border: none;
border-radius: 50%;
width: 56px;
height: 56px;
cursor: pointer;
transition: all 0.15s;
font-size: 13px;
font-weight: 600;
}
.control-btn:hover { background: var(--primary); }
.control-btn.muted {
background: var(--red);
color: white;
}
.control-btn.hangup {
background: var(--red);
color: white;
width: 64px;
height: 64px;
font-size: 14px;
}
.control-btn.hangup:hover { opacity: 0.85; }
/* ── Stats ── */
.stats {
text-align: center;
font-size: 10px;
color: var(--text-dim);
font-family: monospace;
padding: 4px;
}
/* ── Icon button ── */
.icon-btn {
background: none;
border: 1px solid #444;
border-radius: 8px;
color: var(--text-dim);
font-size: 18px;
width: 36px;
height: 36px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--text); }
.icon-btn.small { width: 28px; height: 28px; font-size: 14px; }
.call-header-row {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
/* ── Settings panel ── */
#settings-panel {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
padding: 20px;
}
.settings-card {
background: var(--bg);
border: 1px solid #333;
border-radius: 16px;
padding: 24px;
width: 100%;
max-width: 380px;
max-height: 90vh;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 20px;
}
.settings-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.settings-header h2 {
font-size: 18px;
font-weight: 600;
}
.settings-section {
display: flex;
flex-direction: column;
gap: 10px;
}
.settings-section h3 {
font-size: 12px;
text-transform: uppercase;
letter-spacing: 1px;
color: var(--text-dim);
border-bottom: 1px solid #333;
padding-bottom: 4px;
}
.settings-section label {
display: flex;
flex-direction: column;
gap: 4px;
font-size: 11px;
color: var(--text-dim);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.settings-section input[type="text"] {
background: var(--surface);
border: 1px solid #333;
border-radius: 8px;
padding: 8px 10px;
color: var(--text);
font-size: 14px;
outline: none;
}
.settings-section input[type="text"]:focus {
border-color: var(--accent);
}
.setting-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 4px 0;
}
.setting-label {
font-size: 12px;
color: var(--text-dim);
}
.fp-display-large {
font-family: monospace;
font-size: 12px;
color: var(--text);
word-break: break-all;
}
.recent-rooms-list {
display: flex;
flex-direction: column;
gap: 4px;
}
.recent-room-item {
display: flex;
justify-content: space-between;
align-items: center;
background: var(--surface);
border-radius: 8px;
padding: 6px 10px;
font-size: 13px;
}
.recent-room-item .remove {
background: none;
border: none;
color: var(--text-dim);
cursor: pointer;
font-size: 16px;
}
.recent-room-item .remove:hover { color: var(--red); }
.secondary-btn {
background: var(--surface);
border: 1px solid #444;
border-radius: 8px;
padding: 8px;
color: var(--text-dim);
font-size: 13px;
cursor: pointer;
transition: all 0.15s;
}
.secondary-btn:hover { border-color: var(--accent); color: var(--text); }