itube-specs 0.0.949 → 0.0.950
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/profile/setup.vue +15 -4
- package/package.json +1 -1
- package/pages/user/profile.vue +16 -2
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
<script setup lang="ts">
|
|
131
131
|
import type { ICountry, IGender, IProfileData, ISelectItem } from '../../types';
|
|
132
132
|
import { compressImage, convertDateToTimestamp, validateEmail } from '../../runtime';
|
|
133
|
+
import { isoCodeToCountryName } from '../../utils/iso-code-to-country-name';
|
|
133
134
|
import { AuthorizationApiService } from '../../services/api/authorization.service';
|
|
134
135
|
import { DictionariesApiService } from '../../services/api/dictionaries.service';
|
|
135
136
|
|
|
@@ -224,10 +225,20 @@ const [
|
|
|
224
225
|
useFetchDictionariesGenders(DictionariesApiService.getGenders),
|
|
225
226
|
]);
|
|
226
227
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
// Список стран приходит с API только по-английски — подписываем его ICU-словарём и
|
|
229
|
+
// пересортировываем коллатором, как в layout/language.vue. `value` остаётся английским
|
|
230
|
+
// title: по нему findCountry() ищет страну и им же инициализируется поле из профиля.
|
|
231
|
+
const countriesItems = computed<ISelectItem[] | undefined>(() => {
|
|
232
|
+
const collator = new Intl.Collator(locale.value);
|
|
233
|
+
|
|
234
|
+
return countriesData.value?.countries
|
|
235
|
+
.map((item) => {
|
|
236
|
+
const code = (item.isoCodes?.[0] || '').toUpperCase();
|
|
237
|
+
const name = isoCodeToCountryName(code, locale.value);
|
|
238
|
+
return { title: name === code ? item.title : name, value: item.title };
|
|
239
|
+
})
|
|
240
|
+
.sort((a, b) => collator.compare(a.title, b.title));
|
|
241
|
+
});
|
|
231
242
|
|
|
232
243
|
const gendersItems = computed<ISelectItem[] | undefined>(() => gendersData.value?.genders.map(item => ({
|
|
233
244
|
title: item.title,
|
package/package.json
CHANGED
package/pages/user/profile.vue
CHANGED
|
@@ -64,8 +64,9 @@
|
|
|
64
64
|
</template>
|
|
65
65
|
|
|
66
66
|
<script setup lang="ts">
|
|
67
|
-
import type { IProfileData } from '../../types';
|
|
67
|
+
import type { ICountry, IProfileData } from '../../types';
|
|
68
68
|
import { convertDateToTimestamp } from '../../runtime';
|
|
69
|
+
import { isoCodeToCountryName } from '../../utils/iso-code-to-country-name';
|
|
69
70
|
|
|
70
71
|
interface IDataItem {
|
|
71
72
|
title: string
|
|
@@ -86,11 +87,24 @@ const memberSince = computed(() => {
|
|
|
86
87
|
return new Intl.DateTimeFormat(locale.value, { month: 'long', year: 'numeric' }).format(date);
|
|
87
88
|
});
|
|
88
89
|
|
|
90
|
+
// Страна с API приходит объектом словаря (тип профиля знает её как строку) — подписываем её
|
|
91
|
+
// тем же ICU-словарём, что селектор в шапке и форму профиля. Строку отдаём как есть: имени
|
|
92
|
+
// без ISO-кода не перевести.
|
|
93
|
+
const countryName = computed(() => {
|
|
94
|
+
const country = data.value.country as unknown as ICountry | string | null;
|
|
95
|
+
if (!country) return '';
|
|
96
|
+
if (typeof country === 'string') return country;
|
|
97
|
+
|
|
98
|
+
const code = (country.isoCodes?.[0] || '').toUpperCase();
|
|
99
|
+
const name = isoCodeToCountryName(code, locale.value);
|
|
100
|
+
return name === code ? country.title : name;
|
|
101
|
+
});
|
|
102
|
+
|
|
89
103
|
const items = computed<Array<IDataItem>>(() => {
|
|
90
104
|
return [
|
|
91
105
|
{
|
|
92
106
|
title: t('profile.country'),
|
|
93
|
-
text:
|
|
107
|
+
text: countryName.value,
|
|
94
108
|
icon: 'geo'
|
|
95
109
|
},
|
|
96
110
|
{
|