Use getContextByClass for Project

This removes quite a bit of prop drilling.
This commit is contained in:
Mattias Granlund 2024-03-21 22:40:00 +01:00
parent 2d3f4f0cb7
commit f285579113
43 changed files with 157 additions and 261 deletions

View File

@ -2,12 +2,12 @@ import { invoke } from '$lib/backend/ipc';
import { persisted } from '$lib/persisted/persisted';
import * as toasts from '$lib/utils/toasts';
import { open } from '@tauri-apps/api/dialog';
import { plainToInstance } from 'class-transformer';
import {
BehaviorSubject,
catchError,
firstValueFrom,
from,
map,
shareReplay,
skip,
switchMap
@ -23,17 +23,17 @@ export type LocalKey = {
export type Key = Exclude<KeyType, 'local'> | LocalKey;
export type Project = {
id: string;
title: string;
export class Project {
id!: string;
title!: string;
description?: string;
path: string;
path!: string;
api?: CloudProject & { sync: boolean };
preferred_key: Key;
ok_with_force_push: boolean;
preferred_key!: Key;
ok_with_force_push!: boolean;
omit_certificate_check: boolean | undefined;
use_diff_context: boolean | undefined;
};
}
export class ProjectService {
private reload$ = new BehaviorSubject<void>(undefined);
@ -41,7 +41,9 @@ export class ProjectService {
error$ = new BehaviorSubject<any>(undefined);
projects$ = this.reload$.pipe(
switchMap(() => from(invoke<Project[]>('list_projects'))),
switchMap(() =>
from(invoke<Project[]>('list_projects').then((p) => plainToInstance(Project, p)))
),
shareReplay(1),
catchError((e) => {
this.error$.next(e);
@ -51,18 +53,8 @@ export class ProjectService {
constructor(private homeDir: string | undefined) {}
getProject(projectId: string) {
return this.projects$.pipe(
map((projects) => {
const project = projects.find((p) => p.id == projectId);
if (!project) {
// We need to abort loading of /[projectId]/ if no project exists, such
// that the type here is of Project rather than Project | undefined.
throw 'Project not found';
}
return project;
})
);
async getProject(projectId: string) {
return await invoke<Project>('get_project', { id: projectId });
}
async updateProject(params: {

View File

@ -6,13 +6,10 @@
import { getContextByClass } from '$lib/utils/context';
import { tooltip } from '$lib/utils/tooltip';
import { BranchController } from '$lib/vbranches/branchController';
import type { Project } from '$lib/backend/projects';
import type { BaseBranch, AnyFile } from '$lib/vbranches/types';
import type { Writable } from 'svelte/store';
export let project: Project | undefined;
export let base: BaseBranch;
export let projectId: string;
export let selectedFiles: Writable<AnyFile[]>;
const branchController = getContextByClass(BranchController);
@ -54,13 +51,7 @@
<div class="flex h-full">
<div class="z-20 flex w-full flex-col gap-2">
{#each base.upstreamCommits as commit}
<CommitCard
{commit}
{project}
{projectId}
{selectedFiles}
commitUrl={base.commitUrl(commit.id)}
/>
<CommitCard {commit} {selectedFiles} commitUrl={base.commitUrl(commit.id)} />
{/each}
</div>
</div>
@ -78,13 +69,7 @@
</div>
<div class="flex flex-col gap-y-2">
{#each base.recentCommits as commit}
<CommitCard
{commit}
{project}
{projectId}
{selectedFiles}
commitUrl={base.commitUrl(commit.id)}
/>
<CommitCard {commit} {selectedFiles} commitUrl={base.commitUrl(commit.id)} />
{/each}
</div>
</div>

View File

@ -1,18 +1,18 @@
<script lang="ts">
import SyncButton from './SyncButton.svelte';
import { Project } from '$lib/backend/projects';
import Badge from '$lib/components/Badge.svelte';
import Icon from '$lib/components/Icon.svelte';
import { getContextByClass } from '$lib/utils/context';
import { tooltip } from '$lib/utils/tooltip';
import { BaseBranchService } from '$lib/vbranches/branchStoresCache';
import type { Project } from '$lib/backend/projects';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
export let project: Project;
export let isNavCollapsed: boolean;
const baseBranchService = getContextByClass(BaseBranchService);
const project = getContextByClass(Project);
$: base = baseBranchService.base;
$: selected = $page.url.href.endsWith('/base');
@ -43,7 +43,7 @@
{#if ($base?.behind || 0) > 0}
<Badge count={$base?.behind || 0} help="Unmerged upstream commits" />
{/if}
<SyncButton projectId={project.id} cloudEnabled={project?.api?.sync || false} />
<SyncButton />
</div>
<div class="row_2 text-base-12">
{#if $base?.remoteUrl.includes('github.com')}

View File

@ -2,6 +2,7 @@
import FullviewLoading from './FullviewLoading.svelte';
import NewBranchDropZone from './NewBranchDropZone.svelte';
import dzenSvg from '$lib/assets/dzen-pc.svg?raw';
import { Project } from '$lib/backend/projects';
import BranchLane from '$lib/components/BranchLane.svelte';
import Icon from '$lib/components/Icon.svelte';
import { cloneWithRotation } from '$lib/dragging/draggable';
@ -10,16 +11,14 @@
import { BaseBranch, type Branch } from '$lib/vbranches/types';
import { open } from '@tauri-apps/api/shell';
import type { User } from '$lib/backend/cloud';
import type { Project } from '$lib/backend/projects';
export let project: Project;
export let projectPath: string;
export let branches: Branch[] | undefined;
export let branchesError: any;
export let user: User | undefined;
const branchController = getContextByClass(BranchController);
const baseBranch = getContextStoreByClass(BaseBranch);
const project = getContextByClass(Project);
let dragged: any;
let dropZone: HTMLDivElement;
@ -104,13 +103,7 @@
clone?.remove();
}}
>
<BranchLane
{branch}
{project}
branchCount={branches.filter((c) => c.active).length}
{projectPath}
{user}
/>
<BranchLane {branch} branchCount={branches.filter((c) => c.active).length} {user} />
</div>
{/each}
@ -145,14 +138,14 @@
<Icon name="docs" />
</div>
<span class="text-base-12">GitButler docs</span>
<span class="text-base-12">GitButler Docs</span>
</a>
<div
class="empty-board__suggestions__link"
role="button"
tabindex="0"
on:keypress={() => open(`vscode://file${projectPath}/`)}
on:click={() => open(`vscode://file${projectPath}/`)}
on:keypress={() => open(`vscode://file${project.path}/`)}
on:click={() => open(`vscode://file${project.path}/`)}
>
<div class="empty-board__suggestions__link__icon">
<Icon name="vscode" />

View File

@ -9,6 +9,7 @@
import laneNewSvg from '$lib/assets/empty-state/lane-new.svg?raw';
import noChangesSvg from '$lib/assets/empty-state/lane-no-changes.svg?raw';
import { AIService } from '$lib/backend/aiService';
import { Project } from '$lib/backend/projects';
import Resizer from '$lib/components/Resizer.svelte';
import { projectAiGenAutoBranchNamingEnabled } from '$lib/config/config';
import { projectAiGenEnabled } from '$lib/config/config';
@ -35,13 +36,11 @@
import { getContext, onMount } from 'svelte';
import { get, type Writable } from 'svelte/store';
import type { User } from '$lib/backend/cloud';
import type { Project } from '$lib/backend/projects';
import type { Persisted } from '$lib/persisted/persisted';
import type { Branch, LocalFile, RemoteBranchData } from '$lib/vbranches/types';
export let branch: Branch;
export let isUnapplied = false;
export let project: Project;
export let branchCount = 1;
export let user: User | undefined;
export let selectedFiles: Writable<LocalFile[]>;
@ -50,6 +49,7 @@
export let commitBoxOpen: Writable<boolean>;
const branchController = getContextByClass(BranchController);
const project = getContextByClass(Project);
const aiGenEnabled = projectAiGenEnabled(project.id);
const aiGenAutoBranchNamingEnabled = projectAiGenAutoBranchNamingEnabled(project.id);
@ -92,10 +92,7 @@
.slice(0, 5000);
try {
const message = await aiService.summarizeBranch({
diff,
userToken: user?.access_token
});
const message = await aiService.summarizeBranch({ diff, userToken: user?.access_token });
if (message && message !== branch.name) {
branch.name = message;
@ -265,7 +262,6 @@
branchId={branch.id}
files={branch.files}
{isUnapplied}
{project}
{selectedOwnership}
{selectedFiles}
showCheckboxes={$commitBoxOpen}
@ -316,14 +312,7 @@
{/if}
</div>
<BranchCommits
{branch}
{project}
{branchCount}
{isUnapplied}
{selectedFiles}
{remoteBranchData}
/>
<BranchCommits {branch} {branchCount} {isUnapplied} {selectedFiles} {remoteBranchData} />
</div>
</ScrollableContainer>
<div class="divider-line">

View File

@ -1,10 +1,8 @@
<script lang="ts">
import CommitList from './CommitList.svelte';
import type { Project } from '$lib/backend/projects';
import type { Branch, AnyFile, RemoteBranchData } from '$lib/vbranches/types';
import type { Writable } from 'svelte/store';
export let project: Project;
export let branch: Branch;
export let selectedFiles: Writable<AnyFile[]>;
export let isUnapplied: boolean;
@ -19,7 +17,6 @@
{#if unknownCommits && unknownCommits.length > 0}
<CommitList
{branch}
{project}
{branchCount}
{isUnapplied}
{selectedFiles}
@ -29,7 +26,6 @@
{/if}
<CommitList
{branch}
{project}
{isUnapplied}
{selectedFiles}
commits={branch.commits.filter((c) => c.status == 'local')}
@ -37,7 +33,6 @@
/>
<CommitList
{branch}
{project}
{isUnapplied}
{selectedFiles}
type="remote"
@ -45,7 +40,6 @@
/>
<CommitList
{branch}
{project}
{isUnapplied}
{selectedFiles}
type="integrated"

View File

@ -3,12 +3,10 @@
import BranchFilesList from './BranchFilesList.svelte';
import FileTree from './FileTree.svelte';
import { filesToFileTree } from '$lib/vbranches/filetree';
import type { Project } from '$lib/backend/projects';
import type { Ownership } from '$lib/vbranches/ownership';
import type { LocalFile, RemoteFile } from '$lib/vbranches/types';
import type { Writable } from 'svelte/store';
export let project: Project | undefined;
export let branchId: string;
export let files: LocalFile[] | RemoteFile[];
export let isUnapplied: boolean;
@ -38,7 +36,6 @@
{selectedFiles}
{showCheckboxes}
{isUnapplied}
{project}
/>
{:else}
<FileTree
@ -52,7 +49,6 @@
{selectedFiles}
{isUnapplied}
{files}
{project}
/>
{/if}
</div>

View File

@ -2,12 +2,10 @@
import FileListItem from './FileListItem.svelte';
import { maybeMoveSelection } from '$lib/utils/selection';
import { sortLikeFileTree } from '$lib/vbranches/filetree';
import type { Project } from '$lib/backend/projects';
import type { Ownership } from '$lib/vbranches/ownership';
import type { AnyFile } from '$lib/vbranches/types';
import type { Writable } from 'svelte/store';
export let project: Project | undefined;
export let branchId: string;
export let files: AnyFile[];
export let selectedOwnership: Writable<Ownership>;
@ -28,7 +26,6 @@
{isUnapplied}
{selectedFiles}
{selectedOwnership}
{project}
showCheckbox={showCheckboxes}
selected={$selectedFiles.includes(file)}
on:click={(e) => {

View File

@ -1,10 +1,12 @@
<script lang="ts">
import BranchCard from './BranchCard.svelte';
import FileCard from './FileCard.svelte';
import { Project } from '$lib/backend/projects';
import Resizer from '$lib/components/Resizer.svelte';
import { projectLaneCollapsed } from '$lib/config/config';
import { persisted } from '$lib/persisted/persisted';
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/settings/userSettings';
import { getContextByClass } from '$lib/utils/context';
import { Ownership } from '$lib/vbranches/ownership';
import { RemoteFile, type Branch, type LocalFile, type AnyFile } from '$lib/vbranches/types';
import lscache from 'lscache';
@ -13,18 +15,16 @@
import { writable } from 'svelte/store';
import { slide } from 'svelte/transition';
import type { User } from '$lib/backend/cloud';
import type { Project } from '$lib/backend/projects';
export let branch: Branch;
export let isUnapplied = false;
export let project: Project;
export let branchCount = 1;
export let user: User | undefined;
export let projectPath: string;
$: selectedOwnership = writable(Ownership.fromBranch(branch));
$: selected = setSelected($selectedFiles, branch);
const project = getContextByClass(Project);
const selectedFiles = writable<LocalFile[]>([]);
let rsViewport: HTMLElement;
@ -63,7 +63,6 @@
<BranchCard
{branch}
{isUnapplied}
{project}
{selectedOwnership}
{commitBoxOpen}
bind:isLaneCollapsed
@ -83,7 +82,6 @@
conflicted={selected.conflicted}
branchId={branch.id}
file={selected}
{projectPath}
{selectedOwnership}
{isUnapplied}
branchCommits={branch.commits}

View File

@ -1,6 +1,7 @@
<script lang="ts">
import BranchLabel from './BranchLabel.svelte';
import Tag from './Tag.svelte';
import { Project } from '$lib/backend/projects';
import Button from '$lib/components/Button.svelte';
import Icon from '$lib/components/Icon.svelte';
import ViewPrContextMenu from '$lib/components/ViewPrContextMenu.svelte';
@ -16,10 +17,10 @@
export let branch: RemoteBranch;
export let base: BaseBranch | undefined | null;
export let projectId: string;
export let pr: PullRequest | undefined;
const branchController = getContextByClass(BranchController);
const project = getContextByClass(Project);
let meatballButton: HTMLDivElement;
let container: HTMLDivElement;
@ -101,7 +102,7 @@
isApplying = true;
try {
await branchController.createvBranchFromBranch(branch.name);
goto(`/${projectId}/board`);
goto(`/${project.id}/board`);
} catch (e) {
const err = 'Failed to apply branch';
toast.error(err);

View File

@ -2,6 +2,7 @@
import SectionCard from './SectionCard.svelte';
import WelcomeSigninAction from './WelcomeSigninAction.svelte';
import { CloudClient } from '$lib/backend/cloud';
import { Project } from '$lib/backend/projects';
import Link from '$lib/components/Link.svelte';
import Spacer from '$lib/components/Spacer.svelte';
import Toggle from '$lib/components/Toggle.svelte';
@ -11,13 +12,11 @@
import { getContextByClass } from '$lib/utils/context';
import * as toasts from '$lib/utils/toasts';
import { createEventDispatcher, onMount } from 'svelte';
import type { Project } from '$lib/backend/projects';
import { PUBLIC_API_BASE_URL } from '$env/static/public';
export let project: Project;
const userService = getContextByClass(UserService);
const cloud = getContextByClass(CloudClient);
const project = getContextByClass(Project);
const user = userService.user;
const aiGenEnabled = projectAiGenEnabled(project.id);

View File

@ -1,5 +1,6 @@
<script lang="ts">
import BranchFiles from './BranchFiles.svelte';
import { Project } from '$lib/backend/projects';
import Tag from '$lib/components/Tag.svelte';
import TimeAgo from '$lib/components/TimeAgo.svelte';
import { persistedCommitMessage } from '$lib/config/config';
@ -20,12 +21,9 @@
} from '$lib/vbranches/types';
import { writable, type Writable } from 'svelte/store';
import { slide } from 'svelte/transition';
import type { Project } from '$lib/backend/projects';
export let branch: Branch | undefined = undefined;
export let project: Project | undefined;
export let commit: Commit | RemoteCommit;
export let projectId: string;
export let commitUrl: string | undefined = undefined;
export let isHeadCommit: boolean = false;
export let isUnapplied = false;
@ -36,14 +34,16 @@
const baseBranch = getContextStoreByClass(BaseBranch);
const selectedOwnership = writable(Ownership.default());
const currentCommitMessage = persistedCommitMessage(projectId, branchId || '');
const project = getContextByClass(Project);
const currentCommitMessage = persistedCommitMessage(project.id, branchId || '');
let showFiles = false;
let files: RemoteFile[] = [];
async function loadFiles() {
files = await listRemoteCommitFiles(projectId, commit.id);
files = await listRemoteCommitFiles(project.id, commit.id);
}
function onClick() {
@ -129,7 +129,6 @@
{isUnapplied}
{selectedOwnership}
{selectedFiles}
{project}
allowMultiple={true}
readonly={true}
/>

View File

@ -2,12 +2,10 @@
import CommitListFooter from './CommitListFooter.svelte';
import CommitListHeader from './CommitListHeader.svelte';
import CommitListItem from './CommitListItem.svelte';
import type { Project } from '$lib/backend/projects';
import type { AnyFile, Branch, Commit, CommitStatus, RemoteCommit } from '$lib/vbranches/types';
import type { Writable } from 'svelte/store';
export let branch: Branch;
export let project: Project;
export let type: CommitStatus;
export let selectedFiles: Writable<AnyFile[]>;
export let isUnapplied: boolean;
@ -41,7 +39,6 @@
<CommitListItem
{branch}
{commit}
{project}
{isUnapplied}
{selectedFiles}
isChained={idx != commits.length - 1}
@ -55,7 +52,7 @@
You have {branchCount} active branches. To merge upstream work, we will unapply all other
branches.
</div>{/if}
<CommitListFooter {branch} {type} {isUnapplied} projectId={project.id} {hasCommits} />
<CommitListFooter {branch} {type} {isUnapplied} {hasCommits} />
</div>
{/if}
</div>

View File

@ -14,7 +14,6 @@
export let branch: Branch;
export let type: CommitStatus;
export let isUnapplied: boolean;
export let projectId: string;
export let hasCommits: boolean;
const branchService = getContextByClass(BranchService);
@ -80,7 +79,6 @@
isPr={!!$pr$}
{type}
{branch}
{projectId}
githubEnabled={true}
on:trigger={async (e) => {
try {

View File

@ -1,6 +1,7 @@
<script lang="ts">
import CommitCard from './CommitCard.svelte';
import DropzoneOverlay from './DropzoneOverlay.svelte';
import { Project } from '$lib/backend/projects';
import {
isDraggableHunk,
type DraggableCommit,
@ -21,10 +22,8 @@
BaseBranch
} from '$lib/vbranches/types';
import { get, type Writable } from 'svelte/store';
import type { Project } from '$lib/backend/projects';
export let branch: Branch;
export let project: Project;
export let commit: Commit | RemoteCommit;
export let isHeadCommit: boolean;
export let isChained: boolean;
@ -33,6 +32,7 @@
const branchController = getContextByClass(BranchController);
const baseBranch = getContextStoreByClass(BaseBranch);
const project = getContextByClass(Project);
function acceptAmend(commit: Commit | RemoteCommit) {
if (commit instanceof RemoteCommit) {
@ -135,8 +135,6 @@
<CommitCard
{branch}
{commit}
projectId={project.id}
{project}
commitUrl={$baseBranch?.commitUrl(commit.id)}
{isHeadCommit}
{isUnapplied}

View File

@ -1,12 +1,13 @@
<script lang="ts">
import { Project } from '$lib/backend/projects';
import SectionCard from '$lib/components/SectionCard.svelte';
import Spacer from '$lib/components/Spacer.svelte';
import TextArea from '$lib/components/TextArea.svelte';
import TextBox from '$lib/components/TextBox.svelte';
import { getContextByClass } from '$lib/utils/context';
import { createEventDispatcher } from 'svelte';
import type { Project } from '$lib/backend/projects';
export let project: Project;
const project = getContextByClass(Project);
let title = project?.title;
let description = project?.description;

View File

@ -12,7 +12,6 @@
export let branchId: string;
export let file: AnyFile;
export let conflicted: boolean;
export let projectPath: string | undefined;
export let isUnapplied: boolean;
export let selectable = false;
export let readonly = false;
@ -56,7 +55,6 @@
isBinary={file.binary}
{readonly}
{sections}
{projectPath}
{isFileLocked}
{isUnapplied}
{selectable}

View File

@ -1,6 +1,7 @@
<script lang="ts">
import Button from './Button.svelte';
import Modal from './Modal.svelte';
import { Project } from '$lib/backend/projects';
import PopupMenu from '$lib/components/PopupMenu.svelte';
import ContextMenu from '$lib/components/contextmenu/ContextMenu.svelte';
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte';
@ -11,12 +12,10 @@
import { BranchController } from '$lib/vbranches/branchController';
import { join } from '@tauri-apps/api/path';
import { open } from '@tauri-apps/api/shell';
import type { Project } from '$lib/backend/projects';
import type { AnyFile } from '$lib/vbranches/types';
export let project: Project | undefined;
const branchController = getContextByClass(BranchController);
const project = getContextByClass(Project);
let confirmationModal: Modal;
let popupMenu: PopupMenu;

View File

@ -14,7 +14,6 @@
export let isBinary: boolean;
export let isLarge: boolean;
export let sections: (HunkSection | ContentSection)[];
export let projectPath: string | undefined;
export let isUnapplied: boolean;
export let selectable = false;
export let selectedOwnership: Writable<Ownership> | undefined = undefined;
@ -83,7 +82,6 @@
{branchId}
{selectable}
{isUnapplied}
{projectPath}
{selectedOwnership}
{isFileLocked}
{minWidth}

View File

@ -7,12 +7,10 @@
import { getVSIFileIcon } from '$lib/ext-icons';
import { updateFocus } from '$lib/utils/selection';
import { onDestroy } from 'svelte';
import type { Project } from '$lib/backend/projects';
import type { Ownership } from '$lib/vbranches/ownership';
import type { AnyFile } from '$lib/vbranches/types';
import type { Writable } from 'svelte/store';
export let project: Project | undefined;
export let branchId: string;
export let file: AnyFile;
export let isUnapplied: boolean;
@ -38,8 +36,7 @@
function updateContextMenu() {
if (popupMenu) popupMenu.$destroy();
return new FileContextMenu({
target: document.body,
props: { project }
target: document.body
});
}

View File

@ -6,13 +6,11 @@
import TreeListFile from './TreeListFile.svelte';
import TreeListFolder from './TreeListFolder.svelte';
import { maybeMoveSelection } from '$lib/utils/selection';
import type { Project } from '$lib/backend/projects';
import type { TreeNode } from '$lib/vbranches/filetree';
import type { Ownership } from '$lib/vbranches/ownership';
import type { AnyFile, LocalFile, RemoteFile } from '$lib/vbranches/types';
import type { Writable } from 'svelte/store';
export let project: Project | undefined;
export let expanded = true;
export let node: TreeNode;
export let isRoot = false;
@ -82,7 +80,6 @@
{readonly}
{allowMultiple}
{files}
{project}
on:checked
on:unchecked
/>
@ -100,7 +97,6 @@
{selectedOwnership}
{selectedFiles}
{readonly}
{project}
showCheckbox={showCheckboxes}
on:click={(e) => {
e.stopPropagation();
@ -151,7 +147,6 @@
{readonly}
{allowMultiple}
{files}
{project}
on:checked
on:unchecked
/>

View File

@ -3,8 +3,10 @@
import HunkContextMenu from './HunkContextMenu.svelte';
import HunkLine from './HunkLine.svelte';
import Scrollbar from './Scrollbar.svelte';
import { Project } from '$lib/backend/projects';
import { draggable } from '$lib/dragging/draggable';
import { draggableHunk } from '$lib/dragging/draggables';
import { getContextByClass } from '$lib/utils/context';
import { onDestroy } from 'svelte';
import type { HunkSection } from '$lib/utils/fileSections';
import type { Ownership } from '$lib/vbranches/ownership';
@ -16,7 +18,6 @@
export let filePath: string;
export let section: HunkSection;
export let branchId: string | undefined;
export let projectPath: string | undefined;
export let minWidth: number;
export let selectable = false;
export let isUnapplied: boolean;
@ -25,6 +26,8 @@
export let selectedOwnership: Writable<Ownership> | undefined = undefined;
export let linesModified: number;
const project = getContextByClass(Project);
function onHunkSelected(hunk: Hunk, isSelected: boolean) {
if (!selectedOwnership) return;
if (isSelected) {
@ -38,7 +41,7 @@
if (popupMenu) popupMenu.$destroy();
return new HunkContextMenu({
target: document.body,
props: { projectPath, filePath }
props: { projectPath: project.path, filePath }
});
}

View File

@ -5,7 +5,7 @@
import SectionCard from './SectionCard.svelte';
import TextBox from './TextBox.svelte';
import { AuthService } from '$lib/backend/auth';
import { ProjectService, type Key, type KeyType, type Project } from '$lib/backend/projects';
import { ProjectService, type Key, type KeyType, Project } from '$lib/backend/projects';
import Button from '$lib/components/Button.svelte';
import Link from '$lib/components/Link.svelte';
import { copyToClipboard } from '$lib/utils/clipboard';
@ -15,7 +15,7 @@
import { BaseBranch } from '$lib/vbranches/types';
import { onMount } from 'svelte';
export let project: Project;
const project = getContextByClass(Project);
const authService = getContextByClass(AuthService);
const baseBranch = getContextStoreByClass(BaseBranch);

View File

@ -5,8 +5,10 @@
import Footer from './Footer.svelte';
import ProjectSelector from './ProjectSelector.svelte';
import Resizer from './Resizer.svelte';
import { Project } from '$lib/backend/projects';
import { persisted } from '$lib/persisted/persisted';
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/settings/userSettings';
import { getContextByClass } from '$lib/utils/context';
import * as hotkeys from '$lib/utils/hotkeys';
import { unsubscribe } from '$lib/utils/unsubscribe';
import { platform } from '@tauri-apps/api/os';
@ -14,15 +16,14 @@
import { onMount } from 'svelte';
import { getContext } from 'svelte';
import type { User } from '$lib/backend/cloud';
import type { Project } from '$lib/backend/projects';
export let project: Project;
export let user: User | undefined;
const platformName = from(platform());
const minResizerWidth = 280;
const minResizerRatio = 150;
const platformName = from(platform());
const userSettings = getContext<SettingsStore>(SETTINGS_CONTEXT);
const project = getContextByClass(Project);
const defaultTrayWidthRem = persisted<number | undefined>(
undefined,
'defaulTrayWidth_ ' + project.id
@ -113,9 +114,9 @@
{#if $platformName == 'darwin'}
<div class="drag-region" data-tauri-drag-region />
{/if}
<ProjectSelector {project} isNavCollapsed={$isNavCollapsed} />
<ProjectSelector isNavCollapsed={$isNavCollapsed} />
<div class="domains">
<BaseBranchCard {project} isNavCollapsed={$isNavCollapsed} />
<BaseBranchCard isNavCollapsed={$isNavCollapsed} />
<DomainButton
href={`/${project.id}/board`}
domain="workspace"

View File

@ -6,7 +6,7 @@
import ProjectSwitcher from './ProjectSwitcher.svelte';
import RemoveProjectButton from './RemoveProjectButton.svelte';
import derectionDoubtSvg from '$lib/assets/illustrations/direction-doubt.svg?raw';
import { ProjectService, type Project } from '$lib/backend/projects';
import { ProjectService, Project } from '$lib/backend/projects';
import { UserService } from '$lib/stores/user';
import { getContextByClass } from '$lib/utils/context';
import * as toasts from '$lib/utils/toasts';
@ -14,11 +14,11 @@
import type { BaseBranch } from '$lib/vbranches/types';
import { goto } from '$app/navigation';
const branchController = getContextByClass(BranchController);
export let project: Project | undefined;
export let baseBranch: BaseBranch;
const branchController = getContextByClass(BranchController);
const projectService = getContextByClass(ProjectService);
const project = getContextByClass(Project);
const userService = getContextByClass(UserService);
const user = userService.user;
@ -84,7 +84,7 @@
</div>
<div class="switchrepo__project">
<ProjectSwitcher {project} />
<ProjectSwitcher />
</div>
</div>
</DecorativeSplitView>

View File

@ -1,12 +1,13 @@
<script lang="ts">
import SectionCard from './SectionCard.svelte';
import Spacer from './Spacer.svelte';
import { Project } from '$lib/backend/projects';
import Toggle from '$lib/components/Toggle.svelte';
import { projectRunCommitHooks } from '$lib/config/config';
import { getContextByClass } from '$lib/utils/context';
import { createEventDispatcher } from 'svelte';
import type { Project } from '$lib/backend/projects';
export let project: Project;
const project = getContextByClass(Project);
let allowForcePushing = project?.ok_with_force_push;
let omitCertificateCheck = project?.omit_certificate_check;

View File

@ -3,17 +3,18 @@
import ProjectSwitcher from './ProjectSwitcher.svelte';
import RemoveProjectButton from './RemoveProjectButton.svelte';
import loadErrorSvg from '$lib/assets/illustrations/load-error.svg?raw';
import { ProjectService, type Project } from '$lib/backend/projects';
import { ProjectService, Project } from '$lib/backend/projects';
import Icon from '$lib/components/Icon.svelte';
import { UserService } from '$lib/stores/user';
import { getContextByClass } from '$lib/utils/context';
import * as toasts from '$lib/utils/toasts';
import { goto } from '$app/navigation';
export let project: Project;
export let error: any = undefined;
const projectService = getContextByClass(ProjectService);
const project = getContextByClass(Project);
const userService = getContextByClass(UserService);
const user = userService.user;
@ -59,7 +60,7 @@
</div>
<div class="problem__switcher">
<ProjectSwitcher {project} />
<ProjectSwitcher />
</div>
</div>
</DecorativeSplitView>

View File

@ -1,14 +1,16 @@
<script lang="ts">
import ProjectAvatar from './ProjectAvatar.svelte';
import ProjectsPopup from './ProjectsPopup.svelte';
import { Project } from '$lib/backend/projects';
import { clickOutside } from '$lib/clickOutside';
import Icon from '$lib/components/Icon.svelte';
import { getContextByClass } from '$lib/utils/context';
import { tooltip } from '$lib/utils/tooltip';
import type { Project } from '$lib/backend/projects';
export let project: Project | undefined;
export let isNavCollapsed: boolean;
const project = getContextByClass(Project);
let popup: ProjectsPopup;
let visible: boolean = false;
</script>

View File

@ -3,16 +3,16 @@
import KeysForm from './KeysForm.svelte';
import ProjectSetupTarget from './ProjectSetupTarget.svelte';
import newProjectSvg from '$lib/assets/illustrations/new-project.svg?raw';
import { Project } from '$lib/backend/projects';
import DecorativeSplitView from '$lib/components/DecorativeSplitView.svelte';
import { UserService } from '$lib/stores/user';
import { getContextByClass } from '$lib/utils/context';
import { BranchController } from '$lib/vbranches/branchController';
import type { Project } from '$lib/backend/projects';
import { goto } from '$app/navigation';
export let project: Project;
export let remoteBranches: { name: string }[];
const project = getContextByClass(Project);
const branchController = getContextByClass(BranchController);
const userService = getContextByClass(UserService);
const user = userService.user;
@ -35,7 +35,7 @@
<DecorativeSplitView user={$user} img={newProjectSvg}>
{#if selectedBranch}
{@const [remoteName, branchName] = selectedBranch.split(/\/(.*)/s)}
<KeysForm {project} {remoteName} {branchName} />
<KeysForm {remoteName} {branchName} />
<div class="actions">
<Button kind="outlined" color="neutral" on:mousedown={() => (selectedBranch = '')}
>Back</Button
@ -44,7 +44,6 @@
</div>
{:else}
<ProjectSetupTarget
projectId={project.id}
projectName={project.title}
{remoteBranches}
on:branchSelected={(e) => {

View File

@ -1,5 +1,6 @@
<script async lang="ts">
import ProjectNameLabel from './ProjectNameLabel.svelte';
import { Project } from '$lib/backend/projects';
import BackButton from '$lib/components/BackButton.svelte';
import Button from '$lib/components/Button.svelte';
import GithubIntegration from '$lib/components/GithubIntegration.svelte';
@ -14,10 +15,10 @@
import { getContextByClass } from '$lib/utils/context';
import { createEventDispatcher } from 'svelte';
export let projectId: string;
export let projectName: string;
export let remoteBranches: { name: string }[];
const project = getContextByClass(Project);
const userService = getContextByClass(UserService);
const user = userService.user;
@ -25,8 +26,8 @@
branchSelected: string;
}>();
const aiGenEnabled = projectAiGenEnabled(projectId);
const aiGenAutoBranchNamingEnabled = projectAiGenAutoBranchNamingEnabled(projectId);
const aiGenEnabled = projectAiGenEnabled(project.id);
const aiGenAutoBranchNamingEnabled = projectAiGenAutoBranchNamingEnabled(project.id);
let aiGenCheckbox: Toggle;
let loading = false;

View File

@ -2,13 +2,12 @@
import Button from './Button.svelte';
import Select from './Select.svelte';
import SelectItem from './SelectItem.svelte';
import { ProjectService, type Project } from '$lib/backend/projects';
import { ProjectService, Project } from '$lib/backend/projects';
import { getContextByClass } from '$lib/utils/context';
import { goto } from '$app/navigation';
export let project: Project | undefined;
const projectService = getContextByClass(ProjectService);
const project = getContextByClass(Project);
$: projects$ = projectService.projects$;

View File

@ -7,17 +7,18 @@
</script>
<script lang="ts">
import { Project } from '$lib/backend/projects';
import Button from '$lib/components/Button.svelte';
import DropDownButton from '$lib/components/DropDownButton.svelte';
import ContextMenu from '$lib/components/contextmenu/ContextMenu.svelte';
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte';
import ContextMenuSection from '$lib/components/contextmenu/ContextMenuSection.svelte';
import { persisted, type Persisted } from '$lib/persisted/persisted';
import { getContextByClass } from '$lib/utils/context';
import * as toasts from '$lib/utils/toasts';
import { createEventDispatcher } from 'svelte';
import type { Branch } from '$lib/vbranches/types';
export let projectId: string;
export let type: string;
export let isLoading = false;
export let githubEnabled: boolean;
@ -25,13 +26,15 @@
export let branch: Branch;
export let isPr = false;
function defaultAction(projectId: string): Persisted<BranchAction> {
const project = getContextByClass(Project);
function defaultAction(): Persisted<BranchAction> {
const key = 'projectDefaultAction_';
return persisted<BranchAction>(BranchAction.Push, key + projectId);
return persisted<BranchAction>(BranchAction.Push, key + project.id);
}
const dispatch = createEventDispatcher<{ trigger: { action: BranchAction } }>();
const preferredAction = defaultAction(projectId);
const preferredAction = defaultAction();
let contextMenu: ContextMenu;
let dropDown: DropDownButton;

View File

@ -3,25 +3,23 @@
import FileCard from './FileCard.svelte';
import Resizer from './Resizer.svelte';
import ScrollableContainer from './ScrollableContainer.svelte';
import { Project } from '$lib/backend/projects';
import CommitCard from '$lib/components/CommitCard.svelte';
import { type SettingsStore, SETTINGS_CONTEXT } from '$lib/settings/userSettings';
import { getRemoteBranchData } from '$lib/stores/remoteBranches';
import { getContextStoreByClass } from '$lib/utils/context';
import { getContextByClass, getContextStoreByClass } from '$lib/utils/context';
import { Ownership } from '$lib/vbranches/ownership';
import { BaseBranch, type AnyFile, type RemoteBranch } from '$lib/vbranches/types';
import lscache from 'lscache';
import { marked } from 'marked';
import { getContext, onMount } from 'svelte';
import { writable } from 'svelte/store';
import type { Project } from '$lib/backend/projects';
import type { PullRequest } from '$lib/github/types';
export let project: Project | undefined;
export let branch: RemoteBranch;
export let projectId: string;
export let projectPath: string;
export let pr: PullRequest | undefined;
const project = getContextByClass(Project);
const baseBranch = getContextStoreByClass(BaseBranch);
const defaultBranchWidthRem = 30;
@ -59,7 +57,7 @@
>
<ScrollableContainer wide>
<div class="branch-preview">
<BranchPreviewHeader {projectId} base={$baseBranch} {branch} {pr} />
<BranchPreviewHeader base={$baseBranch} {branch} {pr} />
{#if pr?.body}
<div class="card">
<div class="card__header">PR Description</div>
@ -68,14 +66,12 @@
</div>
</div>
{/if}
{#await getRemoteBranchData(projectId, branch.name) then branchData}
{#await getRemoteBranchData(project.id, branch.name) then branchData}
{#if branchData.commits && branchData.commits.length > 0}
<div class="flex w-full flex-col gap-y-2">
{#each branchData.commits as commit (commit.id)}
<CommitCard
{commit}
{project}
{projectId}
{selectedFiles}
commitUrl={$baseBranch?.commitUrl(commit.id)}
/>
@ -101,7 +97,6 @@
conflicted={selected.conflicted}
branchId={'blah'}
file={selected}
{projectPath}
{selectedOwnership}
isUnapplied={false}
readonly={true}

View File

@ -1,5 +1,6 @@
<script lang="ts">
import { syncToCloud } from '$lib/backend/cloud';
import { Project } from '$lib/backend/projects';
import Icon from '$lib/components/Icon.svelte';
import TimeAgo from '$lib/components/TimeAgo.svelte';
import { GitHubService } from '$lib/github/service';
@ -7,14 +8,16 @@
import { tooltip } from '$lib/utils/tooltip';
import { BaseBranchService } from '$lib/vbranches/branchStoresCache';
export let projectId: string;
export let cloudEnabled: boolean;
const project = getContextByClass(Project);
let cloudEnabled: boolean;
const githubService = getContextByClass(GitHubService);
const baseBranchService = getContextByClass(BaseBranchService);
const baseBranch = baseBranchService.base;
$: baseServiceBusy$ = baseBranchService.busy$;
$: cloudEnabled = project?.api?.sync || false;
</script>
<button
@ -23,7 +26,7 @@
on:mousedown={async (e) => {
e.preventDefault();
e.stopPropagation();
if (cloudEnabled) syncToCloud(projectId); // don't wait for this
if (cloudEnabled) syncToCloud(project.id); // don't wait for this
await baseBranchService.fetchFromTarget('modal');
if (githubService.isEnabled) {
await githubService.reload();

View File

@ -7,12 +7,10 @@
import { getVSIFileIcon } from '$lib/ext-icons';
import { updateFocus } from '$lib/utils/selection';
import { onDestroy } from 'svelte';
import type { Project } from '$lib/backend/projects';
import type { Ownership } from '$lib/vbranches/ownership';
import type { AnyFile } from '$lib/vbranches/types';
import type { Writable } from 'svelte/store';
export let project: Project | undefined;
export let branchId: string;
export let file: AnyFile;
export let selected: boolean;
@ -41,8 +39,7 @@
function updateContextMenu() {
if (popupMenu) popupMenu.$destroy();
return new FileContextMenu({
target: document.body,
props: { project }
target: document.body
});
}

View File

@ -1,6 +1,7 @@
<script lang="ts">
import { syncToCloud } from '$lib/backend/cloud';
import { handleMenuActions } from '$lib/backend/menuActions';
import { Project } from '$lib/backend/projects';
import { BranchService } from '$lib/branches/service';
import Navigation from '$lib/components/Navigation.svelte';
import NotOnGitButlerBranch from '$lib/components/NotOnGitButlerBranch.svelte';
@ -19,7 +20,7 @@
$: ({
vbranchService,
project$,
project,
projectId,
baseBranchService,
gbBranchActive$,
@ -36,9 +37,10 @@
$: setContext(BranchService, branchService);
$: setContext(BaseBranchService, baseBranchService);
$: setContext(BaseBranch, baseBranch);
$: setContext(Project, project);
let intervalId: any;
handleMenuActions(data.projectId);
handleMenuActions(projectId);
// Once on load and every time the project id changes
$: if (projectId) setupFetchInterval();
@ -59,9 +61,9 @@
onMount(() => {
// Once on load and every time the project id changes
handleMenuActions(data.projectId);
handleMenuActions(projectId);
return unsubscribe(
menuSubscribe(data.projectId),
menuSubscribe(projectId),
hotkeys.on('Meta+Shift+S', () => syncToCloud(projectId))
);
});
@ -71,20 +73,20 @@
<!-- forces components to be recreated when projectId changes -->
{#key projectId}
{#if !$project$}
{#if !project}
<p>Project not found!</p>
{:else if $baseBranch === null}
<!-- Be careful, this works because of the redirect above -->
<slot />
{:else if $baseError}
<ProblemLoadingRepo project={$project$} error={$baseError} />
<ProblemLoadingRepo error={$baseError} />
{:else if $branchesError}
<ProblemLoadingRepo project={$project$} error={$branchesError} />
<ProblemLoadingRepo error={$branchesError} />
{:else if !$gbBranchActive$ && $baseBranch}
<NotOnGitButlerBranch project={$project$} baseBranch={$baseBranch} />
<NotOnGitButlerBranch baseBranch={$baseBranch} />
{:else if $baseBranch}
<div class="view-wrap" role="group" on:dragover|preventDefault>
<Navigation project={$project$} user={$user$} />
<Navigation user={$user$} />
<slot />
</div>
{/if}

View File

@ -18,7 +18,7 @@ export async function load({ params, parent }) {
} = await parent();
const projectId = params.projectId;
const project$ = projectService.getProject(projectId);
const project = await projectService.getProject(projectId);
const fetches$ = getFetchNotifications(projectId);
const heads$ = getHeads(projectId);
const gbBranchActive$ = heads$.pipe(map((head) => head == 'gitbutler/integration'));
@ -52,11 +52,11 @@ export async function load({ params, parent }) {
branchService,
githubService,
projectId,
project,
remoteBranchService,
vbranchService,
// These observables are provided for convenience
project$,
gbBranchActive$
};
}

View File

@ -12,9 +12,6 @@
import { getContext, onMount } from 'svelte';
import { writable } from 'svelte/store';
import type { AnyFile } from '$lib/vbranches/types';
import type { PageData } from './$types';
export let data: PageData;
const defaultBranchWidthRem = 30;
const laneWidthKey = 'historyLaneWidth';
@ -27,12 +24,8 @@
let rsViewport: HTMLDivElement;
let laneWidth: number;
$: project$ = data.project$;
$: projectId = data.projectId;
$: error$ = baseBranchService.error$;
$: projectPath = $project$.path;
$: selectedOwnership = writable(Ownership.default());
$: selected = setSelected($selectedFiles);
@ -59,7 +52,7 @@
>
<ScrollableContainer>
<div class="card">
<BaseBranch {projectId} base={$baseBranch} {selectedFiles} project={$project$} />
<BaseBranch base={$baseBranch} {selectedFiles} />
</div>
</ScrollableContainer>
<Resizer
@ -78,7 +71,6 @@
conflicted={selected.conflicted}
branchId={'blah'}
file={selected}
{projectPath}
{selectedOwnership}
isUnapplied={false}
readonly={true}

View File

@ -14,7 +14,7 @@
const baseBranchService = getContextByClass(BaseBranchService);
const baseBranch = baseBranchService.base;
$: ({ vbranchService, projectId, user$, project$ } = data);
$: ({ vbranchService, projectId, user$ } = data);
$: activeBranches$ = vbranchService.activeBranches$;
$: error$ = vbranchService.branchesError;
@ -48,13 +48,7 @@
<div class="board-wrapper">
<div class="scroll-viewport hide-native-scrollbar" bind:this={viewport}>
<div class="scroll-contents" bind:this={contents}>
<Board
project={$project$}
branches={$activeBranches$}
projectPath={$project$?.path}
branchesError={$error$}
user={$user$}
/>
<Board branches={$activeBranches$} branchesError={$error$} user={$user$} />
</div>
<Scrollbar {viewport} {contents} horz zIndex={50} />
</div>

View File

@ -10,7 +10,6 @@
const githubService = getContextByClass(GitHubService);
$: project$ = data.project$;
$: ({ error, branches } = data.remoteBranchService);
$: branch = $branches?.find((b) => b.sha == $page.params.sha);
@ -22,13 +21,7 @@
{:else if !$branches}
<FullviewLoading />
{:else if branch}
<RemoteBranchPreview
projectId={$project$.id}
projectPath={$project$.path}
project={$project$}
{pr}
{branch}
/>
<RemoteBranchPreview {pr} {branch} />
{:else}
<p>Branch doesn't seem to exist</p>
{/if}

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { Project } from '$lib/backend/projects';
import CloudForm from '$lib/components/CloudForm.svelte';
import DetailsForm from '$lib/components/DetailsForm.svelte';
import FullviewLoading from '$lib/components/FullviewLoading.svelte';
import KeysForm from '$lib/components/KeysForm.svelte';
import PreferencesForm from '$lib/components/PreferencesForm.svelte';
import RemoveProjectButton from '$lib/components/RemoveProjectButton.svelte';
@ -11,7 +11,6 @@
import { UserService } from '$lib/stores/user';
import { getContextByClass } from '$lib/utils/context';
import * as toasts from '$lib/utils/toasts';
import type { Project } from '$lib/backend/projects';
import type { PageData } from './$types';
import { goto } from '$app/navigation';
@ -20,9 +19,9 @@
export let data: PageData;
$: projectService = data.projectService;
$: project$ = data.project$;
$: cloud = data.cloud;
const project = getContextByClass(Project);
const userService = getContextByClass(UserService);
const user = userService.user;
@ -32,7 +31,7 @@
async function onDeleteClicked() {
isDeleting = true;
try {
await projectService.deleteProject($project$?.id);
await projectService.deleteProject(project.id);
await projectService.reload();
goto('/');
toasts.success('Project deleted');
@ -45,13 +44,13 @@
}
async function onCloudUpdated(e: { detail: Project }) {
projectService.updateProject({ ...$project$, ...e.detail });
projectService.updateProject({ ...project, ...e.detail });
}
async function onPreferencesUpdated(e: {
detail: { ok_with_force_push?: boolean; omit_certificate_check?: boolean };
}) {
await projectService.updateProject({ ...$project$, ...e.detail });
await projectService.updateProject({ ...project, ...e.detail });
}
async function onDetailsUpdated(e: { detail: Project }) {
@ -69,29 +68,25 @@
}
</script>
{#if !$project$}
<FullviewLoading />
{:else}
<ContentWrapper title="Project settings">
<CloudForm project={$project$} on:updated={onCloudUpdated} />
<DetailsForm project={$project$} on:updated={onDetailsUpdated} />
<KeysForm project={$project$} />
<Spacer />
<PreferencesForm project={$project$} on:updated={onPreferencesUpdated} />
<SectionCard>
<svelte:fragment slot="title">Remove project</svelte:fragment>
<svelte:fragment slot="caption">
You can remove projects from GitButler, your code remains safe as this only clears
configuration.
</svelte:fragment>
<div>
<RemoveProjectButton
bind:this={deleteConfirmationModal}
projectTitle={$project$?.title}
{isDeleting}
{onDeleteClicked}
/>
</div>
</SectionCard>
</ContentWrapper>
{/if}
<ContentWrapper title="Project settings">
<CloudForm on:updated={onCloudUpdated} />
<DetailsForm on:updated={onDetailsUpdated} />
<KeysForm />
<Spacer />
<PreferencesForm on:updated={onPreferencesUpdated} />
<SectionCard>
<svelte:fragment slot="title">Remove project</svelte:fragment>
<svelte:fragment slot="caption">
You can remove projects from GitButler, your code remains safe as this only clears
configuration.
</svelte:fragment>
<div>
<RemoveProjectButton
bind:this={deleteConfirmationModal}
projectTitle={project.title}
{isDeleting}
{onDeleteClicked}
/>
</div>
</SectionCard>
</ContentWrapper>

View File

@ -1,31 +1,28 @@
<script lang="ts">
import { Project } from '$lib/backend/projects';
import FullviewLoading from '$lib/components/FullviewLoading.svelte';
import ProblemLoadingRepo from '$lib/components/ProblemLoadingRepo.svelte';
import ProjectSetup from '$lib/components/ProjectSetup.svelte';
import { getContextByClass } from '$lib/utils/context';
import { getRemoteBranches } from '$lib/vbranches/branchStoresCache';
import type { PageData } from './$types';
export let data: PageData;
$: ({ projectId, project$ } = data);
const project = getContextByClass(Project);
</script>
{#await getRemoteBranches(projectId)}
{#await getRemoteBranches(project.id)}
<!--TODO: Add project id -->
<FullviewLoading />
{:then remoteBranches}
{#if remoteBranches.length == 0}
<ProblemLoadingRepo
project={$project$}
error="Currently, GitButler requires a remote branch to base its virtual branch work on. To
use virtual branches, please push your code to a remote branch to use as a base"
/>
{:else}
<ProjectSetup project={$project$} {remoteBranches} />
<ProjectSetup {remoteBranches} />
{/if}
{:catch}
<ProblemLoadingRepo
project={$project$}
error="Currently, GitButler requires a remote branch to base its virtual branch work on. To
use virtual branches, please push your code to a remote branch to use as a base"
/>

View File

@ -12,7 +12,7 @@
let applyConflictedModal: Modal;
let deleteBranchModal: Modal;
$: ({ projectId, project$, userService, branchController, vbranchService } = data);
$: ({ projectId, userService, branchController, vbranchService } = data);
$: branches$ = vbranchService.branches$;
$: error = vbranchService.branchesError;
$: user = userService.user;
@ -25,13 +25,7 @@
{:else if !$branches$}
<FullviewLoading />
{:else if branch}
<BranchLane
{branch}
project={$project$}
isUnapplied={!branch.active}
user={$user}
projectPath={$project$.path}
/>
<BranchLane {branch} isUnapplied={!branch.active} user={$user} />
{:else}
<p>Branch no longer exists</p>
{/if}