From 12a4b0824de7ec9e3b1529470659e1a4633c9803 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 17 Feb 2018 14:36:17 -0600 Subject: [PATCH] minor refactors --- .../ClientApp/components/ListDetailsModal.tsx | 93 +++++-------------- .../Views/Shared/_Layout.cshtml | 2 +- 2 files changed, 26 insertions(+), 69 deletions(-) diff --git a/src/FilterLists.Web/ClientApp/components/ListDetailsModal.tsx b/src/FilterLists.Web/ClientApp/components/ListDetailsModal.tsx index 277095658..c85579404 100644 --- a/src/FilterLists.Web/ClientApp/components/ListDetailsModal.tsx +++ b/src/FilterLists.Web/ClientApp/components/ListDetailsModal.tsx @@ -66,31 +66,16 @@ function Name(props: any) { } function Description(props: any) { - if (props.description) { - if (props.url) { - return
{props.description}
; - } else { - return

{props.description}

; - } - } else { - return null; - } + return props.description ? (props.url ?
{props.description}
:

{ + props.description}

) : null; } function PublishedDate(props: any) { - if (props.date) { - return

Published: {props.date}

; - } else { - return null; - } + return props.date ?

Published: {props.date}

: null; } function DiscontinuedDate(props: any) { - if (props.date) { - return

Discontinued: {props.date}

; - } else { - return null; - } + return props.date ?

Discontinued: {props.date}

: null; } function SubscribeUrl(props: any) { @@ -108,73 +93,45 @@ function ViewUrl(props: any) { } function HomeUrl(props: any) { - if (props.url) { - return - Home - ; - } else { - return null; - } + return props.url ? + Home + : null; } function PolicyUrl(props: any) { - if (props.url) { - return - Policy - ; - } else { - return null; - } + return props.url ? + Policy + : null; } function DonateUrl(props: any) { - if (props.url) { - return - Donate - ; - } else { - return null; - } + return props.url ? + Donate + : null; } function IssuesUrl(props: any) { - if (props.url) { - return - GitHub Issues - ; - } else { - return null; - } + return props.url ? + GitHub Issues + : null; } function ForumUrl(props: any) { - if (props.url) { - return - Forum - ; - } else { - return null; - } + return props.url ? + Forum + : null; } function SubmissionUrl(props: any) { - if (props.url) { - return - Submit New Rule - ; - } else { - return null; - } + return props.url ? + Submit New Rule + : null; } function EmailAddress(props: any) { - if (props.email) { - return - Email - ; - } else { - return null; - } + return props.email ? + Email + : null; } interface IFilterListDetailsDto { diff --git a/src/FilterLists.Web/Views/Shared/_Layout.cshtml b/src/FilterLists.Web/Views/Shared/_Layout.cshtml index ab18eccfa..1639a55a6 100644 --- a/src/FilterLists.Web/Views/Shared/_Layout.cshtml +++ b/src/FilterLists.Web/Views/Shared/_Layout.cshtml @@ -5,7 +5,7 @@ FilterLists | @ViewData["Title"] - +