mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-20 16:11:46 +03:00
- Add Remove this project ...
button with not on git butler branch screen
This commit is contained in:
parent
739da32243
commit
19495250e0
@ -1,14 +1,17 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Button from './Button.svelte';
|
import Button from './Button.svelte';
|
||||||
import DecorativeSplitView from './DecorativeSplitView.svelte';
|
import DecorativeSplitView from './DecorativeSplitView.svelte';
|
||||||
|
import RemoveProjectButton from './RemoveProjectButton.svelte';
|
||||||
import Link from './Link.svelte';
|
import Link from './Link.svelte';
|
||||||
import ProjectSwitcher from './ProjectSwitcher.svelte';
|
import ProjectSwitcher from './ProjectSwitcher.svelte';
|
||||||
import Icon from '$lib/components/Icon.svelte';
|
import Icon from '$lib/components/Icon.svelte';
|
||||||
import { slide } from 'svelte/transition';
|
import { slide } from 'svelte/transition';
|
||||||
|
import * as toasts from '$lib/utils/toasts';
|
||||||
import type { Project, ProjectService } from '$lib/backend/projects';
|
import type { Project, ProjectService } from '$lib/backend/projects';
|
||||||
import type { UserService } from '$lib/stores/user';
|
import type { UserService } from '$lib/stores/user';
|
||||||
import type { BranchController } from '$lib/vbranches/branchController';
|
import type { BranchController } from '$lib/vbranches/branchController';
|
||||||
import type { BaseBranch } from '$lib/vbranches/types';
|
import type { BaseBranch } from '$lib/vbranches/types';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
export let projectService: ProjectService;
|
export let projectService: ProjectService;
|
||||||
export let branchController: BranchController;
|
export let branchController: BranchController;
|
||||||
@ -19,6 +22,27 @@
|
|||||||
$: user$ = userService.user$;
|
$: user$ = userService.user$;
|
||||||
|
|
||||||
let showDropDown = false;
|
let showDropDown = false;
|
||||||
|
|
||||||
|
let loading = false;
|
||||||
|
let deleteConfirmationModal: RemoveProjectButton;
|
||||||
|
|
||||||
|
async function onDeleteClicked() {
|
||||||
|
if (project) {
|
||||||
|
loading = true;
|
||||||
|
try {
|
||||||
|
deleteConfirmationModal.close();
|
||||||
|
await projectService.deleteProject(project.id);
|
||||||
|
toasts.success('Project deleted');
|
||||||
|
goto('/');
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
toasts.error('Failed to delete project');
|
||||||
|
} finally {
|
||||||
|
loading = false;
|
||||||
|
projectService.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<DecorativeSplitView
|
<DecorativeSplitView
|
||||||
@ -64,6 +88,14 @@
|
|||||||
Switch to another project...
|
Switch to another project...
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if project}
|
||||||
|
<RemoveProjectButton
|
||||||
|
bind:this={deleteConfirmationModal}
|
||||||
|
projectTitle={project.title}
|
||||||
|
isDeleting={loading}
|
||||||
|
{onDeleteClicked}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if showDropDown}
|
{#if showDropDown}
|
||||||
|
Loading…
Reference in New Issue
Block a user