Skip to content

Commit

Permalink
problem: can't indicate that a problem has been patched
Browse files Browse the repository at this point in the history
  • Loading branch information
gsovereignty committed Nov 11, 2023
1 parent d98885b commit 6501243
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 38 deletions.
20 changes: 11 additions & 9 deletions src/lib/stores/nostrocket_state/soft_state/simplifiedProblems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@ export function handleProblemStatusChangeEvent(
error =
"you cannot mark this problem as patched unless you are the one who claimed it";
}
state.Problems.forEach((p) => {
if (p.ClaimedBy == ev.pubkey) {
console.log(55);
error =
"this pubkey has claimed " +
p.UID +
". Abandon or solve that first before claiming another problem.";
}
});
if (newStatus == "claimed") {
state.Problems.forEach((p) => {
if (p.ClaimedBy == ev.pubkey) {
console.log(55);
error =
"this pubkey has claimed " +
p.UID +
". Abandon or solve that first before claiming another problem.";
}
});
}
if (error == "") {
problem.Status = newStatus;
problem.ClaimedBy = ev.pubkey;
Expand Down
84 changes: 55 additions & 29 deletions src/routes/problems/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@
><DeliveryParcel /> PATCHED AND WAITING FOR VALIDATION</span
>
{/if}
{#if problem?.Status == "patched"}<span style="color:red"
><Close /> PATCHED AND WAITING FOR VALIDATION</span
{#if problem?.Status == "closed"}<span style="color:red"
><Close /> CLOSED</span
>
{/if}
</p>
Expand All @@ -173,6 +173,10 @@
{#if problem?.Status == "claimed"}<p style="color: #94a3b8">
Claimed by <span style="color: #fb923c">{claimedBy?.name}</span>
</p>{/if}

{#if problem?.Status == "patched"}<p style="color: #94a3b8">
Patched by <span style="color: #fb923c">{claimedBy?.name}</span>
</p>{/if}
</Column>
</Row>

Expand All @@ -182,40 +186,62 @@
</Column>
</Row>

<Row padding>
<Row>
<Column>

<LogNewProblemModal parent={problem} />
</Column>
</Row>
{#if claimable}
<br /><br />
<Button
icon={PlayFilledAlt}
size="small"
kind="primary"
on:click={() => {
updateStatus("claimed")
.then((response) => {
console.log(response);
})
.catch((response) => {
console.log(response);
statusErrorText = response;
});
}}>Claim this problem and work on it now</Button
>
{/if}

<Row>
<Column>
{#if problem?.Status == "claimed"}
<br /><br />
<Button
disabled={!claimable}
icon={PlayFilledAlt}
size="small"
kind="primary"
on:click={() => {
updateStatus("claimed")
.then((response) => {
console.log(response);
})
.catch((response) => {
console.log(response);
statusErrorText = response;
});
}}>Claim this problem and work on it now</Button
>
disabled={!(problem?.ClaimedBy == $currentUser?.pubkey)}
icon={PlayFilledAlt}
size="small"
kind="primary"
on:click={() => {
updateStatus("patched")
.then((response) => {
console.log(response);
})
.catch((response) => {
console.log(response);
statusErrorText = response;
});
}}>Mark this problem as patched and ready for review</Button
>
{/if}


{#if statusErrorText}
<InlineNotification
title="Error:"
subtitle={statusErrorText}
on:close={(statusErrorText = undefined)}
/>
{/if}


{#if statusErrorText}
<InlineNotification
title="Error:"
subtitle={statusErrorText}
on:close={(statusErrorText = undefined)}
/>
{/if}
</Column>
</Row>

</Column>
</Row>
{:else}
Expand Down

0 comments on commit 6501243

Please sign in to comment.