Skip to content

Commit

Permalink
fix: Refresh curation images
Browse files Browse the repository at this point in the history
  • Loading branch information
colin969 committed Jan 6, 2024
1 parent 710aa64 commit 8fd0c5d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flashpoint-launcher",
"version": "12.2.0",
"version": "12.2.1",
"description": "A desktop application used to browse, manage and play games from Flashpoint Archive",
"main": "build/main/index.js",
"config": {
Expand Down
11 changes: 11 additions & 0 deletions src/back/curate/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,17 @@ export async function refreshCurationContent(state: BackState, folder: string) {
if (curationIdx !== -1) {
const curation = state.loadedCurations[curationIdx];
const contentPath = getContentFolderByKey(curation.folder, state.config.flashpointPath);
// Check for new loaded images
if (curation.thumbnail.exists === false) {
curation.thumbnail = await loadCurationIndexImage(path.join(state.config.flashpointPath, CURATIONS_FOLDER_WORKING, curation.folder, 'logo.png'));
} else {
curation.thumbnail.version += 1;
}
if (curation.screenshot.exists === false) {
curation.screenshot = await loadCurationIndexImage(path.join(state.config.flashpointPath, CURATIONS_FOLDER_WORKING, curation.folder, 'ss.png'));
} else {
curation.screenshot.version += 1;
}
curation.contents = await genContentTree(contentPath);
curation.warnings = await genCurationWarnings(curation, state.config.flashpointPath, state.suggestions, state.languageContainer['curate'], state.apiEmitters.curations.onWillGenCurationWarnings);
state.loadedCurations[curationIdx] = curation;
Expand Down
8 changes: 6 additions & 2 deletions src/renderer/components/CurateBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ export function CurateBox(props: CurateBoxProps) {
const onDropThumbnail = useDropImageCallback('logo.png', props.curation, strings.dialog);
const onDropScreenshot = useDropImageCallback('ss.png', props.curation, strings.dialog);

const thumbnailPath = props.curation.thumbnail.exists ? `${getCurationURL(props.curation.folder)}/logo.png` : undefined;
const screenshotPath = props.curation.screenshot.exists ? `${getCurationURL(props.curation.folder)}/ss.png` : undefined;
const thumbnailPath = React.useMemo(() => {
return props.curation.thumbnail.exists ? `${getCurationURL(props.curation.folder)}/logo.png?v` + props.curation.thumbnail.version : undefined;
}, [props.curation.thumbnail]);
const screenshotPath = React.useMemo(() => {
return props.curation.screenshot.exists ? `${getCurationURL(props.curation.folder)}/ss.png?v` + props.curation.screenshot.version : undefined;
}, [props.curation.screenshot]);

const onNewAddApp = useCreateAddAppCallback('normal', props.curation.folder, props.dispatch);
const onAddExtras = useCreateAddAppCallback('extras', props.curation.folder, props.dispatch);
Expand Down
2 changes: 1 addition & 1 deletion typings/flashpoint-launcher.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for non-npm package flashpoint-launcher 12
// Type definitions for non-npm package flashpoint-launcher 12.2
// Project: Flashpoint Launcher https://github.com/FlashpointProject/launcher
// Definitions by: Colin Berry <https://github.com/colin969>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
Expand Down

0 comments on commit 8fd0c5d

Please sign in to comment.