og/views/commit.eta
2023-08-03 06:53:49 -05:00

39 lines
1.4 KiB
Text

<% layout('layout') %>
<%
let title = it.commit.message.split('\n')[0]
let body = it.commit.message.split('\n').slice(1).join('\n').trim()
const titleCharLimit = 50
if (title.length > titleCharLimit) {
title = title.slice(0, titleCharLimit).trim() + '...'
}
%>
<div class="main commit">
<div class="contents">
<div class="info">
<p class="repo-name">@<%= it.commit.repository.full_name %></p>
<p class="title"><%= title %></p>
<% if (body) { %>
<p class="description">
<%= body %>
</p>
<% } %>
</div>
<div class="graphics">
<img width="120" height="120" src="<%= it.commit.committer.avatar_url %>?size=120"></img>
</div>
</div>
<div class="commit-stats info-line">
<p><%= it.commit.stats.total %> lines changed</p>
<p style="display: flex; gap: 0.25em; font-weight: 600;">
<span style="color: #53d37c;">+<%= it.commit.stats.additions %></span>
<span style="color: #d35353;">-<%= it.commit.stats.deletions %></span>
</p>
</div>
<div class="info-line">
<img class="avatar" width="48" height="48" src="<%= it.commit.committer.avatar_url %>?size=48"></img>
<p class="author"><%= it.commit.committer.full_name || it.commit.committer.login %></p>
<p>committed <%= new Intl.DateTimeFormat('en-US', { dateStyle: 'long' }).format(new Date(it.commit.created_at)) %></p>
<%~ include('icons/code-commit.eta') %>
<p><%= it.commit.sha.slice(0, 7) %></p>
</div>
</div>