Show metadata time of on your metadata page

This commit is contained in:
Mike Dilger 2023-01-29 08:48:52 +13:00
parent a6977e2f46
commit 5f0f101f85
3 changed files with 38 additions and 0 deletions

28
Cargo.lock generated
View File

@ -1806,6 +1806,7 @@ dependencies = [
"sha2",
"textnonce",
"thiserror",
"time",
"tokio",
"tokio-tungstenite",
"tracing",
@ -3829,6 +3830,33 @@ dependencies = [
"weezl",
]
[[package]]
name = "time"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
dependencies = [
"itoa",
"serde",
"time-core",
"time-macros",
]
[[package]]
name = "time-core"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
[[package]]
name = "time-macros"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2"
dependencies = [
"time-core",
]
[[package]]
name = "tiny-skia"
version = "0.6.6"

View File

@ -38,6 +38,7 @@ serde_json = "1.0"
sha2 = "0.10"
textnonce = "1.0"
thiserror = "1.0"
time = { version = "0.3", features = [ "formatting" ] }
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = [ "std", "env-filter" ] }

View File

@ -41,6 +41,15 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr
None => &EMPTY_METADATA,
};
if let Some(metadata_at) = you.metadata_at {
if let Ok(stamp) = time::OffsetDateTime::from_unix_timestamp(metadata_at) {
if let Ok(formatted) = stamp.format(&time::format_description::well_known::Rfc2822) {
ui.label(format!("Date Stamp of Fetched Metadata is {}", formatted));
ui.add_space(18.0);
}
}
}
if app.editing_metadata {
edit_line(ui, "Name", &mut app.metadata.name);
ui.add_space(18.0);