mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-30 04:58:55 +03:00
merged from upstream
This commit is contained in:
commit
994a50d4aa
@ -2,6 +2,7 @@
|
|||||||
import Tag from '$lib/components/Tag.svelte';
|
import Tag from '$lib/components/Tag.svelte';
|
||||||
import { normalizeBranchName } from '$lib/utils/branch';
|
import { normalizeBranchName } from '$lib/utils/branch';
|
||||||
import { open } from '@tauri-apps/api/shell';
|
import { open } from '@tauri-apps/api/shell';
|
||||||
|
import type { Persisted } from '$lib/persisted/persisted';
|
||||||
import type { BaseBranch, Branch } from '$lib/vbranches/types';
|
import type { BaseBranch, Branch } from '$lib/vbranches/types';
|
||||||
|
|
||||||
export let base: BaseBranch | undefined | null;
|
export let base: BaseBranch | undefined | null;
|
||||||
@ -9,7 +10,7 @@
|
|||||||
export let prUrl: string | undefined;
|
export let prUrl: string | undefined;
|
||||||
export let isUnapplied = false;
|
export let isUnapplied = false;
|
||||||
export let hasIntegratedCommits = false;
|
export let hasIntegratedCommits = false;
|
||||||
export let isLaneCollapsed = false;
|
export let isLaneCollapsed: Persisted<boolean>;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !branch.upstream}
|
{#if !branch.upstream}
|
||||||
@ -19,7 +20,7 @@
|
|||||||
color="light"
|
color="light"
|
||||||
help="These changes are stashed away from your working directory."
|
help="These changes are stashed away from your working directory."
|
||||||
reversedDirection
|
reversedDirection
|
||||||
verticalOrientation={isLaneCollapsed}>unapplied</Tag
|
verticalOrientation={$isLaneCollapsed}>unapplied</Tag
|
||||||
>
|
>
|
||||||
{:else if hasIntegratedCommits}
|
{:else if hasIntegratedCommits}
|
||||||
<Tag
|
<Tag
|
||||||
@ -27,7 +28,7 @@
|
|||||||
color="success"
|
color="success"
|
||||||
help="These changes have been integrated upstream, update your workspace to make this lane disappear."
|
help="These changes have been integrated upstream, update your workspace to make this lane disappear."
|
||||||
reversedDirection
|
reversedDirection
|
||||||
verticalOrientation={isLaneCollapsed}>Integrated</Tag
|
verticalOrientation={$isLaneCollapsed}>Integrated</Tag
|
||||||
>
|
>
|
||||||
{:else}
|
{:else}
|
||||||
<Tag
|
<Tag
|
||||||
@ -35,18 +36,16 @@
|
|||||||
color="light"
|
color="light"
|
||||||
help="These changes are in your working directory."
|
help="These changes are in your working directory."
|
||||||
reversedDirection
|
reversedDirection
|
||||||
verticalOrientation={isLaneCollapsed}>Virtual</Tag
|
verticalOrientation={$isLaneCollapsed}>Virtual</Tag
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !isUnapplied}
|
{#if !isUnapplied}
|
||||||
<Tag
|
<Tag
|
||||||
disabled
|
disabled
|
||||||
help="Branch name that will be used when pushing. You can change it from the lane menu."
|
help="Branch name that will be used when pushing. You can change it from the lane menu."
|
||||||
verticalOrientation={isLaneCollapsed}
|
verticalOrientation={$isLaneCollapsed}
|
||||||
>
|
>
|
||||||
origin/{branch.upstreamName
|
origin/{branch.upstreamName ? branch.upstreamName : normalizeBranchName(branch.name)}</Tag
|
||||||
? branch.upstreamName
|
|
||||||
: normalizeBranchName(branch.name)}</Tag
|
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
@ -54,7 +53,7 @@
|
|||||||
color="dark"
|
color="dark"
|
||||||
icon="remote-branch-small"
|
icon="remote-branch-small"
|
||||||
help="At least some of your changes have been pushed"
|
help="At least some of your changes have been pushed"
|
||||||
verticalOrientation={isLaneCollapsed}
|
verticalOrientation={$isLaneCollapsed}
|
||||||
reversedDirection>Remote</Tag
|
reversedDirection>Remote</Tag
|
||||||
>
|
>
|
||||||
<Tag
|
<Tag
|
||||||
@ -63,7 +62,7 @@
|
|||||||
border
|
border
|
||||||
clickable
|
clickable
|
||||||
shrinkable
|
shrinkable
|
||||||
verticalOrientation={isLaneCollapsed}
|
verticalOrientation={$isLaneCollapsed}
|
||||||
on:click={(e) => {
|
on:click={(e) => {
|
||||||
const url = base?.branchUrl(branch.upstream?.name);
|
const url = base?.branchUrl(branch.upstream?.name);
|
||||||
if (url) open(url);
|
if (url) open(url);
|
||||||
@ -71,7 +70,7 @@
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isLaneCollapsed ? 'View branch' : `origin/${branch.upstream?.name}`}
|
{$isLaneCollapsed ? 'View branch' : `origin/${branch.upstream?.name}`}
|
||||||
</Tag>
|
</Tag>
|
||||||
{#if prUrl}
|
{#if prUrl}
|
||||||
<Tag
|
<Tag
|
||||||
@ -79,7 +78,7 @@
|
|||||||
color="ghost"
|
color="ghost"
|
||||||
border
|
border
|
||||||
clickable
|
clickable
|
||||||
verticalOrientation={isLaneCollapsed}
|
verticalOrientation={$isLaneCollapsed}
|
||||||
on:click={(e) => {
|
on:click={(e) => {
|
||||||
const url = prUrl;
|
const url = prUrl;
|
||||||
if (url) open(url);
|
if (url) open(url);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
import ImgThemed from '$lib/components/ImgThemed.svelte';
|
import ImgThemed from '$lib/components/ImgThemed.svelte';
|
||||||
import Resizer from '$lib/components/Resizer.svelte';
|
import Resizer from '$lib/components/Resizer.svelte';
|
||||||
import { projectAiGenEnabled } from '$lib/config/config';
|
import { projectAiGenEnabled } from '$lib/config/config';
|
||||||
|
import { projectLaneCollapsed } from '$lib/config/config';
|
||||||
import {
|
import {
|
||||||
isDraggableFile,
|
isDraggableFile,
|
||||||
isDraggableHunk,
|
isDraggableHunk,
|
||||||
@ -49,10 +50,7 @@
|
|||||||
let rsViewport: HTMLElement;
|
let rsViewport: HTMLElement;
|
||||||
|
|
||||||
const userSettings = getContext<SettingsStore>(SETTINGS_CONTEXT);
|
const userSettings = getContext<SettingsStore>(SETTINGS_CONTEXT);
|
||||||
const defaultBranchWidthRem = persisted<number | undefined>(
|
const defaultBranchWidthRem = persisted<number | undefined>(24, 'defaulBranchWidth' + project.id);
|
||||||
24,
|
|
||||||
'defaulBranchWidth' + project.id
|
|
||||||
);
|
|
||||||
const laneWidthKey = 'laneWidth_';
|
const laneWidthKey = 'laneWidth_';
|
||||||
|
|
||||||
let laneWidth: number;
|
let laneWidth: number;
|
||||||
@ -130,10 +128,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let isLaneCollapsed: boolean;
|
$: isLaneCollapsed = projectLaneCollapsed(project.id, branch.id);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if isLaneCollapsed}
|
{#if $isLaneCollapsed}
|
||||||
<div class="collapsed-lane-wrapper">
|
<div class="collapsed-lane-wrapper">
|
||||||
<BranchHeader
|
<BranchHeader
|
||||||
{isUnapplied}
|
{isUnapplied}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import type { BranchService } from '$lib/branches/service';
|
import type { BranchService } from '$lib/branches/service';
|
||||||
import type { GitHubService } from '$lib/github/service';
|
import type { GitHubService } from '$lib/github/service';
|
||||||
import type { PrStatus } from '$lib/github/types';
|
import type { PrStatus } from '$lib/github/types';
|
||||||
|
import type { Persisted } from '$lib/persisted/persisted';
|
||||||
import type { BranchController } from '$lib/vbranches/branchController';
|
import type { BranchController } from '$lib/vbranches/branchController';
|
||||||
import type { BaseBranch, Branch } from '$lib/vbranches/types';
|
import type { BaseBranch, Branch } from '$lib/vbranches/types';
|
||||||
import type iconsJson from '../icons/icons.json';
|
import type iconsJson from '../icons/icons.json';
|
||||||
@ -29,7 +30,7 @@
|
|||||||
export let branchService: BranchService;
|
export let branchService: BranchService;
|
||||||
export let projectId: string;
|
export let projectId: string;
|
||||||
|
|
||||||
export let isLaneCollapsed = false;
|
export let isLaneCollapsed: Persisted<boolean>;
|
||||||
|
|
||||||
export let githubService: GitHubService;
|
export let githubService: GitHubService;
|
||||||
$: pr$ = githubService.get(branch.upstreamName);
|
$: pr$ = githubService.get(branch.upstreamName);
|
||||||
@ -122,7 +123,7 @@
|
|||||||
$: hasIntegratedCommits = branch.commits?.some((b) => b.isIntegrated);
|
$: hasIntegratedCommits = branch.commits?.some((b) => b.isIntegrated);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if isLaneCollapsed}
|
{#if $isLaneCollapsed}
|
||||||
<div class="card collapsed-lane" data-tauri-drag-region>
|
<div class="card collapsed-lane" data-tauri-drag-region>
|
||||||
<div class="collapsed-lane__actions">
|
<div class="collapsed-lane__actions">
|
||||||
<div class="collapsed-lane__draggable" data-drag-handle>
|
<div class="collapsed-lane__draggable" data-drag-handle>
|
||||||
@ -134,7 +135,7 @@
|
|||||||
color="neutral"
|
color="neutral"
|
||||||
help="Collapse lane"
|
help="Collapse lane"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
isLaneCollapsed = false;
|
$isLaneCollapsed = false;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -175,6 +176,7 @@
|
|||||||
{branch}
|
{branch}
|
||||||
{isUnapplied}
|
{isUnapplied}
|
||||||
{hasIntegratedCommits}
|
{hasIntegratedCommits}
|
||||||
|
{isLaneCollapsed}
|
||||||
prUrl={$pr$?.htmlUrl}
|
prUrl={$pr$?.htmlUrl}
|
||||||
/>
|
/>
|
||||||
<!-- {#if !branch.upstream}
|
<!-- {#if !branch.upstream}
|
||||||
@ -387,7 +389,7 @@
|
|||||||
color="neutral"
|
color="neutral"
|
||||||
help="Collapse lane"
|
help="Collapse lane"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
isLaneCollapsed = true;
|
$isLaneCollapsed = true;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
import BranchLanePopupMenu from './BranchLanePopupMenu.svelte';
|
import BranchLanePopupMenu from './BranchLanePopupMenu.svelte';
|
||||||
import { clickOutside } from '$lib/clickOutside';
|
import { clickOutside } from '$lib/clickOutside';
|
||||||
import Button from '$lib/components/Button.svelte';
|
import Button from '$lib/components/Button.svelte';
|
||||||
|
import type { Persisted } from '$lib/persisted/persisted';
|
||||||
import type { BranchController } from '$lib/vbranches/branchController';
|
import type { BranchController } from '$lib/vbranches/branchController';
|
||||||
import type { Branch } from '$lib/vbranches/types';
|
import type { Branch } from '$lib/vbranches/types';
|
||||||
|
|
||||||
export let isLaneCollapsed = false;
|
export let isLaneCollapsed: Persisted<boolean>;
|
||||||
export let visible = false;
|
export let visible = false;
|
||||||
|
|
||||||
export let isUnapplied = false;
|
export let isUnapplied = false;
|
||||||
@ -18,12 +19,12 @@
|
|||||||
|
|
||||||
<div style="display: contents;">
|
<div style="display: contents;">
|
||||||
<Button
|
<Button
|
||||||
icon={isLaneCollapsed ? 'unfold-lane' : 'fold-lane'}
|
icon={$isLaneCollapsed ? 'unfold-lane' : 'fold-lane'}
|
||||||
kind="outlined"
|
kind="outlined"
|
||||||
color="neutral"
|
color="neutral"
|
||||||
help={isLaneCollapsed ? 'Expand lane' : 'Collapse lane'}
|
help={$isLaneCollapsed ? 'Expand lane' : 'Collapse lane'}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
isLaneCollapsed = !isLaneCollapsed;
|
$isLaneCollapsed = !$isLaneCollapsed;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
@ -103,9 +103,7 @@
|
|||||||
selectable={$commitBoxOpen && !isUnapplied}
|
selectable={$commitBoxOpen && !isUnapplied}
|
||||||
on:close={() => {
|
on:close={() => {
|
||||||
const selectedId = selected?.id;
|
const selectedId = selected?.id;
|
||||||
selectedFiles.update((fileIds) =>
|
selectedFiles.update((fileIds) => fileIds.filter((file) => file.id != selectedId));
|
||||||
fileIds.filter((file) => file.id != selectedId)
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Resizer
|
<Resizer
|
||||||
|
@ -40,3 +40,8 @@ export function projectRunCommitHooks(projectId: string): Persisted<boolean> {
|
|||||||
const key = 'projectRunCommitHooks_';
|
const key = 'projectRunCommitHooks_';
|
||||||
return persisted(false, key + projectId);
|
return persisted(false, key + projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function projectLaneCollapsed(projectId: string, laneId: string): Persisted<boolean> {
|
||||||
|
const key = 'projectLaneCollapsed_';
|
||||||
|
return persisted(false, key + projectId + '_' + laneId);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user