mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-08-03 11:07:00 -04:00
(nouns) display noun convention group on details page
This commit is contained in:
parent
68d3442686
commit
bf39ca90a4
@ -6,7 +6,7 @@ import { MorphemeValues } from '~/src/language/morphemes.ts';
|
||||
import type { NounConvention } from '~/src/nouns.ts';
|
||||
|
||||
const props = defineProps<{
|
||||
nounConvention: NounConvention;
|
||||
nounConvention: WithKey<NounConvention>;
|
||||
}>();
|
||||
|
||||
const { $translator: translator } = useNuxtApp();
|
||||
@ -39,6 +39,12 @@ const examples = computed(() => {
|
||||
return nounConventions?.examples.map((example) => Example.parse(example))
|
||||
.filter((example) => example.areRequiredExampleValuesPresent(exampleValues.value!));
|
||||
});
|
||||
|
||||
const nounConventionGroup = computed(() => {
|
||||
return Object.values(nounConventions.groups).find((nounConventionGroup) => {
|
||||
return nounConventionGroup.conventions.includes(props.nounConvention.key);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -107,4 +113,15 @@ const examples = computed(() => {
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="nounConventionGroup">
|
||||
<ul class="list-group mt-4">
|
||||
<li class="list-group-item">
|
||||
<NounsConventionsIndexGroup :noun-convention-group />
|
||||
</li>
|
||||
<nuxt-link :to="{ name: 'nouns' }" class="list-group-item list-group-item-action text-center">
|
||||
<Icon v="ellipsis-h-alt" />
|
||||
</nuxt-link>
|
||||
</ul>
|
||||
</section>
|
||||
</template>
|
||||
|
@ -25,11 +25,8 @@ const findNounConvention = async (path: string, config: Config) => {
|
||||
|
||||
const nounConventions = await loadNounConventions();
|
||||
|
||||
for (const [key, nounConvention] of Object.entries(nounConventions?.conventions ?? {})) {
|
||||
if (key === path) {
|
||||
return nounConvention;
|
||||
}
|
||||
}
|
||||
return withKey(nounConventions?.conventions ?? {})
|
||||
.find((nounConvention) => nounConvention.key === path);
|
||||
};
|
||||
|
||||
export default defineNuxtRouteMiddleware(async (to) => {
|
||||
|
@ -37,7 +37,7 @@ declare module 'vue-router' {
|
||||
interface RouteMeta {
|
||||
headerCategory?: string;
|
||||
pronoun?: Pronoun;
|
||||
nounConvention?: NounConvention;
|
||||
nounConvention?: WithKey<NounConvention>;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user