Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
zazedd committed May 21, 2023
1 parent 93e943b commit ea405fd
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 42 deletions.
73 changes: 37 additions & 36 deletions src/Dashboard.elm
Original file line number Diff line number Diff line change
Expand Up @@ -56,44 +56,45 @@ playlists =

dashboard : Model -> Html Msg
dashboard model =
div [] [
sidebar model
, div [ class "dashboard-content" ] (
case model.user of
Nothing -> [
div [ class "center-content" ] [ text "Please login first!" ] ]

Just _ -> [
p [ id "admintitle" ]
[ text "Dashboard" ]
, div
[ class "admin-content" ]
[ div
[ style "display" "flex"
, style "justify-content" "center"
, style "align-items"
"center"
, style
"width"
"100%"
, style "margin" "15px"
]
[ p [ style "margin" "0" ] [ text "These are your playlists" ]
div []
[ sidebar model
, div [ class "dashboard-content" ]
(case model.user of
Nothing ->
[ div [ class "center-content" ] [ text "Please login first!" ]
]
, table [ class "table" ]
[ thead [ style "margin-bottom" "100px" ]
[ tr []
[ -- th [ class "table-dark" ] [ text "Id" ]
th [ class "table-dark" ] [ text "Name" ]
, th [ class "table-dark" ] [ text "Url" ]

-- , th [ class "table-dark" ] [ text "User Id" ]
, th [ class "table-dark" ] [ text "Delete" ]
Just _ ->
[ p [ id "admintitle" ]
[ text "Dashboard" ]
, div
[ class "admin-content" ]
[ div
[ style "display" "flex"
, style "justify-content" "center"
, style "align-items"
"center"
, style
"width"
"100%"
, style "margin" "15px"
]
[ p [ style "margin" "0" ] [ text "These are your playlists" ]
]
, table [ class "table" ]
[ thead [ style "margin-bottom" "100px" ]
[ tr []
[ -- th [ class "table-dark" ] [ text "Id" ]
th [ class "table-dark" ] [ text "Name" ]
, th [ class "table-dark" ] [ text "Url" ]

-- , th [ class "table-dark" ] [ text "User Id" ]
, th [ class "table-dark" ] [ text "Delete" ]
]
]
, tbody [] (playlists model.playlistsStored)
]
]
, tbody [] (playlists model.playlistsStored)
]
]
])
]

)
]
6 changes: 3 additions & 3 deletions src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import Mood exposing (mood)
import Pdf exposing (genPdf)
import Platform.Cmd as Cmd
import PlaylistApi exposing (..)
import Random exposing (..)
import Register exposing (submitRegister)
import Types exposing (..)
import Url exposing (Protocol(..))
import Url.Parser exposing (s, top)
import Random exposing (..)


type alias Flags =
Expand Down Expand Up @@ -217,7 +217,7 @@ update msg model =
( model, Cmd.none )

ToggleDiv ->
( { model | divvis = { visible1 = not model.divvis.visible1, visible2 = not model.divvis.visible2 } }, Random.generate RandomInt (Random.int 1 30))
( { model | divvis = { visible1 = not model.divvis.visible1, visible2 = not model.divvis.visible2 } }, Random.generate RandomInt (Random.int 1 30) )

MoodUpdate m ->
( { model
Expand All @@ -234,7 +234,7 @@ update msg model =
)

RandomInt x ->
( { model | randomInt = x }, Cmd.none )
( { model | randomInt = x }, Cmd.none )

PlaylistSubmit ->
( model, playlistRequest model model.access_token model.mood model.genre )
Expand Down
4 changes: 2 additions & 2 deletions src/PlaylistApi.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module PlaylistApi exposing (..)
import Html exposing (..)
import Http
import Json.Decode as Json
import Types exposing (..)
import Random
import Types exposing (..)


moodSwitch : Int -> String
Expand Down Expand Up @@ -49,7 +49,7 @@ playlistRequest model access_token mood genre =

playlistDecoder : Model -> Json.Decoder Playlist
playlistDecoder model =
Json.at [ "playlists", "items", (model.randomInt |> String.fromInt) ]
Json.at [ "playlists", "items", model.randomInt |> String.fromInt ]
(Json.map5 Playlist
(Json.field "name" Json.string)
(Json.field "id" Json.string)
Expand Down
3 changes: 2 additions & 1 deletion src/Types.elm
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Bytes exposing (Bytes)
import Http
import Json.Decode
import Json.Encode
import Url
import Random
import Url


type Route
Expand Down Expand Up @@ -221,6 +221,7 @@ type alias Model =
, playlistsStored : List PlaylistStored
}


type SpotifyRequest
= PlayListSpotifyRequest
| TracksSpotifyRequest
Expand Down

0 comments on commit ea405fd

Please sign in to comment.