pl-fe: do not display empty content

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-09-14 17:57:50 +02:00
parent 6b6b9cc40a
commit f39c52ac83

View file

@ -204,7 +204,7 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
dangerouslySetInnerHTML={{ __html: spoilerText }} dangerouslySetInnerHTML={{ __html: spoilerText }}
ref={spoilerNode} ref={spoilerNode}
/> />
{expandable && ( {content && expandable && (
<Button <Button
className='ml-2 align-middle' className='ml-2 align-middle'
type='button' type='button'
@ -225,19 +225,21 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
if (expandable && !expanded) return <>{output}</>; if (expandable && !expanded) return <>{output}</>;
if (onClick) { if (onClick) {
output.push( if (content) {
<Markup output.push(
ref={node} <Markup
tabIndex={0} ref={node}
key='content' tabIndex={0}
className={className} key='content'
direction={direction} className={className}
lang={status.language || undefined} direction={direction}
size={textSize} lang={status.language || undefined}
> size={textSize}
{content} >
</Markup>, {content}
); </Markup>,
);
}
const hasPoll = !!status.poll_id; const hasPoll = !!status.poll_id;
@ -251,19 +253,21 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
return <Stack space={4} className={clsx({ 'bg-gray-100 dark:bg-primary-800 rounded-md p-4': hasPoll })}>{output}</Stack>; return <Stack space={4} className={clsx({ 'bg-gray-100 dark:bg-primary-800 rounded-md p-4': hasPoll })}>{output}</Stack>;
} else { } else {
output.push( if (content) {
<Markup output.push(
ref={node} <Markup
tabIndex={0} ref={node}
key='content' tabIndex={0}
className={className} key='content'
direction={direction} className={className}
lang={status.language || undefined} direction={direction}
size={textSize} lang={status.language || undefined}
> size={textSize}
{content} >
</Markup>, {content}
); </Markup>,
);
}
if (collapsed) { if (collapsed) {
output.push(<ReadMoreButton onClick={() => {}} key='read-more' quote={quote} />); output.push(<ReadMoreButton onClick={() => {}} key='read-more' quote={quote} />);