From abe9f28e4e547d632acfa617a654d0689dca6308 Mon Sep 17 00:00:00 2001 From: Mirek Simek Date: Wed, 11 Dec 2024 21:44:14 +0100 Subject: [PATCH] Rendering fields only if they are filled in --- .../common/components/SideRequestInfo.jsx | 84 ++++++++++--------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/oarepo_requests/ui/theme/assets/semantic-ui/js/oarepo_requests_ui/common/components/SideRequestInfo.jsx b/oarepo_requests/ui/theme/assets/semantic-ui/js/oarepo_requests_ui/common/components/SideRequestInfo.jsx index 2b3350c..08db19e 100644 --- a/oarepo_requests/ui/theme/assets/semantic-ui/js/oarepo_requests_ui/common/components/SideRequestInfo.jsx +++ b/oarepo_requests/ui/theme/assets/semantic-ui/js/oarepo_requests_ui/common/components/SideRequestInfo.jsx @@ -10,44 +10,48 @@ export const SideRequestInfo = ({ request }) => { const statusIcon = getRequestStatusIcon(request?.status_code); return ( - - {i18next.t("Creator")} - - - - {_has(request, "links.created_by_html") ? ( - - {request.created_by.label} - - ) : ( - request.created_by?.label - )} - - - - - {i18next.t("Receiver")} - - - - {_has(request, "links.receiver_html") ? ( - - {request?.receiver?.label} - - ) : ( - request?.receiver?.label - )} - - - + {request?.created_by && + + {i18next.t("Creator")} + + + + {_has(request, "links.created_by_html") ? ( + + {request.created_by.label} + + ) : ( + request.created_by?.label + )} + + + + } + {request?.receiver && + + {i18next.t("Receiver")} + + + + {_has(request, "links.receiver_html") ? ( + + {request?.receiver?.label} + + ) : ( + request?.receiver?.label + )} + + + + } {i18next.t("Status")} @@ -68,8 +72,8 @@ export const SideRequestInfo = ({ request }) => { {request?.topic?.label ? _truncate(request?.topic?.label, { - length: 350, - }) + length: 350, + }) : i18next.t("Request topic")}