diff --git a/README.md b/README.md index cc07627..6fadefa 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ as well as making it so all of the images load faster on your player's computers # Disclaimer: This module is currently in beta testing, as such there may be bugs and missing -features. To report bugs or request features you can: -- open an issue on the -[primary issue tracker](https://git.varify.ca/Foundry/image-tagger/issues) -- send an email to [hello@varify.ca](mailto:hello@varify.ca) -- or, open an issue on [Github](https://github.com/Eldritch-Oliver/Foundry-Image-Tagger/issues/new) +features. To report bugs or request features you can open an issue on the +[Public Issue Tracker](https://git.varify.ca/Foundry/image-tagger/issues) or you +can send an email to [hello@varify.ca](mailto:hello@varify.ca). diff --git a/langs/en-ca.json b/langs/en-ca.json index 320de4a..e2a7b55 100644 --- a/langs/en-ca.json +++ b/langs/en-ca.json @@ -12,15 +12,15 @@ "tags": "Tags", "select": "Select", "links": "Links", - "sort-by": "Sort By", - "page-reset-warning":"Changing any of these will reset your page to 1." + "sort-by": "Sort By" }, "apps": { "ArtBrowser": { "selected": "{current}/{required} Selected", "upload-image": "Upload Image", "no-results": "No results were found for that search", - "select-image": "Select image" + "select-image": "Select image", + "page-reset-warning": "Changing any of these will reset your page to 1." }, "ArtistBrowser": { "sort-options": { diff --git a/module/apps/ArtBrowser.mjs b/module/apps/ArtBrowser.mjs index 8b5f0df..98d3cdb 100644 --- a/module/apps/ArtBrowser.mjs +++ b/module/apps/ArtBrowser.mjs @@ -272,7 +272,6 @@ export class ArtBrowser extends HandlebarsApplicationMixin(ApplicationV2) { event.stopPropagation(); const data = (new FormDataExtended(event.currentTarget)).object; this.filters = data; - this.#page = 1; this.render({ parts: [`images`] }); }; diff --git a/module/apps/ArtistBrowser.mjs b/module/apps/ArtistBrowser.mjs index 52318e5..29ffc19 100644 --- a/module/apps/ArtistBrowser.mjs +++ b/module/apps/ArtistBrowser.mjs @@ -56,7 +56,7 @@ export class ArtistBrowser extends HandlebarsApplicationMixin(ApplicationV2) { if (this.#page == page) { return }; this.#page = page; if (this.rendered) { - await this.render({ parts: [`list`] }); + await this.render({ parts: [`images`] }); return; }; return; @@ -152,24 +152,6 @@ export class ArtistBrowser extends HandlebarsApplicationMixin(ApplicationV2) { const allArtists = Object.entries(deepClone(this.#artistDB.data)); const allImages = Object.values(this.#imagesDB.data); - /* - This collates all of the image data into the required summary data for the - display of the artists. Because this does the collation all in one iteration - it is a more performant way of collecting all of the information once the - databases get larger - */ - const summary = {}; - for (const image of allImages) { - for (const artistID of image.artists) { - summary[artistID] ??= { count: 0, tags: {} }; - summary[artistID].count++; - for (const tag of image.tags) { - summary[artistID].tags[tag] ??= { name: tag, count: 0 }; - summary[artistID].tags[tag].count++; - }; - }; - }; - const artists = []; for (const [id, artist] of allArtists) { // Check if it matches the required filters @@ -180,8 +162,20 @@ export class ArtistBrowser extends HandlebarsApplicationMixin(ApplicationV2) { // Populate ephemeral data for rendering artist.id = id; - artist.imageCount = summary[id].count; - artist.commonTags = Object.values(summary[id].tags) + let imageCount = 0; + let tags = {}; + + for (const image of allImages) { + if (!image.artists.includes(id)) continue; + imageCount++; + for (const tag of image.tags) { + tags[tag] ??= { name: tag, count: 0 }; + tags[tag].count++; + }; + }; + + artist.imageCount = imageCount; + artist.commonTags = Object.values(tags) .sort((a, b) => b.count - a.count) .slice(0, 5); @@ -206,7 +200,6 @@ export class ArtistBrowser extends HandlebarsApplicationMixin(ApplicationV2) { event.preventDefault(); event.stopPropagation(); const data = (new FormDataExtended(event.currentTarget)).object; - this.#page = 1; this.filters = data; this.render({ parts: [`list`] }); }; diff --git a/templates/ArtBrowser/sidebar.hbs b/templates/ArtBrowser/sidebar.hbs index 0dad469..8abb4fa 100644 --- a/templates/ArtBrowser/sidebar.hbs +++ b/templates/ArtBrowser/sidebar.hbs @@ -1,6 +1,6 @@