summaryrefslogtreecommitdiff
path: root/elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-07-11 10:40:24 +0200
committerYorhel <git@yorhel.nl>2020-07-11 10:40:26 +0200
commit851be76a04a8d4a3814b4ff58e1e856e6d32482b (patch)
tree78c57170b17d1774cb3d8c71675464459982ffb3 /elm
parent7b86e5c27ede6341f46e18e393c5448f98e1742e (diff)
VN::Edit: Add screenshot resolution warning if inconsistent for same release
This way we can throw a warning even when no resolution is known for the selected release.
Diffstat (limited to 'elm')
-rw-r--r--elm/VNEdit.elm14
1 files changed, 10 insertions, 4 deletions
diff --git a/elm/VNEdit.elm b/elm/VNEdit.elm
index daee7120..94020dfb 100644
--- a/elm/VNEdit.elm
+++ b/elm/VNEdit.elm
@@ -476,7 +476,8 @@ view model =
showrel r = "[" ++ (RDate.format (RDate.expand r.released)) ++ " " ++ (String.join "," r.lang) ++ "] " ++ r.title ++ " (r" ++ String.fromInt r.id ++ ")"
rellist = List.map (\r -> (Just r.id, showrel r)) model.releases
scr n (id, i, rel) = tr [] <|
- let imgdim = Maybe.map (\nfo -> (nfo.width, nfo.height)) i.img |> Maybe.withDefault (0,0)
+ let getdim img = Maybe.map (\nfo -> (nfo.width, nfo.height)) img |> Maybe.withDefault (0,0)
+ imgdim = getdim i.img
relnfo = List.filter (\r -> Just r.id == rel) model.releases |> List.head
reldim = relnfo |> Maybe.andThen (\r -> if r.reso_x == 0 then Nothing else Just (r.reso_x, r.reso_y))
dimstr (x,y) = String.fromInt x ++ "x" ++ String.fromInt y
@@ -491,12 +492,17 @@ view model =
, br [] []
, text <| Maybe.withDefault "" <| Maybe.map (\dim -> "Release resolution: " ++ dimstr dim) reldim
, span [] <|
- if reldim == Nothing then [ br [] [] ]
- else if reldim == Just imgdim then [ text " ✔", br [] [] ]
- else [ text " ❌"
+ if reldim == Just imgdim then [ text " ✔", br [] [] ]
+ else if reldim /= Nothing
+ then [ text " ❌"
, br [] []
, b [ class "standout" ] [ text "WARNING: Resolutions do not match, please take screenshots with the correct resolution and make sure to crop them correctly!" ]
]
+ else if i.img /= Nothing && rel /= Nothing && List.any (\(_,si,sr) -> sr == rel && si.img /= Nothing && imgdim /= getdim si.img) model.screenshots
+ then [ b [ class "standout" ] [ text "WARNING: Inconsistent image resolutions for the same release, please take screenshots with the correct resolution and make sure to crop them correctly!" ]
+ , br [] []
+ ]
+ else [ br [] [] ]
, br [] []
, inputSelect "" rel (ScrRel id) [style "width" "500px"] <| rellist ++
case (relnfo, rel) of