Add fields to Tooty

This commit is contained in:
Ryan Fox 2021-01-11 22:56:21 +00:00
parent da0358b9ea
commit 0222df76c7
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
2 changed files with 67 additions and 1 deletions

View File

@ -713,6 +713,40 @@ input.form-control[type=file] {
padding: 5px 15px 15px 15px;
}
.account-fields {
border-top: 1px solid rgba(0,0,0,0.6);
margin: 0;
}
.account-fields dl {
display: flex;
margin: 0;
border-bottom: 1px solid rgba(0,0,0,0.6);
}
.account-fields dt {
background-color: rgba(0,0,0,0.2);
flex: 0 0 auto;
width: 125px;
border-right: 1px solid rgba(0,0,0,0.6);
}
.account-fields dd {
flex: 1 1 auto;
}
.account-fields dd.verified {
background-color: rgba(125,255,125,0.2);
}
.account-fields dd, .account-fields dt {
text-align: center;
padding: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.account-infos {
text-align:center;
padding: 15px;

View File

@ -11,7 +11,7 @@ import Mastodon.Model exposing (..)
import Types exposing (..)
import View.Common as Common
import View.Status exposing (statusEntryView)
import View.Formatter exposing (formatContent)
import View.Formatter exposing (formatContent, textContent)
type alias CurrentUser =
@ -238,6 +238,37 @@ counterLinks subView account =
]
makeField : Field -> Html Msg
makeField field =
let
dd_class =
if field.verified_at == "" then
""
else
"verified"
checkmark =
if field.verified_at == "" then
text ""
else
span
[ title ("Verified at " ++ Common.formatDate field.verified_at)
, style [ ( "margin-right", "4px") ]
] [ Common.icon "check" ]
in
dl []
[ dt [ title field.name ] [ text field.name ]
, dd [ title (textContent field.value)
, class dd_class ]
(checkmark :: (formatContent field.value []))
]
fields : CurrentAccountView -> Account -> Html Msg
fields subView account =
div [ class "row account-fields" ]
(List.map makeField account.fields)
accountView : CurrentAccountView -> CurrentUser -> AccountInfo -> Html Msg
accountView subView currentUser accountInfo =
case accountInfo.account of
@ -301,6 +332,7 @@ accountView subView currentUser accountInfo =
, span [ class "account-note" ] (formatContent account.note [])
]
]
, fields subView account
, counterLinks subView account
, case subView of
AccountStatusesView ->