mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-23 01:22:12 +03:00
dnd dropzone uses virtualbranch create
This commit is contained in:
parent
bf7d62b62b
commit
ca155eeeb8
@ -2,7 +2,6 @@
|
||||
import Board from './Board.svelte';
|
||||
import Tray from './Tray.svelte';
|
||||
import type { PageData } from './$types';
|
||||
import type { Branch } from './types';
|
||||
import { getStore } from './vbranches';
|
||||
import { Value } from 'svelte-loadable-store';
|
||||
|
||||
@ -15,18 +14,12 @@
|
||||
? $virtualBranches.value
|
||||
: [];
|
||||
let targetChoice = 'origin/master'; // prob should check if it exists
|
||||
|
||||
function handleNewBranch(e: CustomEvent<Branch[]>) {
|
||||
let name = e.detail[0].name;
|
||||
let path = e.detail[0].files[0].path;
|
||||
virtualBranches.createBranch(name, path);
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if target}
|
||||
<div class="flex w-full max-w-full">
|
||||
<Tray bind:branches {target} remoteBranches={remoteBranchesData} {virtualBranches} />
|
||||
<Board bind:branches {projectId} {virtualBranches} on:newBranch={handleNewBranch} />
|
||||
<Board bind:branches {projectId} {virtualBranches} />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="m-auto flex flex-col space-y-2">
|
||||
|
@ -28,11 +28,6 @@
|
||||
}
|
||||
branches = branches;
|
||||
}
|
||||
|
||||
function handleUpdateRequest() {
|
||||
// TODO: pass this as prop to components and refresh whenever we perform updates
|
||||
virtualBranches.refresh();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
@ -62,7 +57,7 @@
|
||||
{virtualBranches}
|
||||
/>
|
||||
{/each}
|
||||
<NewBranchDropZone on:newBranch on:update={handleUpdateRequest} />
|
||||
<NewBranchDropZone {virtualBranches} />
|
||||
</div>
|
||||
|
||||
<style lang="postcss">
|
||||
|
@ -3,10 +3,10 @@
|
||||
import { Branch, File, Hunk } from './types';
|
||||
import type { DndEvent } from 'svelte-dnd-action/typings';
|
||||
import { createBranch, createFile } from './helpers';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { Button } from '$lib/components';
|
||||
import type { VirtualBranchStore } from './vbranches';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
export let virtualBranches: VirtualBranchStore;
|
||||
let items: Branch[] = [];
|
||||
|
||||
function handleDndFinalize(e: CustomEvent<DndEvent<Branch | File | Hunk>>) {
|
||||
@ -24,8 +24,7 @@
|
||||
}
|
||||
|
||||
if (e.type == 'finalize') {
|
||||
dispatch('newBranch', branchItems);
|
||||
dispatch('update');
|
||||
virtualBranches.createBranch(branchItems[0].name, branchItems[0].files[0].path);
|
||||
items = [];
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user