Skip to content

Commit

Permalink
Patch icon in revision timeline reflects patch state color
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinez committed Nov 7, 2023
1 parent 79b1e9c commit a3a7f09
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/views/projects/Cob/Revision.svelte
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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>

Expand Down
1 change: 1 addition & 0 deletions src/views/projects/Patch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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}>
Expand Down

2 comments on commit a3a7f09

@vercel
Copy link

@vercel vercel bot commented on a3a7f09 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

radicle-interface – ./

radicle-interface-rudolfs.vercel.app
app.radicle.xyz
radicle-interface-git-master-rudolfs.vercel.app

@vercel
Copy link

@vercel vercel bot commented on a3a7f09 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.