diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 79653771..5c5afd0e 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -373,6 +373,7 @@ "Thematic table of contents of the magazine. Here you can find all the topics that community authors have written about.": "Thematic table of contents of the magazine. Here you can find all the topics that community authors have written about.", "Thematic table of contents of the magazine. Here you can find all the topics that the community authors wrote about": "Thematic table of contents of the magazine. Here you can find all the topics that the community authors wrote about", "Themes and plots": "Themes and plots", + "Please, set the article title": "Please, set the article title", "Theory": "Theory", "There are unsaved changes in your profile settings. Are you sure you want to leave the page without saving?": "There are unsaved changes in your profile settings. Are you sure you want to leave the page without saving?", "There are unsaved changes in your publishing settings. Are you sure you want to leave the page without saving?": "There are unsaved changes in your publishing settings. Are you sure you want to leave the page without saving?", diff --git a/public/locales/ru/translation.json b/public/locales/ru/translation.json index afb004de..f1f60482 100644 --- a/public/locales/ru/translation.json +++ b/public/locales/ru/translation.json @@ -296,6 +296,7 @@ "Please enter password again": "Пожалуйста, введите пароль ещё рез", "Please, confirm email": "Пожалуйста, подтвердите электронную почту", "Please, set the main topic first": "Пожалуйста, сначала выберите главную тему", + "Please, set the article title": "Пожалуйста, задайте заголовок статьи", "Podcasts": "Подкасты", "Poetry": "Поэзия", "Popular": "Популярное", diff --git a/src/components/Topic/TopicBadge/TopicBadge.module.scss b/src/components/Topic/TopicBadge/TopicBadge.module.scss index 3f9d8436..f219910a 100644 --- a/src/components/Topic/TopicBadge/TopicBadge.module.scss +++ b/src/components/Topic/TopicBadge/TopicBadge.module.scss @@ -8,6 +8,7 @@ flex-direction: row; margin-bottom: .8rem; } + .basicInfo { display: flex; flex-flow: row nowrap; diff --git a/src/components/Views/Edit.module.scss b/src/components/Views/EditView/EditView.module.scss similarity index 98% rename from src/components/Views/Edit.module.scss rename to src/components/Views/EditView/EditView.module.scss index 991c9fc7..15e26228 100644 --- a/src/components/Views/Edit.module.scss +++ b/src/components/Views/EditView/EditView.module.scss @@ -189,10 +189,8 @@ flex-flow: column; .validationError { - position: absolute; - z-index: 1; - top: calc(100% + 4px); font-size: small; + margin-top: -1rem; color: var(--danger-color); } } diff --git a/src/components/Views/Edit.tsx b/src/components/Views/EditView/EditView.tsx similarity index 90% rename from src/components/Views/Edit.tsx rename to src/components/Views/EditView/EditView.tsx index 2532da91..4e862696 100644 --- a/src/components/Views/Edit.tsx +++ b/src/components/Views/EditView/EditView.tsx @@ -3,33 +3,33 @@ import deepEqual from 'fast-deep-equal' import { Accessor, Show, createMemo, createSignal, lazy, onCleanup, onMount } from 'solid-js' import { createStore } from 'solid-js/store' -import { ShoutForm, useEditorContext } from '../../context/editor' -import { useLocalize } from '../../context/localize' -import type { Shout, Topic } from '../../graphql/schema/core.gen' -import { LayoutType, MediaItem } from '../../pages/types' -import { useRouter } from '../../stores/router' -import { clone } from '../../utils/clone' -import { getImageUrl } from '../../utils/getImageUrl' -import { isDesktop } from '../../utils/media-query' -import { slugify } from '../../utils/slugify' -import { Editor, Panel } from '../Editor' -import { AudioUploader } from '../Editor/AudioUploader' -import { AutoSaveNotice } from '../Editor/AutoSaveNotice' -import { VideoUploader } from '../Editor/VideoUploader' -import { Modal } from '../Nav/Modal' -import { TableOfContents } from '../TableOfContents' -import { DropArea } from '../_shared/DropArea' -import { Icon } from '../_shared/Icon' -import { InviteMembers } from '../_shared/InviteMembers' -import { Popover } from '../_shared/Popover' -import { EditorSwiper } from '../_shared/SolidSwiper' +import { ShoutForm, useEditorContext } from '../../../context/editor' +import { useLocalize } from '../../../context/localize' +import type { Shout, Topic } from '../../../graphql/schema/core.gen' +import { LayoutType, MediaItem } from '../../../pages/types' +import { useRouter } from '../../../stores/router' +import { clone } from '../../../utils/clone' +import { getImageUrl } from '../../../utils/getImageUrl' +import { isDesktop } from '../../../utils/media-query' +import { slugify } from '../../../utils/slugify' +import { Editor, Panel } from '../../Editor' +import { AudioUploader } from '../../Editor/AudioUploader' +import { AutoSaveNotice } from '../../Editor/AutoSaveNotice' +import { VideoUploader } from '../../Editor/VideoUploader' +import { Modal } from '../../Nav/Modal' +import { TableOfContents } from '../../TableOfContents' +import { DropArea } from '../../_shared/DropArea' +import { Icon } from '../../_shared/Icon' +import { InviteMembers } from '../../_shared/InviteMembers' +import { Popover } from '../../_shared/Popover' +import { EditorSwiper } from '../../_shared/SolidSwiper' -import { PublishSettings } from './PublishSettings' +import { PublishSettings } from '../PublishSettings' -import styles from './Edit.module.scss' +import styles from './EditView.module.scss' -const SimplifiedEditor = lazy(() => import('../Editor/SimplifiedEditor')) -const GrowingTextarea = lazy(() => import('../_shared/GrowingTextarea/GrowingTextarea')) +const SimplifiedEditor = lazy(() => import('../../Editor/SimplifiedEditor')) +const GrowingTextarea = lazy(() => import('../../_shared/GrowingTextarea/GrowingTextarea')) type Props = { shout: Shout @@ -121,7 +121,7 @@ export const EditView = (props: Props) => { onCleanup(() => window.removeEventListener('beforeunload', handleBeforeUnload)) }) - const handleTitleInputChange = (value) => { + const handleTitleInputChange = (value: string) => { setForm('title', value) setForm('slug', slugify(value)) if (value) { diff --git a/src/components/Views/EditView/index.ts b/src/components/Views/EditView/index.ts new file mode 100644 index 00000000..8bde254e --- /dev/null +++ b/src/components/Views/EditView/index.ts @@ -0,0 +1 @@ +export { EditView } from './EditView' diff --git a/src/context/editor.tsx b/src/context/editor.tsx index 80b90bac..5df99775 100644 --- a/src/context/editor.tsx +++ b/src/context/editor.tsx @@ -95,7 +95,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => { const countWords = (value) => setWordCounter(value) const validate = () => { if (!form.title) { - setFormErrors('title', t('Required')) + setFormErrors('title', t('Please, set the article title')) return false } diff --git a/src/pages/edit.page.tsx b/src/pages/edit.page.tsx index 688d2fe4..031eedf4 100644 --- a/src/pages/edit.page.tsx +++ b/src/pages/edit.page.tsx @@ -10,7 +10,7 @@ import { useRouter } from '../stores/router' import { LayoutType } from './types' -const Edit = lazy(() => import('../components/Views/Edit')) +const EditView = lazy(() => import('../components/Views/EditView/EditView')) export const EditPage = () => { const { page } = useRouter() @@ -54,7 +54,7 @@ export const EditPage = () => { }> - +