add req auth for header buttons (#163)
This commit is contained in:
parent
cc34e79dc5
commit
09717827f2
|
@ -70,6 +70,7 @@
|
||||||
"Create Group": "Create a group",
|
"Create Group": "Create a group",
|
||||||
"Create account": "Create an account",
|
"Create account": "Create an account",
|
||||||
"Create an account to add to your bookmarks": "Create an account to add to your bookmarks",
|
"Create an account to add to your bookmarks": "Create an account to add to your bookmarks",
|
||||||
|
"Create an account to publish articles": "Create an account to publish articles",
|
||||||
"Create an account to participate in discussions": "Create an account to participate in discussions",
|
"Create an account to participate in discussions": "Create an account to participate in discussions",
|
||||||
"Create an account to subscribe": "Create an account to subscribe",
|
"Create an account to subscribe": "Create an account to subscribe",
|
||||||
"Create an account to subscribe to new publications": "Create an account to subscribe to new publications",
|
"Create an account to subscribe to new publications": "Create an account to subscribe to new publications",
|
||||||
|
@ -102,6 +103,7 @@
|
||||||
"Enter text": "Enter text",
|
"Enter text": "Enter text",
|
||||||
"Enter the Discours": "Enter the Discours",
|
"Enter the Discours": "Enter the Discours",
|
||||||
"Enter the Discours to add to your bookmarks": "Enter the Discours to add to your bookmarks",
|
"Enter the Discours to add to your bookmarks": "Enter the Discours to add to your bookmarks",
|
||||||
|
"Enter the Discours to publish articles": "Enter the Discours to publish articles",
|
||||||
"Enter the Discours to participate in discussions": "Enter the Discours to participate in discussions",
|
"Enter the Discours to participate in discussions": "Enter the Discours to participate in discussions",
|
||||||
"Enter the Discours to subscribe": "Enter the Discours to subscribe",
|
"Enter the Discours to subscribe": "Enter the Discours to subscribe",
|
||||||
"Enter the Discours to subscribe to new publications": "Enter the Discours to subscribe to new publications",
|
"Enter the Discours to subscribe to new publications": "Enter the Discours to subscribe to new publications",
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
"Create Group": "Создать группу",
|
"Create Group": "Создать группу",
|
||||||
"Create account": "Создать аккаунт",
|
"Create account": "Создать аккаунт",
|
||||||
"Create an account to add to your bookmarks": "Создайте аккаунт, чтобы добавить в закладки",
|
"Create an account to add to your bookmarks": "Создайте аккаунт, чтобы добавить в закладки",
|
||||||
|
"Create an account to publish articles": "Создайте аккаунт, чтобы публиковать статьи",
|
||||||
"Create an account to participate in discussions": "Создайте аккаунт для участия в дискуссиях",
|
"Create an account to participate in discussions": "Создайте аккаунт для участия в дискуссиях",
|
||||||
"Create an account to subscribe": "Создайте аккаунт, чтобы подписаться",
|
"Create an account to subscribe": "Создайте аккаунт, чтобы подписаться",
|
||||||
"Create an account to subscribe to new publications": "Создайте аккаунт для подписки на новые публикации",
|
"Create an account to subscribe to new publications": "Создайте аккаунт для подписки на новые публикации",
|
||||||
|
@ -106,6 +107,7 @@
|
||||||
"Enter image title": "Введите название изображения",
|
"Enter image title": "Введите название изображения",
|
||||||
"Enter text": "Введите текст",
|
"Enter text": "Введите текст",
|
||||||
"Enter the Discours": "Войти в Дискурс",
|
"Enter the Discours": "Войти в Дискурс",
|
||||||
|
"Enter the Discours to publish articles": "Войдите в Дискурс, чтобы публиковать статьи",
|
||||||
"Enter the Discours to add to your bookmarks": "Войдите в Дискурс, чтобы добавить в закладки",
|
"Enter the Discours to add to your bookmarks": "Войдите в Дискурс, чтобы добавить в закладки",
|
||||||
"Enter the Discours to participate in discussions": "Войдите в Дискурс для участия в дискуссиях",
|
"Enter the Discours to participate in discussions": "Войдите в Дискурс для участия в дискуссиях",
|
||||||
"Enter the Discours to subscribe": "Войдите в Дискурс для подписки на новые публикации",
|
"Enter the Discours to subscribe": "Войдите в Дискурс для подписки на новые публикации",
|
||||||
|
|
|
@ -19,6 +19,12 @@ export const AuthModalHeader = (props: Props) => {
|
||||||
const title = modalType === 'login' ? 'Enter the Discours' : 'Create account'
|
const title = modalType === 'login' ? 'Enter the Discours' : 'Create account'
|
||||||
|
|
||||||
switch (source) {
|
switch (source) {
|
||||||
|
case 'create': {
|
||||||
|
return {
|
||||||
|
title: t(`${title} to publish articles`),
|
||||||
|
description: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
case 'bookmark': {
|
case 'bookmark': {
|
||||||
return {
|
return {
|
||||||
title: t(`${title} to add to your bookmarks`),
|
title: t(`${title} to add to your bookmarks`),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export type AuthModalMode = 'login' | 'register' | 'confirm-email' | 'forgot-password'
|
export type AuthModalMode = 'login' | 'register' | 'confirm-email' | 'forgot-password'
|
||||||
export type AuthModalSource = 'discussions' | 'vote' | 'subscribe' | 'bookmark' | 'follow'
|
export type AuthModalSource = 'discussions' | 'vote' | 'subscribe' | 'bookmark' | 'follow' | 'create'
|
||||||
|
|
||||||
export type AuthModalSearchParams = {
|
export type AuthModalSearchParams = {
|
||||||
mode: AuthModalMode
|
mode: AuthModalMode
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Show, createSignal, createEffect, onMount, onCleanup } from 'solid-js'
|
import { Show, createSignal, createEffect, onMount, onCleanup } from 'solid-js'
|
||||||
import { getPagePath } from '@nanostores/router'
|
import { getPagePath } from '@nanostores/router'
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
|
import { redirectPage } from '@nanostores/router'
|
||||||
|
|
||||||
import { Modal } from './Modal'
|
import { Modal } from './Modal'
|
||||||
import { AuthModal } from './AuthModal'
|
import { AuthModal } from './AuthModal'
|
||||||
|
@ -16,6 +17,7 @@ import { router, useRouter } from '../../stores/router'
|
||||||
import { getDescription } from '../../utils/meta'
|
import { getDescription } from '../../utils/meta'
|
||||||
|
|
||||||
import { useLocalize } from '../../context/localize'
|
import { useLocalize } from '../../context/localize'
|
||||||
|
import { useSession } from '../../context/session'
|
||||||
|
|
||||||
import styles from './Header.module.scss'
|
import styles from './Header.module.scss'
|
||||||
|
|
||||||
|
@ -37,6 +39,10 @@ export const Header = (props: Props) => {
|
||||||
|
|
||||||
const { modal } = useModalStore()
|
const { modal } = useModalStore()
|
||||||
|
|
||||||
|
const {
|
||||||
|
actions: { requireAuthentication }
|
||||||
|
} = useSession()
|
||||||
|
|
||||||
const { page, searchParams } = useRouter<HeaderSearchParams>()
|
const { page, searchParams } = useRouter<HeaderSearchParams>()
|
||||||
|
|
||||||
const [getIsScrollingBottom, setIsScrollingBottom] = createSignal(false)
|
const [getIsScrollingBottom, setIsScrollingBottom] = createSignal(false)
|
||||||
|
@ -86,6 +92,21 @@ export const Header = (props: Props) => {
|
||||||
props.scrollToComments(value)
|
props.scrollToComments(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleBookmarkButtonClick = (ev) => {
|
||||||
|
requireAuthentication(() => {
|
||||||
|
// TODO: implement bookmark clicked
|
||||||
|
ev.preventDefault()
|
||||||
|
}, 'bookmark')
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCreateButtonClick = (ev) => {
|
||||||
|
requireAuthentication(() => {
|
||||||
|
ev.preventDefault()
|
||||||
|
|
||||||
|
redirectPage(router, 'create')
|
||||||
|
}, 'create')
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header
|
<header
|
||||||
class={styles.mainHeader}
|
class={styles.mainHeader}
|
||||||
|
@ -151,11 +172,11 @@ export const Header = (props: Props) => {
|
||||||
<Icon name="comment" class={styles.icon} />
|
<Icon name="comment" class={styles.icon} />
|
||||||
<Icon name="comment-hover" class={clsx(styles.icon, styles.iconHover)} />
|
<Icon name="comment-hover" class={clsx(styles.icon, styles.iconHover)} />
|
||||||
</div>
|
</div>
|
||||||
<a href={getPagePath(router, 'create')} class={styles.control}>
|
<a href="#" class={styles.control} onClick={handleCreateButtonClick}>
|
||||||
<Icon name="pencil-outline" class={styles.icon} />
|
<Icon name="pencil-outline" class={styles.icon} />
|
||||||
<Icon name="pencil-outline-hover" class={clsx(styles.icon, styles.iconHover)} />
|
<Icon name="pencil-outline-hover" class={clsx(styles.icon, styles.iconHover)} />
|
||||||
</a>
|
</a>
|
||||||
<a href="#" class={styles.control} onClick={(event) => event.preventDefault()}>
|
<a href="#" class={styles.control} onClick={handleBookmarkButtonClick}>
|
||||||
<Icon name="bookmark" class={styles.icon} />
|
<Icon name="bookmark" class={styles.icon} />
|
||||||
<Icon name="bookmark-hover" class={clsx(styles.icon, styles.iconHover)} />
|
<Icon name="bookmark-hover" class={clsx(styles.icon, styles.iconHover)} />
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user