Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
src/ui/mod-menu.js builds the moderator menu for one chat line - Remove, Mute 10m/1h/24h/forever, Ban - and the exact /live frame each sends - module and test only #409
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
I added src/ui/mod-menu.js and src/ui/mod-menu.test.ts and pushed the branch. The 5 new tests pass. I didn't run the full bun test for so101.
shipped merged
I added src/ui/mod-menu.js and src/ui/mod-menu.test.ts and pushed the branch. The 5 new tests pass. I didn't run the full bun test for so101. tsc --noEmit failed with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so I have no type-check result.
menuItems(line, me)returns Remove, Mute 10m / 1h / 24h / forever, and Ban. It returns nothing for your own line, nothing for anyone who is neither owner nor moderator, and nothing for a moderator looking at the owner's or another moderator's line. The owner still gets the full menu on a moderator's line.frameFor(item, line)returns exactly{type:'delete',id},{type:'mute',id,on:true,for}or{type:'ban',id,on:true}. For mute and ban,idis the line author's user id.renderMenu(doc, items, onPick)builds buttons withmin-widthandmin-heightof 44px, text set throughtextContent.- Line and
meshape: I assumed a line looks like{id, from:{id, name, owner?, moderator?}}andmelooks like{id, owner?, moderator?}. The server's chatfromcarries no owner or moderator flags today, so whoever wires this up must supply them.viewer.htmlandlobby-panel.jsare unchanged and nothing loads the module yet.
The button-size test uses a small fake document rather than a real DOM, so it checks the style properties set, not rendered size.
🤖 Generated with Claude Code
Module and test only, as the issue asked. The frames match what lobby-panel.js and terminal.ts already send ({type:delete,id}, {type:mute,id,on,for}, {type:ban,id,on}). Nothing loads the module yet, so the preview is unchanged. Text goes through textContent and buttons are 44px. Next: (1) role=menu/menuitem promises arrow-key navigation and roving tabindex that renderMenu does not provide. Either add them or drop the roles and use a plain group of buttons. (2) Wiring needs owner/moderator flags on chat from, which the server does not send today. Keep that wiring in its own pull, and keep the terminal door in step.
I added
src/ui/mod-menu.jsandsrc/ui/mod-menu.test.tsand pushed the branch. The 5 new tests pass. I didn't run the fullbun testforso101.tsc --noEmitfailed with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so I have no type-check result.menuItems(line, me)returns Remove, Mute 10m / 1h / 24h / forever, and Ban. It returns nothing for your own line, nothing for anyone who is neither owner nor moderator, and nothing for a moderator looking at the owner's or another moderator's line. The owner still gets the full menu on a moderator's line.frameFor(item, line)returns exactly{type:'delete',id},{type:'mute',id,on:true,for}or{type:'ban',id,on:true}. For mute and ban,idis the line author's user id.renderMenu(doc, items, onPick)builds buttons withmin-widthandmin-heightof 44px, text set throughtextContent.meshape: I assumed a line looks like{id, from:{id, name, owner?, moderator?}}andmelooks like{id, owner?, moderator?}. The server's chatfromcarries no owner or moderator flags today, so whoever wires this up must supply them.viewer.htmlandlobby-panel.jsare unchanged and nothing loads the module yet.The button-size test uses a small fake
documentrather than a real DOM, so it checks the style properties set, not rendered size.🤖 Generated with Claude Code
Closes #384