fix(WP-0017/E5): Layer 3 error fixes — round 3 (24 files)

Int16→Int in score/stars functions; uuid-based readMay→UUID.fromText;
autoRefresh do-notation fix; id→\x->x ambiguity in HubRoutingRules;
MarketplaceDashboard replaced raw SQL with IHP query builder; optional
hub selector in TypeRegistry views via CanSelect (Text, Maybe Id) instance
added to Web.View.Prelude; import consolidations to Web.View.Prelude.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-12 13:11:32 +00:00
parent 3737845e02
commit 2c22766cd6
24 changed files with 81 additions and 110 deletions

View File

@@ -69,24 +69,24 @@ renderRow decisions signals evaluations record = [hsx|
decisionTitle = maybe "(unknown)" (.title) $
find (\d -> d.id == record.decisionId) decisions
signalCount = length $ filter (\s -> s.deploymentId == record.id) signals
mScore :: Maybe Int16
mScore :: Maybe Int
mScore = fmap (.score) $ find (\e -> e.deploymentId == record.id) evaluations
renderMaybeScore :: Maybe Int16 -> Html
renderMaybeScore :: Maybe Int -> Html
renderMaybeScore Nothing = [hsx|<span class="text-gray-400"></span>|]
renderMaybeScore (Just score) = renderScoreBadge score
renderScoreBadge :: Int16 -> Html
renderScoreBadge :: Int -> Html
renderScoreBadge score = [hsx|
<span class={scoreClass score <> " text-xs px-2 py-0.5 rounded font-medium"}>
{starsFor score}
</span>
|]
starsFor :: Int16 -> Text
starsFor n = pack (replicate (fromIntegral n) '★') <> pack (replicate (5 - fromIntegral n) '☆')
starsFor :: Int -> Text
starsFor n = cs (replicate n '★') <> cs (replicate (5 - n) '☆')
scoreClass :: Int16 -> Text
scoreClass :: Int -> Text
scoreClass n
| n <= 2 = "bg-red-100 text-red-800"
| n == 3 = "bg-yellow-100 text-yellow-800"

View File

@@ -6,6 +6,7 @@ import IHP.Prelude
import IHP.ViewPrelude
import Web.Routes ()
import Data.Int (Int16)
import Data.Scientific (Scientific, toRealFloat)
data PeriodMetrics = PeriodMetrics
{ eventCount :: !Int
@@ -174,9 +175,9 @@ renderSignal sig = [hsx|
</div>
|]
renderSignalValue :: Double -> Html
renderSignalValue :: Scientific -> Html
renderSignalValue v = [hsx|
<span class="text-sm text-gray-700 font-mono">{show v}</span>
<span class="text-sm text-gray-700 font-mono">{show (toRealFloat v :: Double)}</span>
|]
renderNoEvaluationForm :: Id DeploymentRecord -> Html
@@ -321,14 +322,14 @@ outcomeClass "merged" = "bg-indigo-100 text-indigo-800"
outcomeClass "reframed" = "bg-orange-100 text-orange-800"
outcomeClass _ = "bg-gray-100 text-gray-600"
scoreClass :: Int16 -> Text
scoreClass :: Int -> Text
scoreClass n
| n <= 2 = "bg-red-100 text-red-800"
| n == 3 = "bg-yellow-100 text-yellow-800"
| otherwise = "bg-green-100 text-green-800"
starsFor :: Int16 -> Text
starsFor n = pack (replicate (fromIntegral n) '★') <> pack (replicate (5 - fromIntegral n) '☆')
starsFor :: Int -> Text
starsFor n = cs (replicate n '★') <> cs (replicate (5 - n) '☆')
userName :: [User] -> Maybe (Id User) -> Text
userName _ Nothing = ""