Skip to content

Commit

Permalink
Rendering fields only if they are filled in
Browse files Browse the repository at this point in the history
  • Loading branch information
mesemus committed Dec 11, 2024
1 parent 39b7316 commit abe9f28
Showing 1 changed file with 44 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,48 @@ export const SideRequestInfo = ({ request }) => {
const statusIcon = getRequestStatusIcon(request?.status_code);
return (
<List horizontal relaxed divided size="small">
<List.Item>
<List.Header as="h3">{i18next.t("Creator")}</List.Header>
<List.Content>
<Icon name="user circle outline" />
<span>
{_has(request, "links.created_by_html") ? (
<a
href={request.links.created_by_html}
target="_blank"
rel="noreferrer"
>
{request.created_by.label}
</a>
) : (
request.created_by?.label
)}
</span>
</List.Content>
</List.Item>
<List.Item>
<List.Header as="h3">{i18next.t("Receiver")}</List.Header>
<List.Content>
<Icon name="mail outline" />
<span>
{_has(request, "links.receiver_html") ? (
<a
href={request.links.receiver_html}
target="_blank"
rel="noreferrer"
>
{request?.receiver?.label}
</a>
) : (
request?.receiver?.label
)}
</span>
</List.Content>
</List.Item>
{request?.created_by &&
<List.Item>
<List.Header as="h3">{i18next.t("Creator")}</List.Header>
<List.Content>
<Icon name="user circle outline" />
<span>
{_has(request, "links.created_by_html") ? (
<a
href={request.links.created_by_html}
target="_blank"
rel="noreferrer"
>
{request.created_by.label}
</a>
) : (
request.created_by?.label
)}
</span>
</List.Content>
</List.Item>
}
{request?.receiver &&
<List.Item>
<List.Header as="h3">{i18next.t("Receiver")}</List.Header>
<List.Content>
<Icon name="mail outline" />
<span>
{_has(request, "links.receiver_html") ? (
<a
href={request.links.receiver_html}
target="_blank"
rel="noreferrer"
>
{request?.receiver?.label}
</a>
) : (
request?.receiver?.label
)}
</span>
</List.Content>
</List.Item>
}
<List.Item>
<List.Header as="h3">{i18next.t("Status")}</List.Header>
<List.Content>
Expand All @@ -68,8 +72,8 @@ export const SideRequestInfo = ({ request }) => {
<a href={request.links.topic_html} target="_blank" rel="noreferrer">
{request?.topic?.label
? _truncate(request?.topic?.label, {
length: 350,
})
length: 350,
})
: i18next.t("Request topic")}
</a>
</List.Content>
Expand Down

0 comments on commit abe9f28

Please sign in to comment.