mirror of
https://github.com/pawelmalak/flame.git
synced 2026-03-08 05:23:11 +08: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:
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user