From 75ca7b1b1e017eda78ad4fdfea3c3f7027ec7e3a Mon Sep 17 00:00:00 2001 From: James R <113132470+JamesRand12@users.noreply.github.com> Date: Fri, 7 Nov 2025 00:51:01 +0100 Subject: [PATCH] feat: improve emoji panel UI and UX (#2383) Added some basic fixes: - Add backdrop overlay with outside-click-to-close - Reduce emoji button sizes to fit all emojis without scrolling - Update styling to match player info panel theme ## Description: I updated the emoji panel such as reducing the size so it fits on the screen without scrolling for emojis, and ability to close the panel by clicking outside of it. Previously you couldn't close the panel by clicking outside of it, and this was inconsistent with the rest of the UI. I also updated the styling to match the panel before that (the player info panel). ## Please complete the following: - [x] I have added screenshots for all UI updates - [ ] I process any text displayed to the user through translateText() and I've added it to the en.json file - [ ] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: insane.p image --------- Co-authored-by: Evan --- src/client/graphics/layers/EmojiTable.ts | 85 ++++++++++++++---------- 1 file changed, 51 insertions(+), 34 deletions(-) diff --git a/src/client/graphics/layers/EmojiTable.ts b/src/client/graphics/layers/EmojiTable.ts index ca87f009b..ef2745280 100644 --- a/src/client/graphics/layers/EmojiTable.ts +++ b/src/client/graphics/layers/EmojiTable.ts @@ -57,6 +57,15 @@ export class EmojiTable extends LitElement { private onEmojiClicked: (emoji: string) => void = () => {}; + private handleBackdropClick = (e: MouseEvent) => { + const panelContent = this.querySelector( + 'div[class*="bg-zinc-900"]', + ) as HTMLElement; + if (panelContent && !panelContent.contains(e.target as Node)) { + this.hideTable(); + } + }; + render() { if (!this.isVisible) { return null; @@ -64,43 +73,51 @@ export class EmojiTable extends LitElement { return html`
e.preventDefault()} - @wheel=${(e: WheelEvent) => e.stopPropagation()} + class="fixed inset-0 bg-black/15 backdrop-brightness-110 flex items-center justify-center z-[9998]" + @click=${this.handleBackdropClick} > - -
e.preventDefault()} + @wheel=${(e: WheelEvent) => e.stopPropagation()} + @click=${(e: MouseEvent) => e.stopPropagation()} > - ${emojiTable.map( - (row) => html` -
- ${row.map( - (emoji) => html` - - `, - )} -
- `, - )} + + +
+ ${emojiTable.map( + (row) => html` +
+ ${row.map( + (emoji) => html` + + `, + )} +
+ `, + )} +
`;