From c00c879d0cd365ce76499a6aa2b0a61b961f7694 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Fri, 27 Oct 2023 15:33:36 +0200 Subject: [PATCH] Expand and collapse all files in a changeset quickly Signed-off-by: Sebastian Martinez --- src/components/File.svelte | 2 +- src/views/projects/Changeset.svelte | 48 ++++++++++++++------ src/views/projects/Changeset/FileDiff.svelte | 3 +- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/components/File.svelte b/src/components/File.svelte index 7165eab12..cf242337c 100644 --- a/src/components/File.svelte +++ b/src/components/File.svelte @@ -3,8 +3,8 @@ import ExpandButton from "./ExpandButton.svelte"; export let collapsable: boolean = false; + export let expanded: boolean = true; - let expanded = true; let header: HTMLDivElement; diff --git a/src/views/projects/Changeset.svelte b/src/views/projects/Changeset.svelte index 784a30cba..8e9eecbb0 100644 --- a/src/views/projects/Changeset.svelte +++ b/src/views/projects/Changeset.svelte @@ -9,6 +9,7 @@ import { pluralize } from "@app/lib/pluralize"; + import Button from "@app/components/Button.svelte"; import FileDiff from "@app/views/projects/Changeset/FileDiff.svelte"; import FileLocationChange from "@app/views/projects/Changeset/FileLocationChange.svelte"; import Observer, { intersection } from "@app/components/Observer.svelte"; @@ -19,6 +20,8 @@ export let projectId: string; export let revision: string; + let expanded = true; + const diffDescription = ({ modified, added, @@ -59,9 +62,12 @@ -
- {diffDescription(diff)} - with - 0}> - {diff.stats.insertions} - {pluralize("insertion", diff.stats.insertions)} - - and - 0}> - {diff.stats.deletions} - {pluralize("deletion", diff.stats.deletions)} - +
+ + {diffDescription(diff)} + with + 0}> + {diff.stats.insertions} + {pluralize("insertion", diff.stats.insertions)} + + and + 0}> + {diff.stats.deletions} + {pluralize("deletion", diff.stats.deletions)} + + +
+ + +
@@ -98,6 +114,7 @@ {projectId} {baseUrl} {revision} + {expanded} visible={filesVisibility.has(file.path)} content={files[file.new.oid]?.content} filePath={file.path} @@ -111,6 +128,7 @@ {projectId} {baseUrl} {revision} + {expanded} visible={filesVisibility.has(file.path)} oldContent={files[file.old.oid]?.content} filePath={file.path} @@ -124,6 +142,7 @@ {projectId} {baseUrl} {revision} + {expanded} visible={filesVisibility.has(file.path)} oldContent={files[file.old.oid]?.content} content={files[file.new.oid]?.content} @@ -138,6 +157,7 @@ {projectId} {baseUrl} {revision} + {expanded} content="" visible={filesVisibility.has(file.newPath)} filePath={file.newPath} diff --git a/src/views/projects/Changeset/FileDiff.svelte b/src/views/projects/Changeset/FileDiff.svelte index aea6db61f..2ea3194a9 100644 --- a/src/views/projects/Changeset/FileDiff.svelte +++ b/src/views/projects/Changeset/FileDiff.svelte @@ -30,6 +30,7 @@ export let baseUrl: BaseUrl; export let projectId: string; export let visible: boolean = false; + export let expanded: boolean = true; let selection: Selection | undefined = undefined; let highlighting: { new?: string[]; old?: string[] } | undefined = undefined; @@ -376,7 +377,7 @@ } - + {#if (headerBadgeCaption === "moved" || headerBadgeCaption === "copied") && oldFilePath}