Skip to content

Commit

Permalink
Avoid hard-coding creation label
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Jan 2, 2025
1 parent b7ea9cd commit 85ed572
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
13 changes: 9 additions & 4 deletions arches_lingo/src/arches_lingo/components/scheme/SchemeCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { inject } from "vue";
import { systemLanguageKey } from "@/arches_lingo/constants.ts";
import { systemLanguageKey, NEW } from "@/arches_lingo/constants.ts";
import { routeNames } from "@/arches_lingo/routes.ts";
import type { Language } from "@/arches_vue_utils/types";
Expand All @@ -22,8 +22,10 @@ let schemeDescriptor: ResourceDescriptor = {
if (descriptors) {
const descriptor =
descriptors[systemLanguage.code] ?? Object.values(descriptors)[0];
schemeDescriptor.name = descriptor.name ?? "";
schemeDescriptor.description = descriptor.description ?? "";
if (descriptor) {
schemeDescriptor.name = descriptor.name ?? "";
schemeDescriptor.description = descriptor.description ?? "";
}
}
</script>

Expand All @@ -32,7 +34,10 @@ if (descriptors) {
:to="schemeURL"
class="scheme-card"
>
<p>{{ schemeDescriptor.name }}</p>
<p v-if="scheme.resourceinstanceid === NEW">
{{ $gettext("Create a new scheme") }}
</p>
<p v-else>{{ schemeDescriptor.name }}</p>
<p>{{ schemeDescriptor.description }}</p>
</RouterLink>
</template>
Expand Down
7 changes: 1 addition & 6 deletions arches_lingo/src/arches_lingo/pages/SchemeList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ onMounted(async () => {
}
schemes.value.unshift({
resourceinstanceid: NEW,
descriptors: {
en: {
name: "Create a new scheme",
description: "",
},
},
descriptors: {},
});
});
</script>
Expand Down

0 comments on commit 85ed572

Please sign in to comment.