about summary refs log tree commit diff
path: root/frontend/Main.elm
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2017-12-20T19·14+0100
committerVincent Ambo <tazjin@gmail.com>2017-12-20T19·15+0100
commitac623e4a7d61b91ac1bb2763f020ab909a547bd1 (patch)
treecb674b7301afb8df8ed35b7f691423a69514a303 /frontend/Main.elm
parent304f3ae3f15f3c72b01d1069b4c665ae690e3ce5 (diff)
feat(elm): Add nice little texts to display time remaining
Diffstat (limited to 'frontend/Main.elm')
-rw-r--r--frontend/Main.elm21
1 files changed, 16 insertions, 5 deletions
diff --git a/frontend/Main.elm b/frontend/Main.elm
index 905dc2256320..8c5a8e1a5e0e 100644
--- a/frontend/Main.elm
+++ b/frontend/Main.elm
@@ -126,12 +126,22 @@ taskColor task =
         Color.Yellow
 
 
+within : Task -> String
 within task =
-    String.concat
-        [ "This task should be completed within "
-        , toString task.remaining
-        , " days."
-        ]
+    if task.remaining < 0 then
+        "This task is overdue!"
+    else if task.remaining > 2 then
+        String.concat
+            [ "Relax, this task has "
+            , toString task.remaining
+            , " days left before it is due."
+            ]
+    else
+        String.concat
+            [ "This task should be completed within "
+            , toString task.remaining
+            , " days. Consider doing it now!"
+            ]
 
 
 renderTask : Task -> Html Msg
@@ -141,6 +151,7 @@ renderTask task =
         [ Card.title [] [ Card.head [ white ] [ text task.name ] ]
         , Card.text [ white ]
             [ text (Maybe.withDefault "" task.description)
+            , Html.br [] []
             , text (within task)
             ]
         , Card.actions