diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 1220b122..4449f6c9 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -13,7 +13,7 @@ jobs: run: npm ci - name: Check types - run: npm run typecheck + run: npm run check:types - name: Lint with Biome run: npm run check:code diff --git a/package.json b/package.json index 76af1218..86ed0acd 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "lint:styles:fix": "stylelint **/*.{scss,css} --fix", "preview": "vite preview", "start": "vite", - "typecheck": "tsc --noEmit", - "typecheck:watch": "tsc --noEmit --watch" + "check:types": "tsc --noEmit", + "check:types:watch": "tsc --noEmit --watch" }, "dependencies": { "form-data": "4.0.0", diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index a6780846..facbd6c4 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -449,6 +449,7 @@ "Write your colleagues name or email": "Write your colleague's name or email", "You can download multiple tracks at once in .mp3, .wav or .flac formats": "You can download multiple tracks at once in .mp3, .wav or .flac formats", "You can now login using your new password": "Теперь вы можете входить с помощью нового пароля", + "You can't edit this post": "You can't edit this post", "You were successfully authorized": "You were successfully authorized", "You ll be able to participate in discussions, rate others' comments and learn about new responses": "You ll be able to participate in discussions, rate others' comments and learn about new responses", "You've confirmed email": "You've confirmed email", diff --git a/public/locales/ru/translation.json b/public/locales/ru/translation.json index 05add753..74655079 100644 --- a/public/locales/ru/translation.json +++ b/public/locales/ru/translation.json @@ -472,6 +472,7 @@ "You can download multiple tracks at once in .mp3, .wav or .flac formats": "Можно загрузить сразу несколько треков в форматах .mp3, .wav или .flac", "You can now login using your new password": "Теперь вы можете входить с помощью нового пароля", "You was successfully authorized": "Вы были успешно авторизованы", + "You can't edit this post": "Вы не можете редактировать этот материал", "You ll be able to participate in discussions, rate others' comments and learn about new responses": "Вы сможете участвовать в обсуждениях, оценивать комментарии других и узнавать о новых ответах", "You've confirmed email": "Вы подтвердили почту", "You've reached a non-existed page": "Вы попали на несуществующую страницу", diff --git a/src/components/Article/CommentsTree.tsx b/src/components/Article/CommentsTree.tsx index 60054831..e8acc1fa 100644 --- a/src/components/Article/CommentsTree.tsx +++ b/src/components/Article/CommentsTree.tsx @@ -29,7 +29,7 @@ export const CommentsTree = (props: Props) => { const [newReactions, setNewReactions] = createSignal([]) const [clearEditor, setClearEditor] = createSignal(false) const [clickedReplyId, setClickedReplyId] = createSignal() - const { reactionEntities, createReaction } = useReactions() + const { reactionEntities, createReaction, loadReactionsBy } = useReactions() const comments = createMemo(() => Object.values(reactionEntities).filter((reaction) => reaction.kind === 'COMMENT'), @@ -68,7 +68,9 @@ export const CommentsTree = (props: Props) => { setCookie() } }) + const [posting, setPosting] = createSignal(false) const handleSubmitComment = async (value: string) => { + setPosting(true) try { await createReaction({ kind: ReactionKind.Comment, @@ -76,10 +78,12 @@ export const CommentsTree = (props: Props) => { shout: props.shoutId, }) setClearEditor(true) + await loadReactionsBy({ by: { shout: props.shoutSlug } }) } catch (error) { console.error('[handleCreate reaction]:', error) } setClearEditor(false) + setPosting(false) } return ( @@ -157,6 +161,7 @@ export const CommentsTree = (props: Props) => { placeholder={t('Write a comment...')} onSubmit={(value) => handleSubmitComment(value)} setClear={clearEditor()} + isPosting={posting()} /> diff --git a/src/components/Editor/Editor.tsx b/src/components/Editor/Editor.tsx index 950aa355..26b79f75 100644 --- a/src/components/Editor/Editor.tsx +++ b/src/components/Editor/Editor.tsx @@ -151,7 +151,7 @@ export const Editor = (props: Props) => { } showSnackbar({ body: t('Uploading image') }) - const result = await handleImageUpload(uplFile) + const result = await handleImageUpload(uplFile, session()?.access_token) editor() .chain() diff --git a/src/components/Editor/SimplifiedEditor.tsx b/src/components/Editor/SimplifiedEditor.tsx index 44401b1c..187fe25f 100644 --- a/src/components/Editor/SimplifiedEditor.tsx +++ b/src/components/Editor/SimplifiedEditor.tsx @@ -36,6 +36,7 @@ import { UploadModalContent } from './UploadModalContent' import { Figcaption } from './extensions/Figcaption' import { Figure } from './extensions/Figure' +import { Loading } from '../_shared/Loading' import styles from './SimplifiedEditor.module.scss' type Props = { @@ -58,6 +59,7 @@ type Props = { controlsAlwaysVisible?: boolean autoFocus?: boolean isCancelButtonVisible?: boolean + isPosting?: boolean } const DEFAULT_MAX_LENGTH = 400 @@ -365,12 +367,14 @@ const SimplifiedEditor = (props: Props) => {