mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-27 06:49:37 +02:00
Added new search bar shortcut. Fixed bug with forms still being visible after logout. Fixed bug with config fetching order
This commit is contained in:
parent
d86ebe3e58
commit
07cd725d4a
6 changed files with 46 additions and 32 deletions
|
@ -48,6 +48,14 @@ export const Apps = (props: Props): JSX.Element => {
|
|||
}
|
||||
}, []);
|
||||
|
||||
// observe if user is authenticated -> set default view if not
|
||||
useEffect(() => {
|
||||
if (!isAuthenticated) {
|
||||
setIsInEdit(false);
|
||||
setModalIsOpen(false);
|
||||
}
|
||||
}, [isAuthenticated]);
|
||||
|
||||
const toggleModal = (): void => {
|
||||
setModalIsOpen(!modalIsOpen);
|
||||
setIsInUpdate(false);
|
||||
|
|
|
@ -60,6 +60,14 @@ export const Bookmarks = (props: Props): JSX.Element => {
|
|||
}
|
||||
}, []);
|
||||
|
||||
// observe if user is authenticated -> set default view if not
|
||||
useEffect(() => {
|
||||
if (!isAuthenticated) {
|
||||
setIsInEdit(false);
|
||||
setModalIsOpen(false);
|
||||
}
|
||||
}, [isAuthenticated]);
|
||||
|
||||
const toggleModal = (): void => {
|
||||
setModalIsOpen(!modalIsOpen);
|
||||
};
|
||||
|
|
|
@ -60,10 +60,10 @@ export const CategoryForm = ({
|
|||
addCategory(formData);
|
||||
} else {
|
||||
updateCategory(category.id, formData);
|
||||
|
||||
setFormData(newCategoryTemplate);
|
||||
modalHandler();
|
||||
}
|
||||
|
||||
setFormData(newCategoryTemplate);
|
||||
modalHandler();
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
@ -45,12 +45,17 @@ export const SearchBar = (props: Props): JSX.Element => {
|
|||
|
||||
if (key === 'Escape') {
|
||||
clearSearch();
|
||||
} else if (document.activeElement !== inputRef.current) {
|
||||
if (key === '`') {
|
||||
inputRef.current.focus();
|
||||
clearSearch();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', keyOutsideFocus);
|
||||
window.addEventListener('keyup', keyOutsideFocus);
|
||||
|
||||
return () => window.removeEventListener('keydown', keyOutsideFocus);
|
||||
return () => window.removeEventListener('keyup', keyOutsideFocus);
|
||||
}, []);
|
||||
|
||||
const clearSearch = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue