|
| 1 | +<template> |
| 2 | + <uw-card :loaded="isReady" :errored="isErrored" :errored-show="showError"> |
| 3 | + <template #card-heading> |
| 4 | + <h2 class="h4 mb-3 text-dark-beige myuw-font-encode-sans">Name & Pronouns</h2> |
| 5 | + </template> |
| 6 | + <template #card-body> |
| 7 | + <uw-card-property-group> |
| 8 | + <uw-card-property title="Official Name"> |
| 9 | + {{ fullName }} |
| 10 | + </uw-card-property> |
| 11 | + |
| 12 | + <uw-card-property title="Preferred Name"> |
| 13 | + <p v-if="!hasPreferredName" class="text-muted">No Preferred name listed</p> |
| 14 | + <div v-else> |
| 15 | + {{ prefName }} |
| 16 | + </div> |
| 17 | + </uw-card-property> |
| 18 | + <uw-card-property title="Pronouns"> |
| 19 | + <div v-if="hasPronouns"> |
| 20 | + {{ pronouns }} |
| 21 | + </div> |
| 22 | + <div v-else class="text-muted">No pronouns listed</div> |
| 23 | + <div class="mt-4"> |
| 24 | + <uw-link-button |
| 25 | + class="px-2 py-1" |
| 26 | + href="https://identity.uw.edu/" |
| 27 | + >Edit in Identity.UW |
| 28 | + </uw-link-button> |
| 29 | + </div> |
| 30 | + </uw-card-property> |
| 31 | + </uw-card-property-group> |
| 32 | + </template> |
| 33 | + </uw-card> |
| 34 | +</template> |
| 35 | + |
| 36 | +<script> |
| 37 | +import { mapGetters, mapState, mapActions } from 'vuex'; |
| 38 | +import Card from '../_templates/card.vue'; |
| 39 | +import CardProperty from '../_templates/card-property.vue'; |
| 40 | +import CardPropertyGroup from '../_templates/card-property-group.vue'; |
| 41 | +import LinkButton from '../_templates/link-button.vue'; |
| 42 | +
|
| 43 | +export default { |
| 44 | + components: { |
| 45 | + 'uw-card': Card, |
| 46 | + 'uw-card-property': CardProperty, |
| 47 | + 'uw-card-property-group': CardPropertyGroup, |
| 48 | + 'uw-link-button': LinkButton, |
| 49 | + }, |
| 50 | + computed: { |
| 51 | + ...mapState({ |
| 52 | + fullName: (state) => state.directory.value.full_name, |
| 53 | + prefName: (state) => state.directory.value.display_name, |
| 54 | + pronouns: (state) => state.directory.value.pronouns, |
| 55 | + }), |
| 56 | + ...mapGetters('directory', { |
| 57 | + isReady: 'isReady', |
| 58 | + isErrored: 'isErrored', |
| 59 | + }), |
| 60 | + hasPreferredName() { |
| 61 | + return Boolean(this.prefName && this.prefName.length); |
| 62 | + }, |
| 63 | + hasPronouns() { |
| 64 | + return Boolean(this.pronouns && this.pronouns.length); |
| 65 | + }, |
| 66 | + showError() { |
| 67 | + return false; |
| 68 | + }, |
| 69 | + }, |
| 70 | + mounted() { |
| 71 | + this.fetch(); |
| 72 | + }, |
| 73 | + methods: { |
| 74 | + ...mapActions('directory', { |
| 75 | + fetch: 'fetch', |
| 76 | + }), |
| 77 | + }, |
| 78 | +}; |
| 79 | +</script> |
| 80 | + |
| 81 | + |
0 commit comments