diff --git a/src/components/Nav/Header/Header.tsx b/src/components/Nav/Header/Header.tsx index b16f8697..cf0d8e95 100644 --- a/src/components/Nav/Header/Header.tsx +++ b/src/components/Nav/Header/Header.tsx @@ -1,4 +1,4 @@ -import { Show, createSignal, createEffect, onMount, onCleanup } from 'solid-js' +import { For, Show, createSignal, createEffect, onMount, onCleanup } from 'solid-js' import { getPagePath, redirectPage } from '@nanostores/router' import { clsx } from 'clsx' @@ -9,6 +9,7 @@ import { ConfirmModal } from '../ConfirmModal' import { getShareUrl, SharePopup } from '../../Article/SharePopup' import { Snackbar } from '../Snackbar' import { Icon } from '../../_shared/Icon' +import type { Topic } from '../../../graphql/types.gen' import { useModalStore } from '../../../stores/ui' import { router, useRouter } from '../../../stores/router' @@ -17,6 +18,7 @@ import { getDescription } from '../../../utils/meta' import { useLocalize } from '../../../context/localize' import { useSession } from '../../../context/session' +import { useTopicsStore } from '../../../stores/zine/topics' import styles from './Header.module.scss' @@ -27,6 +29,7 @@ type Props = { articleBody?: string cover?: string scrollToComments?: (value: boolean) => void + randomTopics?: Topic[] } type HeaderSearchParams = { @@ -34,7 +37,7 @@ type HeaderSearchParams = { } export const Header = (props: Props) => { - const { t } = useLocalize() + const { t, lang } = useLocalize() const { modal } = useModalStore() @@ -56,6 +59,9 @@ export const Header = (props: Props) => { const toggleFixed = () => setFixed((oldFixed) => !oldFixed) + const tag = (topic: Topic) => + /[ЁА-яё]/.test(topic.title || '') && lang() !== 'ru' ? topic.slug : topic.title + let windowScrollTop = 0 createEffect(() => { @@ -296,34 +302,25 @@ export const Header = (props: Props) => { >