mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
Allow commit selection in revisions only if more than one commit
This commit is contained in:
@@ -90,22 +90,26 @@
|
||||
.commit-dot.active {
|
||||
background-color: var(--color-border-focus);
|
||||
}
|
||||
.commit:hover .commit-dot:not(.active) {
|
||||
.commit:hover:not(.single-commit) .commit-dot:not(.active) {
|
||||
background-color: var(--color-foreground-contrast);
|
||||
}
|
||||
.commit:hover {
|
||||
.commit:hover:not(.single-commit) {
|
||||
background-color: var(--color-background-float);
|
||||
}
|
||||
.disabled {
|
||||
color: var(--color-foreground-disabled) !important;
|
||||
}
|
||||
.summary {
|
||||
cursor: pointer;
|
||||
padding: 0.25rem 0;
|
||||
}
|
||||
.summary:hover {
|
||||
.summary:hover:not(.single-commit) {
|
||||
background-color: var(--color-background-float);
|
||||
color: var(--color-foreground-contrast) !important;
|
||||
}
|
||||
.single-commit {
|
||||
cursor: default !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
@@ -144,13 +148,15 @@
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<div
|
||||
class="global-flex txt-small summary"
|
||||
class:single-commit={commits.length === 1}
|
||||
class:disabled={selectedCommit}
|
||||
style:cursor="pointer"
|
||||
onclick={() =>
|
||||
onclick={() => {
|
||||
if (commits.length === 1) return;
|
||||
selectRevision({
|
||||
headId: revision.head,
|
||||
baseId: revision.base,
|
||||
})}>
|
||||
});
|
||||
}}>
|
||||
<Icon name="branch" />
|
||||
{commits.length}
|
||||
{pluralize("commit", commits.length)} on base
|
||||
@@ -161,20 +167,26 @@
|
||||
</div>
|
||||
<div class="commits">
|
||||
{#each commits.reverse() as commit}
|
||||
<div class="commit" style:position="relative">
|
||||
<div
|
||||
class="commit"
|
||||
class:single-commit={commits.length === 1}
|
||||
style:position="relative">
|
||||
<div class="commit-dot"></div>
|
||||
<div
|
||||
class="commit-dot"
|
||||
class:active={isActiveCommit(commit.id)}>
|
||||
</div>
|
||||
<CobCommitTeaser
|
||||
hoverable={commits.length > 1}
|
||||
disabled={isTeaserDisabled(commit.id)}
|
||||
onclick={() =>
|
||||
onclick={() => {
|
||||
if (commits.length === 1) return;
|
||||
selectRevision({
|
||||
headId: commit.id,
|
||||
baseId: commit.parents[0],
|
||||
commitId: commit.id,
|
||||
})}
|
||||
});
|
||||
}}
|
||||
{commit} />
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
disabled: boolean;
|
||||
commit: Commit;
|
||||
onclick: () => void;
|
||||
hoverable?: boolean;
|
||||
}
|
||||
|
||||
const { disabled, commit, onclick }: Props = $props();
|
||||
const { disabled, hoverable = false, commit, onclick }: Props = $props();
|
||||
|
||||
let commitMessageVisible = $state(false);
|
||||
</script>
|
||||
@@ -67,9 +68,6 @@
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
@@ -77,7 +75,7 @@
|
||||
<div class="teaser" class:disabled {onclick} aria-label="commit-teaser">
|
||||
<div class="left">
|
||||
<div class="message">
|
||||
<div class="summary" use:twemoji>
|
||||
<div style:cursor={hoverable ? "pointer" : "default"} use:twemoji>
|
||||
<InlineTitle fontSize="small" content={commit.summary} />
|
||||
</div>
|
||||
{#if commit.message.trim() !== commit.summary.trim()}
|
||||
|
||||
Reference in New Issue
Block a user