Show last commit on blobs

This commit is contained in:
Alexis Sellier
2021-06-14 14:54:31 +02:00
parent 77c1d0abef
commit a460b9352e
3 changed files with 25 additions and 6 deletions
+21 -2
View File
@@ -3,6 +3,7 @@
export let blob: Blob;
const lastCommit = blob.info.lastCommit;
const lines = (blob.content.match(/\n/g) || []).length;
const lineNumbers = Array(lines).fill(0).map((_, index) => (index + 1).toString());
</script>
@@ -12,7 +13,8 @@
display: flex;
height: 3rem;
align-items: center;
padding: 0 1rem;
justify-content: space-between;
padding: 0 0.5rem 0 1rem;
color: var(--color-foreground);
border-width: 1px 1px 0 1px;
border-color: var(--color-foreground-subtle);
@@ -25,6 +27,19 @@
font-weight: normal;
}
.last-commit {
padding: 0.5rem;
color: var(--color-secondary);
background-color: var(--color-secondary-background);
font-size: 0.75rem;
border-radius: 0.25rem;
}
.last-commit .hash {
font-weight: bold;
font-family: var(--font-family-monospace);
margin-right: 0.25rem;
}
.line-numbers {
color: var(--color-foreground-subtle);
font-family: var(--font-family-sans-serif);
@@ -56,10 +71,14 @@
<div>
<div class="file-source">
<header>
<div class="file-header" data-cy="file-header">
<div class="file-header">
<span class="file-name">
<span>{blob.path.split("/").join(" / ")}</span>
</span>
<div class="last-commit" title="{lastCommit.author.name}">
<span class="hash">{lastCommit.sha1.slice(0, 7)}</span>
{lastCommit.summary}
</div>
</div>
</header>
<div class="container">
+3 -3
View File
@@ -49,7 +49,7 @@
font-family: var(--font-family-monospace);
color: var(--color-secondary);
background-color: var(--color-secondary-background);
padding: 0.75rem;
padding: 0.5rem 0.75rem;
}
.anchor {
@@ -57,7 +57,7 @@
}
.anchor-widget {
display: flex;
padding: 0.75rem;
padding: 0.5rem 0.75rem;
border-radius: 0.25rem;
color: var(--color-tertiary);
background-color: var(--color-tertiary-background);
@@ -76,7 +76,7 @@
.stat {
font-family: var(--font-family-monospace);
padding: 0.75rem;
padding: 0.5rem 0.75rem;
background: var(--color-foreground-background);
}
+1 -1
View File
@@ -69,7 +69,7 @@ export interface Blob {
html?: boolean;
content: string;
path: string;
info: Info;
info: EntryInfo;
}
export async function getInfo(urn: string, config: Config): Promise<Info> {