From 4ff909c7e9525d25d20e68ecc01764ab8d8e31ee Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Fri, 7 Feb 2025 14:55:26 +0100 Subject: [PATCH] Add quick actions buttons to create an accepted or rejected review --- public/colors.css | 6 ++++++ src/components/Button.svelte | 2 +- src/components/Revision.svelte | 32 +++++++++++++++++++++++++++----- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/public/colors.css b/public/colors.css index c49ac9ebc..492dba2fb 100644 --- a/public/colors.css +++ b/public/colors.css @@ -98,12 +98,18 @@ --color-fill-primary-hover: #ff4dff; --color-fill-primary-shade: #e500e5; --color-fill-danger: #aa5078; + --color-fill-danger-hover: #be7495; + --color-fill-danger-shade: #8b3e5e; + --color-fill-danger-counter: #ce97af; --color-fill-yellow: #ffe609; --color-fill-yellow-iconic: #ffff55; --color-fill-gray: #9b9bb1; --color-fill-diff-red: #4d1929; --color-fill-diff-red-light: #2d060d; --color-fill-success: #4fa877; + --color-fill-success-hover: #71bc93; + --color-fill-success-shade: #408760; + --color-fill-success-counter: #97ceb0; --color-fill-diff-green: #183425; --color-fill-diff-green-light: #142a1d; --color-fill-float: #14151a; diff --git a/src/components/Button.svelte b/src/components/Button.svelte index 07472a8eb..613e6da0d 100644 --- a/src/components/Button.svelte +++ b/src/components/Button.svelte @@ -3,7 +3,7 @@ interface Props { children: Snippet; - variant: "primary" | "secondary" | "ghost"; + variant: "primary" | "secondary" | "ghost" | "success" | "danger"; onclick?: () => void; disabled?: boolean; active?: boolean; diff --git a/src/components/Revision.svelte b/src/components/Revision.svelte index 0dee6b91e..a1dd7a80e 100644 --- a/src/components/Revision.svelte +++ b/src/components/Revision.svelte @@ -6,6 +6,7 @@ import type { Embed } from "@bindings/cob/thread/Embed"; import type { Revision } from "@bindings/cob/patch/Revision"; import type { Thread } from "@bindings/cob/thread/Thread"; + import type { Verdict } from "@bindings/cob/patch/Verdict"; import partial from "lodash/partial"; import { tick } from "svelte"; @@ -20,6 +21,7 @@ scrollIntoView, } from "@app/lib/utils"; + import Button from "@app/components/Button.svelte"; import Changeset from "@app/components/Changeset.svelte"; import CobCommitTeaser from "./CobCommitTeaser.svelte"; import CommentComponent from "@app/components/Comment.svelte"; @@ -141,7 +143,7 @@ } } - async function createReview() { + async function createReview(verdict?: Verdict) { try { await invoke("edit_patch", { rid: rid, @@ -149,6 +151,7 @@ action: { type: "review", revision: revision.id, + verdict, // We need to pass an empty string to create a review without a verdict. summary: "", labels: [], @@ -417,10 +420,29 @@
Reviews
- - - New Review - +
+ + + +
{#if revision.reviews && revision.reviews.length}