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

View File

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

View File

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

View File

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