Skip to content

Commit 0a8a04b

Browse files
authored
Merge pull request #51 from Girish-Anadv-07/feature/github_stars
Added github Stars viewing feature
2 parents 8e274c4 + c07d305 commit 0a8a04b

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta charset="UTF-8" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<link rel="stylesheet" href="/niivue.css" />
8+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
89
<title>AI powered brain segmentation</title>
910
</head>
1011

@@ -68,6 +69,17 @@
6869
<!-- important to use class footer here -->
6970
<div class="footer" id="memstatus" style="color: green">Memory OK</div>
7071
</th>
72+
<th>
73+
<div class="github-star">
74+
<div class="star-button">
75+
<a href="https://github.com/neuroneural/brainchop" target="_blank" style="text-decoration:none">
76+
<i class="fa-brands fa-github" style="color: #000000;"></i>
77+
<span>Star</span>
78+
</a>
79+
</div>
80+
<div id="star-count">0</div>
81+
</div>
82+
</th>
7183
</tr>
7284
</table>
7385
</div>

main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,4 +303,14 @@ async function main() {
303303
}
304304
}
305305

306+
async function updateStarCount() {
307+
try {
308+
const response = await fetch(`https://api.github.com/repos/neuroneural/brainchop`);
309+
const data = await response.json();
310+
document.getElementById('star-count').textContent = data.stargazers_count;
311+
} catch (error) {
312+
console.error('Error fetching star count:', error);
313+
}
314+
}
315+
updateStarCount()
306316
main()

public/niivue.css

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,40 @@ div {
106106
}
107107

108108
div.footer { width: 100%; display: block; background: #303030;}
109-
table.footer { width: 100%;height: 100%; table-layout: fixed;}
109+
table.footer { width: 100%;height: 100%; table-layout: fixed;}
110+
111+
.github-star {
112+
display: inline-flex;
113+
align-items: center;
114+
background-color: #fff;
115+
border: 1px solid #d1d5da;
116+
border-radius: 6px;
117+
cursor: pointer;
118+
font-size: 14px;
119+
font-weight: 600;
120+
color: #24292e;
121+
text-decoration: none;
122+
}
123+
124+
.github-star .star-button {
125+
display: flex;
126+
align-items: center;
127+
background-color: #ffffff;
128+
padding: 5px 12px;
129+
border-radius: 6px 0 0 6px;
130+
}
131+
132+
.github-star .star-button span {
133+
color: #24292e;
134+
padding-bottom: 8px
135+
}
136+
137+
.github-star #star-count {
138+
background-color: #eff3f6;
139+
padding: 5px 12px;
140+
border-left: 1px solid #d1d5da;
141+
border-radius: 0 6px 6px 0;
142+
font-size: 14px;
143+
font-weight: 600;
144+
color: #24292e;
145+
}

0 commit comments

Comments
 (0)