Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(elm): Style recommended rooms #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 44 additions & 10 deletions aion/web/elm/src/General/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ notFoundView =
]


asGridContainer : List (Html msg) -> Html msg
asGridContainer data =
Grid.container [] data
Grid.containerFluid [] data


roomListView : Model -> Html Msg
roomListView model =
div []
[ h4 [ class "room-list-label" ] [ text "Recommended" ]
, displayRooms model.rooms Recommended
[ displaySpecialRooms model.rooms
, hr [ class "room-content-separator" ] []
, h4 [ class "room-list-label" ] [ text "All rooms" ]
, displayRooms model.rooms All
]

Expand All @@ -38,6 +37,27 @@ type FilterType
| All


displaySpecialRooms : WebData RoomsData -> Html Msg
displaySpecialRooms rooms =
let
fun =
\rooms ->
let
data =
rooms
|> .data
|> List.take 3
in
Grid.container []
[ Grid.row [] (List.map displaySpecialRoom data) ]
in
div [] [ displayWebData rooms fun ]


displaySpecialRoom room =
Grid.col [] [ div [ class "tile" ] [ displayRoomLabel room Recommended ] ]


displayRooms : WebData RoomsData -> FilterType -> Html Msg
displayRooms rooms filterType =
let
Expand Down Expand Up @@ -75,11 +95,11 @@ listRoomsSlice rooms =
listSingleRoom : Room -> Grid.Column Msg
listSingleRoom room =
Grid.col [ Col.lg2, Col.md4 ]
[ div [ class "tile" ] [ displayRoomLabel room ] ]
[ div [ class "tile" ] [ displayRoomLabel room All ] ]


displayRoomLabel : Room -> Html Msg
displayRoomLabel room =
displayRoomLabel : Room -> FilterType -> Html Msg
displayRoomLabel room roomType =
let
url =
"#rooms/" ++ (toString room.id)
Expand All @@ -97,8 +117,22 @@ displayRoomLabel room =

_ ->
toString (room.player_count) ++ " players"

extras =
let
label =
case roomType of
All ->
[]

Recommended ->
[ text "The most crowded right now" ]
in
p [ class "tile-room-description" ] label
in
a [ href url ]
[ p [ class "tile-room-name" ] [ text roomName ]
, p [ class "tile-player-count" ] [ text playerCount ]
]
([ p [ class "tile-room-name" ] [ text roomName ]
, p [ class "tile-player-count" ] [ text playerCount ]
]
++ [ extras ]
)
9 changes: 7 additions & 2 deletions aion/web/static/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ footer p {
margin-bottom: 0px;
border-radius: 3px;
background-color: #5cb85c;
max-height: 90px;
max-height: 150px;
}

.tile a {
Expand All @@ -148,9 +148,14 @@ footer p {
}

.tile-player-count {
padding-bottom: 30px;
/*padding-bottom: 30px;*/
font-size: 12px;
}
.tile-room-description {
padding-bottom: 10px;
font-style: italic;
text-align: justify;
}

.tile-player-count::before {
content: "\f007";
Expand Down