Приложение и дашборд appdashboardsaashealthcaretelemedicinevideocallchat
Med Video Visit
Интерфейс видеоприёма: окно пациента, своё изображение, таймер, качество связи, кнопки микрофона, камеры, экрана и чата, панель чата и итог звонка.
Живое превью
Video visit with Lucas Silva
Asthma · inhaler technique
Live 00:00 Good connection
Encrypted
LS
Lucas Silva · 6 y · with mum, Ana Silva
LN
You · muted
Camera off
End the visit for everyone?
Visit ended ·
The recording was off. Write your note while the visit is fresh.
Write the consultation noteИспользование
Скопируйте и вставьте этот код на вашу страницу Astro:
astro
---
import { MedVideoVisit } from 'astro-component-kit/app';
---
<MedVideoVisit patient={{ name: 'Lucas Silva', sub: '6 y · with a parent' }} reason="Inhaler technique" noteHref="/app/consultation/">
<video slot="remote" autoplay playsinline></video>
</MedVideoVisit> ---
import { MedVideoVisit } from 'astro-component-kit/app';
---
<MedVideoVisit patient={{ name: 'Lucas Silva', sub: '6 y · with a parent' }} reason="Inhaler technique" noteHref="/app/consultation/">
<video slot="remote" autoplay playsinline></video>
</MedVideoVisit> Примеры в контексте
Реальный код из набора: как этот элемент используется в шаблонах, секциях и других компонентах.
ClinicTelehealthPage.astro astro
<MedVideoVisit
patient={{ name: p.name, sub: p.age < 14 ? `${p.age} y · with a parent` : `${p.age} y` }}
clinician={doc.name}
reason={live.reason}
noteHref={routes.consultation}
/> <MedVideoVisit
patient={{ name: p.name, sub: p.age < 14 ? `${p.age} y · with a parent` : `${p.age} y` }}
clinician={doc.name}
reason={live.reason}
noteHref={routes.consultation}
/> Используется в
Хорошо сочетается с
Ручная установка
Если вы не используете пакет npm, создайте файл и вставьте следующий код: src/components/lib/MedVideoVisit.astro:
astro
---
/**
* MedVideoVisit — Telemedicine call room (UI only, bring your own WebRTC/video SDK): patient video
* stage with a speaking indicator, self-view, live call timer, connection quality, controls for
* microphone, camera, screen share, chat and notes, a chat side panel and an end-of-call summary.
*
* @param {{name: string, sub?: string}} patient - Remote participant.
* @param {string} clinician - Local participant name. Default 'Dr. Laura Navarro'.
* @param {string} reason - Visit reason shown in the top bar.
* @param {number} elapsed - Seconds already elapsed when the page loads. Default 252.
* @param {Array<{from: 'patient'|'clinician', text: string, time: string}>} messages - Chat history.
* @param {string} noteHref - "Write the note" link after the call. Default '#'.
* @param {string} quality - Connection quality (good|fair|poor). Default 'good'.
* @param {string} id - Base id. Default 'video-visit'.
* @param {string} className - Extra class.
*
* Slots: `remote` and `self` — put your <video> elements here; illustrations are shown otherwise.
*
* Accessibility: controls are toggle buttons with aria-pressed and text labels (M / V shortcuts
* when focus is inside the room); the timer is not announced every second; state changes and new
* chat messages are announced in a polite live region; End call asks for confirmation in a
* focused dialog-like panel. Emits `app:call-toggle` `{ control, on }` and `app:call-ended` `{ seconds }`.
*/
import { initials, hueFrom } from './app-icons';
interface Props {
patient?: { name: string; sub?: string };
clinician?: string;
reason?: string;
elapsed?: number;
messages?: Array<{ from: 'patient' | 'clinician'; text: string; time: string }>;
noteHref?: string;
quality?: 'good' | 'fair' | 'poor';
id?: string;
className?: string;
}
const {
patient = { name: 'Lucas Silva', sub: '6 y · with mum, Ana Silva' },
clinician = 'Dr. Laura Navarro',
reason = 'Asthma · inhaler technique',
elapsed = 252,
messages = [
{ from: 'patient', text: 'Hi doctor, can you see us? Lucas has his inhaler ready.', time: '11:30' },
{ from: 'clinician', text: 'Yes, perfect. Hold it up to the camera so I can see the spacer.', time: '11:31' },
],
noteHref = '#',
quality = 'good',
id = 'video-visit',
className = '',
} = Astro.props;
const qualityLabel = { good: 'Good connection', fair: 'Fair connection', poor: 'Poor connection' }[quality];
const bars = { good: 3, fair: 2, poor: 1 }[quality];
const controls = [
{ key: 'mic', label: 'Microphone', on: true, short: 'M', icon: '<path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2M12 19v3"/>' },
{ key: 'cam', label: 'Camera', on: true, short: 'V', icon: '<rect x="2" y="6" width="14" height="12" rx="2"/><path d="m16 10 6-3v10l-6-3z"/>' },
{ key: 'share', label: 'Share screen', on: false, icon: '<rect x="2" y="4" width="20" height="13" rx="2"/><path d="M8 21h8M12 17v4M12 13V8M9 10l3-3 3 3"/>' },
{ key: 'chat', label: 'Chat', on: true, icon: '<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>' },
];
---
<section class:list={['vv', className]} aria-labelledby={`${id}-title`} data-vv data-elapsed={elapsed} tabindex="-1">
<header class="vv__bar">
<div class="vv__who">
<h2 class="vv__title" id={`${id}-title`}>Video visit with {patient.name}</h2>
<p class="vv__reason">{reason}</p>
</div>
<div class="vv__status">
<span class="vv__rec"><span aria-hidden="true"></span>Live</span>
<span class="vv__timer" aria-label="Call duration" data-vv-timer>00:00</span>
<span class={`vv__quality vv__quality--${quality}`} title={qualityLabel}>
<span class="vv__bars" aria-hidden="true">{[1, 2, 3].map((b) => <i class:list={{ on: b <= bars }} />)}</span>
<span class="sr-only">{qualityLabel}</span>
</span>
<span class="vv__secure" title="End-to-end encrypted">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg>
Encrypted
</span>
</div>
</header>
<div class="vv__body">
<div class="vv__stage">
<div class="vv__remote">
<slot name="remote">
<div class="vv__placeholder" style={`--av-h: ${hueFrom(patient.name)}`} aria-hidden="true">
<span class="vv__avatar vv__avatar--speaking">{initials(patient.name)}</span>
</div>
</slot>
<p class="vv__label"><span class="vv__speaking" aria-hidden="true"><i></i><i></i><i></i></span>{patient.name}{patient.sub && <span> · {patient.sub}</span>}</p>
</div>
<div class="vv__self" data-vv-self>
<slot name="self">
<div class="vv__placeholder vv__placeholder--self" style={`--av-h: ${hueFrom(clinician)}`} aria-hidden="true">
<span class="vv__avatar">{initials(clinician.replace(/^Dr\.\s*/, ''))}</span>
</div>
</slot>
<p class="vv__label vv__label--self">You<span class="vv__muted-tag" data-vv-muted hidden> · muted</span></p>
<p class="vv__camoff" data-vv-camoff hidden>Camera off</p>
</div>
<div class="vv__end-panel" role="group" aria-labelledby={`${id}-end-title`} data-vv-confirm hidden>
<p class="vv__end-title" id={`${id}-end-title`}>End the visit for everyone?</p>
<div class="vv__end-actions">
<button type="button" class="vv__pill" data-vv-cancel>Keep talking</button>
<button type="button" class="vv__pill vv__pill--danger" data-vv-confirm-end>End visit</button>
</div>
</div>
<div class="vv__ended" data-vv-ended hidden tabindex="-1">
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>
<p class="vv__ended-title">Visit ended · <span data-vv-total></span></p>
<p>The recording was off. Write your note while the visit is fresh.</p>
<a class="vv__pill vv__pill--primary" href={noteHref}>Write the consultation note</a>
</div>
</div>
<aside class="vv__chat" aria-labelledby={`${id}-chat-title`} data-vv-chat>
<h3 class="vv__chat-title" id={`${id}-chat-title`}>Chat</h3>
<ol class="vv__messages" data-vv-messages>
{messages.map((m) => (
<li class={`vv__msg vv__msg--${m.from}`}>
<span class="vv__msg-meta">{m.from === 'patient' ? patient.name : 'You'} · {m.time}</span>
<span class="vv__msg-text">{m.text}</span>
</li>
))}
</ol>
<form class="vv__compose" data-vv-compose>
<label class="sr-only" for={`${id}-msg`}>Message to {patient.name}</label>
<input id={`${id}-msg`} type="text" autocomplete="off" placeholder="Send a message or a link…" />
<button type="submit" aria-label="Send message">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m22 2-7 20-4-9-9-4z"/><path d="M22 2 11 13"/></svg>
</button>
</form>
</aside>
</div>
<div class="vv__controls" role="toolbar" aria-label="Call controls" data-vv-controls>
{controls.map((c) => (
<button type="button" class="vv__ctrl" aria-pressed={c.on ? 'true' : 'false'} data-vv-ctrl={c.key} aria-keyshortcuts={c.short}>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><Fragment set:html={c.icon} /></svg>
<span>{c.label}</span>
<span class="vv__slash" aria-hidden="true"></span>
</button>
))}
<button type="button" class="vv__ctrl vv__ctrl--end" data-vv-end>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.7 13.3a16 16 0 0 0 3.4 2.6l1.3-1.3a2 2 0 0 1 2.1-.5c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2v3a2 2 0 0 1-2.2 2A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8" transform="rotate(135 12 12)"/></svg>
<span>End</span>
</button>
</div>
<p class="sr-only" role="status" aria-live="polite" data-vv-live></p>
</section>
<script>
document.querySelectorAll<HTMLElement>('[data-vv]:not([data-bound])').forEach((root) => {
root.dataset.bound = '';
let seconds = Number(root.dataset.elapsed) || 0;
let ended = false;
const timer = root.querySelector<HTMLElement>('[data-vv-timer]')!;
const live = root.querySelector<HTMLElement>('[data-vv-live]')!;
const fmt = (s: number) => `${String(Math.floor(s / 60)).padStart(2, '0')}:${String(s % 60).padStart(2, '0')}`;
const tick = () => { timer.textContent = fmt(seconds); };
tick();
const interval = window.setInterval(() => { if (!ended) { seconds++; tick(); } }, 1000);
const setState = (key: string, on: boolean) => {
const btn = root.querySelector<HTMLButtonElement>(`[data-vv-ctrl="${key}"]`);
btn?.setAttribute('aria-pressed', String(on));
if (key === 'mic') root.querySelector<HTMLElement>('[data-vv-muted]')!.hidden = on;
if (key === 'cam') { root.querySelector<HTMLElement>('[data-vv-camoff]')!.hidden = on; root.querySelector('[data-vv-self]')?.classList.toggle('is-off', !on); }
if (key === 'chat') root.classList.toggle('vv--no-chat', !on);
if (key === 'share') root.classList.toggle('vv--sharing', on);
const names: Record<string, [string, string]> = { mic: ['Microphone on', 'Microphone muted'], cam: ['Camera on', 'Camera off'], share: ['Sharing your screen', 'Stopped sharing'], chat: ['Chat shown', 'Chat hidden'] };
live.textContent = names[key]?.[on ? 0 : 1] ?? '';
document.dispatchEvent(new CustomEvent('app:call-toggle', { detail: { control: key, on } }));
};
root.querySelectorAll<HTMLButtonElement>('[data-vv-ctrl]').forEach((b) => b.addEventListener('click', () => setState(b.dataset.vvCtrl!, b.getAttribute('aria-pressed') !== 'true')));
root.addEventListener('keydown', (e) => {
const t = e.target as HTMLElement;
if (ended || t.closest('input, textarea') || e.metaKey || e.ctrlKey || e.altKey) return;
if (e.key === 'm' || e.key === 'M') root.querySelector<HTMLButtonElement>('[data-vv-ctrl="mic"]')?.click();
if (e.key === 'v' || e.key === 'V') root.querySelector<HTMLButtonElement>('[data-vv-ctrl="cam"]')?.click();
});
// End call with confirmation.
const confirm = root.querySelector<HTMLElement>('[data-vv-confirm]')!;
const endBtn = root.querySelector<HTMLButtonElement>('[data-vv-end]')!;
endBtn.addEventListener('click', () => { confirm.hidden = false; root.querySelector<HTMLButtonElement>('[data-vv-cancel]')?.focus(); });
root.querySelector('[data-vv-cancel]')?.addEventListener('click', () => { confirm.hidden = true; endBtn.focus(); });
confirm.addEventListener('keydown', (e) => { if (e.key === 'Escape') { confirm.hidden = true; endBtn.focus(); } });
root.querySelector('[data-vv-confirm-end]')?.addEventListener('click', () => {
ended = true;
window.clearInterval(interval);
confirm.hidden = true;
root.classList.add('is-ended');
root.querySelectorAll<HTMLButtonElement>('[data-vv-controls] button').forEach((b) => { b.disabled = true; });
const done = root.querySelector<HTMLElement>('[data-vv-ended]')!;
root.querySelector('[data-vv-total]')!.textContent = fmt(seconds);
done.hidden = false;
done.focus();
document.dispatchEvent(new CustomEvent('app:call-ended', { detail: { seconds } }));
});
// Chat
const list = root.querySelector<HTMLOListElement>('[data-vv-messages]')!;
list.scrollTop = list.scrollHeight;
root.querySelector<HTMLFormElement>('[data-vv-compose]')?.addEventListener('submit', (e) => {
e.preventDefault();
const input = (e.currentTarget as HTMLFormElement).querySelector('input')!;
const text = input.value.trim();
if (!text) return;
const li = document.createElement('li');
li.className = 'vv__msg vv__msg--clinician';
const meta = document.createElement('span');
meta.className = 'vv__msg-meta';
meta.textContent = `You · ${new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`;
const body = document.createElement('span');
body.className = 'vv__msg-text';
body.textContent = text;
li.append(meta, body);
list.append(li);
list.scrollTop = list.scrollHeight;
input.value = '';
live.textContent = 'Message sent';
});
});
</script>
<style>
.vv {
--vv-accent: var(--app-accent, var(--c-primary-light, #0e7490));
--vv-dark: #0b1a1f;
display: grid;
gap: 0;
min-width: 0;
overflow: hidden;
border-radius: var(--r-lg, 14px);
background: var(--vv-dark);
color: #e7f3f5;
outline: none;
}
.vv__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3, 0.75rem); padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.vv__title { margin: 0; font-size: 1rem; font-weight: 700; color: #fff; }
.vv__reason { margin: 2px 0 0; font-size: 0.82rem; color: #a9c3c9; }
.vv__status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3, 0.75rem); font-size: 0.8rem; }
.vv__rec { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: rgb(239 68 68 / 0.18); color: #fecaca; font-weight: 700; }
.vv__rec span { width: 7px; height: 7px; border-radius: 50%; background: #f87171; animation: vv-blink 1.6s ease-in-out infinite; }
.vv__timer { font-variant-numeric: tabular-nums; font-weight: 700; color: #fff; }
.vv__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.vv__bars i { width: 4px; border-radius: 1px; background: rgb(255 255 255 / 0.25); }
.vv__bars i:nth-child(1) { height: 5px; } .vv__bars i:nth-child(2) { height: 9px; } .vv__bars i:nth-child(3) { height: 14px; }
.vv__quality--good .vv__bars i.on { background: #4ade80; }
.vv__quality--fair .vv__bars i.on { background: #fbbf24; }
.vv__quality--poor .vv__bars i.on { background: #f87171; }
.vv__secure { display: inline-flex; align-items: center; gap: 4px; color: #a9c3c9; }
.vv__body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 440px; }
.vv--no-chat .vv__body { grid-template-columns: minmax(0, 1fr); }
.vv--no-chat .vv__chat { display: none; }
.vv__stage { position: relative; min-height: 400px; padding: var(--sp-3, 0.75rem); }
.vv__remote { position: relative; height: 100%; min-height: 380px; overflow: hidden; border-radius: var(--r-md, 10px); }
.vv__remote :global(video), .vv__self :global(video) { width: 100%; height: 100%; object-fit: cover; }
.vv__placeholder { display: grid; place-items: center; width: 100%; height: 100%; min-height: inherit; background: radial-gradient(circle at 50% 35%, hsl(var(--av-h) 35% 30%), hsl(var(--av-h) 30% 12%) 70%); }
.vv__avatar { display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%; background: hsl(var(--av-h) 55% 82%); color: hsl(var(--av-h) 60% 20%); font-size: 2.4rem; font-weight: 800; }
.vv__avatar--speaking { box-shadow: 0 0 0 6px rgb(74 222 128 / 0.35), 0 0 0 14px rgb(74 222 128 / 0.12); animation: vv-speak 2.4s ease-in-out infinite; }
.vv--sharing .vv__remote::after { content: 'You are sharing your screen'; position: absolute; inset: auto 50% var(--sp-4, 1rem) auto; transform: translateX(50%); padding: 4px 12px; border-radius: 999px; background: var(--vv-accent); color: var(--c-on-primary, #fff); font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.vv__label { position: absolute; left: var(--sp-3, 0.75rem); bottom: var(--sp-3, 0.75rem); display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 10px; border-radius: 8px; background: rgb(0 0 0 / 0.55); font-size: 0.82rem; font-weight: 600; color: #fff; }
.vv__label span { font-weight: 400; color: #cfe1e5; }
.vv__speaking { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.vv__speaking i { width: 3px; border-radius: 2px; background: #4ade80; animation: vv-eq 1s ease-in-out infinite; }
.vv__speaking i:nth-child(2) { animation-delay: -0.3s; } .vv__speaking i:nth-child(3) { animation-delay: -0.6s; }
.vv__self { position: absolute; right: calc(var(--sp-3, 0.75rem) * 2); top: calc(var(--sp-3, 0.75rem) * 2); width: clamp(120px, 24%, 200px); aspect-ratio: 4 / 3; overflow: hidden; border: 2px solid rgb(255 255 255 / 0.2); border-radius: 10px; box-shadow: 0 10px 24px rgb(0 0 0 / 0.35); }
.vv__placeholder--self .vv__avatar { width: 52px; height: 52px; font-size: 1.1rem; }
.vv__self.is-off .vv__placeholder { background: #14262b; }
.vv__label--self { left: 6px; bottom: 6px; padding: 2px 7px; font-size: 0.72rem; }
.vv__camoff { position: absolute; top: 6px; left: 6px; margin: 0; padding: 2px 7px; border-radius: 6px; background: rgb(0 0 0 / 0.55); font-size: 0.7rem; }
.vv__camoff[hidden], .vv__muted-tag[hidden] { display: none; }
.vv__end-panel, .vv__ended {
position: absolute;
inset: 50% auto auto 50%;
transform: translate(-50%, -50%);
display: grid;
justify-items: center;
gap: var(--sp-3, 0.75rem);
width: min(90%, 360px);
padding: var(--sp-5, 1.25rem);
border-radius: var(--r-lg, 14px);
background: #10252b;
border: 1px solid rgb(255 255 255 / 0.12);
box-shadow: 0 20px 50px rgb(0 0 0 / 0.5);
text-align: center;
}
.vv__end-panel[hidden], .vv__ended[hidden] { display: none; }
.vv__end-title, .vv__ended-title { margin: 0; font-weight: 700; font-size: 1.05rem; color: #fff; }
.vv__ended p { margin: 0; color: #cfe1e5; font-size: 0.9rem; }
.vv__ended svg { color: #4ade80; }
.vv__ended:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.vv__end-actions { display: flex; gap: var(--sp-2, 0.5rem); }
.vv__pill { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 var(--sp-4, 1rem); border: 1px solid rgb(255 255 255 / 0.25); border-radius: 999px; background: transparent; color: #fff; font: inherit; font-size: 0.88rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.vv__pill--danger { border-color: #dc2626; background: #dc2626; }
.vv__pill--primary { border-color: #fff; background: #fff; color: #0b1a1f; }
.vv__pill--primary:hover { color: #0b1a1f; }
.vv__pill:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.vv__chat { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid rgb(255 255 255 / 0.08); background: #0f2228; }
.vv__chat-title { margin: 0; padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); font-size: 0.85rem; font-weight: 700; color: #fff; border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.vv__messages { flex: 1; display: grid; align-content: start; gap: var(--sp-3, 0.75rem); max-height: 360px; margin: 0; padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); overflow-y: auto; list-style: none; }
.vv__messages :global(.vv__msg) { display: grid; gap: 2px; max-width: 92%; }
.vv__messages :global(.vv__msg--clinician) { justify-self: end; text-align: right; }
.vv__messages :global(.vv__msg-meta) { font-size: 0.7rem; color: #a9c3c9; }
.vv__messages :global(.vv__msg-text) { padding: 8px 12px; border-radius: 12px; background: rgb(255 255 255 / 0.08); font-size: 0.88rem; line-height: 1.4; color: #fff; text-align: left; }
.vv__messages :global(.vv__msg--clinician .vv__msg-text) { background: var(--vv-accent); color: var(--c-on-primary, #fff); }
.vv__compose { display: flex; gap: var(--sp-2, 0.5rem); padding: var(--sp-3, 0.75rem); border-top: 1px solid rgb(255 255 255 / 0.08); }
.vv__compose input { flex: 1; min-width: 0; min-height: 44px; padding: 0 var(--sp-3, 0.75rem); border: 1px solid rgb(255 255 255 / 0.15); border-radius: 10px; background: rgb(255 255 255 / 0.05); color: #fff; font: inherit; font-size: 0.9rem; }
.vv__compose input::placeholder { color: #8fb0b7; }
.vv__compose button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--vv-accent); color: var(--c-on-primary, #fff); cursor: pointer; }
.vv__compose :is(input, button):focus-visible { outline: 3px solid #fff; outline-offset: 1px; }
.vv__controls { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2, 0.5rem); padding: var(--sp-3, 0.75rem); border-top: 1px solid rgb(255 255 255 / 0.08); }
.vv__ctrl { position: relative; display: grid; justify-items: center; gap: 4px; min-width: 76px; min-height: 64px; padding: var(--sp-2, 0.5rem); border: 0; border-radius: 12px; background: rgb(255 255 255 / 0.08); color: #fff; font: inherit; font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: background 0.2s ease; }
.vv__ctrl:hover:not(:disabled) { background: rgb(255 255 255 / 0.16); }
.vv__ctrl[aria-pressed='false'] { background: #fff; color: #0b1a1f; }
.vv__slash { position: absolute; top: 13px; left: 50%; width: 26px; height: 2px; background: currentColor; transform: translateX(-50%) rotate(-45deg); opacity: 0; }
[data-vv-ctrl='mic'][aria-pressed='false'] .vv__slash, [data-vv-ctrl='cam'][aria-pressed='false'] .vv__slash { opacity: 1; }
[data-vv-ctrl='share'][aria-pressed='true'], [data-vv-ctrl='chat'][aria-pressed='true'] { background: color-mix(in srgb, var(--vv-accent) 55%, transparent); }
[data-vv-ctrl='share'][aria-pressed='false'], [data-vv-ctrl='chat'][aria-pressed='false'] { background: rgb(255 255 255 / 0.08); color: #fff; }
.vv__ctrl--end { background: #dc2626; }
.vv__ctrl--end:hover:not(:disabled) { background: #b91c1c; }
.vv__ctrl:disabled { opacity: 0.4; cursor: not-allowed; }
.vv__ctrl:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes vv-blink { 50% { opacity: 0.3; } }
@keyframes vv-speak { 50% { box-shadow: 0 0 0 9px rgb(74 222 128 / 0.3), 0 0 0 20px rgb(74 222 128 / 0.08); } }
@keyframes vv-eq { 0%, 100% { height: 4px; } 50% { height: 12px; } }
@media (max-width: 900px) {
.vv__body { grid-template-columns: 1fr; }
.vv__chat { border-left: 0; border-top: 1px solid rgb(255 255 255 / 0.08); }
.vv__messages { max-height: 220px; }
}
@media (max-width: 520px) {
.vv__stage, .vv__remote { min-height: 300px; }
.vv__ctrl { min-width: 60px; }
.vv__ctrl span:not(.vv__slash) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
.vv__rec span, .vv__avatar--speaking, .vv__speaking i { animation: none; }
.vv__ctrl { transition: none; }
}
</style> ---
/**
* MedVideoVisit — Telemedicine call room (UI only, bring your own WebRTC/video SDK): patient video
* stage with a speaking indicator, self-view, live call timer, connection quality, controls for
* microphone, camera, screen share, chat and notes, a chat side panel and an end-of-call summary.
*
* @param {{name: string, sub?: string}} patient - Remote participant.
* @param {string} clinician - Local participant name. Default 'Dr. Laura Navarro'.
* @param {string} reason - Visit reason shown in the top bar.
* @param {number} elapsed - Seconds already elapsed when the page loads. Default 252.
* @param {Array<{from: 'patient'|'clinician', text: string, time: string}>} messages - Chat history.
* @param {string} noteHref - "Write the note" link after the call. Default '#'.
* @param {string} quality - Connection quality (good|fair|poor). Default 'good'.
* @param {string} id - Base id. Default 'video-visit'.
* @param {string} className - Extra class.
*
* Slots: `remote` and `self` — put your <video> elements here; illustrations are shown otherwise.
*
* Accessibility: controls are toggle buttons with aria-pressed and text labels (M / V shortcuts
* when focus is inside the room); the timer is not announced every second; state changes and new
* chat messages are announced in a polite live region; End call asks for confirmation in a
* focused dialog-like panel. Emits `app:call-toggle` `{ control, on }` and `app:call-ended` `{ seconds }`.
*/
import { initials, hueFrom } from './app-icons';
interface Props {
patient?: { name: string; sub?: string };
clinician?: string;
reason?: string;
elapsed?: number;
messages?: Array<{ from: 'patient' | 'clinician'; text: string; time: string }>;
noteHref?: string;
quality?: 'good' | 'fair' | 'poor';
id?: string;
className?: string;
}
const {
patient = { name: 'Lucas Silva', sub: '6 y · with mum, Ana Silva' },
clinician = 'Dr. Laura Navarro',
reason = 'Asthma · inhaler technique',
elapsed = 252,
messages = [
{ from: 'patient', text: 'Hi doctor, can you see us? Lucas has his inhaler ready.', time: '11:30' },
{ from: 'clinician', text: 'Yes, perfect. Hold it up to the camera so I can see the spacer.', time: '11:31' },
],
noteHref = '#',
quality = 'good',
id = 'video-visit',
className = '',
} = Astro.props;
const qualityLabel = { good: 'Good connection', fair: 'Fair connection', poor: 'Poor connection' }[quality];
const bars = { good: 3, fair: 2, poor: 1 }[quality];
const controls = [
{ key: 'mic', label: 'Microphone', on: true, short: 'M', icon: '<path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2M12 19v3"/>' },
{ key: 'cam', label: 'Camera', on: true, short: 'V', icon: '<rect x="2" y="6" width="14" height="12" rx="2"/><path d="m16 10 6-3v10l-6-3z"/>' },
{ key: 'share', label: 'Share screen', on: false, icon: '<rect x="2" y="4" width="20" height="13" rx="2"/><path d="M8 21h8M12 17v4M12 13V8M9 10l3-3 3 3"/>' },
{ key: 'chat', label: 'Chat', on: true, icon: '<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>' },
];
---
<section class:list={['vv', className]} aria-labelledby={`${id}-title`} data-vv data-elapsed={elapsed} tabindex="-1">
<header class="vv__bar">
<div class="vv__who">
<h2 class="vv__title" id={`${id}-title`}>Video visit with {patient.name}</h2>
<p class="vv__reason">{reason}</p>
</div>
<div class="vv__status">
<span class="vv__rec"><span aria-hidden="true"></span>Live</span>
<span class="vv__timer" aria-label="Call duration" data-vv-timer>00:00</span>
<span class={`vv__quality vv__quality--${quality}`} title={qualityLabel}>
<span class="vv__bars" aria-hidden="true">{[1, 2, 3].map((b) => <i class:list={{ on: b <= bars }} />)}</span>
<span class="sr-only">{qualityLabel}</span>
</span>
<span class="vv__secure" title="End-to-end encrypted">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg>
Encrypted
</span>
</div>
</header>
<div class="vv__body">
<div class="vv__stage">
<div class="vv__remote">
<slot name="remote">
<div class="vv__placeholder" style={`--av-h: ${hueFrom(patient.name)}`} aria-hidden="true">
<span class="vv__avatar vv__avatar--speaking">{initials(patient.name)}</span>
</div>
</slot>
<p class="vv__label"><span class="vv__speaking" aria-hidden="true"><i></i><i></i><i></i></span>{patient.name}{patient.sub && <span> · {patient.sub}</span>}</p>
</div>
<div class="vv__self" data-vv-self>
<slot name="self">
<div class="vv__placeholder vv__placeholder--self" style={`--av-h: ${hueFrom(clinician)}`} aria-hidden="true">
<span class="vv__avatar">{initials(clinician.replace(/^Dr\.\s*/, ''))}</span>
</div>
</slot>
<p class="vv__label vv__label--self">You<span class="vv__muted-tag" data-vv-muted hidden> · muted</span></p>
<p class="vv__camoff" data-vv-camoff hidden>Camera off</p>
</div>
<div class="vv__end-panel" role="group" aria-labelledby={`${id}-end-title`} data-vv-confirm hidden>
<p class="vv__end-title" id={`${id}-end-title`}>End the visit for everyone?</p>
<div class="vv__end-actions">
<button type="button" class="vv__pill" data-vv-cancel>Keep talking</button>
<button type="button" class="vv__pill vv__pill--danger" data-vv-confirm-end>End visit</button>
</div>
</div>
<div class="vv__ended" data-vv-ended hidden tabindex="-1">
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>
<p class="vv__ended-title">Visit ended · <span data-vv-total></span></p>
<p>The recording was off. Write your note while the visit is fresh.</p>
<a class="vv__pill vv__pill--primary" href={noteHref}>Write the consultation note</a>
</div>
</div>
<aside class="vv__chat" aria-labelledby={`${id}-chat-title`} data-vv-chat>
<h3 class="vv__chat-title" id={`${id}-chat-title`}>Chat</h3>
<ol class="vv__messages" data-vv-messages>
{messages.map((m) => (
<li class={`vv__msg vv__msg--${m.from}`}>
<span class="vv__msg-meta">{m.from === 'patient' ? patient.name : 'You'} · {m.time}</span>
<span class="vv__msg-text">{m.text}</span>
</li>
))}
</ol>
<form class="vv__compose" data-vv-compose>
<label class="sr-only" for={`${id}-msg`}>Message to {patient.name}</label>
<input id={`${id}-msg`} type="text" autocomplete="off" placeholder="Send a message or a link…" />
<button type="submit" aria-label="Send message">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m22 2-7 20-4-9-9-4z"/><path d="M22 2 11 13"/></svg>
</button>
</form>
</aside>
</div>
<div class="vv__controls" role="toolbar" aria-label="Call controls" data-vv-controls>
{controls.map((c) => (
<button type="button" class="vv__ctrl" aria-pressed={c.on ? 'true' : 'false'} data-vv-ctrl={c.key} aria-keyshortcuts={c.short}>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><Fragment set:html={c.icon} /></svg>
<span>{c.label}</span>
<span class="vv__slash" aria-hidden="true"></span>
</button>
))}
<button type="button" class="vv__ctrl vv__ctrl--end" data-vv-end>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.7 13.3a16 16 0 0 0 3.4 2.6l1.3-1.3a2 2 0 0 1 2.1-.5c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2v3a2 2 0 0 1-2.2 2A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8" transform="rotate(135 12 12)"/></svg>
<span>End</span>
</button>
</div>
<p class="sr-only" role="status" aria-live="polite" data-vv-live></p>
</section>
<script>
document.querySelectorAll<HTMLElement>('[data-vv]:not([data-bound])').forEach((root) => {
root.dataset.bound = '';
let seconds = Number(root.dataset.elapsed) || 0;
let ended = false;
const timer = root.querySelector<HTMLElement>('[data-vv-timer]')!;
const live = root.querySelector<HTMLElement>('[data-vv-live]')!;
const fmt = (s: number) => `${String(Math.floor(s / 60)).padStart(2, '0')}:${String(s % 60).padStart(2, '0')}`;
const tick = () => { timer.textContent = fmt(seconds); };
tick();
const interval = window.setInterval(() => { if (!ended) { seconds++; tick(); } }, 1000);
const setState = (key: string, on: boolean) => {
const btn = root.querySelector<HTMLButtonElement>(`[data-vv-ctrl="${key}"]`);
btn?.setAttribute('aria-pressed', String(on));
if (key === 'mic') root.querySelector<HTMLElement>('[data-vv-muted]')!.hidden = on;
if (key === 'cam') { root.querySelector<HTMLElement>('[data-vv-camoff]')!.hidden = on; root.querySelector('[data-vv-self]')?.classList.toggle('is-off', !on); }
if (key === 'chat') root.classList.toggle('vv--no-chat', !on);
if (key === 'share') root.classList.toggle('vv--sharing', on);
const names: Record<string, [string, string]> = { mic: ['Microphone on', 'Microphone muted'], cam: ['Camera on', 'Camera off'], share: ['Sharing your screen', 'Stopped sharing'], chat: ['Chat shown', 'Chat hidden'] };
live.textContent = names[key]?.[on ? 0 : 1] ?? '';
document.dispatchEvent(new CustomEvent('app:call-toggle', { detail: { control: key, on } }));
};
root.querySelectorAll<HTMLButtonElement>('[data-vv-ctrl]').forEach((b) => b.addEventListener('click', () => setState(b.dataset.vvCtrl!, b.getAttribute('aria-pressed') !== 'true')));
root.addEventListener('keydown', (e) => {
const t = e.target as HTMLElement;
if (ended || t.closest('input, textarea') || e.metaKey || e.ctrlKey || e.altKey) return;
if (e.key === 'm' || e.key === 'M') root.querySelector<HTMLButtonElement>('[data-vv-ctrl="mic"]')?.click();
if (e.key === 'v' || e.key === 'V') root.querySelector<HTMLButtonElement>('[data-vv-ctrl="cam"]')?.click();
});
// End call with confirmation.
const confirm = root.querySelector<HTMLElement>('[data-vv-confirm]')!;
const endBtn = root.querySelector<HTMLButtonElement>('[data-vv-end]')!;
endBtn.addEventListener('click', () => { confirm.hidden = false; root.querySelector<HTMLButtonElement>('[data-vv-cancel]')?.focus(); });
root.querySelector('[data-vv-cancel]')?.addEventListener('click', () => { confirm.hidden = true; endBtn.focus(); });
confirm.addEventListener('keydown', (e) => { if (e.key === 'Escape') { confirm.hidden = true; endBtn.focus(); } });
root.querySelector('[data-vv-confirm-end]')?.addEventListener('click', () => {
ended = true;
window.clearInterval(interval);
confirm.hidden = true;
root.classList.add('is-ended');
root.querySelectorAll<HTMLButtonElement>('[data-vv-controls] button').forEach((b) => { b.disabled = true; });
const done = root.querySelector<HTMLElement>('[data-vv-ended]')!;
root.querySelector('[data-vv-total]')!.textContent = fmt(seconds);
done.hidden = false;
done.focus();
document.dispatchEvent(new CustomEvent('app:call-ended', { detail: { seconds } }));
});
// Chat
const list = root.querySelector<HTMLOListElement>('[data-vv-messages]')!;
list.scrollTop = list.scrollHeight;
root.querySelector<HTMLFormElement>('[data-vv-compose]')?.addEventListener('submit', (e) => {
e.preventDefault();
const input = (e.currentTarget as HTMLFormElement).querySelector('input')!;
const text = input.value.trim();
if (!text) return;
const li = document.createElement('li');
li.className = 'vv__msg vv__msg--clinician';
const meta = document.createElement('span');
meta.className = 'vv__msg-meta';
meta.textContent = `You · ${new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`;
const body = document.createElement('span');
body.className = 'vv__msg-text';
body.textContent = text;
li.append(meta, body);
list.append(li);
list.scrollTop = list.scrollHeight;
input.value = '';
live.textContent = 'Message sent';
});
});
</script>
<style>
.vv {
--vv-accent: var(--app-accent, var(--c-primary-light, #0e7490));
--vv-dark: #0b1a1f;
display: grid;
gap: 0;
min-width: 0;
overflow: hidden;
border-radius: var(--r-lg, 14px);
background: var(--vv-dark);
color: #e7f3f5;
outline: none;
}
.vv__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3, 0.75rem); padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.vv__title { margin: 0; font-size: 1rem; font-weight: 700; color: #fff; }
.vv__reason { margin: 2px 0 0; font-size: 0.82rem; color: #a9c3c9; }
.vv__status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3, 0.75rem); font-size: 0.8rem; }
.vv__rec { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: rgb(239 68 68 / 0.18); color: #fecaca; font-weight: 700; }
.vv__rec span { width: 7px; height: 7px; border-radius: 50%; background: #f87171; animation: vv-blink 1.6s ease-in-out infinite; }
.vv__timer { font-variant-numeric: tabular-nums; font-weight: 700; color: #fff; }
.vv__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.vv__bars i { width: 4px; border-radius: 1px; background: rgb(255 255 255 / 0.25); }
.vv__bars i:nth-child(1) { height: 5px; } .vv__bars i:nth-child(2) { height: 9px; } .vv__bars i:nth-child(3) { height: 14px; }
.vv__quality--good .vv__bars i.on { background: #4ade80; }
.vv__quality--fair .vv__bars i.on { background: #fbbf24; }
.vv__quality--poor .vv__bars i.on { background: #f87171; }
.vv__secure { display: inline-flex; align-items: center; gap: 4px; color: #a9c3c9; }
.vv__body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 440px; }
.vv--no-chat .vv__body { grid-template-columns: minmax(0, 1fr); }
.vv--no-chat .vv__chat { display: none; }
.vv__stage { position: relative; min-height: 400px; padding: var(--sp-3, 0.75rem); }
.vv__remote { position: relative; height: 100%; min-height: 380px; overflow: hidden; border-radius: var(--r-md, 10px); }
.vv__remote :global(video), .vv__self :global(video) { width: 100%; height: 100%; object-fit: cover; }
.vv__placeholder { display: grid; place-items: center; width: 100%; height: 100%; min-height: inherit; background: radial-gradient(circle at 50% 35%, hsl(var(--av-h) 35% 30%), hsl(var(--av-h) 30% 12%) 70%); }
.vv__avatar { display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%; background: hsl(var(--av-h) 55% 82%); color: hsl(var(--av-h) 60% 20%); font-size: 2.4rem; font-weight: 800; }
.vv__avatar--speaking { box-shadow: 0 0 0 6px rgb(74 222 128 / 0.35), 0 0 0 14px rgb(74 222 128 / 0.12); animation: vv-speak 2.4s ease-in-out infinite; }
.vv--sharing .vv__remote::after { content: 'You are sharing your screen'; position: absolute; inset: auto 50% var(--sp-4, 1rem) auto; transform: translateX(50%); padding: 4px 12px; border-radius: 999px; background: var(--vv-accent); color: var(--c-on-primary, #fff); font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.vv__label { position: absolute; left: var(--sp-3, 0.75rem); bottom: var(--sp-3, 0.75rem); display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 10px; border-radius: 8px; background: rgb(0 0 0 / 0.55); font-size: 0.82rem; font-weight: 600; color: #fff; }
.vv__label span { font-weight: 400; color: #cfe1e5; }
.vv__speaking { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.vv__speaking i { width: 3px; border-radius: 2px; background: #4ade80; animation: vv-eq 1s ease-in-out infinite; }
.vv__speaking i:nth-child(2) { animation-delay: -0.3s; } .vv__speaking i:nth-child(3) { animation-delay: -0.6s; }
.vv__self { position: absolute; right: calc(var(--sp-3, 0.75rem) * 2); top: calc(var(--sp-3, 0.75rem) * 2); width: clamp(120px, 24%, 200px); aspect-ratio: 4 / 3; overflow: hidden; border: 2px solid rgb(255 255 255 / 0.2); border-radius: 10px; box-shadow: 0 10px 24px rgb(0 0 0 / 0.35); }
.vv__placeholder--self .vv__avatar { width: 52px; height: 52px; font-size: 1.1rem; }
.vv__self.is-off .vv__placeholder { background: #14262b; }
.vv__label--self { left: 6px; bottom: 6px; padding: 2px 7px; font-size: 0.72rem; }
.vv__camoff { position: absolute; top: 6px; left: 6px; margin: 0; padding: 2px 7px; border-radius: 6px; background: rgb(0 0 0 / 0.55); font-size: 0.7rem; }
.vv__camoff[hidden], .vv__muted-tag[hidden] { display: none; }
.vv__end-panel, .vv__ended {
position: absolute;
inset: 50% auto auto 50%;
transform: translate(-50%, -50%);
display: grid;
justify-items: center;
gap: var(--sp-3, 0.75rem);
width: min(90%, 360px);
padding: var(--sp-5, 1.25rem);
border-radius: var(--r-lg, 14px);
background: #10252b;
border: 1px solid rgb(255 255 255 / 0.12);
box-shadow: 0 20px 50px rgb(0 0 0 / 0.5);
text-align: center;
}
.vv__end-panel[hidden], .vv__ended[hidden] { display: none; }
.vv__end-title, .vv__ended-title { margin: 0; font-weight: 700; font-size: 1.05rem; color: #fff; }
.vv__ended p { margin: 0; color: #cfe1e5; font-size: 0.9rem; }
.vv__ended svg { color: #4ade80; }
.vv__ended:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.vv__end-actions { display: flex; gap: var(--sp-2, 0.5rem); }
.vv__pill { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 var(--sp-4, 1rem); border: 1px solid rgb(255 255 255 / 0.25); border-radius: 999px; background: transparent; color: #fff; font: inherit; font-size: 0.88rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.vv__pill--danger { border-color: #dc2626; background: #dc2626; }
.vv__pill--primary { border-color: #fff; background: #fff; color: #0b1a1f; }
.vv__pill--primary:hover { color: #0b1a1f; }
.vv__pill:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.vv__chat { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid rgb(255 255 255 / 0.08); background: #0f2228; }
.vv__chat-title { margin: 0; padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); font-size: 0.85rem; font-weight: 700; color: #fff; border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.vv__messages { flex: 1; display: grid; align-content: start; gap: var(--sp-3, 0.75rem); max-height: 360px; margin: 0; padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); overflow-y: auto; list-style: none; }
.vv__messages :global(.vv__msg) { display: grid; gap: 2px; max-width: 92%; }
.vv__messages :global(.vv__msg--clinician) { justify-self: end; text-align: right; }
.vv__messages :global(.vv__msg-meta) { font-size: 0.7rem; color: #a9c3c9; }
.vv__messages :global(.vv__msg-text) { padding: 8px 12px; border-radius: 12px; background: rgb(255 255 255 / 0.08); font-size: 0.88rem; line-height: 1.4; color: #fff; text-align: left; }
.vv__messages :global(.vv__msg--clinician .vv__msg-text) { background: var(--vv-accent); color: var(--c-on-primary, #fff); }
.vv__compose { display: flex; gap: var(--sp-2, 0.5rem); padding: var(--sp-3, 0.75rem); border-top: 1px solid rgb(255 255 255 / 0.08); }
.vv__compose input { flex: 1; min-width: 0; min-height: 44px; padding: 0 var(--sp-3, 0.75rem); border: 1px solid rgb(255 255 255 / 0.15); border-radius: 10px; background: rgb(255 255 255 / 0.05); color: #fff; font: inherit; font-size: 0.9rem; }
.vv__compose input::placeholder { color: #8fb0b7; }
.vv__compose button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--vv-accent); color: var(--c-on-primary, #fff); cursor: pointer; }
.vv__compose :is(input, button):focus-visible { outline: 3px solid #fff; outline-offset: 1px; }
.vv__controls { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2, 0.5rem); padding: var(--sp-3, 0.75rem); border-top: 1px solid rgb(255 255 255 / 0.08); }
.vv__ctrl { position: relative; display: grid; justify-items: center; gap: 4px; min-width: 76px; min-height: 64px; padding: var(--sp-2, 0.5rem); border: 0; border-radius: 12px; background: rgb(255 255 255 / 0.08); color: #fff; font: inherit; font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: background 0.2s ease; }
.vv__ctrl:hover:not(:disabled) { background: rgb(255 255 255 / 0.16); }
.vv__ctrl[aria-pressed='false'] { background: #fff; color: #0b1a1f; }
.vv__slash { position: absolute; top: 13px; left: 50%; width: 26px; height: 2px; background: currentColor; transform: translateX(-50%) rotate(-45deg); opacity: 0; }
[data-vv-ctrl='mic'][aria-pressed='false'] .vv__slash, [data-vv-ctrl='cam'][aria-pressed='false'] .vv__slash { opacity: 1; }
[data-vv-ctrl='share'][aria-pressed='true'], [data-vv-ctrl='chat'][aria-pressed='true'] { background: color-mix(in srgb, var(--vv-accent) 55%, transparent); }
[data-vv-ctrl='share'][aria-pressed='false'], [data-vv-ctrl='chat'][aria-pressed='false'] { background: rgb(255 255 255 / 0.08); color: #fff; }
.vv__ctrl--end { background: #dc2626; }
.vv__ctrl--end:hover:not(:disabled) { background: #b91c1c; }
.vv__ctrl:disabled { opacity: 0.4; cursor: not-allowed; }
.vv__ctrl:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes vv-blink { 50% { opacity: 0.3; } }
@keyframes vv-speak { 50% { box-shadow: 0 0 0 9px rgb(74 222 128 / 0.3), 0 0 0 20px rgb(74 222 128 / 0.08); } }
@keyframes vv-eq { 0%, 100% { height: 4px; } 50% { height: 12px; } }
@media (max-width: 900px) {
.vv__body { grid-template-columns: 1fr; }
.vv__chat { border-left: 0; border-top: 1px solid rgb(255 255 255 / 0.08); }
.vv__messages { max-height: 220px; }
}
@media (max-width: 520px) {
.vv__stage, .vv__remote { min-height: 300px; }
.vv__ctrl { min-width: 60px; }
.vv__ctrl span:not(.vv__slash) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
.vv__rec span, .vv__avatar--speaking, .vv__speaking i { animation: none; }
.vv__ctrl { transition: none; }
}
</style>
Краткая информация
- Категория
- Приложение и дашборд
- Имя файла
MedVideoVisit.astro- Зависимости
- Нет — чистый Astro + CSS
- Теги
- appdashboardsaashealthcaretelemedicinevideocallchat