Improved default theme setting. Pushed version 2.0.1

This commit is contained in:
Paweł Malak 2021-11-19 13:24:07 +01:00
parent e0f6034868
commit c2e9f82cd6
5 changed files with 11 additions and 6 deletions

2
.env
View file

@ -1,5 +1,5 @@
PORT=5005 PORT=5005
NODE_ENV=development NODE_ENV=development
VERSION=2.0.0 VERSION=2.0.1
PASSWORD=flame_password PASSWORD=flame_password
SECRET=e02eb43d69953658c6d07311d6313f2d4467672cb881f96b29368ba1f3f4da4b SECRET=e02eb43d69953658c6d07311d6313f2d4467672cb881f96b29368ba1f3f4da4b

View file

@ -1,7 +1,8 @@
### v2.0.1 (TBA) ### v2.0.1 (2021-11-19)
- Added option to display humidity in the weather widget ([#136](https://github.com/pawelmalak/flame/issues/136)) - Added option to display humidity in the weather widget ([#136](https://github.com/pawelmalak/flame/issues/136))
- Added option to set default theme for all new users ([#165](https://github.com/pawelmalak/flame/issues/165)) - Added option to set default theme for all new users ([#165](https://github.com/pawelmalak/flame/issues/165))
- Added option to hide header greetings and date separately ([#200](https://github.com/pawelmalak/flame/issues/200)) - Added option to hide header greetings and date separately ([#200](https://github.com/pawelmalak/flame/issues/200))
- Fixed bug with broken basic auth ([#202](https://github.com/pawelmalak/flame/issues/202))
- Fixed bug with custom icons not working with apps when "pin by default" was disabled - Fixed bug with custom icons not working with apps when "pin by default" was disabled
### v2.0.0 (2021-11-15) ### v2.0.0 (2021-11-15)

View file

@ -1 +1 @@
REACT_APP_VERSION=2.0.0 REACT_APP_VERSION=2.0.1

View file

@ -68,7 +68,7 @@ export const App = (): JSX.Element => {
// If there is no user theme, set the default one // If there is no user theme, set the default one
useEffect(() => { useEffect(() => {
if (!loading && !localStorage.theme) { if (!loading && !localStorage.theme) {
setTheme(config.defaultTheme); setTheme(config.defaultTheme, false);
} }
}, [loading]); }, [loading]);

View file

@ -5,11 +5,15 @@ import { Theme } from '../../interfaces/Theme';
import { themes } from '../../components/Settings/Themer/themes.json'; import { themes } from '../../components/Settings/Themer/themes.json';
export const setTheme = export const setTheme =
(name: string) => (dispatch: Dispatch<SetThemeAction>) => { (name: string, remeberTheme: boolean = true) =>
(dispatch: Dispatch<SetThemeAction>) => {
const theme = themes.find((theme) => theme.name === name); const theme = themes.find((theme) => theme.name === name);
if (theme) { if (theme) {
localStorage.setItem('theme', name); if (remeberTheme) {
localStorage.setItem('theme', name);
}
loadTheme(theme); loadTheme(theme);
dispatch({ dispatch({