mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-25 18:49:11 +03:00
fix: rm 'create branch'/'push ref' btns from stacking commit card
This commit is contained in:
parent
ebcfa9f9a0
commit
95767ab474
@ -39,17 +39,16 @@
|
|||||||
let prDetailsModal = $state<ReturnType<typeof PrDetailsModal>>();
|
let prDetailsModal = $state<ReturnType<typeof PrDetailsModal>>();
|
||||||
let meatballButtonEl = $state<HTMLDivElement>();
|
let meatballButtonEl = $state<HTMLDivElement>();
|
||||||
|
|
||||||
|
// TODO: Simplify figuring out if shadow color is needed
|
||||||
const currentSeries = $derived(branch.series?.find((series) => series.name === upstreamName));
|
const currentSeries = $derived(branch.series?.find((series) => series.name === upstreamName));
|
||||||
const topPatch = $derived(currentSeries?.patches[0]);
|
const topPatch = $derived(currentSeries?.patches[0]);
|
||||||
const hasShadow = $derived.by(() => {
|
const hasShadow = $derived.by(() => {
|
||||||
if (!topPatch || !topPatch.remoteCommitId) return false;
|
if (!topPatch || !topPatch.remoteCommitId) return false;
|
||||||
|
|
||||||
if (topPatch.remoteCommitId !== topPatch.id) return true;
|
if (topPatch.remoteCommitId !== topPatch.id) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
const branchColorType = $derived<CommitStatus | 'localAndShadow'>(
|
const branchColorType = $derived<CommitStatus | 'localAndShadow'>(
|
||||||
hasShadow ? 'localAndShadow' : (topPatch?.status ?? 'local')
|
hasShadow ? 'localAndShadow' : topPatch?.status ?? 'local'
|
||||||
);
|
);
|
||||||
const lineColor = $derived(getColorFromBranchType(branchColorType));
|
const lineColor = $derived(getColorFromBranchType(branchColorType));
|
||||||
|
|
||||||
@ -154,6 +153,7 @@
|
|||||||
border-bottom: 1px solid var(--clr-border-2);
|
border-bottom: 1px solid var(--clr-border-2);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.branch-info {
|
.branch-info {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import type { CellType } from '@gitbutler/ui/commitLinesStacking/types';
|
||||||
|
|
||||||
const colorMap = {
|
const colorMap = {
|
||||||
local: 'var(--clr-commit-local)',
|
local: 'var(--clr-commit-local)',
|
||||||
localAndRemote: 'var(--clr-commit-remote)',
|
localAndRemote: 'var(--clr-commit-remote)',
|
||||||
@ -6,6 +8,6 @@ const colorMap = {
|
|||||||
integrated: 'var(--clr-commit-integrated)'
|
integrated: 'var(--clr-commit-integrated)'
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getColorFromBranchType(type: keyof typeof colorMap): string {
|
export function getColorFromBranchType(type: CellType): string {
|
||||||
return colorMap[type];
|
return colorMap[type];
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,8 @@
|
|||||||
import { DraggableCommit, nonDraggable } from '$lib/dragging/draggables';
|
import { DraggableCommit, nonDraggable } from '$lib/dragging/draggables';
|
||||||
import BranchFilesList from '$lib/file/BranchFilesList.svelte';
|
import BranchFilesList from '$lib/file/BranchFilesList.svelte';
|
||||||
import { ModeService } from '$lib/modes/service';
|
import { ModeService } from '$lib/modes/service';
|
||||||
import TextBox from '$lib/shared/TextBox.svelte';
|
|
||||||
import { copyToClipboard } from '$lib/utils/clipboard';
|
import { copyToClipboard } from '$lib/utils/clipboard';
|
||||||
import { getContext, getContextStore, maybeGetContext } from '$lib/utils/context';
|
import { getContext, getContextStore, maybeGetContext } from '$lib/utils/context';
|
||||||
import { error } from '$lib/utils/toasts';
|
|
||||||
import { openExternalUrl } from '$lib/utils/url';
|
import { openExternalUrl } from '$lib/utils/url';
|
||||||
import { BranchController } from '$lib/vbranches/branchController';
|
import { BranchController } from '$lib/vbranches/branchController';
|
||||||
import { createCommitStore } from '$lib/vbranches/contexts';
|
import { createCommitStore } from '$lib/vbranches/contexts';
|
||||||
@ -103,24 +101,6 @@
|
|||||||
let commitMessageValid = $state(false);
|
let commitMessageValid = $state(false);
|
||||||
let description = $state('');
|
let description = $state('');
|
||||||
|
|
||||||
let createRefModal: Modal;
|
|
||||||
let createRefName: string | undefined = $state();
|
|
||||||
let createRefTargetCommit: DetailedCommit | Commit | undefined;
|
|
||||||
|
|
||||||
function openCreateRefModal(e: Event) {
|
|
||||||
e.stopPropagation();
|
|
||||||
if (createRefTargetCommit) {
|
|
||||||
createRefModal.show(createRefTargetCommit);
|
|
||||||
}
|
|
||||||
createRefTargetCommit = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushCommitRef(commit: DetailedCommit) {
|
|
||||||
if (branch && commit.remoteRef) {
|
|
||||||
branchController.pushChangeReference(branch.id, commit.remoteRef);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function openCommitMessageModal(e: Event) {
|
function openCommitMessageModal(e: Event) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
@ -180,36 +160,6 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Modal
|
|
||||||
bind:this={createRefModal}
|
|
||||||
title="Add branch to the stack"
|
|
||||||
width="small"
|
|
||||||
onSubmit={() => {
|
|
||||||
if (!createRefName) {
|
|
||||||
error('No branch name provided');
|
|
||||||
createRefModal.close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!branch) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
branchController.createPatchSeries(
|
|
||||||
branch.id,
|
|
||||||
createRefName,
|
|
||||||
commit.changeId ? { ChangeId: commit.changeId } : { CommitId: commit.id }
|
|
||||||
);
|
|
||||||
createRefModal.close();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{#snippet children()}
|
|
||||||
<TextBox placeholder="New branch name" id="newRemoteName" bind:value={createRefName} focus />
|
|
||||||
{/snippet}
|
|
||||||
{#snippet controls(close)}
|
|
||||||
<Button style="ghost" outline type="reset" onclick={close}>Cancel</Button>
|
|
||||||
<Button style="pop" kind="solid">Ok</Button>
|
|
||||||
{/snippet}
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
{#if draggableCommitElement}
|
{#if draggableCommitElement}
|
||||||
<CommitContextMenu
|
<CommitContextMenu
|
||||||
bind:this={contextMenu}
|
bind:this={contextMenu}
|
||||||
@ -401,31 +351,6 @@
|
|||||||
icon="edit-small"
|
icon="edit-small"
|
||||||
onclick={openCommitMessageModal}>Edit message</Button
|
onclick={openCommitMessageModal}>Edit message</Button
|
||||||
>
|
>
|
||||||
{#if commit instanceof DetailedCommit && !commit.remoteRef}
|
|
||||||
<Button
|
|
||||||
size="tag"
|
|
||||||
style="ghost"
|
|
||||||
outline
|
|
||||||
icon="virtual-branch-small"
|
|
||||||
onclick={(e: Event) => {
|
|
||||||
createRefTargetCommit = commit;
|
|
||||||
openCreateRefModal(e);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Add branch
|
|
||||||
</Button>
|
|
||||||
{/if}
|
|
||||||
{#if commit instanceof DetailedCommit && commit.remoteRef}
|
|
||||||
<Button
|
|
||||||
size="tag"
|
|
||||||
style="ghost"
|
|
||||||
outline
|
|
||||||
icon="remote"
|
|
||||||
onclick={() => {
|
|
||||||
pushCommitRef(commit);
|
|
||||||
}}>Push ref</Button
|
|
||||||
>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if canEdit()}
|
{#if canEdit()}
|
||||||
<Button size="tag" style="ghost" outline onclick={editPatch}>
|
<Button size="tag" style="ghost" outline onclick={editPatch}>
|
||||||
|
@ -114,7 +114,6 @@
|
|||||||
async function push() {
|
async function push() {
|
||||||
isPushingCommits = true;
|
isPushingCommits = true;
|
||||||
try {
|
try {
|
||||||
// TODO: Ensure requiresForce is bubbled up from each series to the stack here
|
|
||||||
await branchController.pushBranch(branch.id, branch.requiresForce, true);
|
await branchController.pushBranch(branch.id, branch.requiresForce, true);
|
||||||
$listingService?.refresh();
|
$listingService?.refresh();
|
||||||
$prMonitor?.refresh();
|
$prMonitor?.refresh();
|
||||||
|
Loading…
Reference in New Issue
Block a user