From 1439160b501ff0843c07f86645cdb7436da32560 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 23 Oct 2023 18:57:24 -0700 Subject: [PATCH] frame: remove dead code in Folder Signed-off-by: Varun Patil --- src/components/frame/Folder.vue | 51 +++++++-------------------------- 1 file changed, 10 insertions(+), 41 deletions(-) diff --git a/src/components/frame/Folder.vue b/src/components/frame/Folder.vue index 8ec7b3b9..cea8fbd9 100644 --- a/src/components/frame/Folder.vue +++ b/src/components/frame/Folder.vue @@ -5,7 +5,6 @@ :class="{ hasPreview: previews.length > 0, onePreview: previews.length === 1, - hasError: error, }" :to="target" > @@ -48,13 +47,6 @@ export default defineComponent({ }, }, - data: () => ({ - // Separate property because the one on data isn't reactive - previews: [] as IPhoto[], - // Error occured fetching thumbs - error: false, - }), - computed: { /** Open folder */ target() { @@ -70,35 +62,22 @@ export default defineComponent({ }, }; }, - }, - mounted() { - this.refreshPreviews(); - }, + previews(): IPhoto[] { + const previews = this.data.previews; + if (!previews?.length) { + return []; + } - watch: { - data() { - this.refreshPreviews(); + if (previews.length > 0 && previews.length < 4) { + return [previews[0]]; + } else { + return previews.slice(0, 4); + } }, }, methods: { - /** Refresh previews */ - refreshPreviews() { - // Reset state - this.error = false; - - // Get preview infos - const previews = this.data.previews; - if (previews) { - if (previews.length > 0 && previews.length < 4) { - this.previews = [previews[0]]; - } else { - this.previews = previews.slice(0, 4); - } - } - }, - /** Get preview url */ previewUrl(info: IPhoto) { return utils.getPreviewUrl({ @@ -162,16 +141,6 @@ export default defineComponent({ opacity: 0; } - // Make it red if has an error - .folder.hasError > & { - .folder-icon { - filter: invert(12%) sepia(62%) saturate(5862%) hue-rotate(8deg) brightness(103%) contrast(128%); - } - .name { - color: #bb0000; - } - } - > .folder-icon { cursor: pointer; height: 90%;