1
0
Fork 0

Make instance icons more prevalent

This commit is contained in:
Ryan Fox 2021-12-01 00:50:51 -08:00
parent afc3f3e09d
commit 592607835a
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
3 changed files with 50 additions and 24 deletions

View File

@ -107,7 +107,7 @@ followView currentUser relationship account =
]
]
, br [] []
, text <| "@" ++ account.acct
, Common.accountAcctView True account
]
, muteButton currentUser relationship account
, followButton currentUser relationship account

View File

@ -1,10 +1,12 @@
module View.Common
exposing
( accountAvatar
( accountAcctView
, accountAvatar
, accountAvatarLink
, accountLink
, accountLinkSmall
, accountLinkLarge
, instanceIconsView
, appLink
, closeablePanelheading
, icon
@ -31,20 +33,32 @@ accountAvatar avatarClass account =
img [ class avatarClass, src account.avatar ] []
accountDisplayName : Account -> String
accountDisplayName account =
if account.display_name == "" then
account.username
else
account.display_name
accountLink : Bool -> Account -> Html Msg
accountLink external account =
let
accountHref =
if external then
target "_blank"
else
href <| "#account/" ++ account.id
in
if external then
a
[ href account.url
, accountHref
, target "_blank"
]
[ text <| "@" ++ account.acct
, instanceIconsView <| account.url
]
else
a
[ href account.url
, href <| "#account/" ++ account.id
]
[ text <| accountDisplayName <| account
, accountAcctView False account
]
[ text <| "@" ++ account.acct ]
accountLinkSmall : Bool -> Account -> Html Msg
@ -86,10 +100,33 @@ accountLinkLarge external account =
else
account.display_name
, br [] []
, span [ class "acct" ] [ text <| "@" ++ account.acct ]
, accountAcctView True account
]
instanceIconsView : String -> Html Msg
instanceIconsView url =
let
instUrl = String.join "/" ( List.take 3 ( String.split "/" url ) )
instIcon = img [ class "acct-instance-icon", src ( instUrl ++ "/favicon.png" ), alt "" ] []
instIcon2 = img [ class "acct-instance-icon", src ( instUrl ++ "/favicon.ico" ), alt "" ] []
in
span [] [ instIcon, instIcon2 ]
accountAcctView : Bool -> Account -> Html Msg
accountAcctView showIcons account =
let
acctText = text <| " @" ++ account.acct
icons =
if showIcons then
instanceIconsView <| account.url
else
text ""
in
span [ class "acct" ] [ acctText, icons ]
accountAvatarLink : Bool -> Account -> Html Msg
accountAvatarLink external account =
let

View File

@ -260,17 +260,6 @@ statusEntryView context className currentUser status =
]
statusAcctView : Account -> Html Msg
statusAcctView account =
let
acctText = text <| " @" ++ account.acct
instUrl = String.join "/" ( List.take 3 ( String.split "/" account.url ) )
instIcon = img [ class "acct-instance-icon", src ( instUrl ++ "/favicon.png" ), alt "" ] []
instIcon2 = img [ class "acct-instance-icon", src ( instUrl ++ "/favicon.ico" ), alt "" ] []
in
span [ class "acct" ] [ acctText, instIcon, instIcon2 ]
statusView : String -> Status -> Bool -> Html Msg
statusView context ({ account, content, media_attachments, reblog, mentions, pinned } as status) clickOpen =
let
@ -316,7 +305,7 @@ statusView context ({ account, content, media_attachments, reblog, mentions, pin
, div [ class "username" ]
[ a accountLinkAttributes
[ text (if account.display_name=="" then account.username else account.display_name)
, statusAcctView <| account
, Common.accountAcctView True account
]
]
, Lazy.lazy2 statusContentView context status