mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-29 14:30:31 +08:00
Implement patch browser context on home page
This commit is contained in:
+29
-6
@@ -116,10 +116,33 @@ pub fn context(context: &Context, theme: &Theme, patch: (PatchId, Patch)) -> Wid
|
||||
common::context::bar(theme, "Patch", &id, title, &author, &comments.to_string())
|
||||
}
|
||||
|
||||
pub fn browse_context(
|
||||
_context: &Context,
|
||||
theme: &Theme,
|
||||
_progress: Progress,
|
||||
) -> Widget<ContextBar> {
|
||||
common::context::bar(theme, "Browse", "", "", "", "")
|
||||
pub fn browse_context(context: &Context, theme: &Theme, progress: Progress) -> Widget<ContextBar> {
|
||||
use radicle::cob::patch::State;
|
||||
|
||||
let patches = context.patches();
|
||||
let mut draft = 0;
|
||||
let mut open = 0;
|
||||
let mut archived = 0;
|
||||
let mut merged = 0;
|
||||
|
||||
for (_, patch) in patches {
|
||||
match patch.state() {
|
||||
State::Draft => draft += 1,
|
||||
State::Open { conflicts: _ } => open += 1,
|
||||
State::Archived => archived += 1,
|
||||
State::Merged {
|
||||
commit: _,
|
||||
revision: _,
|
||||
} => merged += 1,
|
||||
}
|
||||
}
|
||||
|
||||
common::context::bar(
|
||||
theme,
|
||||
"Browse",
|
||||
"",
|
||||
"",
|
||||
&format!("{draft} draft | {open} open | {archived} archived | {merged} merged"),
|
||||
&progress.to_string(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user