Skip to content

Commit

Permalink
Merge pull request #449 from dot-mike/fix/bug-fixes
Browse files Browse the repository at this point in the history
Various minor bug fixes
  • Loading branch information
colin969 authored Dec 22, 2024
2 parents b500e31 + 0c7e07e commit d5eafe8
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 17 deletions.
3 changes: 2 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/back/GameLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/back/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/back/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,6 @@ export function registerRequestCallbacks(state: BackState, init: () => Promise<v
});

state.socketServer.register(BackIn.GET_PLAYLISTS, async () => {
console.log('finding playlists?');
return filterPlaylists(state.playlists, state.preferences.browsePageShowExtreme);
});

Expand Down
2 changes: 0 additions & 2 deletions src/back/util/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -112,7 +111,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 {
Expand Down
9 changes: 8 additions & 1 deletion src/renderer/components/DropdownInputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<InputElement>;
/** Called when the drop-down content is expanded or collapsed. */
onExpand?: (expanded: boolean) => void;
};

type DropdownInputFieldState = {
Expand Down Expand Up @@ -204,7 +206,12 @@ export class DropdownInputField extends React.Component<DropdownInputFieldProps,

onExpandButtonMouseDown = (): void => {
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);
}
});
}
};

Expand Down
9 changes: 5 additions & 4 deletions src/renderer/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ export class Footer extends React.Component<FooterProps> {
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();
Expand All @@ -152,8 +152,9 @@ export class Footer extends React.Component<FooterProps> {
*/
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 });
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/renderer/components/RightBrowseSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ export class RightBrowseSidebar extends React.Component<RightBrowseSidebarProps,
text={game.legacyApplicationPath}
placeholder={strings.noApplicationPath}
onChange={this.onApplicationPathChange}
onExpand={this.onApplicationPathExpand}
editable={editable}
items={suggestions && filterSuggestions(suggestions.applicationPath) || []}
onItemSelect={text => this.props.onEditGame({ legacyApplicationPath: text })} />
Expand Down Expand Up @@ -969,6 +970,15 @@ export class RightBrowseSidebar extends React.Component<RightBrowseSidebarProps,
}
}

onApplicationPathExpand = () => {
if (this.state.middleScrollRef.current) {
this.state.middleScrollRef.current.scrollTo({
top: this.state.middleScrollRef.current.scrollHeight,
behavior: 'smooth'
});
}
}

renderDeleteGameButton({ confirm, extra }: ConfirmElementArgs<LangContainer['browse']>): JSX.Element {
return (
<div
Expand Down
3 changes: 0 additions & 3 deletions src/renderer/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,8 @@ export class App extends React.Component<AppProps> {
}

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 });
Expand Down Expand Up @@ -316,7 +314,6 @@ export class App extends React.Component<AppProps> {
}

this.props.setTagCategories(data.tagCategories);
console.log('navigating to ' + this.props.preferencesData.defaultOpeningPage);
this.props.history.push(this.props.preferencesData.defaultOpeningPage);
})
.then(() => {
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/components/pages/ConfigPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,6 @@ export class ConfigPage extends React.Component<ConfigPageProps, ConfigPageState
renderExtensionsMemo = memoizeOne((extensions: IExtensionDescription[], strings: LangContainer['config'], fpfssConsents: Record<string, boolean | undefined>): JSX.Element[] => {
const allStrings = this.context;
return extensions.map((ext) => {
console.log(fpfssConsents);

const fpfssConsent = fpfssConsents[ext.id];

const shortContribs = [];
Expand Down
1 change: 1 addition & 0 deletions src/shared/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ const langTemplate = {
'deleteView',
'deleteOnlyBrowseView',
'createNewView',
'errorLoadingServices',
] as const,
filter: [
'dateAdded',
Expand Down

0 comments on commit d5eafe8

Please sign in to comment.