From 0693f4f806eaad431fbbbf8b695b0bd26d52bb3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Wed, 23 Oct 2024 15:46:19 +0200 Subject: [PATCH] Add announce preference to settings --- src/components/AnnounceSwitch.svelte | 80 ++++++++++++++++++++++++++++ src/components/Header.svelte | 29 ++++++++-- src/components/ThemeSwitch.svelte | 50 +++++++++-------- src/views/repo/Issue.svelte | 11 ++-- 4 files changed, 138 insertions(+), 32 deletions(-) create mode 100644 src/components/AnnounceSwitch.svelte diff --git a/src/components/AnnounceSwitch.svelte b/src/components/AnnounceSwitch.svelte new file mode 100644 index 000000000..3f8e42c27 --- /dev/null +++ b/src/components/AnnounceSwitch.svelte @@ -0,0 +1,80 @@ + + + + + + +
+ + + +
diff --git a/src/components/Header.svelte b/src/components/Header.svelte index a26385667..4710ed0bd 100644 --- a/src/components/Header.svelte +++ b/src/components/Header.svelte @@ -1,6 +1,7 @@ - +
- +
diff --git a/src/views/repo/Issue.svelte b/src/views/repo/Issue.svelte index fd31a236a..c2ecfe077 100644 --- a/src/views/repo/Issue.svelte +++ b/src/views/repo/Issue.svelte @@ -16,6 +16,8 @@ } from "@app/lib/utils"; import { invoke } from "@tauri-apps/api/core"; + import { announce } from "@app/components/AnnounceSwitch.svelte"; + import Border from "@app/components/Border.svelte"; import CommentComponent from "@app/components/Comment.svelte"; import CommentToggleInput from "@app/components/CommentToggleInput.svelte"; @@ -36,7 +38,6 @@ export let issues: Issue[]; export let config: Config; - const announce = false; let topLevelReplyOpen = false; // Close the comment textbox when switching between issues. The view doesn't @@ -91,7 +92,7 @@ await invoke("create_issue_comment", { rid: repo.rid, new: { id: issue.id, body, embeds }, - opts: { announce }, + opts: { announce: $announce }, }); } catch (error) { console.error("Comment creation failed: ", error); @@ -105,7 +106,7 @@ await invoke("create_issue_comment", { rid: repo.rid, new: { id: issue.id, body, embeds, replyTo }, - opts: { announce }, + opts: { announce: $announce }, }); } catch (error) { console.error("Comment reply creation failed", error); @@ -125,7 +126,7 @@ body, embeds, }, - opts: { announce }, + opts: { announce: $announce }, }); } catch (error) { if (error instanceof Error) { @@ -154,7 +155,7 @@ ({ did }) => publicKeyFromDid(did) === publicKey, ), }, - opts: { announce }, + opts: { announce: $announce }, }); } catch (error) { if (error instanceof Error) {