blob: f7a11106a39744bdf1b871b6edc735409674aba2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import usePluginSettings from "./utils/settings";
import { PackageOpen } from "lucide-react";
import Logo from "./Logo";
export default function NotConfiguredPage() {
const navigate = useNavigate();
const { settings, setSettings } = usePluginSettings();
const [error, setError] = useState("");
const [serverAddress, setServerAddress] = useState(settings.address);
useEffect(() => {
setServerAddress(settings.address);
}, [settings.address]);
const onSave = () => {
if (serverAddress == "") {
setError("Server address is required");
return;
}
setSettings((s) => ({ ...s, address: serverAddress }));
navigate("/signin");
};
return (
<div className="flex flex-col space-y-2">
<Logo />
<span className="pt-3">
To use the plugin, you need to configure it first.
</span>
<p className="text-red-500">{error}</p>
<div className="flex gap-2">
<label className="my-auto">Server Address</label>
<input
name="address"
value={serverAddress}
className="h-8 flex-1 rounded-lg border border-gray-300 p-2"
onChange={(e) => setServerAddress(e.target.value)}
/>
</div>
<button className="bg-black text-white" onClick={onSave}>
Configure
</button>
</div>
);
}
|