Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

v1.0.1: cap live-collab presence UI so a crowded room can't break the topbar

nyblnetb0fa90dc20bf
diff --git a/slides/package.json b/slides/package.json
index 5da3146b..47d27a41 100644
--- a/slides/package.json
+++ b/slides/package.json
@@ -1,7 +1,7 @@
{
"name": "bento-slides",
"private": true,
- "version": "1.0.0",
+ "version": "1.0.1",
"license": "MIT",
"type": "module",
"scripts": {
diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.ts
index c59ffbda..916abc86 100644
--- a/slides/src/editor/editor.ts
+++ b/slides/src/editor/editor.ts
@@ -86,13 +86,17 @@ export class Editor {
this.renderAvatars()
this.canvas.setRemotePeers(session.peers())
if (this.shareWrap.classList.contains('open')) this.renderSharePanel()
- // presence arrivals/departures get a quiet heads-up
+ // presence arrivals/departures get a quiet heads-up — but in a crowded
+ // room (or when joining one, where every existing peer looks like a fresh
+ // arrival), the per-peer toasts would storm. Stay silent past a threshold.
const now = new Map(session.peers().map((p) => [p.actor, p.name]))
- for (const [actor, name] of now) {
- if (!known.has(actor)) this.toast(t('{name} joined', { name }))
- }
- for (const [actor, name] of known) {
- if (!now.has(actor)) this.toast(t('{name} left', { name }))
+ if (now.size <= 8) {
+ for (const [actor, name] of now) {
+ if (!known.has(actor)) this.toast(t('{name} joined', { name }))
+ }
+ for (const [actor, name] of known) {
+ if (!now.has(actor)) this.toast(t('{name} left', { name }))
+ }
}
known = now
})
@@ -134,7 +138,14 @@ export class Editor {
private renderAvatars() {
if (!this.session) return
this.avatarsBox.innerHTML = ''
- for (const peer of this.session.peers()) {
+ const peers = this.session.peers()
+ // cap the strip so a crowded room can't blow out the topbar — show a few
+ // overlapping avatars, then a "+N" pill that opens the Live panel (which
+ // lists everyone, scrollable). Without this, N peers = N×28px of hard width.
+ // MAX=3 keeps the strip < 100px so even a 1280px laptop topbar never
+ // overflows (4+ clips the corner controls at that width — measured).
+ const MAX = 3
+ for (const peer of peers.slice(0, MAX)) {
const chip = document.createElement('button')
chip.className = 'ed-avatar'
chip.style.background = peer.color
@@ -150,6 +161,18 @@ export class Editor {
})
this.avatarsBox.appendChild(chip)
}
+ const extra = peers.length - MAX
+ if (extra > 0) {
+ const more = document.createElement('button')
+ more.className = 'ed-avatar ed-avatar-more'
+ more.textContent = `+${extra}`
+ more.title = t('{n} more — click to see everyone', { n: extra })
+ more.addEventListener('click', () => {
+ this.shareWrap.classList.add('open')
+ this.renderSharePanel()
+ })
+ this.avatarsBox.appendChild(more)
+ }
}
// --- DOM ----------------------------------------------------------------
diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.ts
index 033c57f7..0bd356ec 100644
--- a/slides/src/i18n/de.ts
+++ b/slides/src/i18n/de.ts
@@ -256,6 +256,7 @@ export const de: Catalog = {
"Offline — reconnecting…": "Offline — Verbindung wird wiederhergestellt…",
"Save the file and send a copy — opening it joins this session automatically.": "Datei speichern und eine Kopie senden — beim Öffnen tritt sie dieser Sitzung automatisch bei.",
"{n} connected": "{n} verbunden",
+ "{n} more — click to see everyone": "{n} weitere — zum Anzeigen aller klicken",
"Any copy of this file can join once sharing is on — send it before or after, both work.": "Jede Kopie dieser Datei kann beitreten, sobald das Teilen aktiv ist — vorher oder nachher gesendet, beides funktioniert.",
"Rotate keys — cut off previously sent copies": "Schlüssel erneuern — bereits versandte Kopien aussperren",
"New keys minted — only copies saved from now on can join": "Neue Schlüssel erzeugt — nur ab jetzt gespeicherte Kopien können beitreten",
diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.ts
index 63c1610e..8d12b3c3 100644
--- a/slides/src/i18n/es.ts
+++ b/slides/src/i18n/es.ts
@@ -256,6 +256,7 @@ export const es: Catalog = {
"Offline — reconnecting…": "Sin conexión — reconectando…",
"Save the file and send a copy — opening it joins this session automatically.": "Guarda el archivo y envía una copia: al abrirla se une a esta sesión automáticamente.",
"{n} connected": "{n} conectados",
+ "{n} more — click to see everyone": "{n} más — haz clic para ver a todos",
"Any copy of this file can join once sharing is on — send it before or after, both work.": "Cualquier copia de este archivo puede unirse cuando el uso compartido esté activo: da igual enviarla antes o después.",
"Rotate keys — cut off previously sent copies": "Rotar claves — cortar el acceso a copias ya enviadas",
"New keys minted — only copies saved from now on can join": "Claves nuevas generadas: solo podrán unirse las copias guardadas a partir de ahora",
diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.ts
index dfa08891..37a325c2 100644
--- a/slides/src/i18n/fr.ts
+++ b/slides/src/i18n/fr.ts
@@ -256,6 +256,7 @@ export const fr: Catalog = {
"Offline — reconnecting…": "Hors ligne — reconnexion…",
"Save the file and send a copy — opening it joins this session automatically.": "Enregistrez le fichier et envoyez une copie — l'ouvrir rejoint automatiquement cette session.",
"{n} connected": "{n} connectés",
+ "{n} more — click to see everyone": "{n} de plus — cliquez pour voir tout le monde",
"Any copy of this file can join once sharing is on — send it before or after, both work.": "Toute copie de ce fichier peut rejoindre dès que le partage est actif — envoyée avant ou après, les deux marchent.",
"Rotate keys — cut off previously sent copies": "Renouveler les clés — couper l'accès aux copies déjà envoyées",
"New keys minted — only copies saved from now on can join": "Nouvelles clés générées — seules les copies enregistrées à partir de maintenant pourront rejoindre",
diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.ts
index 370db12e..bfb51c2d 100644
--- a/slides/src/i18n/it.ts
+++ b/slides/src/i18n/it.ts
@@ -256,6 +256,7 @@ export const it: Catalog = {
"Offline — reconnecting…": "Offline — riconnessione…",
"Save the file and send a copy — opening it joins this session automatically.": "Salva il file e invia una copia: aprendola ci si unisce automaticamente alla sessione.",
"{n} connected": "{n} connessi",
+ "{n} more — click to see everyone": "{n} in più — fai clic per vedere tutti",
"Any copy of this file can join once sharing is on — send it before or after, both work.": "Qualsiasi copia di questo file può unirsi quando la condivisione è attiva: inviata prima o dopo, funziona comunque.",
"Rotate keys — cut off previously sent copies": "Ruota le chiavi — revoca le copie già inviate",
"New keys minted — only copies saved from now on can join": "Nuove chiavi generate: solo le copie salvate d'ora in poi potranno unirsi",
diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.ts
index 83477476..ab14aeea 100644
--- a/slides/src/i18n/ja.ts
+++ b/slides/src/i18n/ja.ts
@@ -256,6 +256,7 @@ export const ja: Catalog = {
"Offline — reconnecting…": "オフライン — 再接続中…",
"Save the file and send a copy — opening it joins this session automatically.": "ファイルを保存してコピーを送ってください — 開くだけでこのセッションに参加できます。",
"{n} connected": "{n} 人が接続中",
+ "{n} more — click to see everyone": "他 {n} 人 — クリックで全員を表示",
"Any copy of this file can join once sharing is on — send it before or after, both work.": "共有をオンにすると、このファイルのどのコピーからでも参加できます — 送るのは前でも後でも構いません。",
"Rotate keys — cut off previously sent copies": "キーを更新 — 送付済みコピーのアクセスを遮断",
"New keys minted — only copies saved from now on can join": "新しいキーを発行しました — 今後保存したコピーのみ参加できます",
diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.ts
index cd3a8782..2191155c 100644
--- a/slides/src/i18n/zh-Hans.ts
+++ b/slides/src/i18n/zh-Hans.ts
@@ -256,6 +256,7 @@ export const zhHans: Catalog = {
"Offline — reconnecting…": "离线 — 正在重连…",
"Save the file and send a copy — opening it joins this session automatically.": "保存文件并发送副本 — 打开即可自动加入此会话。",
"{n} connected": "{n} 人已连接",
+ "{n} more — click to see everyone": "还有 {n} 人 — 点击查看全部",
"Any copy of this file can join once sharing is on — send it before or after, both work.": "开启共享后,此文件的任何副本都能加入 — 先发后发都可以。",
"Rotate keys — cut off previously sent copies": "轮换密钥 — 切断此前发出的副本",
"New keys minted — only copies saved from now on can join": "已生成新密钥 — 只有此后保存的副本才能加入",
diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.ts
index 4225eff5..151d3942 100644
--- a/slides/src/i18n/zh-Hant.ts
+++ b/slides/src/i18n/zh-Hant.ts
@@ -256,6 +256,7 @@ export const zhHant: Catalog = {
"Offline — reconnecting…": "離線 — 正在重新連線…",
"Save the file and send a copy — opening it joins this session automatically.": "儲存檔案並傳送副本 — 開啟即會自動加入此工作階段。",
"{n} connected": "{n} 人已連線",
+ "{n} more — click to see everyone": "還有 {n} 人 — 點按查看全部",
"Any copy of this file can join once sharing is on — send it before or after, both work.": "開啟共用後,此檔案的任何副本都能加入 — 先傳後傳都可以。",
"Rotate keys — cut off previously sent copies": "輪替金鑰 — 切斷先前送出的副本",
"New keys minted — only copies saved from now on can join": "已產生新金鑰 — 只有之後儲存的副本才能加入",
diff --git a/slides/src/styles.css b/slides/src/styles.css
index 619d9b95..7465c33b 100644
--- a/slides/src/styles.css
+++ b/slides/src/styles.css
@@ -1219,14 +1219,14 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }
.ed-avatars {
display: flex;
align-items: center;
- gap: 4px;
- margin: 0 2px;
+ margin: 0 6px 0 2px;
+ flex-shrink: 0;
}
.ed-avatar {
width: 24px;
height: 24px;
border-radius: 50%;
- border: 2px solid rgba(255, 255, 255, 0.75);
+ border: 2px solid rgba(255, 255, 255, 0.85);
color: #16273e;
font: 700 11px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
display: flex;
@@ -1235,9 +1235,25 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }
cursor: pointer;
padding: 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
+ /* overlap into a coin-stack so N avatars stay bounded in width */
+ margin-left: -7px;
+}
+.ed-avatars .ed-avatar:first-child {
+ margin-left: 0;
}
.ed-avatar:hover {
transform: translateY(-1px);
+ z-index: 1;
+}
+/* the "+N" overflow pill — widens to fit the count, opens the Live panel */
+.ed-avatar-more {
+ width: auto;
+ min-width: 24px;
+ padding: 0 6px;
+ border-radius: 11px;
+ background: #4a5a72;
+ color: #fff;
+ font-size: 10.5px;
}
.ed-remote-layer {
position: absolute;
@@ -1291,7 +1307,7 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }
text-align: center;
line-height: 1.35;
}
-.ed-share-peers { display: flex; flex-direction: column; gap: 2px; }
+.ed-share-peers { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.ed-share-peer {
display: flex;
align-items: center;