diff --git a/frontend/src/Dashboard.elm b/frontend/src/Dashboard.elm index 27c27c1..f905a74 100644 --- a/frontend/src/Dashboard.elm +++ b/frontend/src/Dashboard.elm @@ -2,7 +2,7 @@ module Dashboard exposing (Model, Msg, Task, init, update, view) import Browser exposing (Document) import Browser.Navigation as Nav -import Html exposing (Html, button, div, input, text, textarea) +import Html exposing (Html, button, div, input, li, text, textarea) import Html.Attributes exposing (placeholder, value) import Html.Events exposing (onClick, onInput) import Http @@ -152,11 +152,43 @@ viewBody model = Success tasks -> div [] - [ text ("Loaded " ++ String.fromInt (List.length tasks) ++ "tasks") + [ viewTaskList tasks , viewCreate model ] +viewTaskList : List Task -> Html Msg +viewTaskList tasks = + div + [] + (text + ("Loaded " + ++ String.fromInt (List.length tasks) + ++ "tasks" + ) + :: List.map viewTaskListItem tasks + ) + + +viewTaskListItem : Task -> Html Msg +viewTaskListItem task = + li [] + [ text + (task.title + ++ (case task.description of + Just "" -> + "" + + Just desc -> + ": " ++ desc + + _ -> + "" + ) + ) + ] + + viewCreate : Model -> Html Msg viewCreate model = if model.createTaskCollapsed then