feat(ui): show repo count in contribution graph summaries
Add "in N repositories" to both the year and all-time graph summary lines. Year graph counts repos with overlapping activity; all-time graph uses total project count. OG image includes repo count too. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -180,7 +180,10 @@ async fn og_contributions(
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
|
||||
let png = render_contributions_png(&counts, earliest, today).map_err(|e| ApiError {
|
||||
let projects = state.store.list_projects().await.map_err(internal)?;
|
||||
let repo_count = projects.len();
|
||||
|
||||
let png = render_contributions_png(&counts, earliest, today, repo_count).map_err(|e| ApiError {
|
||||
status: StatusCode::INTERNAL_SERVER_ERROR,
|
||||
message: e,
|
||||
})?;
|
||||
@@ -199,6 +202,7 @@ fn render_contributions_png(
|
||||
counts: &[DailyCount],
|
||||
from: NaiveDate,
|
||||
to: NaiveDate,
|
||||
repo_count: usize,
|
||||
) -> Result<Vec<u8>, String> {
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -280,8 +284,13 @@ fn render_contributions_png(
|
||||
let mut svg = format!(
|
||||
r#"<svg xmlns="http://www.w3.org/2000/svg" width="{svg_w}" height="{svg_h}" viewBox="0 0 {svg_w} {svg_h}"><rect width="100%" height="100%" fill="{bg}"/>"#,
|
||||
);
|
||||
let repo_text = if repo_count > 0 {
|
||||
format!(" in {repo_count} repositories")
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
svg.push_str(&format!(
|
||||
r##"<text x="{x}" y="18" fill="#ecf0f1" font-size="12" opacity="0.6">{total} contributions since {from}</text>"##,
|
||||
r##"<text x="{x}" y="18" fill="#ecf0f1" font-size="12" opacity="0.6">{total} contributions since {from}{repo_text}</text>"##,
|
||||
x = year_label_w,
|
||||
));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user