From 61b3eb3ac38553ef4cda0512be19b1f4480d613c Mon Sep 17 00:00:00 2001 From: Vinzent Date: Fri, 30 Sep 2022 20:24:59 +0200 Subject: [PATCH] feat: stage/unstage directory close # --- src/gitManager.ts | 3 +- src/types.ts | 1 + .../sidebar/components/fileComponent.svelte | 7 +- .../components/pulledFileComponent.svelte | 4 + .../components/stagedFileComponent.svelte | 41 +++-- .../sidebar/components/treeComponent.svelte | 158 ++++++++++++------ 6 files changed, 141 insertions(+), 73 deletions(-) diff --git a/src/gitManager.ts b/src/gitManager.ts index 0d3d5f70..2c902e25 100644 --- a/src/gitManager.ts +++ b/src/gitManager.ts @@ -100,10 +100,11 @@ export abstract class GitManager { childrenWithSameTitle.forEach((item) => children.remove(item)); list.push({ title: title, + path: first.path, children: this.getTreeStructure(childrenWithSameTitle, (beginLength > 0 ? (beginLength + title.length) : title.length) + 1) }); } else { - list.push({ title: restPath, statusResult: first }); + list.push({ title: restPath, statusResult: first, path: first.path }); children.remove(first); } } diff --git a/src/types.ts b/src/types.ts index d529bef3..5c0b9984 100644 --- a/src/types.ts +++ b/src/types.ts @@ -139,6 +139,7 @@ export interface BranchInfo { export interface TreeItem { title: string; + path: string; statusResult?: FileStatusResult; children?: TreeItem[]; } diff --git a/src/ui/sidebar/components/fileComponent.svelte b/src/ui/sidebar/components/fileComponent.svelte index 33abdb5b..5b22edd4 100644 --- a/src/ui/sidebar/components/fileComponent.svelte +++ b/src/ui/sidebar/components/fileComponent.svelte @@ -132,6 +132,10 @@