super nice flow with the shortcuts
This commit is contained in:
@@ -22,6 +22,7 @@ import KeyboardShortcutLabel from './KeyboardShortcutLabel';
|
||||
import { useSnackbar } from 'notistack';
|
||||
import { useKeyPressEvent, useRendersCount } from 'react-use';
|
||||
import useTerminal from './Terminal';
|
||||
import { KeyboardShortcuts } from '../util/keyboard';
|
||||
|
||||
const Navbar = ({
|
||||
handleChangeSearchInput,
|
||||
@@ -42,7 +43,7 @@ const Navbar = ({
|
||||
if (searchRef?.current) searchRef.current.focus();
|
||||
}, [enqueueSnackbar, searchRef]);
|
||||
|
||||
useKeyPressEvent('Shift', onSearchFocus);
|
||||
useKeyPressEvent(KeyboardShortcuts.search, onSearchFocus);
|
||||
|
||||
const rendersCount = useRendersCount();
|
||||
console.warn('RENDER COUNT | NAVBAR | ', rendersCount);
|
||||
@@ -88,7 +89,7 @@ const Navbar = ({
|
||||
|
||||
{isSearching && <CircularProgress size={20} />}
|
||||
|
||||
<KeyboardShortcutLabel label="Shift" />
|
||||
<KeyboardShortcutLabel label={KeyboardShortcuts.search} />
|
||||
</Stack>
|
||||
|
||||
<Tooltip title={'Group conversation'}>
|
||||
|
||||
@@ -102,7 +102,7 @@ export default function NewConversationDialog({
|
||||
[setConversationName],
|
||||
);
|
||||
|
||||
const [isSubmitting, toggleIsSubmitting] = useToggle(false);
|
||||
const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
|
||||
|
||||
const handleSubmitLocal = useCallback(async () => {
|
||||
if (selectedUsers.length === 0) {
|
||||
@@ -110,7 +110,7 @@ export default function NewConversationDialog({
|
||||
return;
|
||||
}
|
||||
|
||||
toggleIsSubmitting();
|
||||
setIsSubmitting(true);
|
||||
|
||||
handleSubmit(selectedUsers, conversationName);
|
||||
|
||||
@@ -118,7 +118,7 @@ export default function NewConversationDialog({
|
||||
setSelectedUsers([]);
|
||||
setConversationName('');
|
||||
|
||||
toggleIsSubmitting();
|
||||
setIsSubmitting(false);
|
||||
}, [
|
||||
selectedUsers,
|
||||
setConversationName,
|
||||
@@ -126,7 +126,7 @@ export default function NewConversationDialog({
|
||||
enqueueSnackbar,
|
||||
handleSubmit,
|
||||
setSelectedUsers,
|
||||
toggleIsSubmitting,
|
||||
setIsSubmitting,
|
||||
]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
const searchShortcut = 'Shift';
|
||||
export enum KeyboardShortcuts {
|
||||
search = 'shift',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user