From 4aa58d81f59dc233a1da7b6d35ba4c1e422962c3 Mon Sep 17 00:00:00 2001 From: Dimitri Gritsajuk Date: Mon, 30 Dec 2024 17:36:06 +0100 Subject: [PATCH] [News] fix empty author --- src/components/Layout/Footer.jsx | 1 - src/components/News/NewsList.jsx | 2 +- src/components/News/ReadModal.jsx | 10 +++++++--- src/ui/Card/Title/Title.jsx | 16 +++++++++------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/components/Layout/Footer.jsx b/src/components/Layout/Footer.jsx index 218142930..1c8cf280b 100644 --- a/src/components/Layout/Footer.jsx +++ b/src/components/Layout/Footer.jsx @@ -2,7 +2,6 @@ import MentionsLegales from './MentionsLegales' import { styled } from '@mui/system' import { Button, Grid, Stack } from '@mui/material' import { APP_VERSION } from '~/shared/environments' -import Iconify from '~/mui/iconify' import { useSelector } from 'react-redux' import { getFeaturebaseToken } from '~/redux/user/selectors.js' diff --git a/src/components/News/NewsList.jsx b/src/components/News/NewsList.jsx index 236762ad4..af45fe58c 100644 --- a/src/components/News/NewsList.jsx +++ b/src/components/News/NewsList.jsx @@ -20,7 +20,7 @@ const NewsList = ({ data, toggleNewsStatus, toggleNewsPinned, handleEdit, handle
diff --git a/src/components/News/ReadModal.jsx b/src/components/News/ReadModal.jsx index 7d58d2b18..69630058c 100644 --- a/src/components/News/ReadModal.jsx +++ b/src/components/News/ReadModal.jsx @@ -128,9 +128,13 @@ const ReadModal = ({ open, news, handleEdit, onCloseResolve }) => { </Grid> <Title title={news?.title}>{news?.title} - - {`${news?.creator?.first_name} ${news?.creator?.last_name}`} - + {news?.creator && ( + <> + + {`${news?.creator?.first_name} ${news?.creator?.last_name}`} + + )} + {news?.createdAt && `Le ${formatDate(news.createdAt, 'dd/MM/yyyy')} à ${formatDate(news.createdAt, 'HH:mm')}`} diff --git a/src/ui/Card/Title/Title.jsx b/src/ui/Card/Title/Title.jsx index 77d9f6a2a..705f94164 100644 --- a/src/ui/Card/Title/Title.jsx +++ b/src/ui/Card/Title/Title.jsx @@ -11,12 +11,14 @@ export const Title = ({ subject, author, dateTime, lines = 1, ...props }) => ( {subject} - - - - {author} - - + {author && ( + + + + {author} + + + )} {dateTime && ( @@ -31,6 +33,6 @@ export const Title = ({ subject, author, dateTime, lines = 1, ...props }) => ( Title.propTypes = { subject: PropTypes.string.isRequired, lines: PropTypes.number, - author: PropTypes.string.isRequired, + author: PropTypes.string, dateTime: PropTypes.object, }