feat: add desktop build using wails

This commit is contained in:
2024-11-16 02:34:07 +07:00
parent f2c0ab0945
commit a07c72974f
69 changed files with 1603 additions and 137 deletions
+23 -2
View File
@@ -11,11 +11,14 @@ import { useMutation } from "@tanstack/react-query";
import { ofetch } from "ofetch";
import { z } from "zod";
import { ErrorAlert } from "@/components/ui/alert";
import { addServer } from "@/stores/app";
import appStore, { addServer, setCurrentServer } from "@/stores/app";
import tamaguiConfig from "@/tamagui.config";
import { useStore } from "zustand";
import Icons from "@/components/ui/icons";
export default function ServerPage() {
const form = useZForm(serverSchema);
const localServer = useStore(appStore, (i) => i.localServer);
const serverConnect = useMutation({
mutationFn: async (body: z.infer<typeof serverSchema>) => {
@@ -36,6 +39,13 @@ export default function ServerPage() {
serverConnect.mutate(values);
});
const onUseLocalServer = () => {
if (localServer) {
setCurrentServer(localServer);
router.replace("/auth/login");
}
};
return (
<>
<Stack.Screen
@@ -73,9 +83,20 @@ export default function ServerPage() {
/>
</FormField>
<Button onPress={onSubmit} isLoading={serverConnect.isPending}>
<Button
onPress={onSubmit}
icon={<Icons name="desktop-classic" size={16} />}
isLoading={serverConnect.isPending}
>
Connect
</Button>
{localServer != null && (
<>
<Text textAlign="center">or</Text>
<Button onPress={onUseLocalServer}>Use Local Server</Button>
</>
)}
</Card>
</ScrollView>
</>