From 37934340bc62f6a7cba39ad8ed7722a3d50c4c54 Mon Sep 17 00:00:00 2001 From: Aylong <69762909+Aylong220@users.noreply.github.com> Date: Tue, 6 Feb 2024 22:16:22 +0200 Subject: [PATCH] TGchat: Case Sensitive fix, Mute button (#24024) * Mute tab button * Some tooltips * Highlights Case Sensitive fix and Cyrillic support * Button fix and Mute icons * Little button cleanup * Focus transition - longer --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> --- .../tgui-panel/chat/ChatPageSettings.js | 23 +- tgui/packages/tgui-panel/chat/ChatTabs.js | 1 + tgui/packages/tgui-panel/chat/model.js | 1 + tgui/packages/tgui-panel/chat/renderer.js | 2 +- .../tgui-panel/chat/replaceInTextNode.js | 2 +- .../tgui-panel/settings/SettingsPanel.js | 31 ++- .../tgui/styles/components/Button.scss | 19 +- tgui/public/tgui-panel.bundle.css | 2 +- tgui/public/tgui-panel.bundle.js | 218 +++++++++--------- tgui/public/tgui.bundle.css | 2 +- 10 files changed, 159 insertions(+), 142 deletions(-) diff --git a/tgui/packages/tgui-panel/chat/ChatPageSettings.js b/tgui/packages/tgui-panel/chat/ChatPageSettings.js index bcaf7a0c559f..36807f46725e 100644 --- a/tgui/packages/tgui-panel/chat/ChatPageSettings.js +++ b/tgui/packages/tgui-panel/chat/ChatPageSettings.js @@ -25,7 +25,7 @@ export const ChatPageSettings = (props, context) => { dispatch( @@ -37,8 +37,25 @@ export const ChatPageSettings = (props, context) => { } /> + + + dispatch( + updateChatPage({ + pageId: page.id, + hideUnreadCount: !page.hideUnreadCount, + }) + ) + } + /> + + /> diff --git a/tgui/packages/tgui-panel/chat/ChatTabs.js b/tgui/packages/tgui-panel/chat/ChatTabs.js index e6833336ec4f..02590dfd912a 100644 --- a/tgui/packages/tgui-panel/chat/ChatTabs.js +++ b/tgui/packages/tgui-panel/chat/ChatTabs.js @@ -38,6 +38,7 @@ export const ChatTabs = (props, context) => { key={page.id} selected={page === currentPage} rightSlot={ + !page.hideUnreadCount && page.unreadCount > 0 && ( ) diff --git a/tgui/packages/tgui-panel/chat/model.js b/tgui/packages/tgui-panel/chat/model.js index fa12153890d8..99292e74fc01 100644 --- a/tgui/packages/tgui-panel/chat/model.js +++ b/tgui/packages/tgui-panel/chat/model.js @@ -22,6 +22,7 @@ export const createPage = (obj) => { name: 'New Tab', acceptedTypes: acceptedTypes, unreadCount: 0, + hideUnreadCount: false, createdAt: Date.now(), ...obj, }; diff --git a/tgui/packages/tgui-panel/chat/renderer.js b/tgui/packages/tgui-panel/chat/renderer.js index e18414f9cb08..039506a0543c 100644 --- a/tgui/packages/tgui-panel/chat/renderer.js +++ b/tgui/packages/tgui-panel/chat/renderer.js @@ -190,7 +190,7 @@ class ChatRenderer { const highlightWholeMessage = setting.highlightWholeMessage; const matchWord = setting.matchWord; const matchCase = setting.matchCase; - const allowedRegex = /^[a-z0-9_\-$/^[\s\]\\]+$/gi; + const allowedRegex = /^[a-zа-яё0-9_\-$/^[\s\]\\]+$/gi; const regexEscapeCharacters = /[!#$%^&*)(+=.<>{}[\]:;'"|~`_\-\\/]/g; const lines = String(text) .split(/[,|]/) diff --git a/tgui/packages/tgui-panel/chat/replaceInTextNode.js b/tgui/packages/tgui-panel/chat/replaceInTextNode.js index 753997b3b821..8e616ea26cda 100644 --- a/tgui/packages/tgui-panel/chat/replaceInTextNode.js +++ b/tgui/packages/tgui-panel/chat/replaceInTextNode.js @@ -93,7 +93,7 @@ export const replaceInTextNode = (regex, words, createNode) => (node) => { for (let word of words) { // Capture if the word is at the beginning, end, middle, // or by itself in a message - wordRegexStr += `^${word}\\W|\\W${word}\\W|\\W${word}$|^${word}$`; + wordRegexStr += `^${word}\\s\\W|\\s\\W${word}\\s\\W|\\s\\W${word}$|^${word}\\s\\W$`; // Make sure the last character for the expression is NOT '|' if (++i !== words.length) { wordRegexStr += '|'; diff --git a/tgui/packages/tgui-panel/settings/SettingsPanel.js b/tgui/packages/tgui-panel/settings/SettingsPanel.js index 01593d11c9fb..b1751e650073 100644 --- a/tgui/packages/tgui-panel/settings/SettingsPanel.js +++ b/tgui/packages/tgui-panel/settings/SettingsPanel.js @@ -176,18 +176,25 @@ export const SettingsGeneral = (props, context) => { -