From 82560dbb0b6ef44e46038314fb304d89657aa0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Thu, 3 Apr 2025 17:07:40 +0200 Subject: [PATCH] Restyle and move issue/patch state buttons --- src/components/IssueStateBadge.svelte | 22 ---- src/components/IssueStateButton.svelte | 133 +++++++++++++------------ src/components/PatchStateBadge.svelte | 20 ---- src/components/PatchStateButton.svelte | 133 ++++++++++++------------- src/views/repo/Issue.svelte | 12 ++- src/views/repo/Patch.svelte | 21 ++-- 6 files changed, 154 insertions(+), 187 deletions(-) delete mode 100644 src/components/IssueStateBadge.svelte delete mode 100644 src/components/PatchStateBadge.svelte diff --git a/src/components/IssueStateBadge.svelte b/src/components/IssueStateBadge.svelte deleted file mode 100644 index 43f4639fd..000000000 --- a/src/components/IssueStateBadge.svelte +++ /dev/null @@ -1,22 +0,0 @@ - - -
- {capitalize(state.status)}{state.status === "closed" - ? ` as ${state.reason}` - : ""} -
diff --git a/src/components/IssueStateButton.svelte b/src/components/IssueStateButton.svelte index 77970c33e..a218c043f 100644 --- a/src/components/IssueStateButton.svelte +++ b/src/components/IssueStateButton.svelte @@ -1,88 +1,91 @@ -
- - - - {#snippet toggle(onclick)} - - {/snippet} - {#snippet popover()} - - !isEqual(a.state, issueState))}> - {#snippet item(action)} - { - selectedAction = action; - closeFocused(); - }}> - {action.caption} - - {/snippet} - - - {/snippet} - -
+ + + {/snippet} + {#snippet popover()} + + + {#snippet item(state)} + { + onSelect(state); + closeFocused(); + }}> + + + {capitalize(state.status)} + {state.status === "closed" ? `as ${state.reason}` : ""} + + + {/snippet} + + + {/snippet} + diff --git a/src/components/PatchStateBadge.svelte b/src/components/PatchStateBadge.svelte deleted file mode 100644 index 81779080d..000000000 --- a/src/components/PatchStateBadge.svelte +++ /dev/null @@ -1,20 +0,0 @@ - - -
- {capitalize(state.status)} -
diff --git a/src/components/PatchStateButton.svelte b/src/components/PatchStateButton.svelte index 2b5126f37..cd3d17f29 100644 --- a/src/components/PatchStateButton.svelte +++ b/src/components/PatchStateButton.svelte @@ -1,89 +1,88 @@ -
- - - - {#snippet toggle(onclick)} - - {/snippet} - {#snippet popover()} - - !isEqual(a.state, patchState))}> - {#snippet item(action)} - { - selectedAction = action; - closeFocused(); - }}> - {action.caption} - - {/snippet} - - - {/snippet} - -
+ + + {/snippet} + {#snippet popover()} + + + {#snippet item(state)} + { + onSelect(state); + closeFocused(); + }}> + + + {capitalize(state.status)} + + + {/snippet} + + + {/snippet} + diff --git a/src/views/repo/Issue.svelte b/src/views/repo/Issue.svelte index e153280a1..843aef6ee 100644 --- a/src/views/repo/Issue.svelte +++ b/src/views/repo/Issue.svelte @@ -30,7 +30,6 @@ import Icon from "@app/components/Icon.svelte"; import InlineTitle from "@app/components/InlineTitle.svelte"; import IssueSecondColumn from "@app/components/IssueSecondColumn.svelte"; - import IssueStateBadge from "@app/components/IssueStateBadge.svelte"; import IssueStateButton from "@app/components/IssueStateButton.svelte"; import IssueTimeline from "@app/components/IssueTimeline.svelte"; import LabelInput from "@app/components/LabelInput.svelte"; @@ -410,7 +409,6 @@ updatedTitle = issue.title; editingTitle = !editingTitle; }} /> - {:else} @@ -433,7 +431,6 @@ {#if roles.isDelegateOrAuthor( config.publicKey, repo.delegates.map(delegate => delegate.did), issue.body.author.did, )}
(editingTitle = !editingTitle)} /> -
{/if} @@ -443,7 +440,14 @@ diff --git a/src/views/repo/Patch.svelte b/src/views/repo/Patch.svelte index f9c3d8e02..2ce7a9f35 100644 --- a/src/views/repo/Patch.svelte +++ b/src/views/repo/Patch.svelte @@ -38,7 +38,6 @@ import Link from "@app/components/Link.svelte"; import NakedButton from "@app/components/NakedButton.svelte"; import OutlineButton from "@app/components/OutlineButton.svelte"; - import PatchStateBadge from "@app/components/PatchStateBadge.svelte"; import PatchStateButton from "@app/components/PatchStateButton.svelte"; import PatchTeaser from "@app/components/PatchTeaser.svelte"; import PatchTimeline from "@app/components/PatchTimeline.svelte"; @@ -174,20 +173,17 @@ } } - async function saveState(state: Patch["state"]) { + async function saveState(newState: Patch["state"]) { try { await invoke("edit_patch", { rid: repo.rid, cobId: patch.id, action: { type: "lifecycle", - state, + state: newState, }, opts: { announce: $nodeRunning && $announce }, }); - if (initialStatus !== undefined) { - status = state["status"]; - } } catch (error) { console.error("Changing state failed", error); } finally { @@ -343,6 +339,7 @@ flex-direction: column; align-items: flex-start; height: 100%; + z-index: 20; } .metadata-section-title { margin-bottom: 0.5rem; @@ -594,7 +591,6 @@ updatedTitle = patch.title; editingTitle = !editingTitle; }} /> - {:else} @@ -618,7 +614,6 @@ (editingTitle = !editingTitle)} /> - {/if} @@ -627,7 +622,15 @@