From 3bdd61c5e14d988dd0b82babeec2ff3c16c1bdd3 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Mon, 5 Dec 2022 21:23:37 -0700 Subject: [PATCH] Add ability to copy config --- web/src/routes/Config.jsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web/src/routes/Config.jsx b/web/src/routes/Config.jsx index 8c10c9084..526772861 100644 --- a/web/src/routes/Config.jsx +++ b/web/src/routes/Config.jsx @@ -4,19 +4,30 @@ import CodeEditor from '@uiw/react-textarea-code-editor'; import ActivityIndicator from '../components/ActivityIndicator'; import Heading from '../components/Heading'; import { useState } from 'preact/hooks'; +import Button from '../components/Button'; export default function Config() { const { data: config } = useSWR('config/raw'); const [newCode, setNewCode] = useState(config); const [error, setError] = useState(); + const handleCopyConfig = async () => { + await window.navigator.clipboard.writeText(newCode); + }; + if (!config) { return ; } return (
- Config +
+ Config +
+ + +
+
{error &&
There is an error
}