mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-20 16:11:46 +03:00
Merge pull request #2810 from Caleb-T-Owens/Add-tooltip-to-show-full-commit-message
Add tooltip to show full commit message
This commit is contained in:
commit
1786a38cf3
@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import BranchFiles from './BranchFiles.svelte';
|
import BranchFiles from './BranchFiles.svelte';
|
||||||
import Button from '$lib/components/Button.svelte';
|
|
||||||
import Tag from '$lib/components/Tag.svelte';
|
import Tag from '$lib/components/Tag.svelte';
|
||||||
import TimeAgo from '$lib/components/TimeAgo.svelte';
|
import TimeAgo from '$lib/components/TimeAgo.svelte';
|
||||||
import { projectCurrentCommitMessage } from '$lib/config/config';
|
import { projectCurrentCommitMessage } from '$lib/config/config';
|
||||||
@ -39,6 +38,9 @@
|
|||||||
showFiles = !showFiles;
|
showFiles = !showFiles;
|
||||||
if (showFiles) loadFiles();
|
if (showFiles) loadFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isUndoable = isHeadCommit && !isUnapplied;
|
||||||
|
const hasCommitUrl = !commit.isLocal && commitUrl;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@ -49,11 +51,12 @@
|
|||||||
class:is-commit-open={showFiles}
|
class:is-commit-open={showFiles}
|
||||||
>
|
>
|
||||||
<div class="commit__header" on:click={onClick} on:keyup={onClick} role="button" tabindex="0">
|
<div class="commit__header" on:click={onClick} on:keyup={onClick} role="button" tabindex="0">
|
||||||
|
<div class="commit__message">
|
||||||
<div class="commit__row">
|
<div class="commit__row">
|
||||||
<span class="commit__description text-base-12 truncate">
|
<span class="commit__title text-semibold text-base-12" class:truncate={!showFiles}>
|
||||||
{commit.description}
|
{commit.descriptionTitle}
|
||||||
</span>
|
</span>
|
||||||
{#if isHeadCommit && !isUnapplied}
|
{#if isUndoable && !showFiles}
|
||||||
<Tag
|
<Tag
|
||||||
color="ghost"
|
color="ghost"
|
||||||
icon="undo-small"
|
icon="undo-small"
|
||||||
@ -67,6 +70,14 @@
|
|||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
{#if showFiles && commit.descriptionBody}
|
||||||
|
<div class="commit__row" transition:slide={{ duration: 100 }}>
|
||||||
|
<span class="commit__body text-base-body-12">
|
||||||
|
{commit.descriptionBody}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
<div class="commit__row">
|
<div class="commit__row">
|
||||||
<div class="commit__author">
|
<div class="commit__author">
|
||||||
<img
|
<img
|
||||||
@ -99,16 +110,32 @@
|
|||||||
readonly={true}
|
readonly={true}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if !commit.isLocal && commitUrl}
|
{#if hasCommitUrl || isUndoable}
|
||||||
<div class="files__footer">
|
<div class="files__footer">
|
||||||
<Button
|
{#if isUndoable}
|
||||||
color="neutral"
|
<Tag
|
||||||
kind="outlined"
|
color="ghost"
|
||||||
|
icon="undo-small"
|
||||||
|
border
|
||||||
|
clickable
|
||||||
|
on:click={(e) => {
|
||||||
|
currentCommitMessage.set(commit.description);
|
||||||
|
e.stopPropagation();
|
||||||
|
resetHeadCommit();
|
||||||
|
}}>Undo</Tag
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
{#if hasCommitUrl}
|
||||||
|
<Tag
|
||||||
|
color="ghost"
|
||||||
icon="open-link"
|
icon="open-link"
|
||||||
|
border
|
||||||
|
clickable
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (commitUrl) openExternalUrl(commitUrl);
|
if (commitUrl) openExternalUrl(commitUrl);
|
||||||
}}>Open commit</Button
|
}}>Open commit</Tag
|
||||||
>
|
>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@ -156,30 +183,48 @@
|
|||||||
background-color: color-mix(
|
background-color: color-mix(
|
||||||
in srgb,
|
in srgb,
|
||||||
var(--clr-theme-container-light),
|
var(--clr-theme-container-light),
|
||||||
var(--darken-tint-light)
|
var(--darken-tint-extralight)
|
||||||
);
|
);
|
||||||
|
|
||||||
& .commit__header {
|
& .commit__header {
|
||||||
padding-bottom: var(--space-16);
|
padding-bottom: var(--space-16);
|
||||||
|
border-bottom: 1px solid var(--clr-theme-container-outline-light);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: color-mix(
|
background-color: color-mix(
|
||||||
in srgb,
|
in srgb,
|
||||||
var(--clr-theme-container-light),
|
var(--clr-theme-container-light),
|
||||||
var(--darken-tint-mid)
|
var(--darken-tint-light)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .commit__message {
|
||||||
|
margin-bottom: var(--space-4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.commit__description {
|
.commit__message {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.commit__title {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--clr-theme-scale-ntrl-0);
|
color: var(--clr-theme-scale-ntrl-0);
|
||||||
line-height: 120%;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.commit__body {
|
||||||
|
flex: 1;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
color: var(--clr-theme-scale-ntrl-40);
|
||||||
|
white-space: pre-line;
|
||||||
|
}
|
||||||
|
|
||||||
.commit__row {
|
.commit__row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -214,7 +259,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.files__footer {
|
.files__footer {
|
||||||
text-align: right;
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: var(--space-8);
|
||||||
padding: var(--space-12);
|
padding: var(--space-12);
|
||||||
border-top: 1px solid var(--clr-theme-container-outline-light);
|
border-top: 1px solid var(--clr-theme-container-outline-light);
|
||||||
}
|
}
|
||||||
|
@ -115,9 +115,28 @@ export class Commit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get descriptionTitle(): string | undefined {
|
||||||
|
return this.descriptionLines[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
get descriptionBody(): string | undefined {
|
||||||
|
let sliceCount = 1;
|
||||||
|
|
||||||
|
// Remove a blank first line
|
||||||
|
if (this.descriptionLines[1] == '') {
|
||||||
|
sliceCount = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.descriptionLines.slice(sliceCount).join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
isParentOf(possibleChild: Commit) {
|
isParentOf(possibleChild: Commit) {
|
||||||
return possibleChild.parentIds.includes(this.id);
|
return possibleChild.parentIds.includes(this.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get descriptionLines() {
|
||||||
|
return this.description.split('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RemoteCommit {
|
export class RemoteCommit {
|
||||||
@ -130,6 +149,25 @@ export class RemoteCommit {
|
|||||||
get isLocal() {
|
get isLocal() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get descriptionTitle(): string | undefined {
|
||||||
|
return this.descriptionLines[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
get descriptionBody(): string | undefined {
|
||||||
|
let sliceCount = 1;
|
||||||
|
|
||||||
|
// Remove a blank first line
|
||||||
|
if (this.descriptionLines[1] == '') {
|
||||||
|
sliceCount = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.descriptionLines.slice(sliceCount).join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
private get descriptionLines() {
|
||||||
|
return this.description.split('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RemoteHunk {
|
export class RemoteHunk {
|
||||||
|
Loading…
Reference in New Issue
Block a user