fix: series list in stack header

This commit is contained in:
ndom91 2024-11-19 13:01:46 +01:00
parent d4e81fd227
commit 014e0704ca
No known key found for this signature in database
3 changed files with 20 additions and 5 deletions

View File

@ -6,7 +6,7 @@
import Button from '@gitbutler/ui/Button.svelte'; import Button from '@gitbutler/ui/Button.svelte';
interface Props { interface Props {
series: PatchSeries[]; series: (PatchSeries | Error)[];
onCollapseButtonClick: () => void; onCollapseButtonClick: () => void;
} }

View File

@ -1,11 +1,11 @@
<script lang="ts"> <script lang="ts">
import Select from '$lib/select/Select.svelte'; import Select from '$lib/select/Select.svelte';
import { PatchSeries } from '$lib/vbranches/types'; import { isPatchSeries, PatchSeries } from '$lib/vbranches/types';
import Icon from '@gitbutler/ui/Icon.svelte'; import Icon from '@gitbutler/ui/Icon.svelte';
import SeriesLabelsRow from '@gitbutler/ui/SeriesLabelsRow.svelte'; import SeriesLabelsRow from '@gitbutler/ui/SeriesLabelsRow.svelte';
interface Props { interface Props {
series: PatchSeries[]; series: (PatchSeries | Error)[];
disableSelector?: boolean; disableSelector?: boolean;
} }
@ -13,7 +13,12 @@
const shiftedSeries = $derived(series.slice(1)); const shiftedSeries = $derived(series.slice(1));
const seriesTypes = $derived( const seriesTypes = $derived(
shiftedSeries.map((s) => (s.patches?.[0] ? s.patches?.[0].status : 'local')) shiftedSeries.map((s) => {
if (isPatchSeries(s) && s.patches?.[0]) {
return s.patches?.[0].status;
}
return 'error';
})
); );
</script> </script>
@ -174,6 +179,10 @@
&.integrated { &.integrated {
background-color: var(--clr-commit-integrated); background-color: var(--clr-commit-integrated);
} }
&.error {
background-color: var(--clr-theme-err-element);
}
} }
.selector-series-chain-icon { .selector-series-chain-icon {

View File

@ -4,6 +4,7 @@
import { BranchController } from '$lib/vbranches/branchController'; import { BranchController } from '$lib/vbranches/branchController';
import { VirtualBranch } from '$lib/vbranches/types'; import { VirtualBranch } from '$lib/vbranches/types';
import { getContext } from '@gitbutler/shared/context'; import { getContext } from '@gitbutler/shared/context';
import { isError } from '@gitbutler/ui/utils/typeguards';
interface Props { interface Props {
branch: VirtualBranch; branch: VirtualBranch;
@ -14,7 +15,12 @@
const { onCollapseButtonClick, branch }: Props = $props(); const { onCollapseButtonClick, branch }: Props = $props();
const nonArchivedSeries = $derived(branch.validSeries.filter((s) => !s.archived)); const nonArchivedSeries = $derived(
branch.series.filter((s) => {
if (isError(s)) return s;
return !s.archived;
})
);
</script> </script>
<div class="stack-header"> <div class="stack-header">