fix: StackingSeriesHeader merge conflicts

Discard changes to apps/desktop/src/lib/branch/BranchLabel.svelte
This commit is contained in:
Nico Domino 2024-10-30 17:13:43 +01:00
parent 3884c96ddf
commit b4bdbdcfb6
3 changed files with 54 additions and 37 deletions

View File

@ -10,7 +10,7 @@
onDblClick?: () => void; onDblClick?: () => void;
} }
let { name, disabled = false, onChange }: Props = $props(); let { name, disabled = false, readonly = false, onChange, onDblClick }: Props = $props();
let inputEl: HTMLInputElement; let inputEl: HTMLInputElement;
let initialName = name; let initialName = name;
@ -28,12 +28,18 @@
<input <input
type="text" type="text"
{disabled} {disabled}
{readonly}
bind:this={inputEl} bind:this={inputEl}
bind:value={name} bind:value={name}
onchange={(e) => onChange?.(e.currentTarget.value.trim())} onchange={(e) => onChange?.(e.currentTarget.value.trim())}
title={name} title={name}
class="branch-name-input text-14 text-bold" class="branch-name-input text-14 text-bold"
ondblclick={(e) => e.stopPropagation()} ondblclick={(e) => {
e.stopPropagation();
if (readonly) {
onDblClick?.();
}
}}
oncontextmenu={(e) => { oncontextmenu={(e) => {
e.stopPropagation(); e.stopPropagation();
}} }}
@ -93,14 +99,18 @@
outline: none; outline: none;
/* not readonly */ /* not readonly */
&:not([disabled]):hover { &:not([readonly]):not([disabled]):hover {
background-color: var(--clr-bg-2); background-color: var(--clr-bg-2);
} }
&:not([disabled]):focus { &:not([readonly]):not([disabled]):focus {
outline: none; outline: none;
background-color: var(--clr-bg-2); background-color: var(--clr-bg-2);
border-color: var(--clr-border-2); border-color: var(--clr-border-2);
} }
} }
.branch-name-input[readonly] {
pointer: normal;
user-select: none;
}
</style> </style>

View File

@ -2,6 +2,7 @@
import BranchLabel from './BranchLabel.svelte'; import BranchLabel from './BranchLabel.svelte';
import Dropzones from './Dropzones.svelte'; import Dropzones from './Dropzones.svelte';
import StackingAddSeriesModal from './StackingAddSeriesModal.svelte'; import StackingAddSeriesModal from './StackingAddSeriesModal.svelte';
import StackingSeriesDescription from './StackingSeriesDescription.svelte';
import StackingStatusIcon from './StackingStatusIcon.svelte'; import StackingStatusIcon from './StackingStatusIcon.svelte';
import { getColorFromBranchType } from './stackingUtils'; import { getColorFromBranchType } from './stackingUtils';
import { PromptService } from '$lib/ai/promptService'; import { PromptService } from '$lib/ai/promptService';
@ -173,7 +174,7 @@
{branchType} {branchType}
/> />
<div role="article" class="branch-header" tabindex="-1" oncontextmenu={(e) => e.preventDefault()}> <div role="article" class="branch-header" oncontextmenu={(e) => e.preventDefault()}>
<Dropzones type="commit"> <Dropzones type="commit">
<PopoverActionsContainer class="branch-actions-menu" stayOpen={contextMenuOpened}> <PopoverActionsContainer class="branch-actions-menu" stayOpen={contextMenuOpened}>
{#if $stackingFeatureMultipleSeries} {#if $stackingFeatureMultipleSeries}
@ -214,29 +215,7 @@
color={lineColor} color={lineColor}
lineBottom={currentSeries.patches.length > 0 || branch.series.length > 1} lineBottom={currentSeries.patches.length > 0 || branch.series.length > 1}
/> />
<div class="text-14 text-bold branch-info__name"> <div class="branch-info__content">
<span class:no-upstream={!forgeBranch} class="remote-name">
{$baseBranch.pushRemoteName ? `${$baseBranch.pushRemoteName} /` : 'origin /'}
</span>
<BranchLabel
name={currentSeries.name}
onChange={(name) => editTitle(name)}
readonly={!!forgeBranch}
onDblClick={() => {
if (branchType !== 'integrated') {
stackingContextMenu?.showSeriesRenameModal?.();
}
}}
/>
</div>
</div>
{#if descriptionVisible}
<div class="branch-info__description">
<div class="branch-action__line" style:--bg-color={lineColor}></div>
<BranchLabel
name={branch.description}
onChange={(description) => editDescription(description)}
/>
<div class="text-14 text-bold branch-info__name"> <div class="text-14 text-bold branch-info__name">
<span class:no-upstream={!forgeBranch} class="remote-name"> <span class:no-upstream={!forgeBranch} class="remote-name">
{$baseBranch.pushRemoteName ? `${$baseBranch.pushRemoteName} /` : 'origin /'} {$baseBranch.pushRemoteName ? `${$baseBranch.pushRemoteName} /` : 'origin /'}
@ -244,11 +223,27 @@
<BranchLabel <BranchLabel
name={currentSeries.name} name={currentSeries.name}
onChange={(name) => editTitle(name)} onChange={(name) => editTitle(name)}
disabled={!!forgeBranch} readonly={!!forgeBranch}
onDblClick={() => {
if (branchType !== 'integrated') {
stackingContextMenu?.showSeriesRenameModal?.();
}
}}
/> />
</div> </div>
{#if descriptionVisible}
<div class="branch-info__description">
<div class="branch-action__line" style:--bg-color={lineColor}></div>
<StackingSeriesDescription
bind:textAreaEl={seriesDescriptionEl}
value={currentSeries.description ?? ''}
onBlur={(value) => editDescription(value)}
onEmpty={() => toggleDescription()}
/>
</div>
{/if}
</div> </div>
{/if} </div>
{#if ($prService && !hasNoCommits) || showCreateCloudBranch} {#if ($prService && !hasNoCommits) || showCreateCloudBranch}
<div class="branch-action"> <div class="branch-action">
<div class="branch-action__line" style:--bg-color={lineColor}></div> <div class="branch-action__line" style:--bg-color={lineColor}></div>
@ -266,7 +261,7 @@
style="ghost" style="ghost"
wide wide
outline outline
disabled={currentSeries.patches.length === 0 || !forge || !$prService} disabled={currentSeries.patches.length === 0 || !$forge || !$prService}
onclick={() => handleOpenPR(!forgeBranch)} onclick={() => handleOpenPR(!forgeBranch)}
> >
Create pull request Create pull request
@ -277,19 +272,22 @@
{#if showCreateCloudBranch} {#if showCreateCloudBranch}
<Button <Button
style="ghost" style="ghost"
wide
outline outline
disabled={currentSeries.patches.length === 0 || !$forge || !$prService} disabled={branch.commits.length === 0}
onclick={() => { onclick={() => {
cloudBranchCreationService.createBranch(branch.id); cloudBranchCreationService.createBranch(branch.id);
}} }}>Publish Branch</Button
> >
Create pull request
</Button>
{/if} {/if}
</div> </div>
</div> </div>
{/if} {/if}
{#if $pr}
<PrDetailsModal bind:this={prDetailsModal} type="display" pr={$pr} />
{:else}
<PrDetailsModal bind:this={prDetailsModal} type="preview-series" {currentSeries} />
{/if}
</Dropzones> </Dropzones>
</div> </div>
@ -333,6 +331,15 @@
flex-grow: 1; flex-grow: 1;
} }
.branch-info__content {
flex: 1;
width: 100%;
display: flex;
flex-direction: column;
gap: 6px;
padding: 14px 0;
}
.branch-action { .branch-action {
width: 100%; width: 100%;
display: flex; display: flex;

View File

@ -12,7 +12,7 @@
maxRows?: number; maxRows?: number;
autofocus?: boolean; autofocus?: boolean;
class?: string; class?: string;
flex: string; flex?: string;
padding?: { padding?: {
top: number; top: number;
right: number; right: number;