From 6c0603813b3c91b1d74b0000139466145f99c661 Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Mon, 19 Feb 2024 12:40:38 +0000 Subject: [PATCH 1/8] Add tooltip to show full commit message --- gitbutler-ui/src/lib/components/CommitCard.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gitbutler-ui/src/lib/components/CommitCard.svelte b/gitbutler-ui/src/lib/components/CommitCard.svelte index 64fa27b8b..796436e3b 100644 --- a/gitbutler-ui/src/lib/components/CommitCard.svelte +++ b/gitbutler-ui/src/lib/components/CommitCard.svelte @@ -6,6 +6,7 @@ import { projectCurrentCommitMessage } from '$lib/config/config'; import { draggable } from '$lib/dragging/draggable'; import { draggableCommit, nonDraggable } from '$lib/dragging/draggables'; + import { tooltip } from '$lib/utils/tooltip'; import { openExternalUrl } from '$lib/utils/url'; import { Ownership } from '$lib/vbranches/ownership'; import { listRemoteCommitFiles } from '$lib/vbranches/remoteCommits'; @@ -50,7 +51,7 @@ >
- + {commit.description} {#if isHeadCommit && !isUnapplied} From 95b18f880682c9c92d9116781ea9b260f41b457a Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Mon, 19 Feb 2024 18:48:40 +0000 Subject: [PATCH 2/8] More changes With more lines --- gitbutler-ui/src/lib/components/CommitCard.svelte | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gitbutler-ui/src/lib/components/CommitCard.svelte b/gitbutler-ui/src/lib/components/CommitCard.svelte index 796436e3b..64fa27b8b 100644 --- a/gitbutler-ui/src/lib/components/CommitCard.svelte +++ b/gitbutler-ui/src/lib/components/CommitCard.svelte @@ -6,7 +6,6 @@ import { projectCurrentCommitMessage } from '$lib/config/config'; import { draggable } from '$lib/dragging/draggable'; import { draggableCommit, nonDraggable } from '$lib/dragging/draggables'; - import { tooltip } from '$lib/utils/tooltip'; import { openExternalUrl } from '$lib/utils/url'; import { Ownership } from '$lib/vbranches/ownership'; import { listRemoteCommitFiles } from '$lib/vbranches/remoteCommits'; @@ -51,7 +50,7 @@ >
- + {commit.description} {#if isHeadCommit && !isUnapplied} From adbebb93fd2c5c6ca5bc23378df08c7bb150a2d4 Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Mon, 19 Feb 2024 20:58:18 +0000 Subject: [PATCH 3/8] Updated styles and now pull title and body from commit methods Update styles Update title class Updated styles Refactor conditions --- .../src/lib/components/CommitCard.svelte | 73 ++++++++++++++----- gitbutler-ui/src/lib/vbranches/types.ts | 24 ++++++ 2 files changed, 77 insertions(+), 20 deletions(-) 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 { From 5b340f13017cbfe2316297f42196bd57c4424114 Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Mon, 19 Feb 2024 21:06:54 +0000 Subject: [PATCH 4/8] Update icon alignment, and author-name Fix linting errors --- .../src/lib/components/CommitCard.svelte | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/gitbutler-ui/src/lib/components/CommitCard.svelte b/gitbutler-ui/src/lib/components/CommitCard.svelte index 512df1986..171beb29e 100644 --- a/gitbutler-ui/src/lib/components/CommitCard.svelte +++ b/gitbutler-ui/src/lib/components/CommitCard.svelte @@ -40,8 +40,8 @@ if (showFiles) loadFiles(); } - const isUndoable = isHeadCommit && !isUnapplied; - const hasCommitUrl = !commit.isLocal && commitUrl; + const isUndoable = isHeadCommit && !isUnapplied; + const hasCommitUrl = !commit.isLocal && commitUrl;
{ currentCommitMessage.set(commit.description); e.stopPropagation(); @@ -162,7 +163,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: var(--clr-theme-container-pale); + background-color: var(--clr-theme-container-pale); } } @@ -182,7 +183,7 @@ & .commit__header { padding-bottom: var(--space-16); - border-bottom: 1px solid var(--clr-theme-container-outline-light); + border-bottom: 1px solid var(--clr-theme-container-outline-light); &:hover { background-color: color-mix( @@ -203,14 +204,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); - } + .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); @@ -236,7 +237,7 @@ .commit__time, .commit__author-name { - color: var(--clr-theme-scale-ntrl-40); + color: var(--clr-theme-scale-ntrl-50); } .files-container { From 7e2ef922dd02bf215fab22df7d1aa6fefada2413 Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Mon, 19 Feb 2024 21:55:58 +0000 Subject: [PATCH 5/8] Handle commit descriptions that start with just one new line rather than 2 --- gitbutler-ui/src/lib/vbranches/types.ts | 30 ++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/gitbutler-ui/src/lib/vbranches/types.ts b/gitbutler-ui/src/lib/vbranches/types.ts index f2001c6fa..c8f37c01d 100644 --- a/gitbutler-ui/src/lib/vbranches/types.ts +++ b/gitbutler-ui/src/lib/vbranches/types.ts @@ -116,19 +116,26 @@ export class Commit { } get descriptionTitle(): string | undefined { - return this.descriptionParagraphs[0]; + return this.descriptionLines[0]; } get descriptionBody(): string | undefined { - return this.descriptionParagraphs.slice(1).join('\n\n'); + let sliceCount = 1; + + // Remove a blank first line + if (this.descriptionLines[1] == '') { + sliceCount = 2; + } + + return this.descriptionLines.slice(sliceCount).join('\n'); } isParentOf(possibleChild: Commit) { return possibleChild.parentIds.includes(this.id); } - private get descriptionParagraphs() { - return this.description.split('\n\n'); + private get descriptionLines() { + return this.description.split('\n'); } } @@ -144,15 +151,22 @@ export class RemoteCommit { } get descriptionTitle(): string | undefined { - return this.descriptionParagraphs[0]; + return this.descriptionLines[0]; } get descriptionBody(): string | undefined { - return this.descriptionParagraphs.slice(1).join('\n\n'); + let sliceCount = 1; + + // Remove a blank first line + if (this.descriptionLines[1] == '') { + sliceCount = 2; + } + + return this.descriptionLines.slice(sliceCount).join('\n'); } - private get descriptionParagraphs() { - return this.description.split('\n\n'); + private get descriptionLines() { + return this.description.split('\n'); } } From dba7ebf89aa37bd93c4da670e98d69961dffc194 Mon Sep 17 00:00:00 2001 From: Pavel Laptev Date: Tue, 20 Feb 2024 01:49:52 +0100 Subject: [PATCH 6/8] ui: commit card styles update --- .../src/lib/components/CommitCard.svelte | 112 ++++++++++-------- 1 file changed, 63 insertions(+), 49 deletions(-) diff --git a/gitbutler-ui/src/lib/components/CommitCard.svelte b/gitbutler-ui/src/lib/components/CommitCard.svelte index 171beb29e..b964a2bae 100644 --- a/gitbutler-ui/src/lib/components/CommitCard.svelte +++ b/gitbutler-ui/src/lib/components/CommitCard.svelte @@ -52,32 +52,34 @@ class:is-commit-open={showFiles} >
-
- - {commit.descriptionTitle} - - {#if isUndoable && !showFiles} - { - currentCommitMessage.set(commit.description); - e.stopPropagation(); - resetHeadCommit(); - }}>Undo +
+
+ + {commit.descriptionTitle} + + {#if isUndoable && !showFiles} + { + currentCommitMessage.set(commit.description); + e.stopPropagation(); + resetHeadCommit(); + }}>Undo + {/if} +
+ {#if showFiles && commit.descriptionBody} +
+ + {commit.descriptionBody} + +
{/if}
- {#if showFiles && commit.descriptionBody} -
- - {commit.descriptionBody} - -
- {/if} -
+
{#if isUndoable} - Undo {/if} {#if hasCommitUrl} - Open commit {/if}
@@ -163,7 +165,11 @@ &:not(.is-commit-open):hover { border: 1px solid color-mix(in srgb, var(--clr-theme-container-outline-light), var(--darken-tint-mid)); - background-color: var(--clr-theme-container-pale); + background-color: color-mix( + in srgb, + var(--clr-theme-container-light), + var(--darken-tint-extralight) + ); } } @@ -178,7 +184,7 @@ background-color: color-mix( in srgb, var(--clr-theme-container-light), - var(--darken-tint-light) + var(--darken-tint-extralight) ); & .commit__header { @@ -189,29 +195,38 @@ background-color: color-mix( in srgb, var(--clr-theme-container-light), - var(--darken-tint-mid) + var(--darken-tint-light) ); } } + + & .commit__message { + margin-bottom: var(--space-4); + } + } + + .commit__message { + display: flex; + flex-direction: column; + gap: var(--space-6); } .commit__title { flex: 1; display: block; color: var(--clr-theme-scale-ntrl-0); - line-height: 120%; width: 100%; } + .commit__body { + flex: 1; + display: block; + width: 100%; + color: var(--clr-theme-scale-ntrl-40); + white-space: pre-line; + } + .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); @@ -245,11 +260,10 @@ } .files__footer { - text-align: right; display: flex; - gap: var(--space-16); + /* justify-content: flex-end; */ + gap: var(--space-8); padding: var(--space-12); border-top: 1px solid var(--clr-theme-container-outline-light); - background-color: var(--clr-theme-container-pale); } From 376cee414a31031f27741d3d6293377699eae59a Mon Sep 17 00:00:00 2001 From: Pavel Laptev Date: Tue, 20 Feb 2024 01:52:58 +0100 Subject: [PATCH 7/8] lint fix: unused component removed --- gitbutler-ui/src/lib/components/CommitCard.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/gitbutler-ui/src/lib/components/CommitCard.svelte b/gitbutler-ui/src/lib/components/CommitCard.svelte index b964a2bae..7004eadba 100644 --- a/gitbutler-ui/src/lib/components/CommitCard.svelte +++ b/gitbutler-ui/src/lib/components/CommitCard.svelte @@ -1,6 +1,5 @@