From af907c2902f2919bc6e38ee54a54bc04555e9032 Mon Sep 17 00:00:00 2001 From: Pavel Laptev Date: Sat, 17 Feb 2024 02:17:01 +0100 Subject: [PATCH] remove code duplication, `readonly` state for file list tree fixed --- .../src/lib/components/BranchCard.svelte | 15 ++++- .../src/lib/components/BranchFiles.svelte | 44 ++++++-------- .../src/lib/components/CommitCard.svelte | 60 ++++--------------- .../src/lib/components/FileTree.svelte | 4 ++ .../src/lib/components/TreeListFile.svelte | 3 +- 5 files changed, 48 insertions(+), 78 deletions(-) diff --git a/gitbutler-ui/src/lib/components/BranchCard.svelte b/gitbutler-ui/src/lib/components/BranchCard.svelte index 19f02607a..d5c09a463 100644 --- a/gitbutler-ui/src/lib/components/BranchCard.svelte +++ b/gitbutler-ui/src/lib/components/BranchCard.svelte @@ -203,12 +203,25 @@ {#if branch.files?.length > 0}
+ {#if branch.active && branch.conflicted} +
+ {#if branch.files.some((f) => f.conflicted)} + This virtual branch conflicts with upstream changes. Please resolve all conflicts + and commit before you can continue. + {:else} + Please commit your resolved conflicts to continue. + {/if} +
+ {/if} {#if branch.active} ; - export let selectedFiles: Writable; + export let selectedFiles: Writable<(LocalFile | RemoteFile)[]>; export let showCheckboxes = false; + export let allowMultiple: boolean; + export let readonly: boolean; + let selectedListMode: string; -{#if branch.active && branch.conflicted} -
- {#if branch.files.some((f) => f.conflicted)} - This virtual branch conflicts with upstream changes. Please resolve all conflicts and commit - before you can continue. - {:else} - Please commit your resolved conflicts to continue. - {/if} -
-{/if} -
- +
- {#if branch.files.length > 0} + {#if files.length > 0}
{#if selectedListMode == 'list'} {:else} - import BranchFilesHeader from './BranchFilesHeader.svelte'; - import BranchFilesList from './BranchFilesList.svelte'; - import FileTree from './FileTree.svelte'; + import BranchFiles from './BranchFiles.svelte'; import Button from '$lib/components/Button.svelte'; import Tag from '$lib/components/Tag.svelte'; import TimeAgo from '$lib/components/TimeAgo.svelte'; import { draggable } from '$lib/dragging/draggable'; import { draggableCommit, nonDraggable } from '$lib/dragging/draggables'; import { openExternalUrl } from '$lib/utils/url'; - import { filesToFileTree } from '$lib/vbranches/filetree'; import { Ownership } from '$lib/vbranches/ownership'; import { listRemoteCommitFiles } from '$lib/vbranches/remoteCommits'; import { LocalFile, RemoteCommit, Commit, RemoteFile } from '$lib/vbranches/types'; @@ -26,7 +23,6 @@ const selectedOwnership = writable(Ownership.default()); let showFiles = false; - let selectedListMode: string; let files: RemoteFile[] = []; @@ -86,35 +82,16 @@ {#if showFiles}
-
- -
-
- {#if selectedListMode == 'list'} - - {:else} - - {/if} -
+ + {#if !commit.isLocal && commitUrl}