From 7b0bac4ecadfc99a3cbd2dd2a389d0f0c6d454a1 Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Thu, 1 Dec 2022 11:37:04 +0300 Subject: [PATCH] Get User Data & i18n --- .../Pages/profile/ProfileSettingsPage.tsx | 245 ++++++++++-------- src/locales/ru.json | 16 +- 2 files changed, 155 insertions(+), 106 deletions(-) diff --git a/src/components/Pages/profile/ProfileSettingsPage.tsx b/src/components/Pages/profile/ProfileSettingsPage.tsx index 29a405db..556ab1a6 100644 --- a/src/components/Pages/profile/ProfileSettingsPage.tsx +++ b/src/components/Pages/profile/ProfileSettingsPage.tsx @@ -1,125 +1,160 @@ import { PageWrap } from '../../_shared/PageWrap' +import { t } from '../../../utils/intl' import type { PageProps } from '../../types' -import styles from './Settings.module.scss' import { Icon } from '../../_shared/Icon' -import { clsx } from 'clsx' import ProfileSettingsNavigation from '../../Discours/ProfileSettingsNavigation' +import { useSession } from '../../../context/session' +import { createMemo, For, createSignal, Show, createEffect } from 'solid-js' +import { loadAuthor, useAuthorsStore } from '../../../stores/zine/authors' +import type { Author } from '../../../graphql/types.gen' +import { clsx } from 'clsx' +import styles from './Settings.module.scss' export const ProfileSettingsPage = (props: PageProps) => { + const [author, setAuthor] = createSignal(null) + const { session } = useSession() + const currentSlug = createMemo(() => session()?.user?.slug) + const { authorEntities } = useAuthorsStore({ authors: [] }) + const currentAuthor = createMemo(() => authorEntities()[currentSlug()]) + + createEffect(async () => { + if (!currentSlug()) return + try { + await loadAuthor({ slug: currentSlug() }) + setAuthor(currentAuthor()) + console.log('!!! currentAuthor:', currentAuthor()) + } catch (error) { + console.error(error) + } + }) + return ( -
-
-
-
- + +
+
+
+
+ +
-
- -
-
-

Настройки профиля

-

Здесь можно настроить свой профиль так, как вы хотите.

- -
-

Аватар

-
-
- - -
-
- -

Имя

-

- Ваше имя появится на странице вашего профиля и как ваша подпись - в публикациях, комментариях и откликах -

-
- - -
- -

Адрес на Дискурсе

-
-
- -
- -

- Увы, этот адрес уже занят, выберите другой -

+
+
+

{t('Profile settings')}

+

{t('Here you can customize your profile the way you want.')}

+ +

{t('Userpic')}

+
+
+ +
-
-

Представление

-
- + +
+ +

{t('How can I help/skills')}

+
+ +
+ +

{t('Where')}

+
+ + +
+ +

{t('Date of Birth')}

+
+ +
+ +
+
+

{t('Social networks')}

+ +
+ + {(link) => ( +
+ + +
+ )} +
+
+ +
+

+ +

+ +
-
+ ) } diff --git a/src/locales/ru.json b/src/locales/ru.json index a04a7365..53fae93b 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -189,5 +189,19 @@ "create_group": "Создать группу", "discourse_theme": "Тема дискурса", "cancel": "Отмена", - "group_chat": "Общий чат" + "group_chat": "Общий чат", + "Profile settings": "Настройки профиля", + "Here you can customize your profile the way you want.": "Здесь можно настроить свой профиль так, как вы хотите.", + "Userpic": "Аватар", + "Name": "Имя", + "Your name will appear on your profile page and as your signature in publications, comments and responses.": "Ваше имя появится на странице вашего профиля и как ваша подпись в публикациях, комментариях и откликах", + "Address on Discourse": "Адрес на Дискурсе", + "Sorry, this address is already taken, please choose another one.": "Увы, этот адрес уже занят, выберите другой", + "Introduce": "Представление", + "About myself": "О себе", + "How can I help/skills": "Чем могу помочь/навыки", + "Where": "Откуда", + "Date of Birth": "Дата рождения", + "Social networks": "Социальные сети", + "Save settings": "Сохранить настройки" }