mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Co-authored-by: Rūdolfs Ošiņš <rudolfs@osins.org> Signed-off-by: xphoniex <dj.2dixx@gmail.com> Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
112 lines
2.7 KiB
Svelte
112 lines
2.7 KiB
Svelte
<script lang="ts" strictEvents>
|
|
import type { CommitMetadata } from "@app/lib/commit";
|
|
import { formatCommit, twemoji } from "@app/lib/utils";
|
|
import { createEventDispatcher } from "svelte";
|
|
|
|
import Icon from "@app/components/Icon.svelte";
|
|
import CommitAuthorship from "./CommitAuthorship.svelte";
|
|
import CommitVerifiedBadge from "./CommitVerifiedBadge.svelte";
|
|
|
|
export let commit: CommitMetadata;
|
|
|
|
const dispatch = createEventDispatcher<{ browseCommit: string }>();
|
|
|
|
function browseCommit(commit: string) {
|
|
dispatch("browseCommit", commit);
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.hash {
|
|
font-family: var(--font-family-monospace);
|
|
font-size: var(--font-size-tiny);
|
|
padding: 0 1.5rem;
|
|
}
|
|
.commit-teaser {
|
|
background-color: var(--color-foreground-1);
|
|
padding: 0.75rem 0rem;
|
|
}
|
|
.commit-teaser:hover {
|
|
background-color: var(--color-foreground-2);
|
|
}
|
|
.commit-teaser:first-child {
|
|
border-top-left-radius: var(--border-radius-small);
|
|
border-top-right-radius: var(--border-radius-small);
|
|
}
|
|
.commit-teaser:last-child {
|
|
border-bottom-left-radius: var(--border-radius-small);
|
|
border-bottom-right-radius: var(--border-radius-small);
|
|
}
|
|
.commit-teaser {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.column-left {
|
|
padding-left: 1rem;
|
|
flex: min-content;
|
|
}
|
|
.commit-teaser .column-right {
|
|
display: flex;
|
|
align-items: center;
|
|
padding-right: 1.5rem;
|
|
}
|
|
.summary {
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
padding-right: 1rem;
|
|
}
|
|
.browse {
|
|
display: flex;
|
|
z-index: 10;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
@media (max-width: 720px) {
|
|
.hash {
|
|
padding-right: 0;
|
|
}
|
|
.column-left {
|
|
overflow: hidden;
|
|
}
|
|
.browse {
|
|
display: none !important;
|
|
}
|
|
.summary {
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
padding-right: 1rem;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<div class="commit-teaser">
|
|
<div class="column-left">
|
|
<div class="header">
|
|
<div class="summary" use:twemoji>
|
|
{commit.header.summary}
|
|
</div>
|
|
</div>
|
|
<CommitAuthorship {commit} noDelegate />
|
|
</div>
|
|
<div class="column-right">
|
|
{#if !window.HEARTWOOD && commit.context.committer}
|
|
<div class="layout-desktop">
|
|
<CommitVerifiedBadge {commit} />
|
|
</div>
|
|
{/if}
|
|
<span class="hash txt-highlight">{formatCommit(commit.header.sha1)}</span>
|
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
<div
|
|
class="browse"
|
|
title="Browse the repository at this point in the history"
|
|
on:click|stopPropagation={() => browseCommit(commit.header.sha1)}>
|
|
<Icon name="browse" />
|
|
</div>
|
|
</div>
|
|
</div>
|