show current wisp server
This commit is contained in:
parent
22394a7b18
commit
c35930952d
2 changed files with 14 additions and 4 deletions
|
|
@ -30,7 +30,7 @@ export default function SettingsLayout({
|
||||||
}
|
}
|
||||||
className="w-full items-center justify-start gap-2"
|
className="w-full items-center justify-start gap-2"
|
||||||
>
|
>
|
||||||
<ArrowRightLeft className="h-5 w-5" /> Wisp Switcher
|
<ArrowRightLeft className="h-5 w-5" /> Wisp
|
||||||
</Button>
|
</Button>
|
||||||
</NextLink>
|
</NextLink>
|
||||||
<NextLink href="/settings/credits/">
|
<NextLink href="/settings/credits/">
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import {
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { Save, RotateCcw } from "lucide-react";
|
import { Save, RotateCcw } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
|
|
@ -34,6 +34,16 @@ export default function WispSwitcher() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const wispServer: string = window.chemical.getStore("wisp");
|
||||||
|
const defaultWisp: string =
|
||||||
|
(location.protocol === "https:" ? "wss" : "ws") +
|
||||||
|
"://" +
|
||||||
|
location.host +
|
||||||
|
"/wisp/";
|
||||||
|
form.setValue("wispServer", wispServer !== defaultWisp ? wispServer : "");
|
||||||
|
}, []);
|
||||||
|
|
||||||
function onSubmit(values: z.infer<typeof formSchema>) {
|
function onSubmit(values: z.infer<typeof formSchema>) {
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
|
|
||||||
|
|
@ -53,7 +63,7 @@ export default function WispSwitcher() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-4xl font-semibold">Wisp Switcher</h1>
|
<h1 className="text-4xl font-semibold">Wisp</h1>
|
||||||
<Separator />
|
<Separator />
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
|
|
@ -66,7 +76,7 @@ export default function WispSwitcher() {
|
||||||
name="wispServer"
|
name="wispServer"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Wisp Server</FormLabel>
|
<FormLabel>Wisp Server Switcher</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder="Wisp Server URL" {...field} />
|
<Input placeholder="Wisp Server URL" {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue