From 35aaf5898b7949ea1f0bc361019d1fb4880a563a Mon Sep 17 00:00:00 2001 From: dot-mike <586280+dot-mike@users.noreply.github.com> Date: Sat, 14 Dec 2024 01:42:50 +0100 Subject: [PATCH 1/7] fix: update key codes scaling. Fixes #437 --- src/renderer/components/Footer.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/Footer.tsx b/src/renderer/components/Footer.tsx index bf562e800..b92cdd870 100644 --- a/src/renderer/components/Footer.tsx +++ b/src/renderer/components/Footer.tsx @@ -132,13 +132,13 @@ export class Footer extends React.Component { onGlobalKeydown = (event: KeyboardEvent): void => { const scaleDif = 0.1; // How much the scale should change per increase/decrease // Increase Game Scale (CTRL PLUS) - if (event.ctrlKey && event.key === '+') { + if (event.ctrlKey && (event.keyCode === 187 || event.keyCode === 61 || event.keyCode === 171)) { const scale = this.props.preferencesData.browsePageGameScale; this.setScaleSliderValue(scale + scaleDif); event.preventDefault(); } // Decrease Game Scale (CTRL MINUS) - else if (event.ctrlKey && event.key === '-') { + else if (event.ctrlKey && (event.keyCode === 189 || event.keyCode === 173)) { const scale = this.props.preferencesData.browsePageGameScale; this.setScaleSliderValue(scale - scaleDif); event.preventDefault(); From 0878c24ecaa00734733ff33f96849cb6d46b9392 Mon Sep 17 00:00:00 2001 From: dot-mike <586280+dot-mike@users.noreply.github.com> Date: Sat, 14 Dec 2024 20:58:39 +0100 Subject: [PATCH 2/7] feat: add error message for service loading failures. This fixes #392 --- lang/en.json | 3 ++- src/back/index.ts | 5 +++-- src/shared/lang.ts | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lang/en.json b/lang/en.json index eff26753e..11ad7f3a4 100644 --- a/lang/en.json +++ b/lang/en.json @@ -198,7 +198,8 @@ "noLauncherUpdateReady": "Metadata update requires a newer Launcher version, but the software update is not currently available.", "deleteView": "Delete Search View", "deleteOnlyBrowseView": "Delete Search View (Must have another custom view)", - "createNewView": "Create new search view" + "createNewView": "Create new search view", + "errorLoadingServices": "An error occurred while loading services. Please check the logs for more details." }, "filter": { "dateAdded": "Date Added", diff --git a/src/back/index.ts b/src/back/index.ts index 6bb7f89e2..b2053e98f 100644 --- a/src/back/index.ts +++ b/src/back/index.ts @@ -816,8 +816,9 @@ async function initialize() { state.config, error => { log.info(SERVICES_SOURCE, error.toString()); } ); - } catch (error) { - console.log('Error loading services - ' + error); + } catch (error: any) { + log.error('Back', 'Error loading services - ' + error.toString()); + state.socketServer.broadcast(BackOut.OPEN_ALERT, state.languageContainer.app.errorLoadingServices); } if (state.serviceInfo) { // Run start commands diff --git a/src/shared/lang.ts b/src/shared/lang.ts index e9400b156..c51826e53 100644 --- a/src/shared/lang.ts +++ b/src/shared/lang.ts @@ -206,6 +206,7 @@ const langTemplate = { 'deleteView', 'deleteOnlyBrowseView', 'createNewView', + 'errorLoadingServices', ] as const, filter: [ 'dateAdded', From 7a94cfd642d326b7710d488a096e15f945dcc105 Mon Sep 17 00:00:00 2001 From: dot-mike <586280+dot-mike@users.noreply.github.com> Date: Sat, 14 Dec 2024 21:13:58 +0100 Subject: [PATCH 3/7] fix: remove console log spam from GameLauncher and search utility This removes left over printouts to the console from development process. --- src/back/GameLauncher.ts | 1 - src/back/util/search.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/back/GameLauncher.ts b/src/back/GameLauncher.ts index 6ee415f5a..6fef00a90 100644 --- a/src/back/GameLauncher.ts +++ b/src/back/GameLauncher.ts @@ -187,7 +187,6 @@ export namespace GameLauncher { // Handle middleware if (launchInfo.activeConfig) { log.info(logSource, `Using Game Configuration: ${launchInfo.activeConfig.name}`); - console.log(JSON.stringify(launchInfo.activeConfig, undefined, 2)); for (const middlewareConfig of launchInfo.activeConfig.middleware) { // Find middleware in registry const middleware = opts.state.registry.middlewares.get(middlewareConfig.middlewareId); diff --git a/src/back/util/search.ts b/src/back/util/search.ts index 8e5681bf2..abdab2c8f 100644 --- a/src/back/util/search.ts +++ b/src/back/util/search.ts @@ -112,7 +112,6 @@ export function createSearchFilter(query: QueryData, preferences: AppPreferences newFilter.matchAny = false; newFilter.subfilters = [inner, playlistFilter]; search.filter = newFilter; - console.log(JSON.stringify(search, undefined, 2)); } return { From edd7654d3fe473444c6f834f1b4cc4557f4f625b Mon Sep 17 00:00:00 2001 From: dot-mike <586280+dot-mike@users.noreply.github.com> Date: Sat, 14 Dec 2024 21:33:23 +0100 Subject: [PATCH 4/7] fix: remove unnecessary console logs from App and ConfigPage components This remove leftover printsout to the console from development process --- src/renderer/components/app.tsx | 3 --- src/renderer/components/pages/ConfigPage.tsx | 2 -- 2 files changed, 5 deletions(-) diff --git a/src/renderer/components/app.tsx b/src/renderer/components/app.tsx index 36ea21a93..bd7e2cafd 100644 --- a/src/renderer/components/app.tsx +++ b/src/renderer/components/app.tsx @@ -259,10 +259,8 @@ export class App extends React.Component { } onDatabaseLoaded() { - console.log('db load'); window.Shared.back.request(BackIn.GET_PLAYLISTS) .then(data => { - console.log('got playlists'); if (data) { this.props.mainActions.addLoaded([BackInit.PLAYLISTS]); this.props.setMainState({ playlists: data }); @@ -316,7 +314,6 @@ export class App extends React.Component { } this.props.setTagCategories(data.tagCategories); - console.log('navigating to ' + this.props.preferencesData.defaultOpeningPage); this.props.history.push(this.props.preferencesData.defaultOpeningPage); }) .then(() => { diff --git a/src/renderer/components/pages/ConfigPage.tsx b/src/renderer/components/pages/ConfigPage.tsx index cc363e2bc..cdad9f805 100644 --- a/src/renderer/components/pages/ConfigPage.tsx +++ b/src/renderer/components/pages/ConfigPage.tsx @@ -723,8 +723,6 @@ export class ConfigPage extends React.Component): JSX.Element[] => { const allStrings = this.context; return extensions.map((ext) => { - console.log(fpfssConsents); - const fpfssConsent = fpfssConsents[ext.id]; const shortContribs = []; From 275084aa0c7b5155c64df1d5ec572b5980e32b3f Mon Sep 17 00:00:00 2001 From: dot-mike <586280+dot-mike@users.noreply.github.com> Date: Sun, 15 Dec 2024 00:45:49 +0100 Subject: [PATCH 5/7] fix: scaling using shortcuts should not exceed limit Fixes zooming issue mentioned in #437 --- src/renderer/components/Footer.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/Footer.tsx b/src/renderer/components/Footer.tsx index b92cdd870..2b2422524 100644 --- a/src/renderer/components/Footer.tsx +++ b/src/renderer/components/Footer.tsx @@ -152,8 +152,9 @@ export class Footer extends React.Component { */ setScaleSliderValue(scale: number): void { if (this.scaleSliderRef.current) { - const value = Math.min(Math.max(0, scale), 1) * Footer.scaleSliderMax; - this.scaleSliderRef.current.value = value + ''; + if (scale < 0) { scale = 0; } + else if (scale > 1) { scale = 1; } + this.scaleSliderRef.current.value = (Math.min(Math.max(0, scale), 1) * Footer.scaleSliderMax).toFixed(1).toString(); updatePreferencesData({ browsePageGameScale: scale }); } } From e06633f12478eca4f1d18f124b7798a4985491c6 Mon Sep 17 00:00:00 2001 From: dot-mike <586280+dot-mike@users.noreply.github.com> Date: Sun, 15 Dec 2024 00:46:09 +0100 Subject: [PATCH 6/7] fix: remove unnecessary console logs --- src/back/responses.ts | 1 - src/back/util/search.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/back/responses.ts b/src/back/responses.ts index feb11a0a1..f118a8439 100644 --- a/src/back/responses.ts +++ b/src/back/responses.ts @@ -1297,7 +1297,6 @@ export function registerRequestCallbacks(state: BackState, init: () => Promise { - console.log('finding playlists?'); return filterPlaylists(state.playlists, state.preferences.browsePageShowExtreme); }); diff --git a/src/back/util/search.ts b/src/back/util/search.ts index abdab2c8f..2ebc914ca 100644 --- a/src/back/util/search.ts +++ b/src/back/util/search.ts @@ -29,7 +29,6 @@ export function createSearchFilter(query: QueryData, preferences: AppPreferences break; } - console.log(`Order by: ${orderBy}`); if (advancedFilter.playlistOrder && playlist !== undefined) { search.order.column = GameSearchSortable.CUSTOM; } else { From 0c7e07e1dc33d434b1f0bb53836635be4193ff79 Mon Sep 17 00:00:00 2001 From: dot-mike <586280+dot-mike@users.noreply.github.com> Date: Fri, 20 Dec 2024 01:56:48 +0100 Subject: [PATCH 7/7] feat: implement scroll to view in rightsidebar for legacy application path on edit --- src/renderer/components/DropdownInputField.tsx | 9 ++++++++- src/renderer/components/RightBrowseSidebar.tsx | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/DropdownInputField.tsx b/src/renderer/components/DropdownInputField.tsx index 64808ae9f..55c3c61f1 100644 --- a/src/renderer/components/DropdownInputField.tsx +++ b/src/renderer/components/DropdownInputField.tsx @@ -16,6 +16,8 @@ export type DropdownInputFieldProps = InputFieldProps & { onItemSelect?: (text: string, index: number) => void; /** Function for getting a reference to the input element. Called whenever the reference could change. */ inputRef?: RefFunc; + /** Called when the drop-down content is expanded or collapsed. */ + onExpand?: (expanded: boolean) => void; }; type DropdownInputFieldState = { @@ -204,7 +206,12 @@ export class DropdownInputField extends React.Component { if (!this.props.disabled) { - this.setState({ expanded: !this.state.expanded }); + const newExpandedState = !this.state.expanded; + this.setState({ expanded: newExpandedState }, () => { + if (this.props.onExpand) { + this.props.onExpand(newExpandedState); + } + }); } }; diff --git a/src/renderer/components/RightBrowseSidebar.tsx b/src/renderer/components/RightBrowseSidebar.tsx index 8439bba6f..626c9d375 100644 --- a/src/renderer/components/RightBrowseSidebar.tsx +++ b/src/renderer/components/RightBrowseSidebar.tsx @@ -852,6 +852,7 @@ export class RightBrowseSidebar extends React.Component this.props.onEditGame({ legacyApplicationPath: text })} /> @@ -969,6 +970,15 @@ export class RightBrowseSidebar extends React.Component { + if (this.state.middleScrollRef.current) { + this.state.middleScrollRef.current.scrollTo({ + top: this.state.middleScrollRef.current.scrollHeight, + behavior: 'smooth' + }); + } + } + renderDeleteGameButton({ confirm, extra }: ConfirmElementArgs): JSX.Element { return (