This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/routes/any.vue

102 lines
3.0 KiB
Vue
Raw Normal View History

2020-09-13 13:15:44 -07:00
<template>
2021-12-23 03:36:54 -08:00
<NotFound v-if="pronounGroups === undefined"/>
<div v-else>
2020-09-13 13:15:44 -07:00
<h2>
<Icon v="tag"/>
2021-12-02 08:18:25 -08:00
<T>pronouns.intro</T><T>quotation.colon</T>
2020-09-13 13:15:44 -07:00
</h2>
<section>
<div class="alert alert-primary">
<h2 class="text-center mb-0">
2021-12-23 03:36:54 -08:00
<strong>
<T>pronouns.any.short</T>
<span v-if="groupKey">{{groupKey}}</span>
</strong>
2020-09-13 13:15:44 -07:00
</h2>
<p class="h6 small text-center mb-0 mt-2">
<em>
<T>pronouns.any.description</T>
(<T>pronouns.any.options</T>)
2020-09-13 13:15:44 -07:00
</em>
</p>
</div>
</section>
<section>
<h2 class="h4">
<Icon v="file-signature"/>
2021-12-02 08:18:25 -08:00
<T>pronouns.examples</T><T>quotation.colon</T>
2020-09-13 13:15:44 -07:00
</h2>
<ul>
<li v-for="example in examples" class="my-1">
<Example :example="example" :pronoun="randomPronoun()" link/>
2020-09-13 13:15:44 -07:00
</li>
</ul>
</section>
2021-12-23 03:36:54 -08:00
<PronounGroup v-for="pronounGroup in pronounGroups" :key="pronounGroup.name" :pronounGroup="pronounGroup"/>
2020-09-13 13:15:44 -07:00
<section>
<Share :title="`${$t('pronouns.intro')}: ${$t('pronouns.any.short')}`"/>
2020-09-13 13:15:44 -07:00
</section>
<Separator icon="info"/>
<section class="mb-0">
<h2 class="h4">
<Icon v="info-circle"/>
2021-12-02 08:18:25 -08:00
<T>home.whatisit</T><T>quotation.colon</T>
2020-09-13 13:15:44 -07:00
</h2>
<T>home.about</T>
2020-09-13 13:15:44 -07:00
<Homepage align="center"/>
</section>
</div>
</template>
<script>
2021-12-23 03:36:54 -08:00
import { examples, pronouns, pronounLibrary } from "~/src/data";
2020-09-23 12:29:55 -07:00
import { head } from "../src/helpers";
2020-09-13 13:15:44 -07:00
export default {
data() {
2021-12-23 03:36:54 -08:00
const groupKey = this.$route.params.group;
let pronounGroups = [];
if (groupKey) {
pronounGroups = pronounLibrary.byKey()[groupKey];
}
2020-09-13 13:15:44 -07:00
return {
2021-12-23 03:36:54 -08:00
examples,
groupKey,
pronounGroups,
2020-09-13 13:15:44 -07:00
}
},
head() {
2020-09-23 12:29:55 -07:00
return head({
2021-12-23 03:36:54 -08:00
title: `${this.$t('pronouns.intro')}: ${this.$t('pronouns.any.short')} ${this.groupKey || ''}`.trim(),
banner: `api/banner/${this.$t('pronouns.any.short')}.png`,
2020-09-23 12:29:55 -07:00
});
2020-09-13 13:15:44 -07:00
},
2021-12-23 03:36:54 -08:00
computed: {
pronounsChoice() {
if (!this.pronounGroups.length) {
return pronouns;
}
let choice = {};
for (let pronounGroup of this.pronounGroups) {
choice = {...choice, ...pronounGroup.groupPronouns}
}
return choice;
}
},
2020-09-13 13:15:44 -07:00
methods: {
randomPronoun() {
2021-12-23 03:36:54 -08:00
const keys = Object.keys(this.pronounsChoice);
return this.pronounsChoice[keys[keys.length * Math.random() << 0]];
2020-09-13 13:15:44 -07:00
},
}
}
</script>