mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-21 01:01:30 +03: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
18
README.md
18
README.md
@ -31,6 +31,13 @@ docker pull pawelmalak/flame:multiarch
|
|||||||
docker pull pawelmalak/flame:2.0.0
|
docker pull pawelmalak/flame:2.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Deployment
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# run container
|
||||||
|
docker run -p 5005:5005 -v /path/to/data:/app/data -e PASSWORD=flame_password flame
|
||||||
|
```
|
||||||
|
|
||||||
#### Building images
|
#### Building images
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@ -45,13 +52,6 @@ docker buildx build \
|
|||||||
-t flame:multiarch .
|
-t flame:multiarch .
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Deployment
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# run container
|
|
||||||
docker run -p 5005:5005 -v /path/to/data:/app/data -e PASSWORD=flame_password flame
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Docker-Compose
|
#### Docker-Compose
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -130,9 +130,7 @@ Visit [project wiki](https://github.com/pawelmalak/flame/wiki/Authentication) to
|
|||||||
|
|
||||||
#### Searching
|
#### Searching
|
||||||
|
|
||||||
To use search bar you need to type your search query with selected prefix. For example, to search for "what is docker" using google search you would type: `/g what is docker`.
|
The default search setting is to search through all your apps and bookmarks. If you want to search using specific search engine, you need to type your search query with selected prefix. For example, to search for "what is docker" using google search you would type: `/g what is docker`.
|
||||||
|
|
||||||
> You can change where to open search results (same/new tab) in the settings
|
|
||||||
|
|
||||||
For list of supported search engines, shortcuts and more about searching functionality visit [project wiki](https://github.com/pawelmalak/flame/wiki/Search-bar).
|
For list of supported search engines, shortcuts and more about searching functionality visit [project wiki](https://github.com/pawelmalak/flame/wiki/Search-bar).
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { BrowserRouter, Route, Switch } from 'react-router-dom';
|
import { BrowserRouter, Route, Switch } from 'react-router-dom';
|
||||||
import { actionCreators } from './store';
|
import { autoLogin, getConfig } from './store/action-creators';
|
||||||
|
import { actionCreators, store } from './store';
|
||||||
import 'external-svg-loader';
|
import 'external-svg-loader';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
@ -15,23 +16,20 @@ import { useDispatch } from 'react-redux';
|
|||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
export const App = (): JSX.Element => {
|
// Get config
|
||||||
const dispath = useDispatch();
|
store.dispatch<any>(getConfig());
|
||||||
const {
|
|
||||||
fetchQueries,
|
|
||||||
getConfig,
|
|
||||||
setTheme,
|
|
||||||
logout,
|
|
||||||
createNotification,
|
|
||||||
autoLogin,
|
|
||||||
} = bindActionCreators(actionCreators, dispath);
|
|
||||||
|
|
||||||
useEffect(() => {
|
// Validate token
|
||||||
// login if token exists
|
|
||||||
if (localStorage.token) {
|
if (localStorage.token) {
|
||||||
autoLogin();
|
store.dispatch<any>(autoLogin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const App = (): JSX.Element => {
|
||||||
|
const dispath = useDispatch();
|
||||||
|
const { fetchQueries, setTheme, logout, createNotification } =
|
||||||
|
bindActionCreators(actionCreators, dispath);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
// check if token is valid
|
// check if token is valid
|
||||||
const tokenIsValid = setInterval(() => {
|
const tokenIsValid = setInterval(() => {
|
||||||
if (localStorage.token) {
|
if (localStorage.token) {
|
||||||
@ -48,9 +46,6 @@ export const App = (): JSX.Element => {
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
// load app config
|
|
||||||
getConfig();
|
|
||||||
|
|
||||||
// set theme
|
// set theme
|
||||||
if (localStorage.theme) {
|
if (localStorage.theme) {
|
||||||
setTheme(localStorage.theme);
|
setTheme(localStorage.theme);
|
||||||
|
@ -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 => {
|
const toggleModal = (): void => {
|
||||||
setModalIsOpen(!modalIsOpen);
|
setModalIsOpen(!modalIsOpen);
|
||||||
setIsInUpdate(false);
|
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 => {
|
const toggleModal = (): void => {
|
||||||
setModalIsOpen(!modalIsOpen);
|
setModalIsOpen(!modalIsOpen);
|
||||||
};
|
};
|
||||||
|
@ -60,10 +60,10 @@ export const CategoryForm = ({
|
|||||||
addCategory(formData);
|
addCategory(formData);
|
||||||
} else {
|
} else {
|
||||||
updateCategory(category.id, formData);
|
updateCategory(category.id, formData);
|
||||||
|
}
|
||||||
|
|
||||||
setFormData(newCategoryTemplate);
|
setFormData(newCategoryTemplate);
|
||||||
modalHandler();
|
modalHandler();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -45,12 +45,17 @@ export const SearchBar = (props: Props): JSX.Element => {
|
|||||||
|
|
||||||
if (key === 'Escape') {
|
if (key === 'Escape') {
|
||||||
clearSearch();
|
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 = () => {
|
const clearSearch = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user