Skip to content

Commit

Permalink
Merge pull request #82 from ulu-telegram/master
Browse files Browse the repository at this point in the history
deploy
  • Loading branch information
ulugmer authored Nov 16, 2023
2 parents 2ad1c65 + 98e4947 commit 8cd5c90
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/left/main/UluHeaderProfile.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@
text-overflow: ellipsis;
overflow: hidden;
max-width: 250px;
width: 50%;
white-space: nowrap;
min-width: 125px;
}
18 changes: 18 additions & 0 deletions src/components/main/CommandMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { getMainUsername, getUserFullName } from '../../global/helpers';
import captureKeyboardListeners from '../../util/captureKeyboardListeners';
import { convertLayout } from '../../util/convertLayout';
import { throttle } from '../../util/schedulers';
import { IS_ARC_BROWSER } from '../../util/windowEnvironment';
import renderText from '../common/helpers/renderText';

import useArchiver from '../../hooks/useArchiver';
Expand Down Expand Up @@ -360,6 +361,23 @@ const CommandMenu: FC<CommandMenuProps> = ({ topUserIds, usersById }) => {
}
}, [close, archiveMessages, track]);

useEffect(() => {
const listener = (e: KeyboardEvent) => {
if (IS_ARC_BROWSER && e.metaKey && e.ctrlKey && e.code === 'KeyC') {
handleSelectNewGroup();
e.preventDefault();
e.stopPropagation();
} else if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.code === 'KeyC') {
handleSelectNewGroup();
e.preventDefault();
e.stopPropagation();
}
};

document.addEventListener('keydown', listener);
return () => document.removeEventListener('keydown', listener);
}, [handleSelectNewGroup]);

const CommandMenuInner = (
<Command.Dialog
label="Command Menu"
Expand Down
6 changes: 6 additions & 0 deletions src/util/windowEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export const IS_FIREFOX = navigator.userAgent.toLowerCase().includes('firefox')
|| navigator.userAgent.toLowerCase().includes('iceweasel')
|| navigator.userAgent.toLowerCase().includes('icecat');
export const IS_ELECTRON = Boolean(window.electron);
export const IS_ARC_BROWSER = navigator.userAgent.includes('Chrome')
&& navigator.userAgent.includes('Safari')
&& !navigator.userAgent.includes('Edg')
&& !IS_FIREFOX
&& !IS_YA_BROWSER
&& !IS_SAFARI;

export enum MouseButton {
Main = 0,
Expand Down

0 comments on commit 8cd5c90

Please sign in to comment.