og/views/issue.eta
2023-12-21 08:21:50 -06:00

55 lines
1.6 KiB
Text

<% layout('layout') %>
<%
let title = it.issue.title
const titleCharLimit = 30
if (title.length > titleCharLimit) {
title = title.slice(0, titleCharLimit).trim() + '...'
}
%>
<div class="main issue">
<div class="contents">
<div class="info">
<p class="repo-name">@<%= it.issue.repository?.full_name || it.issue.base.repo.full_name %></p>
<p class="title"><span class="number">#<%= it.issue.number %></span><%= title %></p>
<% if (it.issue.body) { %>
<p class="description">
<%= it.issue.body %>
</p>
<% } %>
</div>
<div class="graphics">
<img width="120" height="120" src="<%= it.issue.user.avatar_url %>?size=120"></img>
</div>
</div>
<% if (it.prStats) { %>
<%~ include('partials/commit-stats.eta', {stats: it.prStats}) %>
<% } %>
<div class="info-line">
<img class="avatar" width="48" height="48" src="<%= it.issue.user.avatar_url %>?size=48"></img>
<p class="author"><%= it.issue.user.full_name || it.issue.user.login %></p>
<p>opened <%= new Intl.DateTimeFormat('en-US', { dateStyle: 'long' }).format(new Date(it.issue.created_at)) %></p>
<% if (it.issue.commits_count) { %>
<%~ include('icons/code-commit.eta') %>
<p><%= it.issue.commits_count != 1 ? `${it.issue.commits_count} commits` : `${it.issue.commits_count} commit` %></p>
<% } %>
<% if (it.issue.state != 'open') { %>
<p>·</p>
<p><%= it.issue.merged ? 'merged' : it.issue.state %></p>
<% } %>
</div>
</div>
<style>
.issue .title {
display: flex;
column-gap: 0.25em;
flex-wrap: wrap;
}
.issue .number {
font-weight: 400;
color: #6d728f;
}
.issue .repo-name {
font-size: 2.5rem;
color: #6d728f;
}
</style>