Make RID on repo cards copyable

This commit is contained in:
Rūdolfs Ošiņš
2025-02-14 09:05:29 +01:00
committed by Sebastian Martinez
parent b6501604e0
commit 46d1c2177d
2 changed files with 11 additions and 11 deletions
+4 -2
View File
@@ -13,6 +13,7 @@
export let style: "oid" | "commit" | "none" = "oid";
export let ariaLabel: string | undefined = undefined;
export let styleWidth: string | undefined = undefined;
export let title: string | undefined = undefined;
let icon: ComponentProps<Icon>["name"] = "clipboard";
const text = "Click to copy";
@@ -72,9 +73,10 @@
}
</style>
<div class="container" style:width={styleWidth}>
<div class="container" style:width={styleWidth} {title}>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
style:display="flex"
on:mouseenter={() => {
setVisible(true);
}}
@@ -84,7 +86,7 @@
class="target-{style} global-{style}"
style:cursor="copy"
aria-label={ariaLabel}
on:click={async () => {
on:click|preventDefault|stopPropagation={async () => {
await copy();
setVisible(true);
}}
+7 -9
View File
@@ -14,6 +14,7 @@
import ActivityDiagram from "@app/components/ActivityDiagram.svelte";
import Badge from "@app/components/Badge.svelte";
import Icon from "@app/components/Icon.svelte";
import Id from "@app/components/Id.svelte";
import Link from "@app/components/Link.svelte";
export let compact = false;
@@ -39,7 +40,6 @@
display: flex;
flex-direction: column;
justify-content: space-between;
overflow: hidden;
}
.repo-card.compact {
@@ -132,12 +132,6 @@
align-items: center;
white-space: nowrap;
}
.rid {
font-family: var(--font-family-monospace);
margin-left: auto;
color: var(--color-foreground-emphasized);
}
</style>
<Link
@@ -195,8 +189,12 @@
· Updated {formatTimestamp(commit.committer.time)}
</span>
{/await}
<span class="rid" title={repo.rid}>
{formatRepositoryId(repo.rid)}
<span class="global-flex-item" style:margin-left="auto">
<Id id={repo.rid} title={repo.rid}>
<span style:font-size="var(--font-size-tiny)">
{formatRepositoryId(repo.rid)}
</span>
</Id>
</span>
</div>
</div>