diff options
-rw-r--r-- | src/client/elm/Model/View/LoggedIn/Add.elm | 2 | ||||
-rw-r--r-- | src/client/elm/View/Header.elm | 12 | ||||
-rw-r--r-- | src/client/elm/View/SignIn.elm | 10 | ||||
-rw-r--r-- | src/server/Design/Header.hs | 4 | ||||
-rw-r--r-- | src/server/Design/Helper.hs | 23 | ||||
-rw-r--r-- | src/server/Design/Media.hs | 2 | ||||
-rw-r--r-- | src/server/Design/SignIn.hs | 9 | ||||
-rw-r--r-- | src/server/Model/Message/Key.hs | 6 | ||||
-rw-r--r-- | src/server/Model/Message/Translations.hs | 49 |
9 files changed, 48 insertions, 69 deletions
diff --git a/src/client/elm/Model/View/LoggedIn/Add.elm b/src/client/elm/Model/View/LoggedIn/Add.elm index 5598084..c25c640 100644 --- a/src/client/elm/Model/View/LoggedIn/Add.elm +++ b/src/client/elm/Model/View/LoggedIn/Add.elm @@ -38,6 +38,6 @@ validateCost : String -> Translations -> Result String Int validateCost cost translations = cost |> validateNonEmpty (getMessage "CostRequired" translations) - |> flip Result.andThen (validateNumber (getMessage "CostMustBeNonNullNumber" translations) ((/=) 0)) + |> flip Result.andThen (validateNumber (getMessage "CostRequired" translations) ((/=) 0)) type Frequency = Punctual | Monthly diff --git a/src/client/elm/View/Header.elm b/src/client/elm/View/Header.elm index 3a6241b..94bdb01 100644 --- a/src/client/elm/View/Header.elm +++ b/src/client/elm/View/Header.elm @@ -22,18 +22,12 @@ renderHeader model = [] [ text (getMessage "SharedCost" model.translations) ] , case model.view of - LoadingView -> - text "" - SignInView _ -> - button - [ class "icon" - , onClick operations.address Persona.SignIn - ] - [ renderIcon "sign-in" ] LoggedInView _ -> button [ class "icon" , onClick operations.address Persona.SignOut ] - [ renderIcon "sign-out" ] + [ renderIcon "power-off" ] + _ -> + text "" ] diff --git a/src/client/elm/View/SignIn.elm b/src/client/elm/View/SignIn.elm index 8fcac16..d35d655 100644 --- a/src/client/elm/View/SignIn.elm +++ b/src/client/elm/View/SignIn.elm @@ -14,17 +14,25 @@ import Update.SignIn exposing (..) import ServerCommunication as SC import ServerCommunication exposing (serverCommunications) +import Persona exposing (operations) + import Model exposing (Model) import Model.View.SignInView exposing (..) import Model.Translations exposing (getMessage) import View.Events exposing (onSubmitPrevDefault) +import View.Icon exposing (renderIcon) renderSignIn : Model -> SignInView -> Html renderSignIn model signInView = div [ class "signIn" ] - [ div + [ button + [ onClick operations.address Persona.SignIn ] + [ span [] [ text (getMessage "SignIn" model.translations) ] + , renderIcon "plug" + ] + , div [ class "result" ] [ signInResult model signInView ] ] diff --git a/src/server/Design/Header.hs b/src/server/Design/Header.hs index 9f83778..5ef3fb0 100644 --- a/src/server/Design/Header.hs +++ b/src/server/Design/Header.hs @@ -6,6 +6,8 @@ module Design.Header import Clay +import Data.Monoid ((<>)) + import Design.Color as C import Design.Constants @@ -36,4 +38,4 @@ headerDesign = backgroundColor C.red color C.white fontSize iconFontSize - hover & transform (scale 1.2 1.2) + hover & i ? transform (scale 1.2 1.2) diff --git a/src/server/Design/Helper.hs b/src/server/Design/Helper.hs index 6e2fde3..bd11766 100644 --- a/src/server/Design/Helper.hs +++ b/src/server/Design/Helper.hs @@ -3,14 +3,19 @@ module Design.Helper ( clearFix , defaultButton + , iconButton , defaultInput , centeredWithMargin , expandBlock , verticalCentering ) where +import Prelude hiding (span) + import Clay +import Data.Monoid ((<>)) + import Design.Constants import Design.Color as C import qualified Clay.Display as D @@ -23,15 +28,29 @@ clearFix = clear both defaultButton :: Color -> Color -> Size Abs -> Css -defaultButton backgroundCol textCol height = do +defaultButton backgroundCol textCol h = do backgroundColor backgroundCol color textCol borderRadius radius radius radius radius verticalAlign middle cursor pointer - lineHeight height + lineHeight h textAlign (alignSide sideCenter) +iconButton :: Color -> Color -> Size Abs -> Css +iconButton backgroundCol textCol h = do + defaultButton backgroundCol textCol h + i <> span ? do + height h + lineHeight h + span ? do + display inlineBlock + marginLeft (px 20) + i ? do + marginLeft (px 20) + marginRight (px 20) + hover & i ? transform (scale 1.2 1.2) + defaultInput :: Integer -> Css defaultInput inputHeight = do height (px inputHeight) diff --git a/src/server/Design/Media.hs b/src/server/Design/Media.hs index 925e2f9..df91505 100644 --- a/src/server/Design/Media.hs +++ b/src/server/Design/Media.hs @@ -11,7 +11,7 @@ limit :: Integer limit = 950 smallFeature :: [Feature] -smallFeature = [M.maxWidth (px (limit - 1))] +smallFeature = [M.maxWidth (px limit)] largeFeature :: [Feature] largeFeature = [M.minWidth (px limit)] diff --git a/src/server/Design/SignIn.hs b/src/server/Design/SignIn.hs index 7aff720..92e485b 100644 --- a/src/server/Design/SignIn.hs +++ b/src/server/Design/SignIn.hs @@ -8,15 +8,20 @@ import Clay import Design.Color as C import Design.Helper -import Design.Animation.Opacity signInDesign :: Css signInDesign = ".signIn" ? do + button ? do + display block + margin (em 5) auto (em 2) auto + iconButton C.blue C.white (em 2.5) + fontSize (em 1.5) + position relative + ".result" ? do - marginTop (px 40) textAlign (alignSide sideCenter) ".success" ? color C.greenSuccess ".error" ? color C.redError diff --git a/src/server/Model/Message/Key.hs b/src/server/Model/Message/Key.hs index 7f49ae7..1a1e944 100644 --- a/src/server/Model/Message/Key.hs +++ b/src/server/Model/Message/Key.hs @@ -8,15 +8,12 @@ data Key = NoReplyMail - -- Sign in + -- Sign | SharedCost | SignIn | InvalidEmail | Unauthorized - | SignInMailTitle - | SignInMail - | SignInEmailSent -- Dates @@ -40,7 +37,6 @@ data Key = | CategoryRequired | CostRequired - | CostMustBeNonNullNumber | IncomeRequired | IncomeMustBeNonNullNumber | IncomeMustBePositiveNumber diff --git a/src/server/Model/Message/Translations.hs b/src/server/Model/Message/Translations.hs index 29b21ea..05187aa 100644 --- a/src/server/Model/Message/Translations.hs +++ b/src/server/Model/Message/Translations.hs @@ -44,46 +44,6 @@ m l Unauthorized = English -> "You are not authorized to sign in." French -> "Tu n'es pas autorisé à te connecter." -m l SignInMailTitle = - case l of - English -> T.concat ["Sign in to ", m l SharedCost] - French -> T.concat ["Connexion à ", m l SharedCost] - -m l SignInMail = - T.intercalate - "\n" - ( case l of - English -> - [ "Hi {1}," - , "" - , T.concat - [ "Click to the following link in order to sign in to Shared Cost:" - , m l SharedCost - , ":" - ] - , "{2}" - , "" - , "See you soon!" - ] - French -> - [ "Salut {1}," - , "" - , T.concat - [ "Clique sur le lien suivant pour te connecter à " - , m l SharedCost - , ":" - ] - , "{2}" - , "" - , "À très vite !" - ] - ) - -m l SignInEmailSent = - case l of - English -> "We sent you an email with a connexion link." - French -> "Nous t'avons envoyé un courriel avec un lien pour te connecter." - -- Date m l January = @@ -165,13 +125,8 @@ m l CategoryRequired = m l CostRequired = case l of - English -> "Type a cost." - French -> "Entre un coût." - -m l CostMustBeNonNullNumber = - case l of - English -> "The cost must be a non-null integer." - French -> "Le coût doit être un entier non nul." + English -> "Type a positive cost." + French -> "Entre un coût positif." m l IncomeRequired = case l of |