Skip to content

Commit

Permalink
0.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
averrin committed Nov 10, 2022
1 parent 20d008a commit 76a6a19
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 33 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
68 changes: 41 additions & 27 deletions src/view/FilesUI.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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: () => {
Expand All @@ -669,12 +683,12 @@
allowHTML: true,
}}
>
{#if isVideo(file.name)}
{#if isVideo(file.name) || isSound(file.name)}
<video
id={`video--${file.id}`}
class="ui-rounded-md"
class:file-video={mode == "list"}
poster={findPoster(file.id)}
poster={findPoster(file)}
preload="none"
disablePictureInPicture
style="height: 100%;"
Expand All @@ -691,7 +705,7 @@
<source src={file.id} type="video/webm" />
</video>
<!-- <iconify-icon class="seq-icon" icon="fa6-solid:database" title="Sequencer" /> -->
{#if Sequencer && Sequencer.Database.inverseFlattenedEntries?.get(file.id)}
{#if isSequencer && Sequencer.Database.inverseFlattenedEntries?.get(file.id)}
<CopyButton
size="xs"
icon="fa6-solid:database"
Expand All @@ -704,7 +718,7 @@
{/if}
{/if}
{#if (!isImage(file.name) && !isVideo(file.name)) || mode == "list"}
{#if (!isImage(file.name) && !isVideo(file.name) && !isSound(file.name)) || mode == "list"}
<div
class="ui-text-base-content ui-w-full"
style:text-align={mode == "list" ? `center` : "left"}
Expand Down
4 changes: 1 addition & 3 deletions src/view/components/AdvancedRightPane.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
aliases
);
total = fc.length;
if (total < currentPage * pageSize) {
if (total < (currentPage + 1) * pageSize) {
currentPage = 1;
}
content = pageContent(fc, currentPage, pageSize).map((i) => {
Expand All @@ -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 = [];
Expand Down
1 change: 1 addition & 0 deletions src/view/components/BrowserRightPane.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
4 changes: 2 additions & 2 deletions src/view/components/FilterPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/view/components/SelectedFiles.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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)}%`}
Expand Down Expand Up @@ -88,7 +89,7 @@
<input type="text" class="ui-input ui-w-full" value={file.id} readonly />
<CopyButton icon="fa6-solid:copy" text={file.id} title="Copy path" />
{#if isVideo(file.name)}
{#if Sequencer && Sequencer.Database.inverseFlattenedEntries?.get(file.id)}
{#if isSequencer && Sequencer.Database.inverseFlattenedEntries?.get(file.id)}
<CopyButton
icon="fa6-solid:database"
title={"Copy Sequencer path: " + Sequencer.Database.inverseFlattenedEntries.get(file.id)}
Expand Down

0 comments on commit 76a6a19

Please sign in to comment.