mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Make Operation generic, and handle patch operations
So far we only supported issue operations on the `activity_by_id` command. With this commit we separate the commands into a `activity_by_issue` and `activity_by_patch` command that calls a generic `activity_by_id` trait implementation. `Operation` now takes as a generic either `cob/issue/Action.ts` or `cob/patch/Action.ts`. Also `Operation` now stores the array of all `Action` that happened on said operation. I'm not entirely sure if this will help us in the future, but it represents more closely the state of the relation between an `Operation` and the cob `Actions`.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import type { Operation } from "@bindings/cob/issue/Operation";
|
||||
import type { Operation } from "@bindings/cob/Operation";
|
||||
import type { Action } from "@bindings/cob/issue/Action";
|
||||
|
||||
import { authorForNodeId, formatTimestamp } from "@app/lib/utils";
|
||||
|
||||
@@ -8,19 +9,20 @@
|
||||
import NodeId from "@app/components/NodeId.svelte";
|
||||
|
||||
interface Props {
|
||||
operation: Extract<Operation, { type: "lifecycle" }>;
|
||||
action: Extract<Action, { type: "lifecycle" }>;
|
||||
op: Operation<Action>;
|
||||
}
|
||||
|
||||
const { operation }: Props = $props();
|
||||
const { op, action }: Props = $props();
|
||||
</script>
|
||||
|
||||
<Border variant="float" stylePadding="1rem">
|
||||
<div class="txt-small">
|
||||
<div class="global-flex txt-small">
|
||||
<NodeId {...authorForNodeId(operation.author)} />
|
||||
<NodeId {...authorForNodeId(op.author)} />
|
||||
changed status to
|
||||
<IssueStateBadge state={operation.state} />
|
||||
{formatTimestamp(operation.timestamp)}
|
||||
<IssueStateBadge state={action.state} />
|
||||
{formatTimestamp(op.timestamp)}
|
||||
</div>
|
||||
</div>
|
||||
</Border>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<script lang="ts">
|
||||
import type { Operation } from "@bindings/cob/Operation";
|
||||
import type { Action } from "@bindings/cob/patch/Action";
|
||||
|
||||
import { authorForNodeId, formatTimestamp } from "@app/lib/utils";
|
||||
|
||||
import Border from "@app/components/Border.svelte";
|
||||
import NodeId from "@app/components/NodeId.svelte";
|
||||
import PatchStateBadge from "./PatchStateBadge.svelte";
|
||||
|
||||
interface Props {
|
||||
action: Extract<Action, { type: "lifecycle" }>;
|
||||
op: Operation<Action>;
|
||||
}
|
||||
|
||||
const { op, action }: Props = $props();
|
||||
</script>
|
||||
|
||||
<Border variant="float" stylePadding="1rem">
|
||||
<div class="txt-small">
|
||||
<div class="global-flex txt-small">
|
||||
<NodeId {...authorForNodeId(op.author)} />
|
||||
changed status to
|
||||
<PatchStateBadge state={action.state} />
|
||||
{formatTimestamp(op.timestamp)}
|
||||
</div>
|
||||
</div>
|
||||
</Border>
|
||||
Reference in New Issue
Block a user