From 4501aa3251c939c3daa7f28dc572d2b4bf8df6ea Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Wed, 10 May 2023 04:46:39 +0300 Subject: [PATCH] - show existed link in url popup - hide Panel after click on menu item - hide Cooperate button in Article - revert drafts list in DraftView --- src/components/Article/FullArticle.tsx | 3 +-- src/components/Editor/InlineForm/InlineForm.tsx | 1 + src/components/Editor/Panel/Panel.module.scss | 7 ++++++- src/components/Editor/Panel/Panel.tsx | 6 +++++- src/components/Views/DraftsView/DraftsView.tsx | 2 +- src/components/Views/Edit.tsx | 10 +++++++--- src/context/editor.tsx | 7 +++++++ 7 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx index bca37f77..60a76e5c 100644 --- a/src/components/Article/FullArticle.tsx +++ b/src/components/Article/FullArticle.tsx @@ -76,7 +76,6 @@ export const FullArticle = (props: ArticleProps) => { }) const canEdit = () => props.article.authors?.some((a) => a.slug === user()?.slug) - // eslint-disable-next-line unicorn/consistent-function-scoping const handleBookmarkButtonClick = (ev) => { // TODO: implement bookmark clicked @@ -254,7 +253,7 @@ export const FullArticle = (props: ArticleProps) => {
- + diff --git a/src/components/Editor/InlineForm/InlineForm.tsx b/src/components/Editor/InlineForm/InlineForm.tsx index 0305038e..ea6ac219 100644 --- a/src/components/Editor/InlineForm/InlineForm.tsx +++ b/src/components/Editor/InlineForm/InlineForm.tsx @@ -55,6 +55,7 @@ export const InlineForm = (props: Props) => { handleKeyPress(e)} onInput={(e) => handleFormInput(e.currentTarget.value)} diff --git a/src/components/Editor/Panel/Panel.module.scss b/src/components/Editor/Panel/Panel.module.scss index 4d58a49b..eb589799 100644 --- a/src/components/Editor/Panel/Panel.module.scss +++ b/src/components/Editor/Panel/Panel.module.scss @@ -16,7 +16,7 @@ .close { filter: invert(1); - margin: -1.6rem 0 0 -1.6rem; + margin: -1.6rem 0 0 -2.4rem; } .actionsHolder { @@ -56,6 +56,11 @@ } } + a { + text-decoration: none; + border-bottom: none; + } + .linkWithIcon { margin-left: -1.6rem; } diff --git a/src/components/Editor/Panel/Panel.tsx b/src/components/Editor/Panel/Panel.tsx index efb9221b..83e72514 100644 --- a/src/components/Editor/Panel/Panel.tsx +++ b/src/components/Editor/Panel/Panel.tsx @@ -84,6 +84,7 @@ export const Panel = (props: Props) => {

toggleEditorPanel()} href={getPagePath(router, 'edit', { shoutId: props.shoutId.toString() })} > @@ -103,7 +104,10 @@ export const Panel = (props: Props) => { {t('Invite co-authors')}

- + toggleEditorPanel()} + href={getPagePath(router, 'editSettings', { shoutId: props.shoutId.toString() })} + > {t('Publication settings')}

diff --git a/src/components/Views/DraftsView/DraftsView.tsx b/src/components/Views/DraftsView/DraftsView.tsx index ef9c2923..d98efe08 100644 --- a/src/components/Views/DraftsView/DraftsView.tsx +++ b/src/components/Views/DraftsView/DraftsView.tsx @@ -16,7 +16,7 @@ export const DraftsView = () => { const loadDrafts = async () => { const loadedDrafts = await apiClient.getDrafts() - setDrafts(loadedDrafts) + setDrafts(loadedDrafts.reverse()) } onMount(() => { diff --git a/src/components/Views/Edit.tsx b/src/components/Views/Edit.tsx index 5a4876d6..2ef4dac5 100644 --- a/src/components/Views/Edit.tsx +++ b/src/components/Views/Edit.tsx @@ -13,6 +13,7 @@ import styles from './Edit.module.scss' import { useSession } from '../../context/session' import { Modal } from '../Nav/Modal' import { hideModal, showModal } from '../../stores/ui' +import { imageProxy } from '../../utils/imageProxy' type EditViewProps = { shout: Shout @@ -28,7 +29,6 @@ const scrollTop = () => { export const EditView = (props: EditViewProps) => { const { t } = useLocalize() const { user } = useSession() - const [isScrolled, setIsScrolled] = createSignal(false) const [topics, setTopics] = createSignal(null) const [coverImage, setCoverImage] = createSignal(null) @@ -82,7 +82,7 @@ export const EditView = (props: EditViewProps) => { const handleUploadModalContentCloseSetCover = (imgUrl: string) => { hideModal() - setCoverImage(imgUrl) + setCoverImage(imageProxy(imgUrl)) setForm('coverImageUrl', imgUrl) } @@ -227,7 +227,11 @@ export const EditView = (props: EditViewProps) => {
- {form.title} + {form.title}
diff --git a/src/context/editor.tsx b/src/context/editor.tsx index dfae291f..221b912a 100644 --- a/src/context/editor.tsx +++ b/src/context/editor.tsx @@ -80,6 +80,10 @@ export const EditorProvider = (props: { children: JSX.Element }) => { } const saveShout = async () => { + if (isEditorPanelVisible()) { + toggleEditorPanel() + } + if (!validate()) { return } @@ -113,6 +117,9 @@ export const EditorProvider = (props: { children: JSX.Element }) => { } const publishShout = async () => { + if (isEditorPanelVisible()) { + toggleEditorPanel() + } if (!validate()) { return }