Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sequence count to branches. Design variant #2 #5344

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions apps/desktop/src/lib/branch/StackingSeriesHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
interface Props {
currentSeries: PatchSeries;
isTopSeries: boolean;
sequenceId: number;
seqenceAmount: number;
}

const { currentSeries, isTopSeries }: Props = $props();
const { currentSeries, isTopSeries, sequenceId, seqenceAmount }: Props = $props();

let descriptionVisible = $state(false);

Expand Down Expand Up @@ -193,10 +195,13 @@

<div class="branch-info">
<StackingStatusIcon
{branchType}
lineTop={isTopSeries ? false : true}
icon={branchType === 'integrated' ? 'tick-small' : 'remote-branch-small'}
iconColor="var(--clr-core-ntrl-100)"
color={lineColor}
{sequenceId}
{seqenceAmount}
lineBottom={currentSeries.patches.length > 0 || branch.series.length > 1}
/>
<div class="text-14 text-bold branch-info__name">
Expand Down Expand Up @@ -258,11 +263,6 @@
</div>
{/if}

<div class="branch-action">
<div class="branch-action__line" style:--bg-color={lineColor}></div>
<div class="branch-action__body"></div>
</div>

{#if $pr}
<PrDetailsModal bind:this={prDetailsModal} type="display" pr={$pr} />
{:else}
Expand Down Expand Up @@ -343,7 +343,7 @@

.branch-action__line {
min-width: 2px;
margin: 0 20px;
margin: var(--lines-inner-margin);
background-color: var(--bg-color, var(--clr-border-3));
}
</style>
74 changes: 65 additions & 9 deletions apps/desktop/src/lib/branch/StackingStatusIcon.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script lang="ts">
import { type CommitStatus } from '$lib/vbranches/types';
import Icon from '@gitbutler/ui/Icon.svelte';
import Tooltip from '@gitbutler/ui/Tooltip.svelte';

const FALLBACK_COLOR = 'var(--clr-scale-ntrl-80)';

Expand All @@ -9,25 +11,55 @@
color?: string;
lineTop?: boolean;
lineBottom?: boolean;
sequenceId: number;
seqenceAmount: number;
branchType: CommitStatus;
}

const {
icon,
iconColor,
color = FALLBACK_COLOR,
lineTop = true,
lineBottom = true
lineBottom = true,
sequenceId,
seqenceAmount,
branchType
}: Props = $props();

function branchNameType() {
console.log(branchType);
if (branchType === 'integrated') {
return 'Integrated branch';
} else if (branchType === 'localAndRemote') {
return 'Remote branch';
} else {
return 'Local branch';
}
}
</script>

<div class="stack__status gap">
<div class="stack__status gap" class:small-sequence-label={seqenceAmount >= 10}>
<div
class="stack__status--bar"
style:--bg-color={lineTop ? color : 'var(--clr-transparent)'}
></div>
<div class="stack__status--icon" style:--bg-color={color} style:--icon-color={iconColor}>
<Icon name={icon} />
</div>

<Tooltip
text={seqenceAmount > 1
? `${branchNameType()} ${sequenceId} of ${seqenceAmount}`
: branchNameType()}
>
<div class="stack__status--icon" style:--bg-color={color} style:--icon-color={iconColor}>
{#if seqenceAmount > 1}
<span class="text-9 text-semibold stack__status--sequence-label"
>{sequenceId}/{seqenceAmount}</span
>
{:else}
<Icon name={icon} />
{/if}
</div>
</Tooltip>
<div
class="stack__status--bar"
style:--bg-color={lineBottom ? color : 'var(--clr-transparent)'}
Expand All @@ -47,18 +79,42 @@
display: flex;
align-items: center;
justify-content: center;
width: 20px;
height: 24px;
margin-left: -2px;
min-width: 20px;
max-width: 24px;
padding: 3px 2px;
border-radius: var(--radius-m);
background-color: var(--bg-color);
color: var(--icon-color, var(--clr-text-1));
}

& .stack__status--bar {
width: 2px;
height: 10px;
margin: 0 20px;
height: 9px;
margin: var(--lines-inner-margin);
background: var(--bg-color);
}

& .stack__status--sequence-label {
padding: 2px 3px 3px;
text-align: center;
line-height: 1;
}

/* MODIFIER */

&.small-sequence-label {
margin-right: 4px;

& .stack__status--icon {
margin-left: 4px;
max-width: none;
width: 30px;
}

& .stack__status--sequence-label {
padding: 3px;
}
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
& .accordion-row__line {
position: relative;
width: 2px;
margin: 0 20px;
margin: var(--lines-inner-margin);
background-color: var(--clr-commit-upstream);
--dots-y-shift: -8px;

Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/lib/stack/StackCurrentSeries.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

<style>
.branch-group {
--lines-inner-margin: 0 22px 0 20px;
border: 1px solid var(--clr-border-2);
border-radius: var(--radius-m);
background: var(--clr-bg-1);
Expand Down
7 changes: 6 additions & 1 deletion apps/desktop/src/lib/stack/StackSeries.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
<StackSeriesDividerLine {currentSeries} />
{/if}
<StackCurrentSeries {currentSeries}>
<StackingSeriesHeader {currentSeries} {isTopSeries} />
<StackingSeriesHeader
{currentSeries}
{isTopSeries}
sequenceId={branch.series.length - idx}
seqenceAmount={branch.series.length}
/>

{#if currentSeries.upstreamPatches.length === 0 && currentSeries.patches.length === 0}
<div class="branch-emptystate">
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/lib/commitLinesStacking/Cell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
<style lang="postcss">
.commit-line {
width: 2px;
margin: 0 20px;
margin: var(--lines-inner-margin);
}
</style>
Loading