og/views/repo.eta

81 lines
2.3 KiB
Text
Raw Normal View History

2023-08-02 18:51:06 -04:00
<% layout('layout') %>
2023-08-02 23:50:27 -04:00
<%
2023-08-03 03:06:43 -04:00
let description = it.repo.description?.replace(/https?:\/\/([\S]+)/g, '$1')
2023-08-02 23:50:27 -04:00
function prettyNumber(number) {
2023-08-03 07:54:13 -04:00
if (number < 10) return number
if (number < 1000) return Math.floor(number/10) * 10 + '+'
2023-08-02 23:50:27 -04:00
return Math.floor(number / 1000)+'k'
}
%>
2023-08-02 22:01:10 -04:00
<div class="main repo">
2023-08-02 18:37:47 -04:00
<div class="contents">
<div class="info">
2023-08-03 03:06:43 -04:00
<p class="author"><span><%= it.repo.owner.full_name || it.repo.owner.login %></span><span class="username">@<%= it.repo.owner.login %></span></p>
2023-08-02 23:26:39 -04:00
<p class="title"><%= it.repo.name %></p>
2023-08-03 03:06:43 -04:00
<% if (description) { %>
<p class="description"><%= description %></p>
<% } %>
</div>
<div class="graphics">
<img width="120" height="120" src="<%= it.repo.avatar_url || it.repo.owner.avatar_url %>"></img>
</div>
2023-08-02 18:37:47 -04:00
</div>
2023-08-03 03:06:43 -04:00
<div class="info-line">
2023-08-03 07:54:13 -04:00
<% if (!it.repo.empty) { %>
<div class="fact">
<p class="fact-heading"><%= prettyNumber(it.repo.commits_count) %></p>
<p class="fact-subtitle"><%= (it.repo.commits_count) != 1 ? 'Commits' : 'Commit' %></p>
</div>
2023-08-03 00:02:53 -04:00
<div class="fact">
2023-08-02 23:50:27 -04:00
<p class="fact-heading"><%= prettyNumber(it.repo.open_issues_count) %></p>
<p class="fact-subtitle"><%= (it.repo.open_issues_count) != 1 ? 'Issues' : 'Issue' %></p>
</div>
2023-08-03 00:02:53 -04:00
<div class="fact">
2023-08-02 23:50:27 -04:00
<p class="fact-heading"><%= prettyNumber(it.repo.stars_count) %></p>
<p class="fact-subtitle"><%= (it.repo.stars_count) != 1 ? 'Stars' : 'Star' %></p>
</div>
2023-08-03 00:02:53 -04:00
<div class="fact">
2023-08-02 23:50:27 -04:00
<p class="fact-heading"><%= prettyNumber(it.repo.forks_count) %></p>
<p class="fact-subtitle"><%= (it.repo.forks_count) != 1 ? 'Forks' : 'Fork' %></p>
</div>
2023-08-03 03:06:43 -04:00
<% } %>
<div class="fact">
<p class="fact-subtitle">Last updated</p>
<p class="fact-heading"><%= new Intl.DateTimeFormat('en-US', { dateStyle: 'long' }).format(new Date(it.repo.updated_at)) %></p>
2023-08-02 23:50:27 -04:00
</div>
2023-08-03 03:06:43 -04:00
</div>
2023-09-10 14:48:50 -04:00
</div>
<style>
.repo .title {
white-space: nowrap;
}
.repo .author {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 2.5rem;
font-weight: 600;
color: #aeb3d0;
}
.repo .author .username {
font-size: 1.75rem;
font-weight: 400;
color: #6d728f;
}
.repo .repo-name {
font-weight: 800;
font-size: 4.5rem;
line-height: 1.2em;
}
.fact {
display: flex;
margin-right: 0.5em;
font-size: 1.5rem;
flex-direction: column;
}
.fact-heading {
color: #8c91af;
font-size: 2rem;
font-weight: 600;
}
</style>