From 52868af138cb009f89c53c16a1a7e3f535133b14 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Fri, 18 Aug 2023 12:47:41 +0200 Subject: [PATCH] canned responses plugin --- README.md | 14 +- plugins/canned-responses/index.jsx | 287 +++++++++++++++++++++++++++ plugins/canned-responses/plugin.json | 5 + previews/responses.png | Bin 0 -> 150138 bytes 4 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 plugins/canned-responses/index.jsx create mode 100644 plugins/canned-responses/plugin.json create mode 100644 previews/responses.png diff --git a/README.md b/README.md index 793c046..84e24e2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ # shelter-plugins -`https://edde746.github.io/shelter-plugins/gpt` - Generate responses based on recent messages in the channel and a prompt. +## gpt + +`https://edde746.github.io/shelter-plugins/gpt` + +Generate responses based on recent messages in the channel and a prompt. ![GPT Plugin Showcase](/previews/gpt.png) + +## canned-responses + +`https://edde746.github.io/shelter-plugins/canned-responses` + +Quickly send a canned response. + +![Canned Responses Plugin Showcase](/previews/responses.png) diff --git a/plugins/canned-responses/index.jsx b/plugins/canned-responses/index.jsx new file mode 100644 index 0000000..74ca19d --- /dev/null +++ b/plugins/canned-responses/index.jsx @@ -0,0 +1,287 @@ +const { + observeDom, + ui: { + injectCss, + Button, + openModal, + ModalRoot, + ModalHeader, + ModalBody, + ModalFooter, + ModalSizes, + ButtonColors, + ButtonSizes, + TextArea, + TextBox, + niceScrollbarsClass, + }, + plugin: { store }, + util: { getFiber }, +} = shelter; + +if (!store.responses) store.responses = []; + +let closeManagementModal = null; +const managementModal = () => ( + + closeManagementModal()}> + Canned Responses + + +
+
+ +
+ {store.responses.map((response) => ( +
+
+ {/*

{response.name}

*/} + { + const index = store.responses.findIndex( + ({ id }) => id === response.id + ); + store.responses[index].name = value; + }} + /> +
+ +
+
+