1
0
Fork 0

Make whole status clickable

This makes it possible to open statuses without status text.
This commit is contained in:
Ryan Fox 2021-01-30 02:13:25 +00:00
parent a037cbe9ec
commit 21ccfe7e52
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
1 changed files with 36 additions and 35 deletions

View File

@ -150,41 +150,34 @@ statusActionsView status currentUser showApp =
]
statusContentView : String -> Status -> Bool -> Html Msg
statusContentView context status clickOpen =
let
statusTextEvents =
if clickOpen then
[ onClickWithStop <| OpenThread status ]
else
[]
in
case status.spoiler_text of
"" ->
div [ class "status-text" ]
[ div statusTextEvents <| formatContent status.content status.mentions
, attachmentListView context status
]
statusContentView : String -> Status -> Html Msg
statusContentView context status =
case status.spoiler_text of
"" ->
div [ class "status-text" ]
[ div [] <| formatContent status.content status.mentions
, attachmentListView context status
]
spoiler ->
-- Note: Spoilers are dealt with using pure CSS.
let
statusId =
"spoiler" ++ extractStatusId status.id ++ context
in
div [ class "status-text spoiled" ]
[ div
[ class "spoiler"
, onClickWithStop <| OpenThread status
]
[ text status.spoiler_text ]
, input [ type_ "checkbox", id statusId, class "spoiler-toggler" ] []
, label [ for statusId ] [ text "Reveal content" ]
, div [ class "spoiled-content" ]
[ div [] <| formatContent status.content status.mentions
, attachmentListView context status
]
spoiler ->
-- Note: Spoilers are dealt with using pure CSS.
let
statusId =
"spoiler" ++ extractStatusId status.id ++ context
in
div [ class "status-text spoiled" ]
[ div
[ class "spoiler"
, onClickWithStop <| OpenThread status
]
[ text status.spoiler_text ]
, input [ type_ "checkbox", id statusId, class "spoiler-toggler" ] []
, label [ for statusId ] [ text "Reveal content" ]
, div [ class "spoiled-content" ]
[ div [] <| formatContent status.content status.mentions
, attachmentListView context status
]
]
statusEntryView : String -> String -> CurrentUser -> Status -> Html Msg
@ -214,6 +207,14 @@ statusEntryView context className currentUser status =
statusView : String -> Status -> Bool -> Html Msg
statusView context ({ account, content, media_attachments, reblog, mentions, pinned } as status) clickOpen =
let
statusAttribs =
if clickOpen then
[ class "status"
, onClickWithStop <| OpenThread status
]
else
[ class "status" ]
accountLinkAttributes =
[ href <| "#account/" ++ account.id ]
@ -242,7 +243,7 @@ statusView context ({ account, content, media_attachments, reblog, mentions, pin
]
Nothing ->
div [ class "status" ]
div statusAttribs
[ pin
, Common.accountAvatarLink False account
, div [ class "username" ]
@ -251,5 +252,5 @@ statusView context ({ account, content, media_attachments, reblog, mentions, pin
, span [ class "acct" ] [ text <| " @" ++ account.acct ]
]
]
, Lazy.lazy3 statusContentView context status clickOpen
, Lazy.lazy2 statusContentView context status
]