From ea13f7170c8dd21298e490df46c0df804290d6c9 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Wed, 29 Nov 2023 00:07:21 +0900 Subject: [PATCH] Fix media hidden buttons --- .../components/timelines/status/Media.tsx | 78 +++++++++---------- 1 file changed, 35 insertions(+), 43 deletions(-) diff --git a/renderer/components/timelines/status/Media.tsx b/renderer/components/timelines/status/Media.tsx index cc30865e..1cce325e 100644 --- a/renderer/components/timelines/status/Media.tsx +++ b/renderer/components/timelines/status/Media.tsx @@ -1,6 +1,6 @@ +import { Button } from 'flowbite-react' import { Entity } from 'megalodon' import { useState } from 'react' -import { Blurhash } from 'react-blurhash' import { FaEyeSlash } from 'react-icons/fa6' import { FormattedMessage } from 'react-intl' @@ -11,54 +11,46 @@ type Props = { export default function Media(props: Props) { const [sensitive, setSensitive] = useState(props.sensitive) - return ( -
- {sensitive ? ( - - ) : ( - - )} - -
- {props.media.map((media, key) => ( -
- -
- ))} + if (props.media.length > 0) { + return ( +
+ {sensitive ? ( + + ) : ( + <> + +
+ {props.media.map((media, key) => ( +
+ +
+ ))} +
+ + )}
-
- ) + ) + } else { + return null + } } type AttachmentProps = { attachment: Entity.Attachment - sensitive: boolean } function Attachment(props: AttachmentProps) { - if (props.sensitive) { - return ( - - ) - } else { - return ( - {props.attachment.description} - ) - } + return ( + {props.attachment.description} + ) }