fix title error-message in editor

This commit is contained in:
ilya-bkv 2024-02-13 16:09:44 +03:00
parent 88ecd906f9
commit a445e360c9
8 changed files with 33 additions and 31 deletions

View File

@ -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 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", "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", "Themes and plots": "Themes and plots",
"Please, set the article title": "Please, set the article title",
"Theory": "Theory", "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 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?", "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?",

View File

@ -296,6 +296,7 @@
"Please enter password again": "Пожалуйста, введите пароль ещё рез", "Please enter password again": "Пожалуйста, введите пароль ещё рез",
"Please, confirm email": "Пожалуйста, подтвердите электронную почту", "Please, confirm email": "Пожалуйста, подтвердите электронную почту",
"Please, set the main topic first": "Пожалуйста, сначала выберите главную тему", "Please, set the main topic first": "Пожалуйста, сначала выберите главную тему",
"Please, set the article title": "Пожалуйста, задайте заголовок статьи",
"Podcasts": "Подкасты", "Podcasts": "Подкасты",
"Poetry": "Поэзия", "Poetry": "Поэзия",
"Popular": "Популярное", "Popular": "Популярное",

View File

@ -8,6 +8,7 @@
flex-direction: row; flex-direction: row;
margin-bottom: .8rem; margin-bottom: .8rem;
} }
.basicInfo { .basicInfo {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;

View File

@ -189,10 +189,8 @@
flex-flow: column; flex-flow: column;
.validationError { .validationError {
position: absolute;
z-index: 1;
top: calc(100% + 4px);
font-size: small; font-size: small;
margin-top: -1rem;
color: var(--danger-color); color: var(--danger-color);
} }
} }

View File

@ -3,33 +3,33 @@ import deepEqual from 'fast-deep-equal'
import { Accessor, Show, createMemo, createSignal, lazy, onCleanup, onMount } from 'solid-js' import { Accessor, Show, createMemo, createSignal, lazy, onCleanup, onMount } from 'solid-js'
import { createStore } from 'solid-js/store' import { createStore } from 'solid-js/store'
import { ShoutForm, useEditorContext } from '../../context/editor' import { ShoutForm, useEditorContext } from '../../../context/editor'
import { useLocalize } from '../../context/localize' import { useLocalize } from '../../../context/localize'
import type { Shout, Topic } from '../../graphql/schema/core.gen' import type { Shout, Topic } from '../../../graphql/schema/core.gen'
import { LayoutType, MediaItem } from '../../pages/types' import { LayoutType, MediaItem } from '../../../pages/types'
import { useRouter } from '../../stores/router' import { useRouter } from '../../../stores/router'
import { clone } from '../../utils/clone' import { clone } from '../../../utils/clone'
import { getImageUrl } from '../../utils/getImageUrl' import { getImageUrl } from '../../../utils/getImageUrl'
import { isDesktop } from '../../utils/media-query' import { isDesktop } from '../../../utils/media-query'
import { slugify } from '../../utils/slugify' import { slugify } from '../../../utils/slugify'
import { Editor, Panel } from '../Editor' import { Editor, Panel } from '../../Editor'
import { AudioUploader } from '../Editor/AudioUploader' import { AudioUploader } from '../../Editor/AudioUploader'
import { AutoSaveNotice } from '../Editor/AutoSaveNotice' import { AutoSaveNotice } from '../../Editor/AutoSaveNotice'
import { VideoUploader } from '../Editor/VideoUploader' import { VideoUploader } from '../../Editor/VideoUploader'
import { Modal } from '../Nav/Modal' import { Modal } from '../../Nav/Modal'
import { TableOfContents } from '../TableOfContents' import { TableOfContents } from '../../TableOfContents'
import { DropArea } from '../_shared/DropArea' import { DropArea } from '../../_shared/DropArea'
import { Icon } from '../_shared/Icon' import { Icon } from '../../_shared/Icon'
import { InviteMembers } from '../_shared/InviteMembers' import { InviteMembers } from '../../_shared/InviteMembers'
import { Popover } from '../_shared/Popover' import { Popover } from '../../_shared/Popover'
import { EditorSwiper } from '../_shared/SolidSwiper' 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 SimplifiedEditor = lazy(() => import('../../Editor/SimplifiedEditor'))
const GrowingTextarea = lazy(() => import('../_shared/GrowingTextarea/GrowingTextarea')) const GrowingTextarea = lazy(() => import('../../_shared/GrowingTextarea/GrowingTextarea'))
type Props = { type Props = {
shout: Shout shout: Shout
@ -121,7 +121,7 @@ export const EditView = (props: Props) => {
onCleanup(() => window.removeEventListener('beforeunload', handleBeforeUnload)) onCleanup(() => window.removeEventListener('beforeunload', handleBeforeUnload))
}) })
const handleTitleInputChange = (value) => { const handleTitleInputChange = (value: string) => {
setForm('title', value) setForm('title', value)
setForm('slug', slugify(value)) setForm('slug', slugify(value))
if (value) { if (value) {

View File

@ -0,0 +1 @@
export { EditView } from './EditView'

View File

@ -95,7 +95,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
const countWords = (value) => setWordCounter(value) const countWords = (value) => setWordCounter(value)
const validate = () => { const validate = () => {
if (!form.title) { if (!form.title) {
setFormErrors('title', t('Required')) setFormErrors('title', t('Please, set the article title'))
return false return false
} }

View File

@ -10,7 +10,7 @@ import { useRouter } from '../stores/router'
import { LayoutType } from './types' import { LayoutType } from './types'
const Edit = lazy(() => import('../components/Views/Edit')) const EditView = lazy(() => import('../components/Views/EditView/EditView'))
export const EditPage = () => { export const EditPage = () => {
const { page } = useRouter() const { page } = useRouter()
@ -54,7 +54,7 @@ export const EditPage = () => {
<AuthGuard> <AuthGuard>
<Show when={shout()}> <Show when={shout()}>
<Suspense fallback={<Loading />}> <Suspense fallback={<Loading />}>
<Edit shout={shout()} /> <EditView shout={shout()} />
</Suspense> </Suspense>
</Show> </Show>
</AuthGuard> </AuthGuard>