mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-20 16:11:46 +03:00
fix: automatically close file on branch collapse.
This commit is contained in:
parent
d94ba76302
commit
9b3e99fe83
@ -7,7 +7,6 @@
|
||||
import ImgThemed from '$lib/components/ImgThemed.svelte';
|
||||
import Resizer from '$lib/components/Resizer.svelte';
|
||||
import { projectAiGenEnabled } from '$lib/config/config';
|
||||
import { projectLaneCollapsed } from '$lib/config/config';
|
||||
import {
|
||||
isDraggableFile,
|
||||
isDraggableHunk,
|
||||
@ -28,6 +27,7 @@
|
||||
import type { Project } from '$lib/backend/projects';
|
||||
import type { BranchService } from '$lib/branches/service';
|
||||
import type { GitHubService } from '$lib/github/service';
|
||||
import type { Persisted } from '$lib/persisted/persisted';
|
||||
import type { BranchController } from '$lib/vbranches/branchController';
|
||||
import type { BaseBranch, Branch, LocalFile } from '$lib/vbranches/types';
|
||||
|
||||
@ -45,6 +45,8 @@
|
||||
export let selectedOwnership: Writable<Ownership>;
|
||||
export let commitBoxOpen: Writable<boolean>;
|
||||
|
||||
export let isLaneCollapsed: Persisted<boolean>;
|
||||
|
||||
const aiGenEnabled = projectAiGenEnabled(project.id);
|
||||
|
||||
let rsViewport: HTMLElement;
|
||||
@ -127,8 +129,6 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$: isLaneCollapsed = projectLaneCollapsed(project.id, branch.id);
|
||||
</script>
|
||||
|
||||
{#if $isLaneCollapsed}
|
||||
|
@ -2,6 +2,7 @@
|
||||
import BranchCard from './BranchCard.svelte';
|
||||
import FileCard from './FileCard.svelte';
|
||||
import Resizer from '$lib/components/Resizer.svelte';
|
||||
import { projectLaneCollapsed } from '$lib/config/config';
|
||||
import { persisted } from '$lib/persisted/persisted';
|
||||
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/settings/userSettings';
|
||||
import { Ownership } from '$lib/vbranches/ownership';
|
||||
@ -51,7 +52,7 @@
|
||||
|
||||
fileWidth = lscache.get(fileWidthKey + branch.id);
|
||||
|
||||
function setSelected(files: AnyFile[], branch: Branch) {
|
||||
const setSelected = (files: AnyFile[], branch: Branch) => {
|
||||
if (files.length == 0) return undefined;
|
||||
if (files.length == 1 && files[0] instanceof RemoteFile) return files[0];
|
||||
|
||||
@ -59,6 +60,11 @@
|
||||
const match = branch.files?.find((f) => files[0].id == f.id);
|
||||
if (!match) $selectedFiles = [];
|
||||
return match;
|
||||
};
|
||||
|
||||
$: isLaneCollapsed = projectLaneCollapsed(project.id, branch.id);
|
||||
$: if ($isLaneCollapsed) {
|
||||
$selectedFiles = [];
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -78,6 +84,7 @@
|
||||
{branchService}
|
||||
{selectedOwnership}
|
||||
bind:commitBoxOpen
|
||||
bind:isLaneCollapsed
|
||||
{branchCount}
|
||||
{user}
|
||||
{selectedFiles}
|
||||
|
Loading…
Reference in New Issue
Block a user