diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 7e980854..a5a3ed40 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -70,6 +70,7 @@ "Create Group": "Create a group", "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 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 subscribe": "Create an account to subscribe", "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 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 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 subscribe": "Enter the Discours to subscribe", "Enter the Discours to subscribe to new publications": "Enter the Discours to subscribe to new publications", diff --git a/public/locales/ru/translation.json b/public/locales/ru/translation.json index 4226ea97..5612625c 100644 --- a/public/locales/ru/translation.json +++ b/public/locales/ru/translation.json @@ -74,6 +74,7 @@ "Create Group": "Создать группу", "Create account": "Создать аккаунт", "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 subscribe": "Создайте аккаунт, чтобы подписаться", "Create an account to subscribe to new publications": "Создайте аккаунт для подписки на новые публикации", @@ -106,6 +107,7 @@ "Enter image title": "Введите название изображения", "Enter text": "Введите текст", "Enter the Discours": "Войти в Дискурс", + "Enter the Discours to publish articles": "Войдите в Дискурс, чтобы публиковать статьи", "Enter the Discours to add to your bookmarks": "Войдите в Дискурс, чтобы добавить в закладки", "Enter the Discours to participate in discussions": "Войдите в Дискурс для участия в дискуссиях", "Enter the Discours to subscribe": "Войдите в Дискурс для подписки на новые публикации", diff --git a/src/components/Nav/AuthModal/AuthModalHeader/AuthModalHeader.tsx b/src/components/Nav/AuthModal/AuthModalHeader/AuthModalHeader.tsx index 311e42fe..a0e1e046 100644 --- a/src/components/Nav/AuthModal/AuthModalHeader/AuthModalHeader.tsx +++ b/src/components/Nav/AuthModal/AuthModalHeader/AuthModalHeader.tsx @@ -19,6 +19,12 @@ export const AuthModalHeader = (props: Props) => { const title = modalType === 'login' ? 'Enter the Discours' : 'Create account' switch (source) { + case 'create': { + return { + title: t(`${title} to publish articles`), + description: '' + } + } case 'bookmark': { return { title: t(`${title} to add to your bookmarks`), diff --git a/src/components/Nav/AuthModal/types.ts b/src/components/Nav/AuthModal/types.ts index a9c8f427..ea233cf1 100644 --- a/src/components/Nav/AuthModal/types.ts +++ b/src/components/Nav/AuthModal/types.ts @@ -1,5 +1,5 @@ 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 = { mode: AuthModalMode diff --git a/src/components/Nav/Header.tsx b/src/components/Nav/Header.tsx index f4146a9a..58135664 100644 --- a/src/components/Nav/Header.tsx +++ b/src/components/Nav/Header.tsx @@ -1,6 +1,7 @@ import { Show, createSignal, createEffect, onMount, onCleanup } from 'solid-js' import { getPagePath } from '@nanostores/router' import { clsx } from 'clsx' +import { redirectPage } from '@nanostores/router' import { Modal } from './Modal' import { AuthModal } from './AuthModal' @@ -16,6 +17,7 @@ import { router, useRouter } from '../../stores/router' import { getDescription } from '../../utils/meta' import { useLocalize } from '../../context/localize' +import { useSession } from '../../context/session' import styles from './Header.module.scss' @@ -37,6 +39,10 @@ export const Header = (props: Props) => { const { modal } = useModalStore() + const { + actions: { requireAuthentication } + } = useSession() + const { page, searchParams } = useRouter() const [getIsScrollingBottom, setIsScrollingBottom] = createSignal(false) @@ -86,6 +92,21 @@ export const Header = (props: Props) => { 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 (
{ - + - event.preventDefault()}> +