maintopic-limit-hotfix

This commit is contained in:
Untone 2024-02-05 22:05:49 +03:00
parent 7c2f8370b5
commit d39872281e
8 changed files with 25 additions and 8 deletions

View File

@ -1,5 +1,5 @@
{
"*.{js,ts,cjs,mjs,d.mts,jsx,tsx,json,jsonc,scss,css}": [
"npm run check"
"npx @biomejs/biome check ./src && tsc"
]
}

2
package-lock.json generated
View File

@ -24,7 +24,7 @@
},
"devDependencies": {
"@babel/core": "7.23.3",
"@biomejs/biome": "1.5.3",
"@biomejs/biome": "^1.5.3",
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-operations": "4.0.1",

View File

@ -281,6 +281,7 @@
"Please enter password": "Please enter a password",
"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",
"Podcasts": "Podcasts",
"Poetry": "Poetry",
"Popular": "Popular",

View File

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

View File

@ -25,7 +25,11 @@ export const Draft = (props: Props) => {
const handlePublishLinkClick = (e) => {
e.preventDefault()
if (props.shout.main_topic) {
props.onPublish(props.shout)
} else {
showSnackbar({ body: t('Please, set the main topic first') })
}
}
const handleDeleteLinkClick = async (e) => {

View File

@ -14,6 +14,7 @@ import { Button } from '../../_shared/Button'
import { DarkModeToggle } from '../../_shared/DarkModeToggle'
import { Icon } from '../../_shared/Icon'
import { useSnackbar } from '../../../context/snackbar'
import styles from './Panel.module.scss'
const typograf = new Typograf({ locale: ['ru', 'en-US'] })
@ -46,9 +47,10 @@ export const Panel = (props: Props) => {
const handleSaveClick = () => {
saveShout(form)
}
const { showSnackbar } = useSnackbar()
const handlePublishClick = () => {
publishShout(form)
if (form.mainTopic) publishShout(form)
else showSnackbar({ body: t('Please, set the main topic first') })
}
const html = useEditorHTML(() => editorRef.current())

View File

@ -16,6 +16,7 @@ import { ShowOnlyOnClient } from '../_shared/ShowOnlyOnClient'
import { ProfilePopup } from './ProfilePopup'
import { useSnackbar } from '../../context/snackbar'
import styles from './Header/Header.module.scss'
type Props = {
@ -62,9 +63,10 @@ export const HeaderAuth = (props: Props) => {
const handleSaveButtonClick = () => {
saveShout(form)
}
const { showSnackbar } = useSnackbar()
const handlePublishButtonClick = () => {
publishShout(form)
if (form.mainTopic) publishShout(form)
else showSnackbar({ body: t('Please, set the main topic first') })
}
const [width, setWidth] = createSignal(0)

View File

@ -17,6 +17,7 @@ import { Button } from '../../_shared/Button'
import { Icon } from '../../_shared/Icon'
import { Image } from '../../_shared/Image'
import { useSnackbar } from '../../../context/snackbar'
import stylesBeside from '../../Feed/Beside.module.scss'
import styles from './PublishSettings.module.scss'
@ -53,6 +54,7 @@ export const PublishSettings = (props: Props) => {
const { t } = useLocalize()
const { author } = useSession()
const { sortedTopics } = useTopicsStore()
const { showSnackbar } = useSnackbar()
const [topics, setTopics] = createSignal<Topic[]>(sortedTopics())
const composeDescription = () => {
@ -124,7 +126,12 @@ export const PublishSettings = (props: Props) => {
handleBackClick()
}
const handlePublishSubmit = () => {
publishShout({ ...props.form, ...settingsForm })
const shoutData = { ...props.form, ...settingsForm }
if (!shoutData?.mainTopic) {
showSnackbar({ body: t('Please, set the main topic first') })
} else {
publishShout(shoutData)
}
}
const handleSaveDraft = () => {
saveShout({ ...props.form, ...settingsForm })