Show created_at date in changelog generator
This commit is contained in:
parent
40b184f022
commit
242ba99964
4 changed files with 65 additions and 2 deletions
42
Cargo.lock
generated
42
Cargo.lock
generated
|
|
@ -756,6 +756,7 @@ name = "changelog"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced",
|
"iced",
|
||||||
|
"jiff",
|
||||||
"log",
|
"log",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
@ -2853,6 +2854,47 @@ version = "1.0.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff"
|
||||||
|
version = "0.2.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35"
|
||||||
|
dependencies = [
|
||||||
|
"jiff-static",
|
||||||
|
"jiff-tzdb-platform",
|
||||||
|
"log",
|
||||||
|
"portable-atomic",
|
||||||
|
"portable-atomic-util",
|
||||||
|
"serde_core",
|
||||||
|
"windows-sys 0.61.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff-static"
|
||||||
|
version = "0.2.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff-tzdb"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c1283705eb0a21404d2bfd6eef2a7593d240bc42a0bdb39db0ad6fa2ec026524"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff-tzdb-platform"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8"
|
||||||
|
dependencies = [
|
||||||
|
"jiff-tzdb",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jni"
|
name = "jni"
|
||||||
version = "0.21.1"
|
version = "0.21.1"
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ tokio.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde.features = ["derive"]
|
serde.features = ["derive"]
|
||||||
|
|
||||||
|
jiff = "0.2"
|
||||||
webbrowser = "1"
|
webbrowser = "1"
|
||||||
tracing-subscriber = "0.3"
|
tracing-subscriber = "0.3"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
use jiff::Timestamp;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
use tokio::process;
|
use tokio::process;
|
||||||
|
|
@ -306,6 +307,7 @@ pub struct PullRequest {
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
pub labels: Vec<String>,
|
pub labels: Vec<String>,
|
||||||
pub author: String,
|
pub author: String,
|
||||||
|
pub created_at: Timestamp,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PullRequest {
|
impl PullRequest {
|
||||||
|
|
@ -334,6 +336,7 @@ impl PullRequest {
|
||||||
body: Option<String>,
|
body: Option<String>,
|
||||||
user: User,
|
user: User,
|
||||||
labels: Vec<Label>,
|
labels: Vec<Label>,
|
||||||
|
created_at: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
|
@ -354,6 +357,7 @@ impl PullRequest {
|
||||||
description: schema.body,
|
description: schema.body,
|
||||||
labels: schema.labels.into_iter().map(|label| label.name).collect(),
|
labels: schema.labels.into_iter().map(|label| label.name).collect(),
|
||||||
author: schema.user.login,
|
author: schema.user.login,
|
||||||
|
created_at: schema.created_at.parse()?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -371,6 +375,9 @@ pub enum Error {
|
||||||
|
|
||||||
#[error("the changelog format is not valid")]
|
#[error("the changelog format is not valid")]
|
||||||
InvalidFormat,
|
InvalidFormat,
|
||||||
|
|
||||||
|
#[error("date could not be parsed: {0}")]
|
||||||
|
InvalidDate(#[from] jiff::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<io::Error> for Error {
|
impl From<io::Error> for Error {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ enum Generator {
|
||||||
pending: Vec<changelog::Contribution>,
|
pending: Vec<changelog::Contribution>,
|
||||||
state: State,
|
state: State,
|
||||||
preview: Vec<markdown::Item>,
|
preview: Vec<markdown::Item>,
|
||||||
|
timezone: jiff::tz::TimeZone,
|
||||||
},
|
},
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
@ -73,6 +74,7 @@ impl Generator {
|
||||||
pending,
|
pending,
|
||||||
state: State::Loading(contribution.clone()),
|
state: State::Loading(contribution.clone()),
|
||||||
preview,
|
preview,
|
||||||
|
timezone: jiff::tz::TimeZone::system(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Task::perform(
|
Task::perform(
|
||||||
|
|
@ -235,6 +237,7 @@ impl Generator {
|
||||||
pending,
|
pending,
|
||||||
state,
|
state,
|
||||||
preview,
|
preview,
|
||||||
|
timezone,
|
||||||
} => {
|
} => {
|
||||||
let progress = {
|
let progress = {
|
||||||
let total = pending.len() + changelog.len();
|
let total = pending.len() + changelog.len();
|
||||||
|
|
@ -297,9 +300,19 @@ impl Generator {
|
||||||
.spacing(10)
|
.spacing(10)
|
||||||
.wrap();
|
.wrap();
|
||||||
|
|
||||||
|
let created_at = text(
|
||||||
|
timezone
|
||||||
|
.to_datetime(pull_request.created_at)
|
||||||
|
.strftime("%B %d, %Y at %I:%M%p")
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
.size(12);
|
||||||
|
|
||||||
column![
|
column![
|
||||||
title,
|
title,
|
||||||
labels,
|
row![labels, created_at]
|
||||||
|
.align_y(Center)
|
||||||
|
.spacing(10),
|
||||||
scrollable(description)
|
scrollable(description)
|
||||||
.spacing(10)
|
.spacing(10)
|
||||||
.width(Fill)
|
.width(Fill)
|
||||||
|
|
@ -370,6 +383,6 @@ impl Generator {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn theme(&self) -> Theme {
|
fn theme(&self) -> Theme {
|
||||||
Theme::TokyoNightStorm
|
Theme::CatppuccinMocha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue