chore: refactor code formatting and remove unused imports and variables

This commit is contained in:
Pavel Laptev 2024-02-11 20:40:43 +01:00 committed by GitButler
parent 994a50d4aa
commit 5e6d5c466b
4 changed files with 35 additions and 96 deletions

View File

@ -50,7 +50,10 @@
let rsViewport: HTMLElement;
const userSettings = getContext<SettingsStore>(SETTINGS_CONTEXT);
const defaultBranchWidthRem = persisted<number | undefined>(24, 'defaulBranchWidth' + project.id);
const defaultBranchWidthRem = persisted<number | undefined>(
24,
'defaulBranchWidth' + project.id
);
const laneWidthKey = 'laneWidth_';
let laneWidth: number;
@ -129,6 +132,10 @@
}
$: isLaneCollapsed = projectLaneCollapsed(project.id, branch.id);
// $: if (isLaneCollapsed) {
// console.log('isLaneCollapsed', $isLaneCollapsed);
// }
</script>
{#if $isLaneCollapsed}

View File

@ -2,17 +2,13 @@
import ActiveBranchStatus from './ActiveBranchStatus.svelte';
import BranchLabel from './BranchLabel.svelte';
import BranchLanePopupMenu from './BranchLanePopupMenu.svelte';
// import BranchLanePopupMenu from './BranchLanePopupMenu.svelte';
import MergeButton from './MergeButton.svelte';
import Tag from './Tag.svelte';
import { clickOutside } from '$lib/clickOutside';
// import { clickOutside } from '$lib/clickOutside';
import Button from '$lib/components/Button.svelte';
import Icon, { type IconColor } from '$lib/components/Icon.svelte';
// import { normalizeBranchName } from '$lib/utils/branch';
import * as toasts from '$lib/utils/toasts';
import { tooltip } from '$lib/utils/tooltip';
// import { open } from '@tauri-apps/api/shell';
import toast from 'svelte-french-toast';
import type { BranchService } from '$lib/branches/service';
import type { GitHubService } from '$lib/github/service';
@ -37,7 +33,6 @@
let meatballButton: HTMLDivElement;
let visible = false;
let container: HTMLDivElement;
let isApplying = false;
let isDeleting = false;
let isMerging = false;
@ -161,7 +156,7 @@
</div>
{:else}
<div class="header__wrapper">
<div class="header card" bind:this={container} class:isUnapplied>
<div class="header card" class:isUnapplied>
<div class="header__info">
<div class="header__label">
<BranchLabel
@ -179,73 +174,8 @@
{isLaneCollapsed}
prUrl={$pr$?.htmlUrl}
/>
<!-- {#if !branch.upstream}
{#if !branch.active}
<Tag
icon="virtual-branch-small"
color="light"
help="These changes are stashed away from your working directory."
reversedDirection>unapplied</Tag
>
{:else if hasIntegratedCommits}
<Tag
icon="removed-branch-small"
color="success"
help="These changes have been integrated upstream, update your workspace to make this lane disappear."
reversedDirection>integrated</Tag
>
{:else}
<Tag
icon="virtual-branch-small"
color="light"
help="These changes are in your working directory."
reversedDirection>virtual</Tag
>
{/if}
{#if !isUnapplied}
<Tag
disabled
help="Branch name that will be used when pushing. You can change it from the lane menu."
>
origin/{branch.upstreamName
? branch.upstreamName
: normalizeBranchName(branch.name)}</Tag
>
{/if}
{:else} -->
{#if branch.upstream}
<!-- <Tag
icon="open-link"
color="ghost"
border
clickable
shrinkable
on:click={(e) => {
const url = base?.branchUrl(branch.upstream?.name);
if (url) open(url);
e.preventDefault();
e.stopPropagation();
}}
>
origin/{branch.upstreamName}
</Tag>
{#if $pr$?.htmlUrl}
<Tag
icon="pr-small"
color="ghost"
border
clickable
on:click={(e) => {
const url = $pr$?.htmlUrl;
if (url) open(url);
e.preventDefault();
e.stopPropagation();
}}
>
View PR
</Tag>
{/if} -->
{#if prIcon}
{#if branch.upstream && prIcon}
<div
class="pr-status"
role="button"
@ -261,7 +191,6 @@
{/if}
</div>
{/if}
{/if}
{#await branch.isMergeable then isMergeable}
{#if !isMergeable}
<Tag
@ -397,7 +326,6 @@
kind="outlined"
color="neutral"
on:click={() => {
console.log('meatballButton', meatballButton);
visible = !visible;
}}
/>

View File

@ -66,7 +66,7 @@
class="wrapper"
data-tauri-drag-region
class:target-branch={branch.active && branch.selectedForChanges}
class:selected
class:file-selected={selected}
>
<BranchCard
{branch}
@ -103,7 +103,9 @@
selectable={$commitBoxOpen && !isUnapplied}
on:close={() => {
const selectedId = selected?.id;
selectedFiles.update((fileIds) => fileIds.filter((file) => file.id != selectedId));
selectedFiles.update((fileIds) =>
fileIds.filter((file) => file.id != selectedId)
);
}}
/>
<Resizer
@ -143,7 +145,7 @@
);
}
.selected {
.file-selected {
--selected-resize-shift: calc(var(--space-6) * -1);
--selected-target-branch-right-padding: calc(var(--space-4) * -1);
--selected-opacity: 0;

View File

@ -56,8 +56,10 @@
{indeterminate}
on:change={(e) => {
selectedOwnership.update((ownership) => {
if (e.detail) file.hunks.forEach((h) => ownership.addHunk(file.id, h.id));
if (!e.detail) file.hunks.forEach((h) => ownership.removeHunk(file.id, h.id));
if (e.detail)
file.hunks.forEach((h) => ownership.addHunk(file.id, h.id));
if (!e.detail)
file.hunks.forEach((h) => ownership.removeHunk(file.id, h.id));
return ownership;
});
}}
@ -120,13 +122,13 @@
line-height: 120%;
}
.path {
color: var(--clr-theme-scale-ntrl-40);
color: var(--clr-theme-scale-ntrl-0);
line-height: 120%;
flex-shrink: 1;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
line-height: 120%;
opacity: 0.3;
}
.selected-draggable {
background-color: var(--clr-theme-pop-container);