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';
interface Props {
series: PatchSeries[];
series: (PatchSeries | Error)[];
onCollapseButtonClick: () => void;
}

View File

@ -1,11 +1,11 @@
<script lang="ts">
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 SeriesLabelsRow from '@gitbutler/ui/SeriesLabelsRow.svelte';
interface Props {
series: PatchSeries[];
series: (PatchSeries | Error)[];
disableSelector?: boolean;
}
@ -13,7 +13,12 @@
const shiftedSeries = $derived(series.slice(1));
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>
@ -174,6 +179,10 @@
&.integrated {
background-color: var(--clr-commit-integrated);
}
&.error {
background-color: var(--clr-theme-err-element);
}
}
.selector-series-chain-icon {

View File

@ -4,6 +4,7 @@
import { BranchController } from '$lib/vbranches/branchController';
import { VirtualBranch } from '$lib/vbranches/types';
import { getContext } from '@gitbutler/shared/context';
import { isError } from '@gitbutler/ui/utils/typeguards';
interface Props {
branch: VirtualBranch;
@ -14,7 +15,12 @@
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>
<div class="stack-header">