diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b91cc2..06f83ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ### v1.7.1 (TBA) - Fixed search action not being triggered by Numpad Enter +- Added option to change date formatting ([#92](https://github.com/pawelmalak/flame/issues/92)) +- Added shortcuts (Esc and double click) to clear search bar ([#100](https://github.com/pawelmalak/flame/issues/100)) +- Added Traefik integration ([#102](https://github.com/pawelmalak/flame/issues/102)) - Fixed search bar not redirecting to valid URL if it starts with capital letter ([#118](https://github.com/pawelmalak/flame/issues/118)) - Performance improvements diff --git a/client/src/App.tsx b/client/src/App.tsx index 9311b4b..3968bcd 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -16,7 +16,7 @@ import Settings from './components/Settings/Settings'; import Bookmarks from './components/Bookmarks/Bookmarks'; import NotificationCenter from './components/NotificationCenter/NotificationCenter'; -// Get config pairs from database +// Load config store.dispatch(getConfig()); // Set theme diff --git a/client/src/components/Home/functions/dateTime.ts b/client/src/components/Home/functions/dateTime.ts index 44cc5e1..ddcfc70 100644 --- a/client/src/components/Home/functions/dateTime.ts +++ b/client/src/components/Home/functions/dateTime.ts @@ -1,8 +1,39 @@ export const dateTime = (): string => { - const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; - const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; + const days = [ + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday', + ]; + const months = [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', + ]; const now = new Date(); - return `${days[now.getDay()]}, ${now.getDate()} ${months[now.getMonth()]} ${now.getFullYear()}`; -} \ No newline at end of file + const useAmericanDate = localStorage.useAmericanDate === 'true'; + + if (!useAmericanDate) { + return `${days[now.getDay()]}, ${now.getDate()} ${ + months[now.getMonth()] + } ${now.getFullYear()}`; + } else { + return `${days[now.getDay()]}, ${ + months[now.getMonth()] + } ${now.getDate()} ${now.getFullYear()}`; + } +}; diff --git a/client/src/components/SearchBar/SearchBar.tsx b/client/src/components/SearchBar/SearchBar.tsx index 85175ff..b6a981f 100644 --- a/client/src/components/SearchBar/SearchBar.tsx +++ b/client/src/components/SearchBar/SearchBar.tsx @@ -72,6 +72,7 @@ const SearchBar = (props: ComponentProps): JSX.Element => { type="text" className={classes.SearchBar} onKeyUp={(e) => searchHandler(e)} + onDoubleClick={clearSearch} /> ); diff --git a/client/src/components/Settings/OtherSettings/OtherSettings.tsx b/client/src/components/Settings/OtherSettings/OtherSettings.tsx index 3d82fa4..6610b65 100644 --- a/client/src/components/Settings/OtherSettings/OtherSettings.tsx +++ b/client/src/components/Settings/OtherSettings/OtherSettings.tsx @@ -92,6 +92,18 @@ const OtherSettings = (props: ComponentProps): JSX.Element => { onChange={(e) => inputChangeHandler(e)} /> + + + + {/* BEAHVIOR OPTIONS */} diff --git a/client/src/interfaces/Config.ts b/client/src/interfaces/Config.ts index d0152c5..1b60ca7 100644 --- a/client/src/interfaces/Config.ts +++ b/client/src/interfaces/Config.ts @@ -19,4 +19,5 @@ export interface Config { dockerHost: string; kubernetesApps: boolean; unpinStoppedApps: boolean; + useAmericanDate: boolean; } diff --git a/client/src/interfaces/Forms.ts b/client/src/interfaces/Forms.ts index 9123d62..411ce90 100644 --- a/client/src/interfaces/Forms.ts +++ b/client/src/interfaces/Forms.ts @@ -25,4 +25,5 @@ export interface OtherSettingsForm { dockerHost: string; kubernetesApps: boolean; unpinStoppedApps: boolean; + useAmericanDate: boolean; } diff --git a/client/src/store/actions/config.ts b/client/src/store/actions/config.ts index 8b1ef5a..79bcebe 100644 --- a/client/src/store/actions/config.ts +++ b/client/src/store/actions/config.ts @@ -20,6 +20,9 @@ export const getConfig = () => async (dispatch: Dispatch) => { // Set custom page title if set document.title = res.data.data.customTitle; + + // Store settings for priority UI elements + localStorage.setItem('useAmericanDate', `${res.data.data.useAmericanDate}`); } catch (err) { console.log(err); } @@ -46,6 +49,9 @@ export const updateConfig = (formData: any) => async (dispatch: Dispatch) => { type: ActionTypes.updateConfig, payload: res.data.data, }); + + // Store settings for priority UI elements + localStorage.setItem('useAmericanDate', `${res.data.data.useAmericanDate}`); } catch (err) { console.log(err); } diff --git a/client/src/utility/templateObjects/configTemplate.ts b/client/src/utility/templateObjects/configTemplate.ts index bbc7998..4d4843f 100644 --- a/client/src/utility/templateObjects/configTemplate.ts +++ b/client/src/utility/templateObjects/configTemplate.ts @@ -21,4 +21,5 @@ export const configTemplate: Config = { dockerHost: 'localhost', kubernetesApps: false, unpinStoppedApps: false, + useAmericanDate: false, }; diff --git a/client/src/utility/templateObjects/settingsTemplate.ts b/client/src/utility/templateObjects/settingsTemplate.ts index 674931b..05bc887 100644 --- a/client/src/utility/templateObjects/settingsTemplate.ts +++ b/client/src/utility/templateObjects/settingsTemplate.ts @@ -14,6 +14,7 @@ export const otherSettingsTemplate: OtherSettingsForm = { dockerHost: 'localhost', kubernetesApps: true, unpinStoppedApps: true, + useAmericanDate: false, }; export const weatherSettingsTemplate: WeatherForm = { diff --git a/controllers/category.js b/controllers/category.js index 557c1a1..d10183f 100644 --- a/controllers/category.js +++ b/controllers/category.js @@ -15,14 +15,12 @@ exports.createCategory = asyncWrapper(async (req, res, next) => { let category; if (pinCategories) { - if (parseInt(pinCategories.value)) { - category = await Category.create({ - ...req.body, - isPinned: true, - }); - } else { - category = await Category.create(req.body); - } + category = await Category.create({ + ...req.body, + isPinned: true, + }); + } else { + category = await Category.create(req.body); } res.status(201).json({