aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/src/components/PersonalInfo/PronounsSection.vue
blob: fb35b1800c595dc190b9bc8f9e1138f99bf084ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!--
  - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  - SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
	<AccountPropertySection v-bind.sync="pronouns"
		:placeholder="randomPronounsPlaceholder" />
</template>

<script>
import { loadState } from '@nextcloud/initial-state'

import AccountPropertySection from './shared/AccountPropertySection.vue'

import { NAME_READABLE_ENUM } from '../../constants/AccountPropertyConstants.js'

const { pronouns } = loadState('settings', 'personalInfoParameters', {})

export default {
	name: 'PronounsSection',

	components: {
		AccountPropertySection,
	},

	data() {
		return {
			pronouns: { ...pronouns, readable: NAME_READABLE_ENUM[pronouns.name] },
		}
	},

	computed: {
		randomPronounsPlaceholder() {
			const pronouns = [
				this.t('settings', 'she/her'),
				this.t('settings', 'he/him'),
				this.t('settings', 'they/them'),
			]
			const pronounsExample = pronouns[Math.floor(Math.random() * pronouns.length)]
			return this.t('settings', `Your pronouns. E.g. ${pronounsExample}`, { pronounsExample })
		},
	},
}
</script>