srctree

Gregory Mullen parent 0dca4970 aa047f31
make blame a bit prettyer

src/endpoints/repos.zig added: 41, removed: 18, total 23
@@ -540,19 +540,16 @@ fn wrapLineNumbersBlame(
) ![]S.BlameLines {
const b_lines = try a.alloc(S.BlameLines, blames.len);
for (blames, b_lines, 0..) |src, *dst, i| {
const b = allocPrint(a, "#L{}", .{i + 1}) catch unreachable;
const bcommit = map.get(src.sha) orelse unreachable;
dst.* = .{
.repo_name = repo_name,
.sha = bcommit.sha[0..8],
.author = Bleach.sanitizeAlloc(a, bcommit.author.name, .{}) catch unreachable,
.author_email = .{
.author = Bleach.sanitizeAlloc(a, bcommit.author.name, .{}) catch unreachable,
.email = Bleach.sanitizeAlloc(a, bcommit.author.email, .{}) catch unreachable,
},
.time = try Humanize.unix(bcommit.author.timestamp).printAlloc(a),
.num = b[2..],
.id = b[1..],
.href = b,
.num = i + 1,
.line = src.line,
};
}
 
static/main.css added: 41, removed: 18, total 23
@@ -40,7 +40,6 @@ h1,h2,h3 { margin: 0 }
color: #bbb;
font-family: 'Titillium Web', sans-serif;
font-size: 80%;
margin: 6px 0 0;
}
 
header {
@@ -74,8 +73,14 @@ content {
display: block;
margin: auto;
text-align: center;
max-width: 1050px;
width: fit-content;
&.mw{
width: 1050px;
}
 
header {
max-width: none;
}
h3 { text-align: left; }
&.diff {
display: flex;
@@ -113,11 +118,18 @@ code {
display: inline-block;
font-family: "Ubuntu Mono", monospace, sans-serif;
text-align: left;
white-space: pre;
width: 100%;
.blame-line {
display: block;
.blame-header {
color: #aaa;
a {
color: #aaa;
}
.muted {
color: #888;
}
display: inline-block;
sha {
width: 5em;
display: inline-block;
@@ -126,18 +138,25 @@ code {
width: 8em;
display: inline-block;
}
time {
width: 6.6em;
display: inline-block;
text-align: right;
}
}
}
 
ln {
width: 100%;
white-space: pre;
display: inline-block;
&:before {
content: attr(num);
width: 3em;
display: inline-block;
}
&:target { background-color: #222; }
&:target {
background-color: #222;
}
}
}
 
 
templates/blame.html added: 41, removed: 18, total 23
@@ -11,7 +11,14 @@
<header><Filename></header>
<div class="code-block">
<code>
<For BlameLines><span class="blame-line"><span class="blame-header"><a href="/repo/<RepoName>/commit/<Sha>"><Sha>&nbsp;</a><author><With AuthorEmail><a href="/user?user=<Email>"></With><Author></a></author><time><Time ORNULL></time></span><ln num="<Num>" id="<Id>" href="<Href>"><Line></ln></span></For>
<For BlameLines><span class="blame-line">
<span class="blame-header">
<time><Time ORNULL></time>
<a href="/repo/<RepoName>/commit/<Sha>"><Sha>&nbsp;</a>
<With AuthorEmail><author class="muted"><a href="/user?user=<Email>"><Author></a></author></With>
</span>
<ln num="<Num type=usize >" id="L<Num type=usize >" href="#L<Num type=usize >"><Line></ln>
</span></For>
</code>
</div>
</blob>
 
templates/repos.html added: 41, removed: 18, total 23
@@ -6,7 +6,7 @@
</head>
<body>
<_body_header.html>
<content>
<content class="mw">
<With Buttons><Buttons></With>
<repos>
<For RepoList>
 
templates/user_commits.html added: 41, removed: 18, total 23
@@ -6,7 +6,7 @@
</head>
<body>
<_body_header.html>
<content>
<content class="mw">
<h3><TotalHits> commits across <CheckedRepos> repos!</h3>
<div class="commit-flex">
<!--For Flexes_-->