Skip to content

Commit

Permalink
fix: rm 'create branch'/'push ref' btns from stacking commit card
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Oct 9, 2024
1 parent d068ef9 commit 97a09f0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 79 deletions.
5 changes: 2 additions & 3 deletions apps/desktop/src/lib/branch/StackingBranchHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,16 @@
let prDetailsModal = $state<ReturnType<typeof PrDetailsModal>>();
let meatballButtonEl = $state<HTMLDivElement>();
// TODO: Simplify figuring out if shadow color is needed
const currentSeries = $derived(branch.series?.find((series) => series.name === upstreamName));
const topPatch = $derived(currentSeries?.patches[0]);
const hasShadow = $derived.by(() => {
if (!topPatch || !topPatch.remoteCommitId) return false;
if (topPatch.remoteCommitId !== topPatch.id) return true;
return false;
});
const branchColorType = $derived<CommitStatus | 'localAndShadow'>(
hasShadow ? 'localAndShadow' : (topPatch?.status ?? 'local')
hasShadow ? 'localAndShadow' : topPatch?.status ?? 'local'
);
const lineColor = $derived(getColorFromBranchType(branchColorType));
Expand Down
75 changes: 0 additions & 75 deletions apps/desktop/src/lib/commit/StackingCommitCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
import { DraggableCommit, nonDraggable } from '$lib/dragging/draggables';
import BranchFilesList from '$lib/file/BranchFilesList.svelte';
import { ModeService } from '$lib/modes/service';
import TextBox from '$lib/shared/TextBox.svelte';
import { copyToClipboard } from '$lib/utils/clipboard';
import { getContext, getContextStore, maybeGetContext } from '$lib/utils/context';
import { error } from '$lib/utils/toasts';
import { openExternalUrl } from '$lib/utils/url';
import { BranchController } from '$lib/vbranches/branchController';
import { createCommitStore } from '$lib/vbranches/contexts';
Expand Down Expand Up @@ -103,24 +101,6 @@
let commitMessageValid = $state(false);
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) {
e.stopPropagation();
Expand Down Expand Up @@ -180,36 +160,6 @@
{/snippet}
</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}
<CommitContextMenu
bind:this={contextMenu}
Expand Down Expand Up @@ -401,31 +351,6 @@
icon="edit-small"
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 canEdit()}
<Button size="tag" style="ghost" outline onclick={editPatch}>
Expand Down
1 change: 0 additions & 1 deletion apps/desktop/src/lib/stack/Stack.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
async function push() {
isPushingCommits = true;
try {
// TODO: Ensure requiresForce is bubbled up from each series to the stack here
await branchController.pushBranch(branch.id, branch.requiresForce, true);
$listingService?.refresh();
$prMonitor?.refresh();
Expand Down

0 comments on commit 97a09f0

Please sign in to comment.