Hide comment editor for no auth users

This commit is contained in:
ilya-bkv 2023-02-13 16:34:10 +03:00
parent ca7a421728
commit 1cfbffc213
3 changed files with 27 additions and 35 deletions

View File

@ -81,6 +81,17 @@ const CommentEditor = (props: Props) => {
return (
<>
<Show
when={session()?.user?.slug}
fallback={
<div class={styles.signInMessage} id="comments">
{t('To write a comment, you must')}&nbsp;
<a href="?modal=auth&mode=register">{t('sign up')}</a>
&nbsp;{t('or')}&nbsp;
<a href="?modal=auth&mode=login">{t('sign in')}</a>
</div>
}
>
<div class={styles.commentEditor}>
<div
class={clsx('ProseMirrorOverrides', styles.textarea)}
@ -96,20 +107,6 @@ const CommentEditor = (props: Props) => {
</div>
</div>
</div>
<div class={styles.helpText}>{'"Cmd-Z": Undo, "Cmd-Y": Redo'}</div>
<Show when={!session()?.user?.slug}>
<div class={styles.signInMessage} id="comments">
{t('To write a comment, you must')}&nbsp;
<span
class={styles.link}
onClick={(evt) => {
evt.preventDefault()
showModal('auth')
}}
>
{t('sign up or sign in')}
</span>
</div>
</Show>
</>
)

View File

@ -25,13 +25,6 @@
}
}
.helpText {
font-size: 12px;
color: #696969;
margin: 12px 0;
font-style: italic;
}
.signInMessage {
background: #f1f2f3;
border-radius: 8px;

View File

@ -179,7 +179,9 @@
"personal data usage and email notifications": "на обработку персональных данных и на получение почтовых уведомлений",
"post": "пост",
"register": "зарегистрируйтесь",
"sign up or sign in": "зарегистрироваться или войти",
"sign up": "зарегистрироваться",
"or": "или",
"sign in": "войти",
"terms of use": "правилами пользования сайтом",
"topics": "темы",
"user already exist": "пользователь уже существует",