Skip to content

Commit

Permalink
WIP: Review page
Browse files Browse the repository at this point in the history
- something is borked in the router, need to investigate why we need the
  $effect to reload patches when switching sidebar

- hover states for review teasers

- start populating the review page
  • Loading branch information
rudolfs committed Feb 10, 2025
1 parent 365674b commit f0c72bd
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 176 deletions.
8 changes: 7 additions & 1 deletion src/components/PatchTeaser.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@
if (loadPatch) {
loadPatch(rid, patch.id);
} else {
void push({ resource: "repo.patch", rid, patch: patch.id, status });
void push({
resource: "repo.patch",
rid,
patch: patch.id,
status,
reviewId: undefined,
});
}
}}>
<div class="global-flex">
Expand Down
23 changes: 21 additions & 2 deletions src/components/ReviewTeaser.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import type { PatchStatus } from "@app/views/repo/router";
import type { Review } from "@bindings/cob/patch/Review";
import {
Expand All @@ -10,13 +11,16 @@
import Icon from "./Icon.svelte";
import Markdown from "./Markdown.svelte";
import NodeId from "@app/components/NodeId.svelte";
import { push } from "@app/lib/router";
interface Props {
rid: string;
review: Review;
patchId: string;
status: PatchStatus | undefined;
}
const { rid, review }: Props = $props();
const { rid, review, patchId, status }: Props = $props();
const header = $derived.by(() => {
if (!review.verdict) {
Expand Down Expand Up @@ -86,7 +90,22 @@
}
</style>

<div class="review" style:background-color={backgroundColor(review.verdict)}>
<!-- svelte-ignore a11y_click_events_have_key_events -->
<div
tabindex="0"
role="button"
class="review"
style:cursor="pointer"
style:background-color={backgroundColor(review.verdict)}
onclick={() => {
void push({
resource: "repo.patch",
rid,
patch: patchId,
status,
reviewId: review.id,
});
}}>
<div class="icon" style:color={color(review.verdict)}>
<Icon name={icon(review.verdict)} />
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/components/Revision.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import type { Config } from "@bindings/config/Config";
import type { Diff } from "@bindings/diff/Diff";
import type { Embed } from "@bindings/cob/thread/Embed";
import type { PatchStatus } from "@app/views/repo/router";
import type { Revision } from "@bindings/cob/patch/Revision";
import type { Thread } from "@bindings/cob/thread/Thread";
import type { Verdict } from "@bindings/cob/patch/Verdict";
Expand Down Expand Up @@ -39,11 +40,12 @@
patchId: string;
revision: Revision;
config: Config;
status: PatchStatus | undefined;
reload: () => Promise<void>;
}
/* eslint-disable prefer-const */
let { rid, repoDelegates, patchId, revision, config, reload }: Props =
let { rid, repoDelegates, patchId, revision, config, status, reload }: Props =
$props();
/* eslint-enable prefer-const */
Expand Down Expand Up @@ -407,7 +409,7 @@
{#if revision.reviews && revision.reviews.length}
<div class:hide={hideReviews} style:margin-top="1rem">
{#each revision.reviews as review}
<ReviewTeaser {rid} {review} />
<ReviewTeaser {rid} {review} {patchId} {status} />
{/each}
</div>
{/if}
Expand Down
Loading

0 comments on commit f0c72bd

Please sign in to comment.