feat: show creation time next to pr title

This commit is contained in:
2026-05-12 02:19:08 +08:00
parent 2fe3f7b94f
commit 6168676ac0
11 changed files with 72 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ edition = "2024"
[dependencies]
anyhow = "1"
chrono = { version = "0.4.44", features = ["serde"] }
futures = "0.3.32"
futures-lite = "2.6.1"
gpui = { version = "*" }

View File

@@ -2,6 +2,7 @@
"title": "feat(prompts): split context loading from execution workers",
"state": "OPEN",
"is_draft": true,
"created_at": "2026-04-30T14:22:00Z",
"author": {
"login": "leaferiksen",
"avatar_url": "https://avatars.githubusercontent.com/u/5151?v=4"

View File

@@ -2,6 +2,7 @@
"title": "chore(tokens): tighten dashboard spacing scale",
"state": "OPEN",
"is_draft": false,
"created_at": "2026-05-02T11:05:00Z",
"author": {
"login": "mariahops",
"avatar_url": "https://avatars.githubusercontent.com/u/6161?v=4"

View File

@@ -2,6 +2,7 @@
"title": "docs(deploy): document manual failover steps",
"state": "CLOSED",
"is_draft": false,
"created_at": "2026-04-24T06:40:00Z",
"author": {
"login": "kennethnym",
"avatar_url": "https://avatars.githubusercontent.com/u/4242?v=4"

View File

@@ -2,6 +2,7 @@
"title": "feat(dashboard): hydrate issue pane from cached query state",
"state": "OPEN",
"is_draft": false,
"created_at": "2026-05-01T09:12:00Z",
"author": {
"login": "kennethnym",
"avatar_url": "https://avatars.githubusercontent.com/u/4242?v=4"

View File

@@ -2,6 +2,7 @@
"title": "feat(repo): add cached repository query for titlebar picker",
"state": "OPEN",
"is_draft": false,
"created_at": "2026-05-03T07:40:00Z",
"author": {
"login": "kennethnym",
"avatar_url": "https://avatars.githubusercontent.com/u/4242?v=4"

View File

@@ -2,6 +2,7 @@
"title": "feat(calendar): ship release handoff checklist in weekly planner",
"state": "MERGED",
"is_draft": false,
"created_at": "2026-04-28T10:20:00Z",
"author": {
"login": "rorycraft",
"avatar_url": "https://avatars.githubusercontent.com/u/7171?v=4"

View File

@@ -6,6 +6,7 @@ query PullRequestQuery($id: ID!) {
body
state
isDraft
createdAt
baseRef {
name
}

View File

@@ -70,6 +70,7 @@ pub(crate) struct DetailedPullRequest {
pub(crate) state: PullRequestState,
pub(crate) is_draft: bool,
pub(crate) body: String,
pub(crate) created_at: Option<chrono::DateTime<chrono::FixedOffset>>,
pub(crate) author: Option<super::user::Actor>,
pub(crate) base_branch_name: Option<String>,
pub(crate) head_branch_name: Option<String>,
@@ -368,18 +369,29 @@ impl query::QueryFn for FetchPullRequest {
"missing 'node' field on PullRequestQuery response".into(),
))
.and_then(|n| match n {
| PullRequestQueryNode::PullRequest(p) => Ok(DetailedPullRequest {
title: p.title,
state: p.state,
is_draft: p.is_draft,
body: p.body,
author: p.author.map(|it| api::user::Actor {
login: it.login,
avatar_url: it.avatar_url,
}),
base_branch_name: p.base_ref.map(|r| r.name),
head_branch_name: p.head_ref.map(|r| r.name),
}),
| PullRequestQueryNode::PullRequest(p) => {
let created_at =
chrono::DateTime::parse_from_rfc3339(&p.created_at).map_err(|err| {
api::Error::MalformedResponse(format!(
"invalid pull request createdAt {:?}: {err}",
p.created_at
))
})?;
Ok(DetailedPullRequest {
title: p.title,
state: p.state,
is_draft: p.is_draft,
body: p.body,
author: p.author.map(|it| api::user::Actor {
login: it.login,
avatar_url: it.avatar_url,
}),
base_branch_name: p.base_ref.map(|r| r.name),
head_branch_name: p.head_ref.map(|r| r.name),
created_at: Some(created_at),
})
}
| _ => Err(api::Error::MalformedResponse(
"unexpected node type on PullRequestQuery".into(),
)),

View File

@@ -151,6 +151,10 @@ mod tests {
merged.head_branch_name.as_deref(),
Some("feat/release-handoff-checklist")
);
assert_eq!(
merged.created_at,
Some(chrono::DateTime::parse_from_rfc3339("2026-04-28T10:20:00Z").unwrap())
);
assert!(
documented_failover
.body
@@ -168,12 +172,20 @@ mod tests {
documented_failover.head_branch_name.as_deref(),
Some("docs/manual-failover-steps")
);
assert_eq!(
documented_failover.created_at,
Some(chrono::DateTime::parse_from_rfc3339("2026-04-24T06:40:00Z").unwrap())
);
assert!(dashboard_markdown.body.contains("```rust"));
assert_eq!(dashboard_markdown.base_branch_name.as_deref(), Some("main"));
assert_eq!(
dashboard_markdown.head_branch_name.as_deref(),
Some("feat/cached-issue-pane")
);
assert_eq!(
dashboard_markdown.created_at,
Some(chrono::DateTime::parse_from_rfc3339("2026-05-01T09:12:00Z").unwrap())
);
assert_eq!(
cached_repo_picker
.author
@@ -186,6 +198,10 @@ mod tests {
cached_repo_picker.head_branch_name.as_deref(),
Some("feat/cached-repo-picker")
);
assert_eq!(
cached_repo_picker.created_at,
Some(chrono::DateTime::parse_from_rfc3339("2026-05-03T07:40:00Z").unwrap())
);
assert_eq!(
worker_split.author.as_ref().map(|author| author.login.as_str()),
Some("leaferiksen")
@@ -195,6 +211,10 @@ mod tests {
worker_split.head_branch_name.as_deref(),
Some("feat/worker-context-envelope")
);
assert_eq!(
worker_split.created_at,
Some(chrono::DateTime::parse_from_rfc3339("2026-04-30T14:22:00Z").unwrap())
);
assert_eq!(
spacing_tokens
.author
@@ -207,6 +227,10 @@ mod tests {
spacing_tokens.head_branch_name.as_deref(),
Some("chore/dashboard-spacing-scale")
);
assert_eq!(
spacing_tokens.created_at,
Some(chrono::DateTime::parse_from_rfc3339("2026-05-02T11:05:00Z").unwrap())
);
}
#[test]

View File

@@ -205,7 +205,22 @@ impl PullRequestView {
.py_3()
.border_b_1()
.border_color(theme.colors.border)
.child(text(pr.title.clone()).w_full().text_xl().mb_1())
.child(
div()
.w_full()
.flex()
.flex_row()
.justify_between()
.items_center()
.child(text(pr.title.clone()).w_full().text_xl().mb_1())
.when_some(pr.created_at, |it, created_at| {
it.child(
text(created_at.format("%Y-%m-%d %H:%M").to_string())
.opacity(0.5)
.text_xs(),
)
}),
)
.child(metadata_line),
)
.child(