Skip to content

Commit

Permalink
TGchat: Case Sensitive fix, Mute button (ParadiseSS13#24024)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
AyIong and S34NW authored Feb 6, 2024
1 parent 7591476 commit 3793434
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 142 deletions.
23 changes: 19 additions & 4 deletions tgui/packages/tgui-panel/chat/ChatPageSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const ChatPageSettings = (props, context) => {
<Stack align="center">
<Stack.Item grow>
<Input
fluid
width="100%"
value={page.name}
onChange={(e, value) =>
dispatch(
Expand All @@ -37,8 +37,25 @@ export const ChatPageSettings = (props, context) => {
}
/>
</Stack.Item>
<Stack.Item>
<Button.Checkbox
content="Mute"
checked={page.hideUnreadCount}
icon={page.hideUnreadCount ? 'bell-slash' : 'bell'}
tooltip="Disables unread counter"
onClick={() =>
dispatch(
updateChatPage({
pageId: page.id,
hideUnreadCount: !page.hideUnreadCount,
})
)
}
/>
</Stack.Item>
<Stack.Item>
<Button
content="Remove"
icon="times"
color="red"
onClick={() =>
Expand All @@ -48,9 +65,7 @@ export const ChatPageSettings = (props, context) => {
})
)
}
>
Remove
</Button>
/>
</Stack.Item>
</Stack>
<Divider />
Expand Down
1 change: 1 addition & 0 deletions tgui/packages/tgui-panel/chat/ChatTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const ChatTabs = (props, context) => {
key={page.id}
selected={page === currentPage}
rightSlot={
!page.hideUnreadCount &&
page.unreadCount > 0 && (
<UnreadCountWidget value={page.unreadCount} />
)
Expand Down
1 change: 1 addition & 0 deletions tgui/packages/tgui-panel/chat/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const createPage = (obj) => {
name: 'New Tab',
acceptedTypes: acceptedTypes,
unreadCount: 0,
hideUnreadCount: false,
createdAt: Date.now(),
...obj,
};
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-panel/chat/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(/[,|]/)
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-panel/chat/replaceInTextNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 += '|';
Expand Down
31 changes: 19 additions & 12 deletions tgui/packages/tgui-panel/settings/SettingsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,25 @@ export const SettingsGeneral = (props, context) => {
</LabeledList.Item>
</LabeledList>
<Divider />
<Button
mt={0.25}
content="Save chat log"
icon="save"
onClick={() => dispatch(saveChatToDisk())}
/>
<Button.Confirm
icon="trash"
confirmContent="Are you sure?"
content="Clear chat"
onClick={() => dispatch(clearChat())}
/>
<Stack fill>
<Stack.Item grow mt={0.15}>
<Button
content="Save chat log"
icon="save"
tooltip="Export current tab history into HTML file"
onClick={() => dispatch(saveChatToDisk())}
/>
</Stack.Item>
<Stack.Item mt={0.15}>
<Button.Confirm
icon="trash"
confirmContent="Are you sure?"
content="Clear chat"
tooltip="Erase current tab history"
onClick={() => dispatch(clearChat())}
/>
</Stack.Item>
</Stack>
</Section>
);
};
Expand Down
19 changes: 6 additions & 13 deletions tgui/packages/tgui/styles/components/Button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,19 @@ $bg-map: colors.$bg-map !default;
$text-color: if($luminance > 0.4, rgba(0, 0, 0, 1), rgba(255, 255, 255, 1));

transition:
color 50ms,
background-color 50ms;
color 100ms,
background-color 100ms;
background-color: $color;
color: $text-color;

&:hover {
transition:
color 0ms,
background-color 0ms;
}

&:focus {
transition:
color 100ms,
background-color 100ms;
color 250ms,
background-color 250ms;
}

&:hover,
&:focus {
background-color: lighten($color, 15%);
&:hover {
background-color: lighten($color, 25%);
color: $text-color;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tgui/public/tgui-panel.bundle.css

Large diffs are not rendered by default.

218 changes: 109 additions & 109 deletions tgui/public/tgui-panel.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tgui/public/tgui.bundle.css

Large diffs are not rendered by default.

0 comments on commit 3793434

Please sign in to comment.