From 5fbbd824ff67a60e718c2e25e4d0bb6f0209dcd8 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 3 Apr 2023 14:14:42 +0200 Subject: [PATCH] Add merged patch state Signed-off-by: Sebastian Martinez --- src/lib/patch.ts | 11 +++++++++-- src/lib/project.ts | 2 ++ src/views/projects/Patches.svelte | 3 +-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/patch.ts b/src/lib/patch.ts index fa4e04297..7cab63478 100644 --- a/src/lib/patch.ts +++ b/src/lib/patch.ts @@ -59,19 +59,26 @@ export interface Merge { export type PatchState = | { status: "draft" } | { status: "open" } - | { status: "archived" }; + | { status: "archived" } + | { status: "merged" }; export function groupPatches(patches: Patch[]): { open: Patch[]; draft: Patch[]; archived: Patch[]; + merged: Patch[]; } { return patches.reduce( (acc, patch) => { acc[patch.state.status].push(patch); return acc; }, - { open: [] as Patch[], draft: [] as Patch[], archived: [] as Patch[] }, + { + open: [] as Patch[], + draft: [] as Patch[], + archived: [] as Patch[], + merged: [] as Patch[], + }, ); } diff --git a/src/lib/project.ts b/src/lib/project.ts index 941800cfe..23343791e 100644 --- a/src/lib/project.ts +++ b/src/lib/project.ts @@ -31,6 +31,7 @@ export interface ProjectInfo { open: number; draft: number; archived: number; + merged: number; }; issues: { open: number; @@ -137,6 +138,7 @@ export class Project implements ProjectInfo { open: number; draft: number; archived: number; + merged: number; }; issues: { open: number; diff --git a/src/views/projects/Patches.svelte b/src/views/projects/Patches.svelte index 02ae1da13..fb83efca2 100644 --- a/src/views/projects/Patches.svelte +++ b/src/views/projects/Patches.svelte @@ -22,7 +22,7 @@ let options: Tab[]; - const stateOptions: PatchStatus[] = ["draft", "open", "archived"]; + const stateOptions: PatchStatus[] = ["draft", "open", "archived", "merged"]; $: options = stateOptions.map<{ value: PatchStatus; title: string; @@ -32,7 +32,6 @@ title: `${project.patches[s]} ${s}`, disabled: project.patches[s] === 0, })); - $: console.log(patches); $: filteredPatches = groupPatches(patches)[status]; $: sortedPatches = filteredPatches.sort( ({ revisions: [r1] }, { revisions: [r2] }) => r2.timestamp - r1.timestamp,