diff --git a/jiji.project b/jiji.project index a9983f9..f6fd60b 100644 --- a/jiji.project +++ b/jiji.project @@ -1 +1 @@ -{"categories":[{"name":"to do","content":[{"name":"ability to change token","description":"use a config file to store token so that \n\n1- it is away from github\n\n2- it is configurable if need be","id":1},{"name":"clean up bot code","description":"try to remove unnecessary code\n\nunindent\n\ngive sender to function ?","id":2},{"name":"trayable ?","description":"// Hello there","id":5},{"name":"guild unread ?","description":"// Hello there","id":2},{"name":"new message marker","description":"perma if too complicated to detect read","id":2},{"name":"proper links","description":"when there is a link, ability to click it","id":3}]},{"name":"in progress","content":[]},{"name":"done","content":[{"name":"run discord bot","description":"make it so the bot is running","id":1},{"name":"fixed token in github","description":"// Hello there","id":1},{"name":"fetch previous messages","description":"// Hello there","id":4},{"name":"ability to write messages","description":"// Hello there","id":5},{"name":"get incoming messages","description":"read","id":2},{"name":"unread system","description":"add a * when a channel just received a message","id":1},{"name":"remember channel id for dm","description":"and put in config file\n\nmaybe load message ? dm first ?","id":3}]},{"name":"bugs","content":[]},{"name":"v1.0","content":[{"name":"better ui error display","description":"handle the error packet for better display","id":1},{"name":"notifications !!!","description":"// Hello there","id":4},{"name":"timestamps","description":"// Hello there","id":1},{"name":"bug : does not save notification state for dm","description":"// Hello there","id":1},{"name":"handle unknown channel better","description":"when receiving a message from a not yet scanned guild, create the channel and put the message\n\nallow scanning if guild selected\n\ndo not add duplicate channel","id":1}]},{"name":"+","content":[]}]} \ No newline at end of file +{"categories":[{"name":"to do","content":[{"name":"ability to change token","description":"use a config file to store token so that \n\n1- it is away from github\n\n2- it is configurable if need be","id":1},{"name":"clean up bot code","description":"try to remove unnecessary code\n\nunindent\n\ngive sender to function ?","id":2},{"name":"trayable ?","description":"// Hello there","id":5},{"name":"new message marker","description":"perma if too complicated to detect read","id":2},{"name":"proper links","description":"when there is a link, ability to click it","id":3}]},{"name":"in progress","content":[]},{"name":"done","content":[{"name":"run discord bot","description":"make it so the bot is running","id":1},{"name":"fixed token in github","description":"// Hello there","id":1},{"name":"fetch previous messages","description":"// Hello there","id":4},{"name":"ability to write messages","description":"// Hello there","id":5},{"name":"get incoming messages","description":"read","id":2},{"name":"unread system","description":"add a * when a channel just received a message","id":1},{"name":"remember channel id for dm","description":"and put in config file\n\nmaybe load message ? dm first ?","id":3},{"name":"bug : does not save notification state for dm","description":"// Hello there","id":1},{"name":"handle unknown channel better","description":"when receiving a message from a not yet scanned guild, create the channel and put the message\n\nallow scanning if guild selected\n\ndo not add duplicate channel","id":1},{"name":"guild unread ?","description":"// Hello there","id":2}]},{"name":"bugs","content":[]},{"name":"v1.0","content":[{"name":"better ui error display","description":"handle the error packet for better display","id":1},{"name":"notifications !!!","description":"// Hello there","id":4},{"name":"timestamps","description":"// Hello there","id":1}]},{"name":"+","content":[]}]} \ No newline at end of file diff --git a/src/ui.rs b/src/ui.rs index 3d2c6e1..7330529 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,4 +1,5 @@ use eframe::egui; +use chrono::DateTime; use crate::postman; use crate::Jiji; @@ -74,6 +75,7 @@ impl Jiji { if ui.add(egui::SelectableLabel::new(self.selected_channel == None, "None")).clicked() { if let Some(selected_channel_index) = &self.selected_channel { self.guilds[*selected_guild_index].channels[*selected_channel_index].unread = false; + self.guilds[*selected_guild_index].check_unread(); } self.selected_channel = None; } @@ -173,7 +175,12 @@ impl Jiji { } if message.author_name != last_author { ui.separator(); - ui.colored_label(hex_str_to_color("#3399ff"), &message.author_name); + ui.horizontal( |ui| { + ui.colored_label(hex_str_to_color("#3399ff"), &message.author_name); + if let Ok(timestamp) = DateTime::parse_from_rfc2822(&message.timestamp) { + ui.label(timestamp.format("%H:%M (%a, %e %b)").to_string()); + } + }); } else { ui.label(""); }