2017-05-02 02:27:01 -04:00
|
|
|
module View.App exposing (view)
|
|
|
|
|
|
|
|
import Html exposing (..)
|
|
|
|
import Html.Attributes exposing (..)
|
2017-05-13 09:55:46 -04:00
|
|
|
import Html.Lazy as Lazy
|
2017-05-02 02:27:01 -04:00
|
|
|
import Mastodon.Model exposing (..)
|
|
|
|
import Types exposing (..)
|
|
|
|
import View.Account exposing (accountFollowView, accountTimelineView)
|
2017-05-09 12:43:12 -04:00
|
|
|
import View.AccountSelector exposing (accountSelectorView)
|
2017-05-02 02:27:01 -04:00
|
|
|
import View.Auth exposing (authView)
|
|
|
|
import View.Common as Common
|
|
|
|
import View.Draft exposing (draftView)
|
|
|
|
import View.Error exposing (errorsListView)
|
|
|
|
import View.Notification exposing (notificationListView)
|
|
|
|
import View.Thread exposing (threadView)
|
2017-05-13 09:55:46 -04:00
|
|
|
import View.Timeline exposing (contextualTimelineView, homeTimelineView)
|
2017-05-02 02:27:01 -04:00
|
|
|
import View.Viewer exposing (viewerView)
|
|
|
|
|
|
|
|
|
|
|
|
type alias CurrentUser =
|
|
|
|
Account
|
|
|
|
|
|
|
|
|
|
|
|
type alias CurrentUserRelation =
|
|
|
|
Maybe Relationship
|
|
|
|
|
|
|
|
|
|
|
|
sidebarView : Model -> Html Msg
|
|
|
|
sidebarView model =
|
|
|
|
div [ class "col-md-3 column" ]
|
|
|
|
[ Lazy.lazy draftView model
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
homepageView : Model -> Html Msg
|
|
|
|
homepageView model =
|
|
|
|
case model.currentUser of
|
|
|
|
Nothing ->
|
|
|
|
text ""
|
|
|
|
|
|
|
|
Just currentUser ->
|
|
|
|
div [ class "row" ]
|
|
|
|
[ Lazy.lazy sidebarView model
|
2017-05-06 05:15:52 -04:00
|
|
|
, homeTimelineView currentUser model.homeTimeline
|
2017-05-02 02:27:01 -04:00
|
|
|
, Lazy.lazy3
|
|
|
|
notificationListView
|
|
|
|
currentUser
|
|
|
|
model.notificationFilter
|
|
|
|
model.notifications
|
|
|
|
, case model.currentView of
|
|
|
|
AccountView account ->
|
|
|
|
accountTimelineView
|
|
|
|
currentUser
|
|
|
|
model.accountTimeline
|
|
|
|
model.accountRelationship
|
|
|
|
account
|
|
|
|
|
2017-05-09 12:43:12 -04:00
|
|
|
AccountSelectorView ->
|
|
|
|
accountSelectorView model
|
|
|
|
|
2017-05-02 02:27:01 -04:00
|
|
|
AccountFollowersView account followers ->
|
|
|
|
accountFollowView
|
|
|
|
currentUser
|
|
|
|
model.accountFollowers
|
|
|
|
model.accountRelationships
|
|
|
|
model.accountRelationship
|
|
|
|
account
|
|
|
|
|
|
|
|
AccountFollowingView account following ->
|
|
|
|
accountFollowView
|
|
|
|
currentUser
|
|
|
|
model.accountFollowing
|
|
|
|
model.accountRelationships
|
|
|
|
model.accountRelationship
|
|
|
|
account
|
|
|
|
|
|
|
|
ThreadView thread ->
|
|
|
|
threadView currentUser thread
|
2017-05-13 09:55:46 -04:00
|
|
|
|
|
|
|
LocalTimelineView ->
|
|
|
|
contextualTimelineView
|
|
|
|
LocalTimelineView
|
|
|
|
"Local timeline"
|
|
|
|
"th-large"
|
|
|
|
currentUser
|
|
|
|
model.localTimeline
|
|
|
|
|
|
|
|
GlobalTimelineView ->
|
|
|
|
contextualTimelineView
|
|
|
|
GlobalTimelineView
|
|
|
|
"Global timeline"
|
|
|
|
"globe"
|
|
|
|
currentUser
|
|
|
|
model.globalTimeline
|
|
|
|
|
|
|
|
FavoriteTimelineView ->
|
|
|
|
contextualTimelineView
|
|
|
|
FavoriteTimelineView
|
|
|
|
"Favorites"
|
|
|
|
"star"
|
|
|
|
currentUser
|
|
|
|
model.favoriteTimeline
|
2017-05-02 02:27:01 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
view : Model -> Html Msg
|
|
|
|
view model =
|
|
|
|
div [ class "container-fluid" ]
|
|
|
|
[ errorsListView model
|
2017-05-09 12:43:12 -04:00
|
|
|
, case (List.head model.clients) of
|
2017-05-02 02:27:01 -04:00
|
|
|
Just client ->
|
|
|
|
homepageView model
|
|
|
|
|
|
|
|
Nothing ->
|
|
|
|
authView model
|
|
|
|
, case model.viewer of
|
|
|
|
Just viewer ->
|
|
|
|
viewerView viewer
|
|
|
|
|
|
|
|
Nothing ->
|
|
|
|
text ""
|
2017-05-12 16:41:11 -04:00
|
|
|
, case model.confirm of
|
|
|
|
Nothing ->
|
|
|
|
text ""
|
|
|
|
|
|
|
|
Just confirm ->
|
|
|
|
Common.confirmView confirm
|
2017-05-02 02:27:01 -04:00
|
|
|
]
|