From 69dc0d20706ed41e5ecdbb77515066d8a7d7703b Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Fri, 19 Jun 2020 22:12:03 +0200
Subject: viewer: code update (no functional change)

Types { [x: T]: R } updated to Record<T, R>
Methods in template updated to getters (computed in VueJS), which are reactive and cached
Code formatting
---
 viewer/src/components/LdCommand.vue | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

(limited to 'viewer/src/components/LdCommand.vue')

diff --git a/viewer/src/components/LdCommand.vue b/viewer/src/components/LdCommand.vue
index d961519..49d86bb 100644
--- a/viewer/src/components/LdCommand.vue
+++ b/viewer/src/components/LdCommand.vue
@@ -21,17 +21,17 @@
 <template>
   <div class="flex command-btns">
     <a class="link" :title="$t('command.search')" @click="$uiStore.toggleFullWidth()">
-      <fa-icon :icon="commandToggleSearchPanelIcon()" size="lg" />
+      <fa-icon :icon="commandToggleSearchPanelIcon" size="lg" />
     </a>
     <a
-      :class="{'disabled': isEntryPoint()}"
+      :class="{'disabled': isEntryPoint}"
       class="link command-secondary"
       :title="$t('command.back')"
-      @click="isEntryPoint() || $router.back()"
+      @click="isEntryPoint || $router.back()"
     >
       <fa-icon icon="arrow-left" size="lg" />
     </a>
-    <router-link :class="{'disabled': isRoot()}" :title="$t('command.parent')" :to="parent()">
+    <router-link :class="{'disabled': isRoot}" :title="$t('command.parent')" :to="parent">
       <fa-icon icon="folder" size="xs" />
       <fa-icon icon="level-up-alt" size="lg" />
     </router-link>
@@ -46,19 +46,19 @@ import { RawLocation } from "vue-router";
 export default class LdCommand extends Vue {
   @Prop({ type: Array, required: true }) readonly currentItemPath!: Gallery.Item[];
 
-  commandToggleSearchPanelIcon(): string {
+  get commandToggleSearchPanelIcon(): string {
     return this.$uiStore.fullWidth ? "search" : "angle-double-left";
   }
 
-  isRoot(): boolean {
+  get isRoot(): boolean {
     return this.currentItemPath.length <= 1 && !this.$uiStore.searchMode;
   }
 
-  isEntryPoint(): boolean {
+  get isEntryPoint(): boolean {
     return history.state?.ldgallery === "ENTRYPOINT"; // Set by MainLayout.vue
   }
 
-  parent(): RawLocation {
+  get parent(): RawLocation {
     if (this.$uiStore.searchMode) return this.$route.path;
     if (this.currentItemPath.length > 1) return this.currentItemPath[this.currentItemPath.length - 2];
     return "";
-- 
cgit v1.2.3

