Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(catalogue): variable list should show +n when repeat info is set #4259

Merged
merged 5 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions apps/nuxt3-ssr/components/VariableCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ const props = withDefaults(
const variableKey = computed(() => getKey(props.variable));

const resourcePathId = resourceIdPath(variableKey.value);

const repeats = computed(() =>
props.variable.repeatMax
? "repeated for " +
props.variable.repeatUnit?.name.toLowerCase() +
" " +
props.variable.repeatMin +
"-" +
props.variable.repeatMax
: undefined
);
</script>

<template>
Expand All @@ -27,18 +38,13 @@ const resourcePathId = resourceIdPath(variableKey.value);
>
{{ variable?.name }}
</NuxtLink>
<span
v-if="variable.repeats?.length"
v-tooltip="{
content:
variable.repeats.length +
(variable.repeats.length === 1 ? ' repeat' : 'repeats'),
}"
class="ml-1 bg-blue-50 text-title-contrast justify-center rounded-full px-2 py-1 font-bold text-heading-sm hover:cursor-help"
<div
v-if="repeats"
class="bg-blue-50 text-title-contrast justify-center rounded-full px-2 py-1 font-bold text-heading-sm hover:cursor-help"
style="display: inline-flex; flex-wrap: wrap"
>
+ {{ variable.repeats?.length }}
</span>
{{ repeats }}
</div>
</h2>
</div>
<div class="hidden md:flex md:basis-3/5">
Expand Down
17 changes: 10 additions & 7 deletions apps/nuxt3-ssr/components/VariableDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ const items = computed(() => [
},
{
label: "Repeated for",
content: variable.value?.repeatUnit?.name
? variable.value?.repeatUnit?.name +
" " +
variable.value?.repeatMin +
"-" +
variable.value?.repeatMax
: undefined,
content:
variable.value?.repeatUnit?.name ||
variable.value?.repeatMin ||
variable.value?.repeatMax
? variable.value?.repeatUnit?.name +
" " +
variable.value?.repeatMin +
"-" +
variable.value?.repeatMax
: undefined,
},
]);
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ const query = computed(() => {
id
}
}
repeatUnit {name}
repeatMin
repeatMax
label
description
mappings ${moduleToString(mappingsFragment)}
Expand Down