refactor: overhaul home UI and audio playback reliability
Redesign the home page and voice stream panel into a compact dock layout to improve the chat experience. Implement a flush mechanism in the PCM playback worklet to handle the resampler tail, preventing premature session termination due to phantom outstanding playback. Fix document filter visibility in settings to ensure controls remain accessible when no results match, and refactor transcript insertion to maintain correct user/assistant ordering.
This commit is contained in:
@@ -1,47 +1,52 @@
|
||||
/* Host collapses its row to 0 when the call ends, so the composer never jumps when the bar is removed. */
|
||||
:host {
|
||||
display: block;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-rows: 1fr;
|
||||
opacity: 1;
|
||||
animation: dockIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
transition:
|
||||
grid-template-rows 0.35s cubic-bezier(0.22, 1, 0.36, 1),
|
||||
opacity 0.3s ease,
|
||||
margin 0.35s ease;
|
||||
}
|
||||
|
||||
.stream-panel {
|
||||
--footer-h: 3.5rem;
|
||||
--orb-zone: 7.25rem;
|
||||
--orb-gap: 0.75rem;
|
||||
--reserve: calc(var(--footer-h) + var(--orb-gap) + var(--orb-zone) + var(--orb-gap));
|
||||
:host(.is-ended) {
|
||||
grid-template-rows: 0fr;
|
||||
opacity: 0;
|
||||
margin-bottom: 0 !important;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.call-dock {
|
||||
direction: rtl;
|
||||
box-sizing: border-box;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
direction: rtl;
|
||||
background: transparent; /* was surface card */
|
||||
border: none; /* removed card border */
|
||||
border-radius: 0;
|
||||
box-shadow: none; /* removed card shadow */
|
||||
overflow: hidden;
|
||||
background: var(--surface-bg);
|
||||
border: 1px solid var(--surface-border);
|
||||
border-radius: 1.25rem;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
/* ---------- Orb layer (behind the transcript) ---------- */
|
||||
.stream-orb-layer {
|
||||
position: absolute;
|
||||
bottom: calc(var(--footer-h) + var(--orb-gap));
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 1;
|
||||
:host(.is-ended) .call-dock {
|
||||
border-color: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.dock-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
transition: opacity 0.45s ease, transform 0.45s ease;
|
||||
gap: 0.75rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
|
||||
/* ---------- Orb ---------- */
|
||||
/* The canvas is larger than the bar is tall (negative margin) so the orb and its glow are not tiny. */
|
||||
.orb-container {
|
||||
width: 88px;
|
||||
height: 88px;
|
||||
max-width: 100%;
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
margin-block: -20px;
|
||||
margin-inline: -14px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -56,11 +61,11 @@
|
||||
|
||||
/* Shown only when WebGL is unavailable */
|
||||
.orb-fallback {
|
||||
width: 70%;
|
||||
height: 70%;
|
||||
width: 55%;
|
||||
height: 55%;
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(circle at 35% 30%, #93c5fd, #3b82f6 55%, #1e3a5f);
|
||||
box-shadow: 0 0 40px rgba(59, 130, 246, 0.35);
|
||||
box-shadow: 0 0 24px rgba(59, 130, 246, 0.35);
|
||||
animation: fallbackPulse 2.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@@ -70,12 +75,14 @@
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.06);
|
||||
transform: scale(1.08);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- Status ---------- */
|
||||
.stream-status {
|
||||
.dock-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
@@ -83,9 +90,12 @@
|
||||
|
||||
.status-text {
|
||||
margin: 0;
|
||||
font-size: 0.8125rem;
|
||||
min-width: 0;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-secondary);
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
@@ -97,22 +107,22 @@
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.stream-status[data-state='LISTENING'] .status-dot {
|
||||
.status-dot[data-state='LISTENING'] {
|
||||
background: #22c55e;
|
||||
animation: dotPulse 1.6s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.stream-status[data-state='PROCESSING'] .status-dot {
|
||||
.status-dot[data-state='PROCESSING'] {
|
||||
background: #818cf8;
|
||||
animation: dotPulse 0.9s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.stream-status[data-state='SPEAKING'] .status-dot {
|
||||
.status-dot[data-state='SPEAKING'] {
|
||||
background: #a78bfa;
|
||||
animation: dotPulse 0.7s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.stream-status[data-state='INTERRUPTED'] .status-dot {
|
||||
.status-dot[data-state='INTERRUPTED'] {
|
||||
background: #f59e0b;
|
||||
}
|
||||
|
||||
@@ -128,56 +138,91 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- Transcript (overlaid on top of the orb) ---------- */
|
||||
.stream-transcript {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
max-width: 680px;
|
||||
margin: 0 auto;
|
||||
overflow-y: auto;
|
||||
/* Hide the scrollbar, keep wheel / trackpad / touch scrolling */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* legacy Edge */
|
||||
padding: 1rem 0.75rem var(--reserve);
|
||||
scroll-behavior: smooth;
|
||||
transition: padding-bottom 0.45s ease;
|
||||
}
|
||||
|
||||
.stream-transcript::-webkit-scrollbar {
|
||||
display: none; /* Chrome, Safari, Edge */
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* ---------- Retryable server error ---------- */
|
||||
.stream-error {
|
||||
position: absolute;
|
||||
bottom: calc(var(--footer-h) + 0.5rem);
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 3;
|
||||
/* ---------- Controls ---------- */
|
||||
.dock-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
width: min(100% - 1.5rem, 640px);
|
||||
box-sizing: border-box;
|
||||
padding: 0.5rem 0.75rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.dock-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.375rem;
|
||||
height: 40px;
|
||||
min-width: 40px;
|
||||
padding: 0 0.75rem;
|
||||
border: 1px solid var(--surface-border);
|
||||
border-radius: 9999px;
|
||||
background: var(--surface-bg);
|
||||
color: var(--text-secondary);
|
||||
font-family: inherit;
|
||||
font-size: 0.875rem;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.dock-btn:hover:not(:disabled) {
|
||||
background: var(--sidebar-hover);
|
||||
color: var(--text-primary);
|
||||
transform: scale(1.04);
|
||||
}
|
||||
|
||||
.dock-btn:active:not(:disabled) {
|
||||
transform: scale(0.96);
|
||||
}
|
||||
|
||||
.dock-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.dock-btn:focus-visible {
|
||||
outline: 2px solid var(--color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.dock-btn.is-active {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
border-color: rgba(239, 68, 68, 0.5);
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.dock-btn.is-end {
|
||||
background: #ef4444;
|
||||
border-color: #ef4444;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.dock-btn.is-end:hover:not(:disabled) {
|
||||
background: #dc2626;
|
||||
border-color: #dc2626;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* ---------- Retryable server error (second row inside the bar) ---------- */
|
||||
.dock-error {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin: 0 0.75rem 0.5rem;
|
||||
padding: 0.375rem 0.625rem;
|
||||
border: 1px solid rgba(239, 68, 68, 0.45);
|
||||
border-radius: 0.875rem;
|
||||
border-radius: 0.75rem;
|
||||
color: #dc2626;
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.stream-error span {
|
||||
.dock-error span {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.stream-error-close {
|
||||
.dock-error-close {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -191,112 +236,20 @@
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.stream-error-close:focus-visible {
|
||||
.dock-error-close:focus-visible {
|
||||
outline: 2px solid var(--color-primary);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
/* ---------- Controls ---------- */
|
||||
.stream-footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 3;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-bottom: 0.25rem;
|
||||
transition: opacity 0.45s ease, transform 0.45s ease;
|
||||
}
|
||||
|
||||
.stream-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.625rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.stream-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.625rem 1.25rem;
|
||||
border: 1px solid var(--surface-border);
|
||||
border-radius: 9999px;
|
||||
background: var(--surface-bg);
|
||||
color: var(--text-secondary);
|
||||
font-family: inherit;
|
||||
font-size: 0.875rem;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.stream-btn:hover:not(:disabled) {
|
||||
background: var(--sidebar-hover);
|
||||
color: var(--text-primary);
|
||||
transform: scale(1.03);
|
||||
}
|
||||
|
||||
.stream-btn:active:not(:disabled) {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
.stream-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.stream-btn:focus-visible {
|
||||
outline: 2px solid var(--color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.stream-btn.is-active {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
border-color: rgba(239, 68, 68, 0.5);
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.stream-btn.is-end {
|
||||
background: #ef4444;
|
||||
border-color: #ef4444;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.stream-btn.is-end:hover:not(:disabled) {
|
||||
background: #dc2626;
|
||||
border-color: #dc2626;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* ---------- Ended: orb + controls fade out, transcript stays ---------- */
|
||||
|
||||
/* The orb + footer reserve only exists while the call is live; collapsing it stops the
|
||||
bottom padding from forcing the panel (and the chat column) taller than the viewport. */
|
||||
.stream-panel.is-ended {
|
||||
--reserve: 0rem;
|
||||
}
|
||||
|
||||
.stream-panel.is-ended .stream-orb-layer {
|
||||
opacity: 0;
|
||||
transform: translateX(-50%) translateY(14px) scale(0.9);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.stream-panel.is-ended .stream-footer {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* The transcript keeps the full height of the chat column: no max-height, so it never
|
||||
collapses into a short nested scroll box — scrolling stays on the full-height area. */
|
||||
.stream-panel.is-ended .stream-transcript {
|
||||
padding: 1rem 0.75rem;
|
||||
@keyframes dockIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
@@ -312,31 +265,34 @@
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:host,
|
||||
.status-dot,
|
||||
.orb-fallback,
|
||||
.stream-btn,
|
||||
.stream-orb-layer,
|
||||
.stream-footer,
|
||||
.stream-transcript {
|
||||
.dock-btn {
|
||||
animation: none !important;
|
||||
transition: none !important;
|
||||
scroll-behavior: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.stream-panel {
|
||||
--footer-h: 3.25rem;
|
||||
--orb-zone: 6rem;
|
||||
--orb-gap: 0.5rem;
|
||||
.dock-row {
|
||||
gap: 0.5rem;
|
||||
padding: 0.375rem 0.625rem;
|
||||
}
|
||||
|
||||
.orb-container {
|
||||
width: 68px;
|
||||
height: 68px;
|
||||
width: 84px;
|
||||
height: 84px;
|
||||
margin-block: -16px;
|
||||
margin-inline: -12px;
|
||||
}
|
||||
|
||||
.stream-btn {
|
||||
padding: 0.5rem 1rem;
|
||||
.dock-btn-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.dock-btn.is-end {
|
||||
padding: 0;
|
||||
width: 40px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user