From 9bddccd1b381183c9dd65abaf8d33f3206532d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 15 Sep 2024 11:59:59 +0200 Subject: [PATCH] pl-fe: use consistent margins in compose form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../src/features/compose/components/compose-form.tsx | 7 ++++--- .../pl-fe/src/features/compose/components/upload-form.tsx | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/pl-fe/src/features/compose/components/compose-form.tsx b/packages/pl-fe/src/features/compose/components/compose-form.tsx index 8335f7a4db..8bc10ec684 100644 --- a/packages/pl-fe/src/features/compose/components/compose-form.tsx +++ b/packages/pl-fe/src/features/compose/components/compose-form.tsx @@ -183,11 +183,12 @@ const ComposeForm = ({ id, shouldCondense, autoFocus, clickab ), [features, id, anyMedia]); - const composeModifiers = !condensed && ( + const showModifiers = !condensed && (compose.media_attachments.size || compose.is_uploading || compose.poll?.options.size || compose.schedule); + + const composeModifiers = showModifiers && ( - ); @@ -228,7 +229,7 @@ const ComposeForm = ({ id, shouldCondense, autoFocus, clickab {!shouldCondense && !event && !group && } {!!selectButtons && ( - + {selectButtons} )} diff --git a/packages/pl-fe/src/features/compose/components/upload-form.tsx b/packages/pl-fe/src/features/compose/components/upload-form.tsx index 5cb19cacb6..d33ad510de 100644 --- a/packages/pl-fe/src/features/compose/components/upload-form.tsx +++ b/packages/pl-fe/src/features/compose/components/upload-form.tsx @@ -16,7 +16,9 @@ interface IUploadForm { const UploadForm: React.FC = ({ composeId, onSubmit }) => { const dispatch = useAppDispatch(); - const mediaIds = useCompose(composeId).media_attachments.map((item) => item.id); + const { is_uploading: isUploading, media_attachments: mediaAttachments } = useCompose(composeId); + + const mediaIds = mediaAttachments.map((item) => item.id); const dragItem = useRef(); const dragOverItem = useRef(); @@ -35,11 +37,13 @@ const UploadForm: React.FC = ({ composeId, onSubmit }) => { dragOverItem.current = null; }, [dragItem, dragOverItem]); + if (!isUploading && mediaIds.isEmpty()) return null; + return (
- + {mediaIds.map((id: string) => (