Skip to content

Commit

Permalink
add conditionals to be resilient to missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
marcolarosa committed Nov 17, 2023
1 parent 7bd1712 commit 909dec6
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<template>
<div class="flex flex-col space-y-4 text-lg text-slate-700 rounded p-6">
<div class="text-2xl">
{{ crate.rootDataset.name[0] }}
{{ crate.rootDataset?.name?.[0] }}
</div>
<div class="flex flex-col md:flex-row space-x-2">
<div class="w-1/5">Identifier:</div>
<div class="w-4/5">
{{ crate.rootDataset.identifier[0] }}
{{ crate.rootDataset?.identifier?.[0] }}
</div>
</div>
<div class="flex flex-col md:flex-row space-x-2">
<div class="w-1/5">Description:</div>
<div
class="w-4/5 flex flex-col space-y-2"
v-for="(d, idx) of crate.rootDataset.description"
v-for="(d, idx) of crate.rootDataset?.description"
:idx="idx"
>
<div>{{ d }}</div>
Expand All @@ -22,9 +22,9 @@
<div class="flex flex-col md:flex-row space-x-2">
<div class="w-1/5">Licence:</div>
<div class="w-4/5">
{{ crate.rootDataset.licence[0].name[0] }}
<span v-if="crate.rootDataset.licence?.[0]?.description?.[0]">
: {{ crate.rootDataset.licence?.[0]?.description?.[0] }}
{{ crate.rootDataset?.licence?.[0]?.name?.[0] }}
<span v-if="crate.rootDataset?.licence?.[0]?.description?.[0]">
: {{ crate.rootDataset?.licence?.[0]?.description?.[0] }}
</span>
</div>
</div>
Expand All @@ -34,12 +34,12 @@
<div class="flex flex-col space-y-4 w-4/5">
<div v-for="language of languages">
<div>
{{ language.name[0] }}
{{ language?.name?.[0] }}
</div>
<!-- <MapComponent class="flex-grow" :entity="language" v-if="language.geo" /> -->
<div class="text-sm">
Also known as:
{{ language.alternateName.join(", ") }}
{{ language?.alternateName?.join(", ") }}
</div>
</div>
</div>
Expand All @@ -50,7 +50,6 @@
<script setup>
import { computed } from "vue";
import { ROCrate } from "ro-crate";
import MapComponent from "./Map.component.vue";
const props = defineProps({
crate: {
Expand Down

0 comments on commit 909dec6

Please sign in to comment.