diff --git a/gitbutler-ui/src/lib/components/CommitCard.svelte b/gitbutler-ui/src/lib/components/CommitCard.svelte index 64fa27b8b..512df1986 100644 --- a/gitbutler-ui/src/lib/components/CommitCard.svelte +++ b/gitbutler-ui/src/lib/components/CommitCard.svelte @@ -39,6 +39,9 @@ showFiles = !showFiles; if (showFiles) loadFiles(); } + + const isUndoable = isHeadCommit && !isUnapplied; + const hasCommitUrl = !commit.isLocal && commitUrl;
- - {commit.description} + + {commit.descriptionTitle} - {#if isHeadCommit && !isUnapplied} + {#if isUndoable && !showFiles} {/if}
-
+ {#if showFiles && commit.descriptionBody} +
+ + {commit.descriptionBody} + +
+ {/if} +
- {#if !commit.isLocal && commitUrl} + {#if hasCommitUrl || isUndoable} {/if}
@@ -137,11 +162,7 @@ &:not(.is-commit-open):hover { border: 1px solid color-mix(in srgb, var(--clr-theme-container-outline-light), var(--darken-tint-mid)); - background-color: color-mix( - in srgb, - var(--clr-theme-container-light), - var(--darken-tint-extralight) - ); + background-color: var(--clr-theme-container-pale); } } @@ -161,6 +182,7 @@ & .commit__header { padding-bottom: var(--space-16); + border-bottom: 1px solid var(--clr-theme-container-outline-light); &:hover { background-color: color-mix( @@ -172,7 +194,7 @@ } } - .commit__description { + .commit__title { flex: 1; display: block; color: var(--clr-theme-scale-ntrl-0); @@ -181,6 +203,14 @@ } .commit__row { + .commit__body { + flex: 1; + display: block; + color: var(--clr-theme-scale-ntrl-0); + line-height: 120%; + width: 100%; + color: var(--clr-theme-scale-ntrl-40); + } display: flex; align-items: center; gap: var(--space-8); @@ -206,7 +236,7 @@ .commit__time, .commit__author-name { - color: var(--clr-theme-scale-ntrl-50); + color: var(--clr-theme-scale-ntrl-40); } .files-container { @@ -215,7 +245,10 @@ .files__footer { text-align: right; + display: flex; + gap: var(--space-16); padding: var(--space-12); border-top: 1px solid var(--clr-theme-container-outline-light); + background-color: var(--clr-theme-container-pale); } diff --git a/gitbutler-ui/src/lib/vbranches/types.ts b/gitbutler-ui/src/lib/vbranches/types.ts index 10e281c50..f2001c6fa 100644 --- a/gitbutler-ui/src/lib/vbranches/types.ts +++ b/gitbutler-ui/src/lib/vbranches/types.ts @@ -115,9 +115,21 @@ export class Commit { } } + get descriptionTitle(): string | undefined { + return this.descriptionParagraphs[0]; + } + + get descriptionBody(): string | undefined { + return this.descriptionParagraphs.slice(1).join('\n\n'); + } + isParentOf(possibleChild: Commit) { return possibleChild.parentIds.includes(this.id); } + + private get descriptionParagraphs() { + return this.description.split('\n\n'); + } } export class RemoteCommit { @@ -130,6 +142,18 @@ export class RemoteCommit { get isLocal() { return false; } + + get descriptionTitle(): string | undefined { + return this.descriptionParagraphs[0]; + } + + get descriptionBody(): string | undefined { + return this.descriptionParagraphs.slice(1).join('\n\n'); + } + + private get descriptionParagraphs() { + return this.description.split('\n\n'); + } } export class RemoteHunk {