Don't re-open statuses on click

This commit is contained in:
Ryan Fox 2021-01-15 20:13:24 +00:00
parent c74e09cfaf
commit a1a7b16842
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
3 changed files with 41 additions and 34 deletions

View File

@ -108,7 +108,7 @@ draftReplyToView draft =
, text ")"
]
]
, div [ class "well" ] [ Lazy.lazy2 statusView "draft" status ]
, div [ class "well" ] [ Lazy.lazy3 statusView "draft" status True ]
]
Nothing ->

View File

@ -99,7 +99,7 @@ notificationStatusView ( context, currentUser, status, { type_, accounts } ) =
_ ->
text ""
, Lazy.lazy2 statusView context status
, Lazy.lazy3 statusView context status True
, Lazy.lazy3 statusActionsView status currentUser False
]

View File

@ -150,35 +150,42 @@ statusActionsView status currentUser showApp =
]
statusContentView : String -> Status -> Html Msg
statusContentView context status =
case status.spoiler_text of
"" ->
div [ class "status-text" ]
[ div [ onClickWithStop <| OpenThread status ] <| 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
]
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
]
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
statusEntryView context className currentUser status =
@ -199,13 +206,13 @@ statusEntryView context className currentUser status =
[]
in
li liAttributes
[ Lazy.lazy2 statusView context status
[ Lazy.lazy3 statusView context status (className /= "thread-target")
, Lazy.lazy3 statusActionsView status currentUser (className == "thread-target")
]
statusView : String -> Status -> Html Msg
statusView context ({ account, content, media_attachments, reblog, mentions, pinned } as status) =
statusView : String -> Status -> Bool -> Html Msg
statusView context ({ account, content, media_attachments, reblog, mentions, pinned } as status) clickOpen =
let
accountLinkAttributes =
[ href <| "#account/" ++ account.id ]
@ -231,7 +238,7 @@ statusView context ({ account, content, media_attachments, reblog, mentions, pin
account.display_name]
, text " boosted"
]
, Lazy.lazy2 statusView context reblog
, Lazy.lazy3 statusView context reblog clickOpen
]
Nothing ->
@ -244,5 +251,5 @@ statusView context ({ account, content, media_attachments, reblog, mentions, pin
, span [ class "acct" ] [ text <| " @" ++ account.acct ]
]
]
, Lazy.lazy2 statusContentView context status
, Lazy.lazy3 statusContentView context status clickOpen
]