2022-11-24 21:37:43 +00:00
|
|
|
|
import { PageWrap } from '../../_shared/PageWrap'
|
2022-12-01 08:37:04 +00:00
|
|
|
|
import { t } from '../../../utils/intl'
|
2022-11-24 21:37:43 +00:00
|
|
|
|
import type { PageProps } from '../../types'
|
|
|
|
|
import { Icon } from '../../_shared/Icon'
|
2022-11-28 22:14:19 +00:00
|
|
|
|
import ProfileSettingsNavigation from '../../Discours/ProfileSettingsNavigation'
|
2022-12-01 08:37:04 +00:00
|
|
|
|
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'
|
2022-11-24 21:37:43 +00:00
|
|
|
|
|
|
|
|
|
export const ProfileSettingsPage = (props: PageProps) => {
|
2022-12-01 08:37:04 +00:00
|
|
|
|
const [author, setAuthor] = createSignal<Author>(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)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2022-11-24 21:37:43 +00:00
|
|
|
|
return (
|
|
|
|
|
<PageWrap>
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<Show when={author()}>
|
|
|
|
|
<div class="wide-container">
|
|
|
|
|
<div class="shift-content">
|
|
|
|
|
<div class="left-col">
|
|
|
|
|
<div class={clsx('left-navigation', styles.leftNavigation)}>
|
|
|
|
|
<ProfileSettingsNavigation />
|
|
|
|
|
</div>
|
2022-11-28 22:14:19 +00:00
|
|
|
|
</div>
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-md-10 col-lg-9 col-xl-8">
|
|
|
|
|
<h1>{t('Profile settings')}</h1>
|
|
|
|
|
<p class="description">{t('Here you can customize your profile the way you want.')}</p>
|
|
|
|
|
<form>
|
|
|
|
|
<h4>{t('Userpic')}</h4>
|
|
|
|
|
<div class="pretty-form__item">
|
|
|
|
|
<div class={styles.avatarContainer}>
|
|
|
|
|
<img class={styles.avatar} src={author().userpic} />
|
|
|
|
|
<input
|
|
|
|
|
type="file"
|
|
|
|
|
name="avatar"
|
|
|
|
|
class={styles.avatarInput}
|
|
|
|
|
accept="image/jpeg,image/png,image/gif,image/webp"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<h4>{t('Name')}</h4>
|
|
|
|
|
<p class="description">
|
|
|
|
|
{t(
|
|
|
|
|
'Your name will appear on your profile page and as your signature in publications, comments and responses.'
|
|
|
|
|
)}
|
|
|
|
|
</p>
|
|
|
|
|
<div class="pretty-form__item">
|
2022-11-24 21:37:43 +00:00
|
|
|
|
<input
|
2022-12-01 08:37:04 +00:00
|
|
|
|
type="text"
|
|
|
|
|
name="username"
|
|
|
|
|
id="username"
|
|
|
|
|
placeholder="Имя"
|
|
|
|
|
value={author().name}
|
2022-11-24 21:37:43 +00:00
|
|
|
|
/>
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<label for="username">Имя</label>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<h4>{t('Address on Discourse')}</h4>
|
|
|
|
|
<div class="pretty-form__item">
|
|
|
|
|
<div class={styles.discoursName}>
|
|
|
|
|
<label for="user-address">https://discours.io/user/</label>
|
|
|
|
|
<div class={styles.discoursNameField}>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
name="user-address"
|
|
|
|
|
id="user-address"
|
|
|
|
|
value={currentSlug()}
|
|
|
|
|
class="nolabel"
|
|
|
|
|
/>
|
|
|
|
|
<p class="form-message form-message--error">
|
|
|
|
|
{t('Sorry, this address is already taken, please choose another one.')}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<h4>{t('Introduce')}</h4>
|
|
|
|
|
<div class="pretty-form__item">
|
|
|
|
|
<textarea name="presentation" id="presentation" placeholder="Представление" />
|
|
|
|
|
<label for="presentation">{t('Introduce')}</label>
|
|
|
|
|
</div>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<h4>{t('About myself')}</h4>
|
|
|
|
|
<div class="pretty-form__item">
|
|
|
|
|
<textarea name="about" id="about" placeholder="О себе">
|
|
|
|
|
{author().bio}
|
|
|
|
|
</textarea>
|
|
|
|
|
<label for="about">{t('About myself')}</label>
|
|
|
|
|
</div>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<h4>{t('How can I help/skills')}</h4>
|
|
|
|
|
<div class="pretty-form__item">
|
|
|
|
|
<input type="text" name="skills" id="skills" />
|
|
|
|
|
</div>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<h4>{t('Where')}</h4>
|
|
|
|
|
<div class="pretty-form__item">
|
|
|
|
|
<input type="text" name="location" id="location" placeholder="Откуда" />
|
|
|
|
|
<label for="location">{t('Where')}</label>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
</div>
|
2022-12-01 08:37:04 +00:00
|
|
|
|
|
|
|
|
|
<h4>{t('Date of Birth')}</h4>
|
|
|
|
|
<div class="pretty-form__item">
|
|
|
|
|
<input
|
|
|
|
|
type="date"
|
|
|
|
|
name="birthdate"
|
|
|
|
|
id="birthdate"
|
|
|
|
|
placeholder="Дата рождения"
|
|
|
|
|
class="nolabel"
|
|
|
|
|
/>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
</div>
|
2022-12-01 08:37:04 +00:00
|
|
|
|
|
|
|
|
|
<div class={clsx(styles.multipleControls, 'pretty-form__item')}>
|
|
|
|
|
<div class={styles.multipleControlsHeader}>
|
|
|
|
|
<h4>{t('Social networks')}</h4>
|
|
|
|
|
<button class="button">+</button>
|
|
|
|
|
</div>
|
|
|
|
|
<For each={author().links}>
|
|
|
|
|
{(link) => (
|
|
|
|
|
<div class={styles.multipleControlsItem}>
|
|
|
|
|
<input type="text" value={link} name="social1" class="nolabel" />
|
|
|
|
|
<button>
|
|
|
|
|
<Icon name="remove" class={styles.icon} />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</For>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
2022-12-01 08:37:04 +00:00
|
|
|
|
<br />
|
|
|
|
|
<p>
|
|
|
|
|
<button class="button button--submit">{t('Save settings')}</button>
|
|
|
|
|
</p>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-12-01 08:37:04 +00:00
|
|
|
|
</Show>
|
2022-11-24 21:37:43 +00:00
|
|
|
|
</PageWrap>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// for lazy loading
|
|
|
|
|
export default ProfileSettingsPage
|