Browse Source

fix: block name changing

Ahmad Kholid 2 years ago
parent
commit
9eb74f839d

+ 3 - 0
src/components/newtab/workflow/WorkflowBlockList.vue

@@ -58,6 +58,7 @@
 </template>
 <script setup>
 import { useI18n } from 'vue-i18n';
+import { tasks } from '@/utils/shared';
 
 defineProps({
   category: {
@@ -79,6 +80,8 @@ const { t, te } = useI18n();
 
 function getBlockTitle({ description, id, name }) {
   const blockPath = `workflow.blocks.${id}`;
+  if (!te(blockPath)) return tasks[id].name;
+
   const descPath = `${blockPath}.${description ? 'description' : 'name'}`;
   let blockDescription = te(descPath) ? t(descPath) : name;
 

+ 9 - 1
src/components/newtab/workflow/WorkflowDetailsCard.vue

@@ -159,7 +159,15 @@ const blocks = computed(() =>
 );
 const pinnedBlocksList = computed(() =>
   pinnedBlocks.value
-    .map((id) => ({ ...tasks[id], id, name: t(`workflow.blocks.${id}.name`) }))
+    .map((id) => {
+      const namePath = `workflow.blocks.${id}.name`;
+
+      return {
+        ...tasks[id],
+        id,
+        name: te(namePath) ? t(namePath) : tasks[id].name,
+      };
+    })
     .filter(({ name }) =>
       name.toLocaleLowerCase().includes(query.value.toLocaleLowerCase())
     )