parent
e0d22ba0b6
commit
b0c6bc0240
60
src/View.elm
60
src/View.elm
@ -68,8 +68,8 @@ accountAvatarLink account =
|
|||||||
[ img [ class "avatar", src account.avatar ] [] ]
|
[ img [ class "avatar", src account.avatar ] [] ]
|
||||||
|
|
||||||
|
|
||||||
attachmentPreview : Maybe Bool -> List Mastodon.Attachment -> Mastodon.Attachment -> Html Msg
|
attachmentPreview : String -> Maybe Bool -> List Mastodon.Attachment -> Mastodon.Attachment -> Html Msg
|
||||||
attachmentPreview sensitive attachments ({ url, preview_url } as attachment) =
|
attachmentPreview context sensitive attachments ({ url, preview_url } as attachment) =
|
||||||
let
|
let
|
||||||
nsfw =
|
nsfw =
|
||||||
case sensitive of
|
case sensitive of
|
||||||
@ -80,7 +80,7 @@ attachmentPreview sensitive attachments ({ url, preview_url } as attachment) =
|
|||||||
False
|
False
|
||||||
|
|
||||||
attId =
|
attId =
|
||||||
"att" ++ (toString attachment.id)
|
"att" ++ (toString attachment.id) ++ context
|
||||||
|
|
||||||
media =
|
media =
|
||||||
a
|
a
|
||||||
@ -111,31 +111,31 @@ attachmentPreview sensitive attachments ({ url, preview_url } as attachment) =
|
|||||||
[ media ]
|
[ media ]
|
||||||
|
|
||||||
|
|
||||||
attachmentListView : Mastodon.Status -> Html Msg
|
attachmentListView : String -> Mastodon.Status -> Html Msg
|
||||||
attachmentListView { media_attachments, sensitive } =
|
attachmentListView context { media_attachments, sensitive } =
|
||||||
case media_attachments of
|
case media_attachments of
|
||||||
[] ->
|
[] ->
|
||||||
text ""
|
text ""
|
||||||
|
|
||||||
attachments ->
|
attachments ->
|
||||||
ul [ class "attachments" ] <|
|
ul [ class "attachments" ] <|
|
||||||
List.map (attachmentPreview sensitive attachments) attachments
|
List.map (attachmentPreview context sensitive attachments) attachments
|
||||||
|
|
||||||
|
|
||||||
statusContentView : Mastodon.Status -> Html Msg
|
statusContentView : String -> Mastodon.Status -> Html Msg
|
||||||
statusContentView status =
|
statusContentView context status =
|
||||||
case status.spoiler_text of
|
case status.spoiler_text of
|
||||||
"" ->
|
"" ->
|
||||||
div [ class "status-text" ]
|
div [ class "status-text" ]
|
||||||
[ div [] <| ViewHelper.formatContent status.content status.mentions
|
[ div [] <| ViewHelper.formatContent status.content status.mentions
|
||||||
, attachmentListView status
|
, attachmentListView context status
|
||||||
]
|
]
|
||||||
|
|
||||||
spoiler ->
|
spoiler ->
|
||||||
-- Note: Spoilers are dealt with using pure CSS.
|
-- Note: Spoilers are dealt with using pure CSS.
|
||||||
let
|
let
|
||||||
statusId =
|
statusId =
|
||||||
"spoiler" ++ (toString status.id)
|
"spoiler" ++ (toString status.id) ++ context
|
||||||
in
|
in
|
||||||
div [ class "status-text spoiled" ]
|
div [ class "status-text spoiled" ]
|
||||||
[ div [ class "spoiler" ] [ text status.spoiler_text ]
|
[ div [ class "spoiler" ] [ text status.spoiler_text ]
|
||||||
@ -143,13 +143,13 @@ statusContentView status =
|
|||||||
, label [ for statusId ] [ text "Reveal content" ]
|
, label [ for statusId ] [ text "Reveal content" ]
|
||||||
, div [ class "spoiled-content" ]
|
, div [ class "spoiled-content" ]
|
||||||
[ div [] <| ViewHelper.formatContent status.content status.mentions
|
[ div [] <| ViewHelper.formatContent status.content status.mentions
|
||||||
, attachmentListView status
|
, attachmentListView context status
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
statusView : Mastodon.Status -> Html Msg
|
statusView : String -> Mastodon.Status -> Html Msg
|
||||||
statusView ({ account, content, media_attachments, reblog, mentions } as status) =
|
statusView context ({ account, content, media_attachments, reblog, mentions } as status) =
|
||||||
let
|
let
|
||||||
accountLinkAttributes =
|
accountLinkAttributes =
|
||||||
[ href account.url
|
[ href account.url
|
||||||
@ -169,7 +169,7 @@ statusView ({ account, content, media_attachments, reblog, mentions } as status)
|
|||||||
[ text <| " @" ++ account.username ]
|
[ text <| " @" ++ account.username ]
|
||||||
, text " boosted"
|
, text " boosted"
|
||||||
]
|
]
|
||||||
, statusView reblog
|
, statusView context reblog
|
||||||
]
|
]
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
@ -181,7 +181,7 @@ statusView ({ account, content, media_attachments, reblog, mentions } as status)
|
|||||||
, span [ class "acct" ] [ text <| " @" ++ account.username ]
|
, span [ class "acct" ] [ text <| " @" ++ account.username ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, statusContentView status
|
, statusContentView context status
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ accountTimelineView account statuses label iconName =
|
|||||||
List.map
|
List.map
|
||||||
(\s ->
|
(\s ->
|
||||||
li [ class "list-group-item status" ]
|
li [ class "list-group-item status" ]
|
||||||
[ statusView s ]
|
[ statusView "account" s ]
|
||||||
)
|
)
|
||||||
statuses
|
statuses
|
||||||
]
|
]
|
||||||
@ -295,8 +295,8 @@ statusActionsView status =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
statusEntryView : Mastodon.Status -> Html Msg
|
statusEntryView : String -> Mastodon.Status -> Html Msg
|
||||||
statusEntryView status =
|
statusEntryView context status =
|
||||||
let
|
let
|
||||||
nsfwClass =
|
nsfwClass =
|
||||||
case status.sensitive of
|
case status.sensitive of
|
||||||
@ -307,13 +307,13 @@ statusEntryView status =
|
|||||||
""
|
""
|
||||||
in
|
in
|
||||||
li [ class <| "list-group-item " ++ nsfwClass ]
|
li [ class <| "list-group-item " ++ nsfwClass ]
|
||||||
[ statusView status
|
[ statusView context status
|
||||||
, statusActionsView status
|
, statusActionsView status
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
timelineView : List Mastodon.Status -> String -> String -> Html Msg
|
timelineView : String -> String -> String -> List Mastodon.Status -> Html Msg
|
||||||
timelineView statuses label iconName =
|
timelineView label iconName context statuses =
|
||||||
div [ class "col-md-3" ]
|
div [ class "col-md-3" ]
|
||||||
[ div [ class "panel panel-default" ]
|
[ div [ class "panel panel-default" ]
|
||||||
[ div [ class "panel-heading" ]
|
[ div [ class "panel-heading" ]
|
||||||
@ -321,7 +321,7 @@ timelineView statuses label iconName =
|
|||||||
, text label
|
, text label
|
||||||
]
|
]
|
||||||
, ul [ class "list-group" ] <|
|
, ul [ class "list-group" ] <|
|
||||||
List.map statusEntryView statuses
|
List.map (statusEntryView context) statuses
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -339,8 +339,8 @@ notificationHeading accounts str iconType =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
notificationStatusView : Mastodon.Status -> Mastodon.NotificationAggregate -> Html Msg
|
notificationStatusView : String -> Mastodon.Status -> Mastodon.NotificationAggregate -> Html Msg
|
||||||
notificationStatusView status { type_, accounts } =
|
notificationStatusView context status { type_, accounts } =
|
||||||
div [ class <| "notification " ++ type_ ]
|
div [ class <| "notification " ++ type_ ]
|
||||||
[ case type_ of
|
[ case type_ of
|
||||||
"reblog" ->
|
"reblog" ->
|
||||||
@ -351,7 +351,7 @@ notificationStatusView status { type_, accounts } =
|
|||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
text ""
|
text ""
|
||||||
, statusView status
|
, statusView context status
|
||||||
, statusActionsView status
|
, statusActionsView status
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ notificationEntryView notification =
|
|||||||
li [ class "list-group-item" ]
|
li [ class "list-group-item" ]
|
||||||
[ case notification.status of
|
[ case notification.status of
|
||||||
Just status ->
|
Just status ->
|
||||||
notificationStatusView status notification
|
notificationStatusView "notification" status notification
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
notificationFollowView notification
|
notificationFollowView notification
|
||||||
@ -414,7 +414,7 @@ draftReplyToView draft =
|
|||||||
, text ")"
|
, text ")"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, div [ class "well" ] [ statusView status ]
|
, div [ class "well" ] [ statusView "draft" status ]
|
||||||
]
|
]
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
@ -566,7 +566,7 @@ homepageView : Model -> Html Msg
|
|||||||
homepageView model =
|
homepageView model =
|
||||||
div [ class "row" ]
|
div [ class "row" ]
|
||||||
[ sidebarView model
|
[ sidebarView model
|
||||||
, timelineView model.userTimeline "Home timeline" "home"
|
, timelineView "Home timeline" "home" "home" model.userTimeline
|
||||||
, notificationListView model.notifications
|
, notificationListView model.notifications
|
||||||
, case model.account of
|
, case model.account of
|
||||||
Just account ->
|
Just account ->
|
||||||
@ -575,9 +575,9 @@ homepageView model =
|
|||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
if model.useGlobalTimeline then
|
if model.useGlobalTimeline then
|
||||||
timelineView model.publicTimeline "Global timeline" "globe"
|
timelineView "Global timeline" "globe" "global" model.publicTimeline
|
||||||
else
|
else
|
||||||
timelineView model.localTimeline "Local timeline" "th-large"
|
timelineView "Local timeline" "th-large" "local" model.localTimeline
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user