aboutsummaryrefslogtreecommitdiff
path: root/src/View/Page.elm
blob: 3aa29a2c2b107ab13012f80886a57cfd0ba2d106 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
module View.Page
  ( pageView
  ) where

import List

import Html (..)
import Html.Attributes (..)
import Html.Attributes as A
import Json.Encode (string)

import Model.Game (Game)
import Model.Round (roundOrder)

import View.Game (gameView)
import View.Time (timeView)

pageView : Game -> Html
pageView game =
  div
    []
    [ h1 [] [ text "cAtchVoid" ]
    , div
        [ id "game" ]
        [ fromElement <| gameView game ]
    , p
        []
        [ text "Catch the points of your color, avoid the other points." ]
    , p
        []
        [ text "Use the arrow keys to move and 'e' to change your color." ]
    , ( let orderedRounds =
              game.rounds
                |> List.sortWith roundOrder
                |> List.reverse
        in case orderedRounds of
             [] ->
               div [ class "bestScore" ] []
             bestRound :: _ ->
               p
                 [ class "bestScore isDefined" ]
                 [ text <| "Best score: " ++ (toString bestRound.score) ++ " hits within " ++ (timeView bestRound.duration) ]
      )
    , a
        [ href "https://github.com/guyonvarch/catchvoid" ]
        [ img
            [ A.style
                [ ("position", "absolute")
                , ("top", "0")
                , ("right", "0")
                , ("border", "0")
                ]
            , src "https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67"
            , alt "Fork me on GitHub"
            , property "data-canonical-src" (string "https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png")
            ]
            []
        ]
    ]