Skip to content

Commit 9aa0ea5

Browse files
committed
Refine community metrics UI for readability
1 parent e260b31 commit 9aa0ea5

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

content/community/community.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Are you looking for something else? Maybe one of the other [community channels](
2525

2626
The following metrics are updated automatically and provide a quick snapshot of community activity.
2727

28+
<p id="community-metrics-status" class="text-muted">Loading automatically generated metrics...</p>
2829
<div id="community-metrics"></div>
29-
<p id="community-metrics-status">Loading automatically generated metrics...</p>
3030

3131
<script src="js/community-metrics.js"></script>
3232

js/community-metrics.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
console.log("community-metrics.js loaded");
2-
31
(function () {
2+
var REPO_BLURBS = {
3+
core: "Core coupling library and ecosystem.",
4+
tutorials: "Ready-to-run tutorial cases for users and developers.",
5+
};
6+
47
function formatNumber(value) {
58
if (typeof value !== "number") {
69
return "n/a";
@@ -31,17 +34,18 @@ console.log("community-metrics.js loaded");
3134

3235
function createCardColumn(title, description, items, linkUrl, linkLabel) {
3336
var column = document.createElement("div");
34-
column.className = "col-md-4 col-sm-6 col-flex";
37+
column.className = "col-md-12";
3538

3639
var card = document.createElement("div");
37-
card.className = "panel panel-primary panel-precice full-height";
40+
card.className = "panel panel-primary panel-precice";
41+
card.style.marginBottom = "14px";
3842

39-
var list = "<ul class=\"list-unstyled\">" + items.join("") + "</ul>";
40-
var descriptionHtml = description ? "<p>" + description + "</p>" : "";
43+
var list = "<ul class=\"list-unstyled no-margin\">" + items.join("") + "</ul>";
44+
var descriptionHtml = description ? "<p class=\"text-muted\" style=\"font-size: 0.9em; margin-bottom: 8px;\">" + description + "</p>" : "";
4145
var linkHtml = "";
4246
if (linkUrl && linkLabel) {
4347
linkHtml =
44-
"<p class=\"no-margin\"><a href=\"" +
48+
"<p class=\"no-margin\" style=\"margin-top: 10px;\"><a href=\"" +
4549
linkUrl +
4650
"\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"no-external-marker\">" +
4751
linkLabel +
@@ -52,7 +56,7 @@ console.log("community-metrics.js loaded");
5256
"<div class=\"panel-heading-precice text-left\"><strong>" +
5357
title +
5458
"</strong></div>" +
55-
"<div class=\"panel-body\">" +
59+
"<div class=\"panel-body\" style=\"font-size: 0.92em; line-height: 1.35;\">" +
5660
descriptionHtml +
5761
list +
5862
linkHtml +
@@ -70,7 +74,7 @@ console.log("community-metrics.js loaded");
7074
"<a href=\"" +
7175
latestRelease.url +
7276
"\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"no-external-marker\">" +
73-
(latestRelease.name || latestRelease.tag_name || "Release") +
77+
(latestRelease.tag_name || latestRelease.name || "Release") +
7478
"</a> (" +
7579
formatDate(latestRelease.published_at) +
7680
")";
@@ -80,11 +84,10 @@ console.log("community-metrics.js loaded");
8084

8185
return createCardColumn(
8286
repo.label,
83-
repo.description || "",
87+
REPO_BLURBS[repo.id] || "",
8488
[
8589
createItem("Stars", formatNumber(repo.stars)),
8690
createItem("Contributors", formatNumber(repo.contributors)),
87-
createItem("Forks", formatNumber(repo.forks)),
8891
createItem("Open issues", formatNumber(repo.open_issues)),
8992
createItem("Latest commit", formatDate(repo.latest_commit_at)),
9093
createItem("Latest release", latestReleaseValue),
@@ -98,7 +101,7 @@ console.log("community-metrics.js loaded");
98101
function createDiscourseCard(discourse) {
99102
return createCardColumn(
100103
"Discourse forum",
101-
"Community activity snapshot from the preCICE forum.",
104+
"Community activity snapshot.",
102105
[
103106
createItem("Users", formatNumber(discourse.users_count)),
104107
createItem("Topics", formatNumber(discourse.topics_count)),
@@ -141,7 +144,7 @@ console.log("community-metrics.js loaded");
141144
}
142145

143146
var row = document.createElement("div");
144-
row.className = "row equal";
147+
row.className = "row";
145148

146149
for (var i = 0; i < repositories.length; i += 1) {
147150
row.appendChild(createRepositoryCard(repositories[i]));

0 commit comments

Comments
 (0)