From 2d118d76648678490881c744b9fd9617829a5182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Wed, 27 Mar 2024 10:29:13 +0100 Subject: [PATCH] [NO-ISSUE] Don't replace the Homepagee link with th flora page --- src/web/FloraWeb/API/Routes/Packages/Types.hs | 2 +- src/web/FloraWeb/Pages/Templates/Packages.hs | 6 ++++-- src/web/FloraWeb/Pages/Templates/Screens/Packages.hs | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/web/FloraWeb/API/Routes/Packages/Types.hs b/src/web/FloraWeb/API/Routes/Packages/Types.hs index 7deef5c0..a9010f49 100644 --- a/src/web/FloraWeb/API/Routes/Packages/Types.hs +++ b/src/web/FloraWeb/API/Routes/Packages/Types.hs @@ -62,7 +62,7 @@ toPackageDTO package release releaseComponents = synopsis = release.synopsis description = release.description releaseDeprecated = - fromMaybe False (release.deprecated) + fromMaybe False release.deprecated repository = release.repository uploadedAt = fromJust release.uploadedAt flags = release.flags diff --git a/src/web/FloraWeb/Pages/Templates/Packages.hs b/src/web/FloraWeb/Pages/Templates/Packages.hs index 3184e523..eb305f29 100644 --- a/src/web/FloraWeb/Pages/Templates/Packages.hs +++ b/src/web/FloraWeb/Pages/Templates/Packages.hs @@ -249,11 +249,13 @@ displayCategories categories = ul_ [class_ "categories"] $ foldMap renderCategory categories displayLinks :: Namespace -> PackageName -> Text -> Release -> FloraHTML -displayLinks namespace packageName packageIndexURL release = +displayLinks namespace packageName packageIndexURL release = do li_ [class_ ""] $ do h3_ [class_ "package-body-section links"] "Links" ul_ [class_ "links"] $ do - li_ [class_ "package-link"] $ a_ [href_ (getHomepage release)] "Homepage" + when (release.homepage /= Just "") $ + li_ [class_ "package-link"] $ + a_ [href_ (getHomepage release)] "Homepage" li_ [class_ "package-link"] $ a_ [href_ (packageIndexURL <> "/package/" <> display packageName <> "-" <> display release.version)] "Documentation" li_ [class_ "package-link"] $ displaySourceRepos release.sourceRepos diff --git a/src/web/FloraWeb/Pages/Templates/Screens/Packages.hs b/src/web/FloraWeb/Pages/Templates/Screens/Packages.hs index cc1e85ad..e225b521 100644 --- a/src/web/FloraWeb/Pages/Templates/Screens/Packages.hs +++ b/src/web/FloraWeb/Pages/Templates/Screens/Packages.hs @@ -13,7 +13,7 @@ import Lucid.Orphans () import Flora.Model.Category.Types (Category (..)) import Flora.Model.Package.Types import Flora.Model.Release.Types (Release (..)) -import FloraWeb.Components.Icons +import FloraWeb.Components.Icons (chevronRightOutline) import FloraWeb.Pages.Templates.Packages ( displayCategories , displayDependencies @@ -27,7 +27,6 @@ import FloraWeb.Pages.Templates.Packages , displayPackageFlags , displayReadme , displayReleaseDeprecation - , displayReleaseVersion , displayTestedWith , displayVersions ) @@ -80,7 +79,7 @@ presentationHeader release namespace name synopsis = chevronRightOutline toHtml name let versionClass = "version" <> if Just True == release.deprecated then " release-deprecated" else "" - span_ [class_ versionClass] $ displayReleaseVersion release.version + span_ [class_ versionClass] $ toHtml release.version div_ [class_ "synopsis"] $ p_ [class_ ""] (toHtml synopsis)