diff --git a/src/components/DropdownList.svelte b/src/components/DropdownList.svelte new file mode 100644 index 000000000..a4aaf1bbb --- /dev/null +++ b/src/components/DropdownList.svelte @@ -0,0 +1,29 @@ + + + + + diff --git a/src/components/DropdownListItem.svelte b/src/components/DropdownListItem.svelte new file mode 100644 index 000000000..f19ca361a --- /dev/null +++ b/src/components/DropdownListItem.svelte @@ -0,0 +1,57 @@ + + + + + +
+ +
diff --git a/src/components/Icon.svelte b/src/components/Icon.svelte index e9086681e..ebe7e04fe 100644 --- a/src/components/Icon.svelte +++ b/src/components/Icon.svelte @@ -9,6 +9,7 @@ | "arrow-left" | "arrow-right" | "checkmark" + | "chevron-down" | "chevron-right" | "comment" | "copy" @@ -92,6 +93,17 @@ + {:else if name === "chevron-down"} + + + + + + + + + + {:else if name === "chevron-right"} diff --git a/src/components/IssueStateButton.svelte b/src/components/IssueStateButton.svelte new file mode 100644 index 000000000..320a085fa --- /dev/null +++ b/src/components/IssueStateButton.svelte @@ -0,0 +1,71 @@ + + + + +
+ + + + + + !isEqual(a.state, state))}> + + { + selectedAction = action; + closeFocused(); + }}> + {action.caption} + + + + + +
diff --git a/src/views/repo/Issue.svelte b/src/views/repo/Issue.svelte index ae512e18c..bb784c43c 100644 --- a/src/views/repo/Issue.svelte +++ b/src/views/repo/Issue.svelte @@ -20,6 +20,7 @@ import { announce } from "@app/components/AnnounceSwitch.svelte"; import Border from "@app/components/Border.svelte"; + import IssueStateButton from "@app/components/IssueStateButton.svelte"; import CommentComponent from "@app/components/Comment.svelte"; import CommentToggleInput from "@app/components/CommentToggleInput.svelte"; import CopyableId from "@app/components/CopyableId.svelte"; @@ -29,10 +30,10 @@ import IssueTimelineLifecycleAction from "@app/components/IssueTimelineLifecycleAction.svelte"; import Link from "@app/components/Link.svelte"; import NodeId from "@app/components/NodeId.svelte"; + import TextInput from "@app/components/TextInput.svelte"; import Thread from "@app/components/Thread.svelte"; import Layout from "./Layout.svelte"; - import TextInput from "@app/components/TextInput.svelte"; export let repo: RepoInfo; export let issue: Issue; @@ -150,9 +151,7 @@ opts: { announce: $announce }, }); } catch (error) { - if (error instanceof Error) { - console.error("Issue comment editing failed: ", error); - } + console.error("Issue comment editing failed: ", error); } finally { await reload(); } @@ -183,9 +182,7 @@ } editingTitle = false; } catch (error) { - if (error instanceof Error) { - console.error("Issue editing failed: ", error); - } + console.error("Issue editing failed: ", error); } } @@ -210,9 +207,25 @@ opts: { announce: $announce }, }); } catch (error) { - if (error instanceof Error) { - console.error("Editing reactions failed", error); - } + console.error("Editing reactions failed", error); + } finally { + await reload(); + } + } + + async function saveState(state: Issue["state"]) { + try { + await invoke("edit_issue", { + rid: repo.rid, + cobId: issue.id, + action: { + type: "lifecycle", + state, + }, + opts: { announce: $announce }, + }); + } catch (error) { + console.error("Editing reactions failed", error); } finally { await reload(); } @@ -271,8 +284,9 @@ .title-icons { display: flex; - gap: 0.5rem; + gap: 1rem; margin-left: 1rem; + align-items: center; } @@ -374,6 +388,7 @@ updatedTitle = issue.title; editingTitle = !editingTitle; }} /> + {:else} @@ -381,6 +396,7 @@
(editingTitle = !editingTitle)} /> +
{/if}