Display the publish date for posts, comments and replies

This commit is contained in:
Bnyro 2023-06-28 11:47:42 +02:00
parent e289867cb8
commit dbe9b6e74d
4 changed files with 22 additions and 4 deletions

View File

@ -10,6 +10,7 @@ use crate::dialogs::editor::EditorDialog;
use crate::dialogs::editor::EditorOutput;
use crate::dialogs::editor::EditorType;
use crate::settings;
use crate::util;
use crate::util::get_web_image_url;
use crate::util::markdown_to_pango_markup;
@ -70,6 +71,11 @@ impl FactoryComponent for CommentRow {
set_label: &self.comment.creator.name,
connect_clicked => CommentRowMsg::OpenPerson,
},
gtk::Label {
set_margin_start: 10,
set_label: &util::format_elapsed_time(self.comment.comment.published),
}
},
gtk::Label {

View File

@ -3,6 +3,7 @@ use lemmy_api_common::lemmy_db_views_actor::structs::CommentReplyView;
use relm4::prelude::*;
use relm4_components::web_image::WebImage;
use crate::util;
use crate::util::get_web_image_url;
use crate::util::markdown_to_pango_markup;
@ -97,6 +98,11 @@ impl FactoryComponent for MentionRow {
set_label: &self.comment.creator.name,
connect_clicked => MentionRowMsg::OpenPerson,
},
gtk::Label {
set_margin_start: 10,
set_label: &util::format_elapsed_time(self.comment.comment.published),
}
},
gtk::Label {

View File

@ -10,7 +10,7 @@ use crate::{
api,
dialogs::editor::{DialogMsg, EditorData, EditorDialog, EditorOutput, EditorType},
settings,
util::{get_web_image_msg, get_web_image_url, markdown_to_pango_markup},
util::{self, get_web_image_msg, get_web_image_url, markdown_to_pango_markup},
};
use super::{
@ -125,6 +125,11 @@ impl SimpleComponent for PostPage {
connect_clicked => PostInput::OpenCommunity,
},
gtk::Label {
set_margin_start: 10,
set_label: &util::format_elapsed_time(model.info.post_view.post.published),
},
gtk::Box {
set_hexpand: true,
},

View File

@ -3,8 +3,8 @@ use lemmy_api_common::lemmy_db_views::structs::PostView;
use relm4::prelude::*;
use relm4_components::web_image::WebImage;
use crate::settings;
use crate::{api, util::get_web_image_url};
use crate::{settings, util};
use super::voting_row::{VotingRowModel, VotingStats};
@ -79,8 +79,9 @@ impl FactoryComponent for PostRow {
connect_clicked => PostRowMsg::OpenPerson,
},
gtk::Box {
set_hexpand: true,
gtk::Label {
set_margin_start: 10,
set_label: &util::format_elapsed_time(self.post.post.published),
}
},