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

View File

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

View File

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