Skip to content

Commit

Permalink
Enable "Save" button for compatible versions. Fixes #122
Browse files Browse the repository at this point in the history
  • Loading branch information
pdamoc authored and tbash committed Apr 12, 2020
1 parent 045212b commit 31b5bc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion assets/src/Elm/Version.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Elm.Version exposing (Version, compare, decoder, encoder, eq, fromString, toString)
module Elm.Version exposing (Version, compare, compatible, decoder, encoder, eq, fromString, toString)

import Json.Decode as Decode exposing (Decoder)
import Json.Encode as Encode exposing (Value)
Expand All @@ -25,6 +25,11 @@ fromString str =
Err "Expecting a version like MAJOR.MINOR.PATCH"


compatible : Version -> Version -> Bool
compatible left right =
( left.major, left.minor ) == ( left.major, left.minor )


eq : Version -> Version -> Bool
eq left right =
case compare left right of
Expand Down
4 changes: 2 additions & 2 deletions assets/src/Pages/Editor/Views/Workbench.elm
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ viewErrorsHeader pane config =
_ ->
Button.none
}
, if Version.eq config.compilerVersion Compiler.version then
, if Version.compatible config.compilerVersion Compiler.version then
Just
{ label =
if config.saving then
Expand Down Expand Up @@ -236,7 +236,7 @@ viewFinishedHeader pane canDebug config =
_ ->
Button.none
}
, if Version.eq config.compilerVersion Compiler.version then
, if Version.compatible config.compilerVersion Compiler.version then
Just
{ icon = Just Icon.Upload
, label = "Save"
Expand Down

0 comments on commit 31b5bc7

Please sign in to comment.