From e1275b76eab48c39d2eb3f791f00675cfcff1a91 Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 3 Jul 2024 10:02:46 +0300 Subject: [PATCH] navheader-fix --- public/locales/en/translation.json | 52 +++++++------- public/locales/ru/translation.json | 48 ++++++------- src/components/Nav/Header/Header.tsx | 70 +++++-------------- src/components/Nav/Header/Link.tsx | 38 ---------- .../Views/AllAuthors/AllAuthors.tsx | 19 ++--- src/components/Views/AllTopics/AllTopics.tsx | 16 ++--- src/graphql/client/core.ts | 1 + src/routes/authors.tsx | 2 +- 8 files changed, 87 insertions(+), 159 deletions(-) delete mode 100644 src/components/Nav/Header/Link.tsx create mode 100644 src/graphql/client/core.ts diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 489ce382..5f8ccc12 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -15,8 +15,8 @@ "Add image": "Add image", "Add images": "Add images", "Add intro": "Add intro", - "add link": "add link", "Add link": "Add link", + "add link": "add link", "Add rule": "Add rule", "Add signature": "Add signature", "Add subtitle": "Add subtitle", @@ -30,8 +30,8 @@ "All articles": "All articles", "All authors": "All authors", "All posts": "All posts", - "all topics": "all topics", "All topics": "All topics", + "all topics": "all topics", "Almost done! Check your email.": "Almost done! Just checking your email.", "and some more authors": "{restUsersCount, plural, =0 {} one { and one more user} other { and more {restUsersCount} users}}", "Anything else": "Anything else", @@ -43,10 +43,10 @@ "Artist": "Artist", "Artworks": "Artworks", "Audio": "Audio", - "author": "author", "Author": "Author", - "authors": "authors", + "author": "author", "Authors": "Authors", + "authors": "authors", "Autotypograph": "Autotypograph", "Back": "Back", "Back to editor": "Back to editor", @@ -54,11 +54,11 @@ "back to menu": "back to menu", "Be the first to rate": "Be the first to rate", "Become an author": "Become an author", - "bold": "bold", "Bold": "Bold", + "bold": "bold", "Bookmarked": "Saved", - "bookmarks": "bookmarks", "Bookmarks": "Bookmarks", + "bookmarks": "bookmarks", "Bullet list": "Bullet list", "By alphabet": "By alphabet", "By authors": "By authors", @@ -75,8 +75,8 @@ "Can make any changes, accept or reject suggestions, and share access with others": "Can make any changes, accept or reject suggestions, and share access with others", "Can offer edits and comments, but cannot edit the post or share access with others": "Can offer edits and comments, but cannot edit the post or share access with others", "Can write and edit text directly, and accept or reject suggestions from others": "Can write and edit text directly, and accept or reject suggestions from others", - "cancel": "cancel", "Cancel": "Cancel", + "cancel": "cancel", "Cancel changes": "Cancel changes", "Change password": "Change password", "Characters": "Знаков", @@ -88,8 +88,8 @@ "Co-author": "Co-author", "Collaborate": "Help Edit", "Collaborators": "Collaborators", - "collections": "collections", "Collections": "Collections", + "collections": "collections", "Come up with a subtitle for your story": "Come up with a subtitle for your story", "Come up with a title for your story": "Come up with a title for your story", "Coming soon": "Coming soon", @@ -148,8 +148,8 @@ "Dogma": "Dogma", "dogma keywords": "Discours.io, dogma, editorial principles, code of ethics, journalism, community", "Draft successfully deleted": "Draft successfully deleted", - "drafts": "drafts", "Drafts": "Drafts", + "drafts": "drafts", "Drag the image to this area": "Drag the image to this area", "Each image must be no larger than 5 MB.": "Each image must be no larger than 5 MB.", "earlier": "earlier", @@ -159,8 +159,8 @@ "Editor": "Editor", "Email": "Mail", "email not confirmed": "email not confirmed", - "enter": "enter", "Enter": "Enter", + "enter": "enter", "Enter a new password": "Enter a new password", "Enter footnote text": "Enter footnote text", "Enter image description": "Enter image description", @@ -175,8 +175,8 @@ "FAQ": "Tips and suggestions", "Favorite": "Favorites", "Favorite topics": "Favorite topics", - "feed": "feed", "Feed": "Feed", + "feed": "feed", "Feed settings": "Feed settings", "Feedback": "Feedback", "Fill email": "Fill email", @@ -196,12 +196,13 @@ "Go to main page": "Go to main page", "Group Chat": "Group Chat", "Groups": "Groups", - "header 1": "header 1", + "guide": "Knowledge base", "Header 1": "Header 1", - "header 2": "header 2", + "header 1": "header 1", "Header 2": "Header 2", - "header 3": "header 3", + "header 2": "header 2", "Header 3": "Header 3", + "header 3": "header 3", "Headers": "Headers", "Help": "Помощь", "Help to edit": "Help to edit", @@ -247,8 +248,8 @@ "Invite to collab": "Invite to Collab", "It does not look like url": "It doesn't look like a link", "It's OK. Just enter your email to receive a link to change your password": "It's OK. Just enter your email to receive a link to change your password", - "italic": "italic", "Italic": "Italic", + "italic": "italic", "Join": "Join", "Join our maillist": "To receive the best postings, just enter your email", "Join the community": "Join the community", @@ -257,7 +258,6 @@ "jpg, .png, max. 10 mb.": "jpg, .png, макс. 10 мб.", "Just start typing...": "Just start typing...", "keywords": "Discours.io, Discours magazine, Discours, culture, science, art, society, independent journalism, literature, music, cinema, video, photography", - "Knowledge base": "Knowledge base", "Language": "Language", "Last rev.": "Посл. изм.", "Let's log in": "Let's log in", @@ -266,8 +266,8 @@ "Link sent, check your email": "Link sent, check your email", "List of authors of the open editorial community": "List of authors of the open editorial community", "Lists": "Lists", - "literature": "literature", "Literature": "Literature", + "literature": "literature", "Load more": "Show more", "Loading": "Loading", "Login and security": "Login and security", @@ -287,10 +287,10 @@ "Most read": "Readable", "Move down": "Move down", "Move up": "Move up", - "music": "music", "Music": "Music", - "my feed": "my ribbon", + "music": "music", "My feed": "My feed", + "my feed": "my ribbon", "My subscriptions": "Subscriptions", "Name": "Name", "New literary work": "New literary work", @@ -414,8 +414,8 @@ "Song title": "Song title", "Soon": "Скоро", "Sorry, this address is already taken, please choose another one.": "Sorry, this address is already taken, please choose another one", - "Special projects": "Special projects", "Special Projects": "Special Projects", + "Special projects": "Special projects", "Specify the source and the name of the author": "Specify the source and the name of the author", "Specify your e-mail and we will reply.": "Specify your e-mail and we will reply.", "Start conversation": "Start a conversation", @@ -429,13 +429,13 @@ "subscriber": "subscriber", "subscriber_rp": "subscriber", "subscribers": "subscribers", - "Subscribing...": "Subscribing...", "subscribing...": "subscribing...", - "subscription": "subscription", + "Subscribing...": "Subscribing...", "Subscription": "Subscription", + "subscription": "subscription", "subscription_rp": "subscription", - "subscriptions": "subscriptions", "Subscriptions": "Subscriptions", + "subscriptions": "subscriptions", "Substrate": "Substrate", "Success": "Success", "Successfully authorized": "Authorization successful", @@ -443,8 +443,8 @@ "Support Discours": "Support Discours", "Support the project": "Support the project", "Support us": "Support us", - "terms of use": "terms of use", "Terms of use": "Site rules", + "terms of use": "terms of use", "terms of use keywords": "Discours.io, site rules, terms of use", "Text checking": "Text checking", "Thank you": "Thank you", @@ -485,8 +485,8 @@ "Top viewed": "Most viewed", "Topic is supported by": "Topic is supported by", "topicKeywords": "{topic}, Discours.io, articles, journalism, research", - "topics": "topics", "Topics": "Topics", + "topics": "topics", "Topics which supported by author": "Topics which supported by author", "try": "попробуйте", "Try to find another way": "Try to find another way", @@ -505,8 +505,8 @@ "Userpic": "Userpic", "Users": "Users", "verified": "verified", - "video": "video", "Video": "Video", + "video": "video", "Video format not supported": "Video format not supported", "view": "view", "Views": "Views", diff --git a/public/locales/ru/translation.json b/public/locales/ru/translation.json index bf097e77..81b53f71 100644 --- a/public/locales/ru/translation.json +++ b/public/locales/ru/translation.json @@ -16,8 +16,8 @@ "Add image": "Добавить изображение", "Add images": "Добавить изображения", "Add intro": "Добавить вступление", - "Add link": "Добавить ссылку", "add link": "добавить ссылку", + "Add link": "Добавить ссылку", "Add rule": "Добавить разделитель", "Add signature": "Добавить подпись", "Add subtitle": "Добавить подзаголовок", @@ -33,8 +33,8 @@ "All authors": "Все авторы", "All posts": "Все публикации", "All posts rating": "Рейтинг всех постов", - "All topics": "Все темы", "all topics": "все темы", + "All topics": "Все темы", "Almost done! Check your email.": "Почти готово! Осталось подтвердить вашу почту.", "and some more authors": "{restUsersCount, plural, =0 {} one { и ещё 1 пользователя} few { и ещё {restUsersCount} пользователей} other { и ещё {restUsersCount} пользователей}}", "Anything else": "Что-либо ещё", @@ -47,10 +47,10 @@ "Artist...": "Исполнитель...", "Artworks": "Артворки", "Audio": "Аудио", - "Author": "Автор", "author": "автор", - "Authors": "Авторы", + "Author": "Автор", "authors": "авторы", + "Authors": "Авторы", "Autotypograph": "Автотипограф", "Back": "Назад", "Back to editor": "Вернуться в редактор", @@ -58,11 +58,11 @@ "back to menu": "назад в меню", "Be the first to rate": "Оцените первым", "Become an author": "Стать автором", - "Bold": "Жирный", "bold": "жирный", + "Bold": "Жирный", "Bookmarked": "Сохранено", - "Bookmarks": "Закладки", "bookmarks": "закладки", + "Bookmarks": "Закладки", "Bullet list": "Маркированный список", "By alphabet": "По алфавиту", "By authors": "По авторам", @@ -79,8 +79,8 @@ "Can make any changes, accept or reject suggestions, and share access with others": "Может вносить любые изменения, принимать и отклонять предложения, а также делиться доступом с другими", "Can offer edits and comments, but cannot edit the post or share access with others": "Может предлагать правки и комментарии, но не может изменять пост и делиться доступом с другими", "Can write and edit text directly, and accept or reject suggestions from others": "Может писать и редактировать текст напрямую, а также принимать или отклонять предложения других", - "Cancel": "Отмена", "cancel": "отменить", + "Cancel": "Отмена", "Cancel changes": "Отменить изменения", "Change password": "Сменить пароль", "Characters": "Знаков", @@ -92,8 +92,8 @@ "Co-author": "Соавтор", "Collaborate": "Помочь редактировать", "Collaborators": "Соавторы", - "Collections": "Коллекции", "collections": "коллекции", + "Collections": "Коллекции", "Come up with a subtitle for your story": "Придумайте подзаголовок вашей истории", "Come up with a title for your story": "Придумайте заголовок вашей истории", "Coming soon": "Уже скоро", @@ -156,8 +156,8 @@ "Dogma": "Догма", "dogma keywords": "Discours.io, догма, редакционные принципы, этический кодекс, журналистика, сообщество", "Draft successfully deleted": "Черновик успешно удален", - "Drafts": "Черновики", "drafts": "черновики", + "Drafts": "Черновики", "Drag the image to this area": "Перетащите изображение в эту область", "Each image must be no larger than 5 MB.": "Каждое изображение должно быть размером не больше 5 мб.", "earlier": "ранее", @@ -167,8 +167,8 @@ "Editor": "Редактор", "Email": "Почта", "email not confirmed": "email не подтвержден", - "Enter": "Войти", "enter": "войти", + "Enter": "Войти", "Enter a new password": "Введите новый пароль", "Enter footnote text": "Введите текст сноски", "Enter image description": "Введите описание изображения", @@ -183,8 +183,8 @@ "FAQ": "Советы и предложения", "Favorite": "Избранное", "Favorite topics": "Избранные темы", - "Feed": "Лента", "feed": "лента", + "Feed": "Лента", "Feed settings": "Настроить ленту", "Feedback": "Обратная связь", "Fill email": "Введите почту", @@ -206,13 +206,14 @@ "Go to main page": "Перейти на главную", "Group Chat": "Общий чат", "Groups": "Группы", + "guide": "База знаний", "Header": "Заголовок", - "Header 1": "Заголовок 1", "header 1": "заголовок 1", - "Header 2": "Заголовок 2", + "Header 1": "Заголовок 1", "header 2": "заголовок 2", - "Header 3": "Заголовок 3", + "Header 2": "Заголовок 2", "header 3": "заголовок 3", + "Header 3": "Заголовок 3", "Headers": "Заголовки", "Help": "Помощь", "Help to edit": "Помочь редактировать", @@ -259,8 +260,8 @@ "Invite to collab": "Пригласить к участию", "It does not look like url": "Это не похоже на ссылку", "It's OK. Just enter your email to receive a link to change your password": "Ничего страшного. Просто укажите свою почту, чтобы получить ссылку для смены пароля", - "Italic": "Курсив", "italic": "курсив", + "Italic": "Курсив", "Join": "Присоединиться", "Join our maillist": "Чтобы получать рассылку лучших публикаций, просто укажите свою почту", "Join the community": "Присоединиться к сообществу", @@ -270,7 +271,6 @@ "Just start typing...": "Просто начните печатать...", "Karma": "Карма", "keywords": "Discours.io, журнал Дискурс, Дискурс, культура, наука, искусство, общество, независимая журналистика, литература, музыка, кино, видео, фотографии", - "Knowledge base": "База знаний", "Language": "Язык", "Last rev.": "Посл. изм.", "Let's log in": "Давайте авторизуемся", @@ -279,8 +279,8 @@ "Link sent, check your email": "Ссылка отправлена, проверьте почту", "List of authors of the open editorial community": "Список авторов сообщества открытой редакции", "Lists": "Списки", - "Literature": "Литература", "literature": "литература", + "Literature": "Литература", "Load more": "Показать ещё", "Loading": "Загрузка", "Login and security": "Вход и безопасность", @@ -300,10 +300,10 @@ "Most read": "Читаемое", "Move down": "Переместить вниз", "Move up": "Переместить вверх", - "Music": "Музыка", "music": "музыка", - "My feed": "Моя лента", + "Music": "Музыка", "my feed": "моя лента", + "My feed": "Моя лента", "My subscriptions": "Подписки", "Name": "Имя", "New literary work": "Новое произведение", @@ -440,8 +440,8 @@ "Song title": "Название песни", "Soon": "Скоро", "Sorry, this address is already taken, please choose another one.": "Увы, этот адрес уже занят, выберите другой", - "Special Projects": "Спецпроекты", "Special projects": "Спецпроекты", + "Special Projects": "Спецпроекты", "Specify the source and the name of the author": "Укажите источник и имя автора", "Specify your e-mail and we will reply.": "Укажите ваш e-mail и мы обязательно ответим.", "squib": "Подверстка", @@ -457,8 +457,8 @@ "subscriber": "подписчик", "subscriber_rp": "подписчика", "subscribers": "подписчиков", - "subscribing...": "Подписка...", "Subscribing...": "Подписываем...", + "subscribing...": "Подписка...", "Subscription": "Подписка", "Subscriptions": "Подписки", "Substrate": "Подложка", @@ -468,8 +468,8 @@ "Support Discours": "Поддержите Дискурс", "Support the project": "Поддержать проект", "Support us": "Помочь журналу", - "Terms of use": "Правила сайта", "terms of use": "правилами пользования сайтом", + "Terms of use": "Правила сайта", "terms of use keywords": "Discours.io, правила сайта, terms of use", "Text checking": "Проверка текста", "Thank you": "Благодарности", @@ -510,8 +510,8 @@ "Top viewed": "Самое читаемое", "Topic is supported by": "Тему поддерживают", "topicKeywords": "{topic}, Discours.io, статьи, журналистика, исследования", - "Topics": "Темы", "topics": "темы", + "Topics": "Темы", "Topics which supported by author": "Автор поддерживает темы", "try": "попробуйте", "Try to find another way": "Попробуйте найти по-другому", @@ -530,8 +530,8 @@ "Userpic": "Аватар", "Users": "Пользователи", "verified": "уже подтверждён", - "Video": "Видео", "video": "видео", + "Video": "Видео", "Video format not supported": "Тип видео не поддерживается", "view": "просмотр", "Views": "Просмотры", diff --git a/src/components/Nav/Header/Header.tsx b/src/components/Nav/Header/Header.tsx index 7a686bdb..ef975e5e 100644 --- a/src/components/Nav/Header/Header.tsx +++ b/src/components/Nav/Header/Header.tsx @@ -1,6 +1,6 @@ +import { A, useLocation, useNavigate, useSearchParams } from '@solidjs/router' import { clsx } from 'clsx' import { For, Show, createEffect, createMemo, createSignal, onCleanup, onMount } from 'solid-js' - import { useUI } from '~/context/ui' import { useLocalize } from '../../../context/localize' import { useSession } from '../../../context/session' @@ -17,8 +17,6 @@ import { HeaderAuth } from '../HeaderAuth' import { Modal } from '../Modal' import { SearchModal } from '../SearchModal/SearchModal' import { Snackbar } from '../Snackbar' - -import { A, useLocation, useNavigate, useSearchParams } from '@solidjs/router' import styles from './Header.module.scss' type Props = { @@ -154,14 +152,9 @@ export const Header = (props: Props) => { const loc = useLocation() const handleToggleMenuByLink = (event: MouseEvent, route: string) => { event.preventDefault() - // console.debug('[Header] toggle menu link from', loc.pathname) - // console.debug('to', route) - if (!fixed()) return - if (loc.pathname.startsWith(route) || loc.pathname.startsWith(`/${route}`)) { - toggleFixed() - } navigate(route) } + return (
{
diff --git a/src/components/Nav/Header/Link.tsx b/src/components/Nav/Header/Link.tsx deleted file mode 100644 index 1dd2a12e..00000000 --- a/src/components/Nav/Header/Link.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { clsx } from 'clsx' - -import { ROUTES } from '../../../config/routes' -import { ConditionalWrapper } from '../../_shared/ConditionalWrapper' - -import { A, useMatch } from '@solidjs/router' -import { createMemo } from 'solid-js' -import styles from './Header.module.scss' - -type Props = { - onMouseOver: (event?: MouseEvent, time?: number) => void - onMouseOut: (event?: MouseEvent, time?: number) => void - routeName?: keyof typeof ROUTES - body: string - active?: boolean - onClick?: (event: MouseEvent) => void -} - -export const Link = (props: Props) => { - const matchRoute = useMatch(() => props.routeName || '') - const isSelected = createMemo(() => Boolean(matchRoute())) - return ( -
  • - {children}} - > - - {props.body} - - -
  • - ) -} diff --git a/src/components/Views/AllAuthors/AllAuthors.tsx b/src/components/Views/AllAuthors/AllAuthors.tsx index b8fa3e0a..60c5d404 100644 --- a/src/components/Views/AllAuthors/AllAuthors.tsx +++ b/src/components/Views/AllAuthors/AllAuthors.tsx @@ -22,12 +22,16 @@ type Props = { topWritingAuthors?: Author[] isLoaded: boolean } +export const AUTHORS_PER_PAGE = 20 +export const ABC = { + ru: 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ#', + en: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ#' +} export const AllAuthors = (props: Props) => { const { t, lang } = useLocalize() const [searchQuery, setSearchQuery] = createSignal('') - const ALPHABET = - lang() === 'ru' ? [...'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ@'] : [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ@'] + const alphabet = createMemo(() => ABC[lang()] || ABC['ru']) const [searchParams] = useSearchParams<{ by?: string }>() const { authorsSorted, addAuthors, setSortBy } = useAuthors() @@ -41,15 +45,12 @@ export const AllAuthors = (props: Props) => { }) const filteredAuthors = createMemo(() => { const query = searchQuery().toLowerCase() - return authorsSorted?.().filter((author: Author) => { - // Предполагаем, что у автора есть свойство name - return author?.name?.toLowerCase().includes(query) - }) + return authorsSorted?.().filter((a: Author) => a?.name?.toLowerCase().includes(query)) }) const byLetterFiltered = createMemo<{ [letter: string]: Author[] }>(() => { return filteredAuthors().reduce( - (acc, author) => authorLetterReduce(acc, author, lang()), + (acc, author: Author) => authorLetterReduce(acc, author, lang()), {} as { [letter: string]: Author[] } ) }) @@ -119,7 +120,7 @@ export const AllAuthors = (props: Props) => {
      - + {(letter, index) => (
    • @@ -142,7 +143,7 @@ export const AllAuthors = (props: Props) => { {(letter) => (
      -

      {letter}

      +

      {letter}

      diff --git a/src/components/Views/AllTopics/AllTopics.tsx b/src/components/Views/AllTopics/AllTopics.tsx index df91d57d..5b5de039 100644 --- a/src/components/Views/AllTopics/AllTopics.tsx +++ b/src/components/Views/AllTopics/AllTopics.tsx @@ -1,5 +1,5 @@ import { Meta } from '@solidjs/meta' -import { useSearchParams } from '@solidjs/router' +import { A, useSearchParams } from '@solidjs/router' import { clsx } from 'clsx' import { For, Show, createEffect, createMemo, createSignal, on, onMount } from 'solid-js' @@ -79,13 +79,13 @@ export const AllTopics = (props: Props) => {