2017-05-02 06:27:01 +00:00
|
|
|
module View.App exposing (view)
|
|
|
|
|
|
|
|
import Html exposing (..)
|
|
|
|
import Html.Attributes exposing (..)
|
2017-05-13 13:55:46 +00:00
|
|
|
import Html.Lazy as Lazy
|
2017-05-02 06:27:01 +00:00
|
|
|
import Mastodon.Model exposing (..)
|
|
|
|
import Types exposing (..)
|
2017-05-29 14:28:01 +00:00
|
|
|
import View.Account exposing (accountView)
|
2017-05-09 16:43:12 +00:00
|
|
|
import View.AccountSelector exposing (accountSelectorView)
|
2017-05-02 06:27:01 +00:00
|
|
|
import View.Auth exposing (authView)
|
2017-05-25 21:07:17 +00:00
|
|
|
import View.Blocks exposing (blocksView)
|
2017-05-02 06:27:01 +00:00
|
|
|
import View.Common as Common
|
|
|
|
import View.Draft exposing (draftView)
|
|
|
|
import View.Error exposing (errorsListView)
|
2017-05-30 22:27:30 +00:00
|
|
|
import View.Search exposing (searchView)
|
2017-05-25 21:07:17 +00:00
|
|
|
import View.Mutes exposing (mutesView)
|
2017-05-02 06:27:01 +00:00
|
|
|
import View.Notification exposing (notificationListView)
|
|
|
|
import View.Thread exposing (threadView)
|
2017-05-30 22:27:30 +00:00
|
|
|
import View.Timeline exposing (contextualTimelineView, homeTimelineView, hashtagTimelineView)
|
2017-05-02 06:27:01 +00: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 09:15:52 +00:00
|
|
|
, homeTimelineView currentUser model.homeTimeline
|
2017-05-02 06:27:01 +00:00
|
|
|
, Lazy.lazy3
|
|
|
|
notificationListView
|
|
|
|
currentUser
|
|
|
|
model.notificationFilter
|
|
|
|
model.notifications
|
|
|
|
, case model.currentView of
|
2017-05-29 14:28:01 +00:00
|
|
|
AccountView subView ->
|
|
|
|
accountView subView currentUser model.accountInfo
|
2017-05-02 06:27:01 +00:00
|
|
|
|
2017-05-09 16:43:12 +00:00
|
|
|
AccountSelectorView ->
|
|
|
|
accountSelectorView model
|
|
|
|
|
2017-05-25 21:07:17 +00:00
|
|
|
MutesView ->
|
|
|
|
mutesView model
|
|
|
|
|
|
|
|
BlocksView ->
|
|
|
|
blocksView model
|
|
|
|
|
2017-05-02 06:27:01 +00:00
|
|
|
ThreadView thread ->
|
|
|
|
threadView currentUser thread
|
2017-05-13 13:55:46 +00:00
|
|
|
|
|
|
|
LocalTimelineView ->
|
|
|
|
contextualTimelineView
|
2017-05-29 14:28:01 +00:00
|
|
|
model.location.hash
|
2017-05-13 13:55:46 +00:00
|
|
|
"Local timeline"
|
|
|
|
"th-large"
|
|
|
|
currentUser
|
|
|
|
model.localTimeline
|
|
|
|
|
|
|
|
GlobalTimelineView ->
|
|
|
|
contextualTimelineView
|
2017-05-29 14:28:01 +00:00
|
|
|
model.location.hash
|
2017-05-13 13:55:46 +00:00
|
|
|
"Global timeline"
|
|
|
|
"globe"
|
|
|
|
currentUser
|
|
|
|
model.globalTimeline
|
|
|
|
|
|
|
|
FavoriteTimelineView ->
|
|
|
|
contextualTimelineView
|
2017-05-29 14:28:01 +00:00
|
|
|
model.location.hash
|
2017-05-13 13:55:46 +00:00
|
|
|
"Favorites"
|
|
|
|
"star"
|
|
|
|
currentUser
|
|
|
|
model.favoriteTimeline
|
2017-05-27 07:32:15 +00:00
|
|
|
|
|
|
|
HashtagView hashtag ->
|
2017-05-30 22:27:30 +00:00
|
|
|
hashtagTimelineView hashtag currentUser model.hashtagTimeline
|
|
|
|
|
|
|
|
SearchView ->
|
|
|
|
searchView model
|
2017-05-02 06:27:01 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
view : Model -> Html Msg
|
|
|
|
view model =
|
|
|
|
div [ class "container-fluid" ]
|
|
|
|
[ errorsListView model
|
2017-05-09 16:43:12 +00:00
|
|
|
, case (List.head model.clients) of
|
2017-05-02 06:27:01 +00:00
|
|
|
Just client ->
|
|
|
|
homepageView model
|
|
|
|
|
|
|
|
Nothing ->
|
|
|
|
authView model
|
|
|
|
, case model.viewer of
|
|
|
|
Just viewer ->
|
|
|
|
viewerView viewer
|
|
|
|
|
|
|
|
Nothing ->
|
|
|
|
text ""
|
2017-05-12 20:41:11 +00:00
|
|
|
, case model.confirm of
|
|
|
|
Nothing ->
|
|
|
|
text ""
|
|
|
|
|
|
|
|
Just confirm ->
|
|
|
|
Common.confirmView confirm
|
2017-05-02 06:27:01 +00:00
|
|
|
]
|