mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-01 09:40:28 +08:00
Patch icon in revision timeline reflects patch state color
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
<script lang="ts">
|
||||
import type { BaseUrl, DiffResponse, Verdict } from "@httpd-client";
|
||||
import type {
|
||||
BaseUrl,
|
||||
DiffResponse,
|
||||
PatchState,
|
||||
Verdict,
|
||||
} from "@httpd-client";
|
||||
import type { Timeline } from "@app/views/projects/Patch.svelte";
|
||||
|
||||
import * as utils from "@app/lib/utils";
|
||||
@@ -25,6 +30,7 @@
|
||||
export let baseUrl: BaseUrl;
|
||||
export let expanded: boolean = false;
|
||||
export let patchId: string;
|
||||
export let patchState: PatchState;
|
||||
export let projectHead: string;
|
||||
export let projectDefaultBranch: string;
|
||||
export let projectId: string;
|
||||
@@ -63,6 +69,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
function badgeColor({ status }: PatchState): string | undefined {
|
||||
if (status === "draft") {
|
||||
return "var(--color-foreground-gray)";
|
||||
} else if (status === "open") {
|
||||
return "var(--color-foreground-success)";
|
||||
} else if (status === "archived") {
|
||||
return "var(--color-foreground-yellow)";
|
||||
} else if (status === "merged") {
|
||||
return "var(--color-fill-primary)";
|
||||
} else {
|
||||
return "var(--color-foreground-success)";
|
||||
}
|
||||
}
|
||||
|
||||
let response: DiffResponse | undefined = undefined;
|
||||
let error: any | undefined = undefined;
|
||||
let loading: boolean = false;
|
||||
@@ -304,7 +324,7 @@
|
||||
<div
|
||||
class="authorship-header"
|
||||
style:border-top="1px solid var(--color-fill-separator)">
|
||||
<div style:color="var(--color-fill-success)">
|
||||
<div style:color={badgeColor(patchState)}>
|
||||
<IconSmall name="patch" />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -776,6 +776,7 @@
|
||||
on:react={event => handleReaction(revisionId, event)}
|
||||
on:reply={createReply}
|
||||
patchId={patch.id}
|
||||
patchState={patch.state}
|
||||
expanded={index === patch.revisions.length - 1}
|
||||
previousRevId={previousRevision?.id}
|
||||
previousRevOid={previousRevision?.oid}>
|
||||
|
||||
Reference in New Issue
Block a user