mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-28 17:50:28 +08:00
Add delegate badge to CommitAuthorship
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
@@ -129,7 +129,7 @@ describe("project commits", () => {
|
||||
});
|
||||
});
|
||||
|
||||
cy.get(".commit-teaser .badge").trigger("mouseenter");
|
||||
cy.get(".commit-teaser .badge").last().trigger("mouseenter");
|
||||
// Checking that the initial commit has the Verified badge
|
||||
cy.get(".popup .header").should(
|
||||
"have.text",
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
<script lang="ts">
|
||||
import type { CommitMetadata } from "@app/commit";
|
||||
|
||||
import Badge from "@app/Badge.svelte";
|
||||
import { formatTimestamp, gravatarURL } from "@app/utils";
|
||||
|
||||
export let commit: CommitMetadata;
|
||||
export let showTime = true;
|
||||
export let showAuthor = true;
|
||||
export let noTime = false;
|
||||
export let noAuthor = false;
|
||||
export let noDelegate = false;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.authorship {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
color: var(--color-foreground-5);
|
||||
padding: 0.125rem 0;
|
||||
}
|
||||
@@ -23,10 +27,6 @@
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
border-radius: var(--border-radius);
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
.authorship .avatar:not(:first-child) {
|
||||
margin-left: 0.125rem;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
@@ -43,44 +43,49 @@
|
||||
alt="avatar"
|
||||
src={gravatarURL(commit.header.committer.email)} />
|
||||
{#if commit.context?.committer}
|
||||
<span class="txt-bold committer verified-committer">
|
||||
<span class="txt-bold committer">
|
||||
{commit.context?.committer.peer.person.name}
|
||||
</span>
|
||||
<span> committed</span>
|
||||
{#if !noDelegate && commit.context?.committer.peer.delegate}
|
||||
<Badge variant="tertiary">delegate</Badge>
|
||||
{/if}
|
||||
<span>committed</span>
|
||||
{:else}
|
||||
<span class="desktop-inline committer">
|
||||
{commit.header.committer.name}
|
||||
</span>
|
||||
<span> committed</span>
|
||||
<span>committed</span>
|
||||
{/if}
|
||||
{:else}
|
||||
{#if showAuthor}
|
||||
{#if !noAuthor}
|
||||
<img
|
||||
class="avatar"
|
||||
alt="avatar"
|
||||
src={gravatarURL(commit.header.author.email)} />
|
||||
<span class="desktop-inline author">{commit.header.author.name}</span>
|
||||
<span> authored </span>
|
||||
<span>authored</span>
|
||||
{/if}
|
||||
<img
|
||||
class="avatar"
|
||||
alt="avatar"
|
||||
src={gravatarURL(commit.header.committer.email)} />
|
||||
{#if commit.context?.committer}
|
||||
<span class="txt-bold committer verified-committer">
|
||||
<span class="txt-bold committer">
|
||||
{commit.context?.committer.peer.person.name}
|
||||
</span>
|
||||
<span> committed</span>
|
||||
{#if !noDelegate && commit.context?.committer.peer.delegate}
|
||||
<Badge variant="tertiary">delegate</Badge>
|
||||
{/if}
|
||||
<span>committed</span>
|
||||
{:else}
|
||||
<span class="desktop-inline committer">
|
||||
{commit.header.committer.name}
|
||||
</span>
|
||||
<span> committed</span>
|
||||
<span>committed</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if showTime}
|
||||
<span> </span>
|
||||
<span class="desktop-inline txt-tiny time">
|
||||
{#if !noTime}
|
||||
<span class="desktop-inline">
|
||||
{formatTimestamp(commit.header.committerTime)}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
{commit.header.summary}
|
||||
</div>
|
||||
</div>
|
||||
<CommitAuthorship {commit} />
|
||||
<CommitAuthorship {commit} noDelegate />
|
||||
</div>
|
||||
<div class="column-right">
|
||||
{#if commit.context.committer}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
margin-top: 0.5rem;
|
||||
padding: 0.5rem 0;
|
||||
position: absolute;
|
||||
width: 14rem;
|
||||
min-width: 14rem;
|
||||
z-index: 99;
|
||||
}
|
||||
.header {
|
||||
@@ -73,7 +73,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="committer">
|
||||
<CommitAuthorship {commit} showAuthor={false} showTime={false} />
|
||||
<CommitAuthorship {commit} noAuthor noTime />
|
||||
{#if commit.context.committer}
|
||||
<div class="peer">
|
||||
{commit.context.committer.peer.id}
|
||||
|
||||
Reference in New Issue
Block a user