From 76a6a19b1b39596cc27e100a413cbea4fb1e8773 Mon Sep 17 00:00:00 2001 From: averrin Date: Thu, 10 Nov 2022 20:46:04 +0100 Subject: [PATCH] 0.4.6 --- CHANGELOG.md | 7 ++ src/view/FilesUI.svelte | 68 ++++++++++++-------- src/view/components/AdvancedRightPane.svelte | 4 +- src/view/components/BrowserRightPane.svelte | 1 + src/view/components/FilterPanel.svelte | 4 +- src/view/components/SelectedFiles.svelte | 3 +- 6 files changed, 54 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78a96ea..2a5ed30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. Dates are displayed in UTC. ## [Unreleased] +## [0.4.5 - 0.4.6](https://github.com/averrin/alpha-suit/compare/0.4.5...0.4.6) +Fixed: + * Pagination in some cases cannot navigate to the last page + * Incorrect test for installed Sequencer + * Missed handlers for some possible errors + * Audio files with extensions like "mp3" (non-video) dont treat like media + ## [0.4.4 - 0.4.5](https://github.com/averrin/alpha-suit/compare/0.4.4...0.4.5) Fixed: * Tokens layout is broken if they dont fit into one line diff --git a/src/view/FilesUI.svelte b/src/view/FilesUI.svelte index 3f1de97..acf3d55 100644 --- a/src/view/FilesUI.svelte +++ b/src/view/FilesUI.svelte @@ -22,11 +22,13 @@ import HelpFilesControls from "../view/help/HelpFilesControls.svelte"; import { fileIndex, indexInProcess, rebuildIndex } from "../modules/file_index.js"; import SelectedFiles from "./components/SelectedFiles.svelte"; - import { isImage, isVideo, showFile } from "crew-components/helpers"; + import { isImage,isSound, isVideo, showFile } from "crew-components/helpers"; import tippy from "sveltejs-tippy"; import { isPremium } from "crew-components/premium"; + const isSequencer = game.modules.get("sequencer")?.active; + const { application } = getContext("external"); const position = application.position; const { height } = position.stores; @@ -59,7 +61,8 @@ let navIndex = writable(0); function findPoster(file) { - return "icons/svg/video.svg"; + if (isVideo(file.name)) return "icons/svg/video.svg"; + return "icons/svg/sound.svg" } function onTagClick(_, tag) { @@ -178,28 +181,39 @@ path = path + "/" + rest; } } - return picker.browse(store, path, options).then((res) => { - return { - dirs: res.dirs.sort().map((id) => { - let base = id.split("/"); - base = base[base.length - 1]; + try { + return picker + .browse(store, path, options) + .then((res) => { return { - id: `${node.id}/${base}`, - children: [], - content: [], - title: base, - name: base, - store: store, - icon: "fa6-solid:folder", - expandable: true, + dirs: res.dirs.sort().map((id) => { + let base = id.split("/"); + base = base[base.length - 1]; + return { + id: `${node.id}/${base}`, + children: [], + content: [], + title: base, + name: base, + store: store, + icon: "fa6-solid:folder", + expandable: true, + }; + }), + files: res.files.sort().map((f) => { + const p = f.split("/"); + return { id: f, name: p[p.length - 1], store: store }; + }), }; - }), - files: res.files.sort().map((f) => { - const p = f.split("/"); - return { id: f, name: p[p.length - 1], store: store }; - }), - }; - }); + }) + .catch((e) => { + logger.error(e); + return { dirs: [], files: [] }; + }); + } catch (e) { + logger.error(e); + return { dirs: [], files: [] }; + } } function toggleExpanded(node, force = false) { @@ -658,7 +672,7 @@ on:dragstart={(e) => onDragStart(e, file)} class:ui-w-full={mode == "list"} style:background-position={mode == "list" ? "left" : "center"} - class:file-video={mode != "list" && isVideo(file.name)} + class:file-video={mode != "list" && (isVideo(file.name) || isSound(file.name))} class:selected-file={$selectedFiles.find((f) => f.id == file.id)} use:tippy={{ content: () => { @@ -669,12 +683,12 @@ allowHTML: true, }} > - {#if isVideo(file.name)} + {#if isVideo(file.name) || isSound(file.name)} - {#if Sequencer && Sequencer.Database.inverseFlattenedEntries?.get(file.id)} + {#if isSequencer && Sequencer.Database.inverseFlattenedEntries?.get(file.id)} { @@ -86,8 +86,6 @@ systemExtraInfo = $system.data?.extraInfo[modeName]; } fields = updateFields([_fields, ...($system.indexFields ?? [])].flat(), $filterAdvanced, systemExtraInfo); - // debugger; - // logger.info(fields, $filterAdvanced, modeName); total = 0; content = []; diff --git a/src/view/components/BrowserRightPane.svelte b/src/view/components/BrowserRightPane.svelte index 77070ee..1de51b8 100644 --- a/src/view/components/BrowserRightPane.svelte +++ b/src/view/components/BrowserRightPane.svelte @@ -88,6 +88,7 @@ } setContent(); + content = content.filter((i) => i.name); //Im trying to fix som weird situation blindfolded content.forEach((i) => (i.compendium = compendium)); } diff --git a/src/view/components/FilterPanel.svelte b/src/view/components/FilterPanel.svelte index 212b306..67ecc28 100644 --- a/src/view/components/FilterPanel.svelte +++ b/src/view/components/FilterPanel.svelte @@ -54,10 +54,10 @@ f.filters.push(...filters); return f; } else if (filter.control == "compare-int") { - if (val.length != 2 || !val[1]) { + if (val.length != 2 || !val[0] || !val[1]) { return f; } - val = `${filter.attribute} ${val[0].value} ${val[1]}`; + val = `${filter.attribute} ${val[0]?.value} ${val[1]}`; } else if (filter.control == "select" && filter.attribute) { if (typeof filter.options === "function") { filter.options = filter.options(); diff --git a/src/view/components/SelectedFiles.svelte b/src/view/components/SelectedFiles.svelte index e5f094a..42096bb 100644 --- a/src/view/components/SelectedFiles.svelte +++ b/src/view/components/SelectedFiles.svelte @@ -12,6 +12,7 @@ const dispatch = createEventDispatcher(); let fileTags = writable(setting(SETTINGS.FILES_TAGS)); + const isSequencer = game.modules.get("sequencer")?.active; // style:width={`${Math.max(100 / selectedFiles.length, 30)}%`} // style:height={`${100 / Math.round(selectedFiles.length / 3 + 1)}%`} @@ -88,7 +89,7 @@ {#if isVideo(file.name)} - {#if Sequencer && Sequencer.Database.inverseFlattenedEntries?.get(file.id)} + {#if isSequencer && Sequencer.Database.inverseFlattenedEntries?.get(file.id)}