Screen sharing #8

Merged
kibi merged 6 commits from screen-sharing into main 2026-10-01 20:40:25 +00:00
3 changed files with 16 additions and 5 deletions
Showing only changes of commit 5cc379417b - Show all commits
+3 -1
View File
@@ -18,7 +18,7 @@
}); });
</script> </script>
<section class="chat" aria-label="Chat"> <section class="chat" class:video-only={videoOnly} aria-label="Chat">
<header> <header>
{#if showMenu}<button class="icon-btn" onclick={onmenu} aria-label="Open channels"><Icon name="menu" /></button>{/if} {#if showMenu}<button class="icon-btn" onclick={onmenu} aria-label="Open channels"><Icon name="menu" /></button>{/if}
<Icon name={isDm ? 'message' : 'hash'} size={20} /> <Icon name={isDm ? 'message' : 'hash'} size={20} />
@@ -74,6 +74,8 @@
</section> </section>
<style> <style>
/* Stacked layout: room for about five lines of chat whatever the stream above takes */
.chat.video-only :global(.wrap[role=log]) { min-height: 124px; flex-shrink: 0; }
.chat { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-2); } .chat { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-2); }
header { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); color: var(--text-dim); } header { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); color: var(--text-dim); }
h1 { flex: 0 1 auto; max-width: 60%; font-size: 16px; margin: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } h1 { flex: 0 1 auto; max-width: 60%; font-size: 16px; margin: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+5 -4
View File
@@ -350,10 +350,11 @@
.away { flex: 1; margin: 0; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 13px; } .away { flex: 1; margin: 0; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 13px; }
.vol { width: 110px; flex: none; padding: 0; } .vol { width: 110px; flex: none; padding: 0; }
/* Video only: the picture as wide as the chat, as tall as its shape asks */ /* Video only: the picture as wide as the chat, as tall as its shape asks */
.stage.solo { background: #000; } /* It gives way when the window is short, so the chat below keeps its last lines in view */
.stage.solo .spot { flex: none; } .stage.solo { flex: 0 1 auto; background: #000; }
.stage.solo .pic { flex: none; display: block; } .stage.solo .spot { flex: 0 1 auto; }
.stage.solo .spot video { height: auto; max-height: 62vh; } .stage.solo .pic { flex: 0 1 auto; flex-direction: column; }
.stage.solo .spot video { flex: 0 1 auto; height: auto; max-height: 62vh; }
.stage.solo .away { flex: none; padding: 24px; } .stage.solo .away { flex: none; padding: 24px; }
.wait { margin: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; color: var(--text-dim); background: var(--bg-1); } .wait { margin: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; color: var(--text-dim); background: var(--bg-1); }
.wait span { flex: 1; min-width: 0; } .wait span { flex: 1; min-width: 0; }
+8
View File
@@ -104,6 +104,14 @@ try {
await alice.page.setViewportSize({ width: 600, height: 800 }); await alice.page.setViewportSize({ width: 600, height: 800 });
await alice.page.locator('.app.stacked .stage.solo video').waitFor(); await alice.page.locator('.app.stacked .stage.solo video').waitFor();
assert.ok(await fits(), 'still as wide as the chat on a narrow window'); assert.ok(await fits(), 'still as wide as the chat on a narrow window');
// On a short window the picture gives way and the chat keeps about five lines
await alice.page.setViewportSize({ width: 600, height: 700 });
const heights = () => alice.page.evaluate(() => [document.querySelector('.chat [role=log]')!.getBoundingClientRect().height, document.querySelector('.stage.solo video')!.getBoundingClientRect().height]);
await alice.page.waitForFunction(() => document.querySelector('.stage.solo video')!.getBoundingClientRect().height < 250);
const [logH, videoH] = await heights();
assert.ok(logH >= 120, `chat keeps its lines: ${logH}`);
assert.ok(videoH > 40, `the picture is still shown: ${videoH}`);
await alice.page.setViewportSize({ width: 600, height: 800 });
if (process.env.SHOTS_DIR) await alice.page.screenshot({ path: `${process.env.SHOTS_DIR}/stacked.png` }); if (process.env.SHOTS_DIR) await alice.page.screenshot({ path: `${process.env.SHOTS_DIR}/stacked.png` });
await alice.page.getByText('0 watching').waitFor(); await alice.page.getByText('0 watching').waitFor();
await alice.page.setViewportSize({ width: 1280, height: 800 }); await alice.page.setViewportSize({ width: 1280, height: 800 });