Skip to content

Commit

Permalink
feat(profile-cover): redesign fields (#906)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr committed Apr 13, 2024
1 parent c5bb023 commit e3ac1d1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
4 changes: 4 additions & 0 deletions data/style.css
Expand Up @@ -230,6 +230,10 @@ flowboxchild {
padding: 1px 6px;
}

.ttl-profile-field {
padding: 6px 12px;
}

.ttl-verified-field {
color: @success_color;
background: alpha(@success_bg_color, 0.1);
Expand Down
27 changes: 19 additions & 8 deletions src/Widgets/ProfileCover.vala
Expand Up @@ -123,16 +123,27 @@ protected class Tuba.Widgets.Cover : Gtk.Box {

if (profile.account.fields != null) {
foreach (API.AccountField f in profile.account.fields) {
var row = new Adw.ActionRow ();
var row = new Gtk.Box (Gtk.Orientation.VERTICAL, 6) {
css_classes = {"ttl-profile-field"}
};
var val = new Widgets.RichLabel (HtmlUtils.simplify (f.val)) {
use_markup = true,
hexpand = true,
xalign = 1
xalign = 0,
selectable = true
};
row.title = f.name;

info.append (row);

var title_label = new Widgets.EmojiLabel () {
use_markup = false
};
title_label.instance_emojis = profile.account.emojis_map;
title_label.content = f.name;
row.append (title_label);

info.append (new Gtk.ListBoxRow () {
child = row,
activatable = false
});
if (f.verified_at != null) {
var verified_date = f.verified_at.slice (0, f.verified_at.last_index_of ("T"));
var verified_label_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
Expand All @@ -141,12 +152,12 @@ protected class Tuba.Widgets.Cover : Gtk.Box {
};

verified_label_box.append (val);
verified_label_box.append (verified_checkmark);
verified_label_box.prepend (verified_checkmark);

row.add_suffix (verified_label_box);
row.append (verified_label_box);
row.add_css_class ("ttl-verified-field");
} else {
row.add_suffix (val);
row.append (val);
};
}
}
Expand Down

0 comments on commit e3ac1d1

Please sign in to comment.