mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-04 03:42:38 +03:00
Show trunk as card
This commit is contained in:
parent
a480ea0ecc
commit
e1b63dfbc3
@ -295,6 +295,6 @@ export function getCloudApiClient(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function syncToCloud(projectId: string) {
|
export function syncToCloud(projectId: string | undefined) {
|
||||||
invoke<void>('project_flush_and_push', { id: projectId });
|
if (projectId) invoke<void>('project_flush_and_push', { id: projectId });
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
export let data: LayoutData;
|
export let data: LayoutData;
|
||||||
let {
|
let {
|
||||||
projectId,
|
projectStore,
|
||||||
update,
|
update,
|
||||||
sessionsStore,
|
sessionsStore,
|
||||||
deltasStore,
|
deltasStore,
|
||||||
@ -46,8 +46,8 @@
|
|||||||
|
|
||||||
onMount(() =>
|
onMount(() =>
|
||||||
unsubscribe(
|
unsubscribe(
|
||||||
hotkeys.on('Meta+Shift+R', () => goto(`/old/${projectId}/player`)),
|
hotkeys.on('Meta+Shift+R', () => goto(`/old/${$projectStore?.id}/player`)),
|
||||||
hotkeys.on('Meta+Shift+S', () => syncToCloud(projectId))
|
hotkeys.on('Meta+Shift+S', () => syncToCloud($projectStore?.id))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
@ -56,19 +56,24 @@
|
|||||||
Loading...
|
Loading...
|
||||||
{:else if $baseBranchStore}
|
{:else if $baseBranchStore}
|
||||||
{#if !$vbranchesState.isError}
|
{#if !$vbranchesState.isError}
|
||||||
|
{@const project = $projectStore}
|
||||||
<div class="relative flex w-full max-w-full" role="group" on:dragover|preventDefault>
|
<div class="relative flex w-full max-w-full" role="group" on:dragover|preventDefault>
|
||||||
<div bind:this={trayViewport} class="z-30 flex flex-shrink">
|
<div bind:this={trayViewport} class="z-30 flex flex-shrink">
|
||||||
|
{#if project}
|
||||||
<Navigation
|
<Navigation
|
||||||
branchesWithContentStore={branchesWithContent}
|
branchesWithContentStore={branchesWithContent}
|
||||||
{remoteBranchStore}
|
{remoteBranchStore}
|
||||||
{baseBranchStore}
|
{baseBranchStore}
|
||||||
{branchController}
|
{branchController}
|
||||||
{projectId}
|
{project}
|
||||||
githubContext={$githubContextStore}
|
githubContext={$githubContextStore}
|
||||||
user={$userStore}
|
user={$userStore}
|
||||||
{update}
|
{update}
|
||||||
{pullRequestsStore}
|
{pullRequestsStore}
|
||||||
/>
|
/>
|
||||||
|
{:else}
|
||||||
|
<p>loading...</p>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<Resizer
|
<Resizer
|
||||||
minWidth={300}
|
minWidth={300}
|
||||||
|
@ -48,7 +48,7 @@ export const load: LayoutLoad = async ({ params }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const githubContextStore = getGitHubContextStore(userStore, baseBranchStore);
|
const githubContextStore = getGitHubContextStore(userStore, baseBranchStore);
|
||||||
const project = getProjectStore({ id: params.projectId });
|
const projectStore = getProjectStore({ id: params.projectId });
|
||||||
|
|
||||||
const pullRequestsStore = listPullRequestsWithCache(githubContextStore);
|
const pullRequestsStore = listPullRequestsWithCache(githubContextStore);
|
||||||
const pullRequestsState = pullRequestsStore.state;
|
const pullRequestsState = pullRequestsStore.state;
|
||||||
@ -66,7 +66,7 @@ export const load: LayoutLoad = async ({ params }) => {
|
|||||||
baseBranchStore,
|
baseBranchStore,
|
||||||
remoteBranchStore,
|
remoteBranchStore,
|
||||||
remoteBranchState,
|
remoteBranchState,
|
||||||
project,
|
projectStore,
|
||||||
githubContextStore,
|
githubContextStore,
|
||||||
pullRequestsStore,
|
pullRequestsStore,
|
||||||
pullRequestsState
|
pullRequestsState
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import type { Project } from '$lib/backend/projects';
|
||||||
import IconButton from '$lib/components/IconButton.svelte';
|
import IconButton from '$lib/components/IconButton.svelte';
|
||||||
import TimeAgo from '$lib/components/TimeAgo.svelte';
|
import TimeAgo from '$lib/components/TimeAgo.svelte';
|
||||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||||
@ -8,7 +9,7 @@
|
|||||||
import type { BranchController } from '$lib/vbranches/branchController';
|
import type { BranchController } from '$lib/vbranches/branchController';
|
||||||
import type { BaseBranch, CustomStore } from '$lib/vbranches/types';
|
import type { BaseBranch, CustomStore } from '$lib/vbranches/types';
|
||||||
|
|
||||||
export let projectId: string;
|
export let project: Project;
|
||||||
export let branchController: BranchController;
|
export let branchController: BranchController;
|
||||||
export let baseBranchStore: CustomStore<BaseBranch | undefined>;
|
export let baseBranchStore: CustomStore<BaseBranch | undefined>;
|
||||||
|
|
||||||
@ -16,10 +17,15 @@
|
|||||||
let fetching = false;
|
let fetching = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a href="/{projectId}/base" class="flex flex-col p-2" tabindex="0" bind:this={baseContents}>
|
<a
|
||||||
|
href="/{project.id}/base"
|
||||||
|
class="bg-color-3 m-4 flex flex-col rounded-lg p-3"
|
||||||
|
tabindex="0"
|
||||||
|
bind:this={baseContents}
|
||||||
|
>
|
||||||
<div class="flex flex-grow items-center">
|
<div class="flex flex-grow items-center">
|
||||||
<div class="flex flex-grow items-center gap-1">
|
<div class="flex flex-grow items-center gap-1">
|
||||||
<span class="font-bold">Trunk</span>
|
<span class="font-bold">{project.title}</span>
|
||||||
{#if ($baseBranchStore?.behind || 0) > 0}
|
{#if ($baseBranchStore?.behind || 0) > 0}
|
||||||
<Tooltip label="Unmerged upstream commits">
|
<Tooltip label="Unmerged upstream commits">
|
||||||
<div
|
<div
|
||||||
|
@ -32,13 +32,14 @@
|
|||||||
import IconSpinner from '$lib/icons/IconSpinner.svelte';
|
import IconSpinner from '$lib/icons/IconSpinner.svelte';
|
||||||
import { isLoading, loadStack } from '$lib/backend/ipc';
|
import { isLoading, loadStack } from '$lib/backend/ipc';
|
||||||
import BaseBranchCard from './BaseBranchCard.svelte';
|
import BaseBranchCard from './BaseBranchCard.svelte';
|
||||||
|
import type { Project } from '$lib/backend/projects';
|
||||||
|
|
||||||
export let branchesWithContentStore: CustomStore<Branch[] | undefined>;
|
export let branchesWithContentStore: CustomStore<Branch[] | undefined>;
|
||||||
export let remoteBranchStore: CustomStore<RemoteBranch[] | undefined>;
|
export let remoteBranchStore: CustomStore<RemoteBranch[] | undefined>;
|
||||||
export let baseBranchStore: CustomStore<BaseBranch | undefined>;
|
export let baseBranchStore: CustomStore<BaseBranch | undefined>;
|
||||||
export let pullRequestsStore: CustomStore<PullRequest[] | undefined>;
|
export let pullRequestsStore: CustomStore<PullRequest[] | undefined>;
|
||||||
export let branchController: BranchController;
|
export let branchController: BranchController;
|
||||||
export let projectId: string;
|
export let project: Project;
|
||||||
export let githubContext: GitHubIntegrationContext | undefined;
|
export let githubContext: GitHubIntegrationContext | undefined;
|
||||||
export let user: User | undefined;
|
export let user: User | undefined;
|
||||||
export let update: Loadable<Update>;
|
export let update: Loadable<Update>;
|
||||||
@ -83,7 +84,8 @@
|
|||||||
<!-- Top spacer -->
|
<!-- Top spacer -->
|
||||||
<div class="flex h-5 flex-shrink-0" data-tauri-drag-region></div>
|
<div class="flex h-5 flex-shrink-0" data-tauri-drag-region></div>
|
||||||
<!-- Base branch -->
|
<!-- Base branch -->
|
||||||
<BaseBranchCard {projectId} {branchController} {baseBranchStore} />
|
|
||||||
|
<BaseBranchCard {project} {branchController} {baseBranchStore} />
|
||||||
<!-- Your branches -->
|
<!-- Your branches -->
|
||||||
<div
|
<div
|
||||||
class="bg-color-4 border-color-4 flex items-center justify-between border-b border-t px-2 py-1 pr-1"
|
class="bg-color-4 border-color-4 flex items-center justify-between border-b border-t px-2 py-1 pr-1"
|
||||||
@ -119,7 +121,7 @@
|
|||||||
{@const { added, removed } = sumBranchLinesAddedRemoved(branch)}
|
{@const { added, removed } = sumBranchLinesAddedRemoved(branch)}
|
||||||
{@const latestModifiedAt = branch.files.at(0)?.hunks.at(0)?.modifiedAt}
|
{@const latestModifiedAt = branch.files.at(0)?.hunks.at(0)?.modifiedAt}
|
||||||
<a
|
<a
|
||||||
href={`/${projectId}/stashed/${branch.id}`}
|
href={`/${project.id}/stashed/${branch.id}`}
|
||||||
transition:slide={{ duration: 250 }}
|
transition:slide={{ duration: 250 }}
|
||||||
class="border-color-4 group block border-b p-2 pr-0 -outline-offset-2 outline-blue-200 last:border-b focus-within:outline-2"
|
class="border-color-4 group block border-b p-2 pr-0 -outline-offset-2 outline-blue-200 last:border-b focus-within:outline-2"
|
||||||
class:bg-light-50={$page.url.pathname.includes(branch.id)}
|
class:bg-light-50={$page.url.pathname.includes(branch.id)}
|
||||||
@ -202,9 +204,9 @@
|
|||||||
|
|
||||||
<!-- Remote branches -->
|
<!-- Remote branches -->
|
||||||
{#if githubContext}
|
{#if githubContext}
|
||||||
<PullRequests {pullRequestsStore} {projectId} />
|
<PullRequests {pullRequestsStore} projectId={project.id} />
|
||||||
{:else}
|
{:else}
|
||||||
<RemoteBranches {remoteBranchStore} {projectId}></RemoteBranches>
|
<RemoteBranches {remoteBranchStore} projectId={project.id}></RemoteBranches>
|
||||||
{/if}
|
{/if}
|
||||||
<!-- Bottom spacer -->
|
<!-- Bottom spacer -->
|
||||||
<div
|
<div
|
||||||
@ -214,7 +216,7 @@
|
|||||||
<Link href="/" class="p-1">
|
<Link href="/" class="p-1">
|
||||||
<IconHome />
|
<IconHome />
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/{projectId}/settings" class="p-1">
|
<Link href="/{project.id}/settings" class="p-1">
|
||||||
<IconSettings />
|
<IconSettings />
|
||||||
</Link>
|
</Link>
|
||||||
<Tooltip label="Send feedback">
|
<Tooltip label="Send feedback">
|
||||||
|
Loading…
Reference in New Issue
Block a user