Skip to content

Commit

Permalink
feat(PreviewCard): verified authors (#1112)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr authored Sep 12, 2024
1 parent b3d36e1 commit 7628843
Show file tree
Hide file tree
Showing 6 changed files with 290 additions and 88 deletions.
13 changes: 13 additions & 0 deletions data/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,14 @@ video > overlay > revealer > controls, .audio-controls {
border-radius: 0px;
}

.ttl-view .small .preview_card.explore {
border-radius: 0px;
}

.ttl-view .preview_card.explore {
border-radius: 12px;
}

/* .ttl-view .small.content .card.card-spacing { */
.ttl-view .small.fake-content .card.card-spacing {
margin: 0px;
Expand Down Expand Up @@ -734,3 +742,8 @@ popover.mini-profile > contents {
border-radius: 9999px;
padding: 4px;
}

.verified-author {
padding: 0 5px;
font-size: small;
}
161 changes: 84 additions & 77 deletions data/ui/widgets/preview_card.ui
Original file line number Diff line number Diff line change
@@ -1,80 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<template class="TubaWidgetsPreviewCard" parent="GtkButton">
<style>
<class name="preview_card"/>
<class name="frame"/>
</style>
<child>
<object class="GtkBox" id="box">
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="margin-top">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-bottom">12</property>
<child>
<object class="GtkLabel" id="author_label">
<property name="ellipsize">end</property>
<property name="halign">start</property>
<property name="single-line-mode">1</property>
<style>
<class name="dim-label"/>
<class name="caption"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="title_label">
<property name="visible">0</property>
<property name="ellipsize">end</property>
<property name="halign">fill</property>
<property name="xalign">0</property>
<property name="lines">2</property>
<property name="wrap">1</property>
<property name="wrap-mode">word-char</property>
<style>
<class name="font-bold"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="description_label">
<property name="visible">0</property>
<property name="ellipsize">end</property>
<property name="halign">fill</property>
<property name="xalign">0</property>
<property name="lines">3</property>
<property name="wrap">1</property>
<property name="wrap-mode">word-char</property>
<property name="single-line-mode">1</property>
<style>
<class name="caption"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="used_times_label">
<property name="visible">0</property>
<property name="halign">fill</property>
<property name="xalign">0</property>
<property name="wrap">1</property>
<property name="wrap-mode">word-char</property>
<style>
<class name="dim-label"/>
<class name="caption"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
<requires lib="gtk" version="4.0" />
<template class="TubaWidgetsPreviewCard" parent="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkButton" id="button">
<style>
<class name="preview_card" />
<class name="frame" />
<class name="flat" />
</style>
<child>
<object class="GtkBox" id="box">
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="margin-top">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-bottom">12</property>
<child>
<object class="GtkLabel" id="author_label">
<property name="ellipsize">end</property>
<property name="halign">start</property>
<property name="single-line-mode">1</property>
<style>
<class name="dim-label" />
<class name="caption" />
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="title_label">
<property name="visible">0</property>
<property name="ellipsize">end</property>
<property name="halign">fill</property>
<property name="xalign">0</property>
<property name="lines">2</property>
<property name="wrap">1</property>
<property name="wrap-mode">word-char</property>
<style>
<class name="font-bold" />
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="description_label">
<property name="visible">0</property>
<property name="ellipsize">end</property>
<property name="halign">fill</property>
<property name="xalign">0</property>
<property name="lines">3</property>
<property name="wrap">1</property>
<property name="wrap-mode">word-char</property>
<property name="single-line-mode">1</property>
<style>
<class name="caption" />
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="used_times_label">
<property name="visible">0</property>
<property name="halign">fill</property>
<property name="xalign">0</property>
<property name="wrap">1</property>
<property name="wrap-mode">word-char</property>
<style>
<class name="dim-label" />
<class name="caption" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
9 changes: 9 additions & 0 deletions src/API/Status/PreviewCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,19 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable {
}
}

public class AuthorEntity : Entity {
public string? name { get; set; }
public string? url { get; set; }
public API.Account? account { get; set; }
}

public string url { get; set; }
public string title { get; set; default=""; }
public string description { get; set; default=""; }
public string kind { get; set; default="link"; }
public string author_name { get; set; default=""; }
public string author_url { get; set; default=""; }
public Gee.ArrayList<AuthorEntity>? authors { get; set; default=null; }
public string provider_name { get; set; default=""; }
public string provider_url { get; set; default=""; }
public string? image { get; set; default=null; }
Expand All @@ -124,6 +131,8 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable {
switch (prop) {
case "history":
return typeof (API.TagHistory);
case "authors":
return typeof (AuthorEntity);
}

return base.deserialize_array_type (prop);
Expand Down
Loading

0 comments on commit 7628843

Please sign in to comment.