mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-16 13:20:39 -07:00
Update development scripts and add macOS icon assets
- Renamed backend development script from `dev:backend` to `dev:server` for clarity. - Added new macOS icon assets and configuration files for the application. - Enhanced App component to improve server management during production and development modes. - Updated ConnectionForm to reset state after successful submission and conditionally render the update button. - Implemented database initialization on application startup in the backend.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useEffect } from 'react';
|
||||
import * as z from 'zod';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -37,8 +38,16 @@ export function ConnectionForm() {
|
||||
},
|
||||
});
|
||||
|
||||
// Sync form with store when serverUrl changes externally
|
||||
useEffect(() => {
|
||||
form.reset({ serverUrl });
|
||||
}, [serverUrl, form]);
|
||||
|
||||
const { isDirty } = form.formState;
|
||||
|
||||
function onSubmit(data: ConnectionFormValues) {
|
||||
setServerUrl(data.serverUrl);
|
||||
form.reset(data); // Reset form state after successful submission
|
||||
toast({
|
||||
title: 'Server URL updated',
|
||||
description: `Connected to ${data.serverUrl}`,
|
||||
@@ -68,7 +77,9 @@ export function ConnectionForm() {
|
||||
)}
|
||||
/>
|
||||
|
||||
<Button type="submit">Update Connection</Button>
|
||||
{isDirty && (
|
||||
<Button type="submit">Update Connection</Button>
|
||||
)}
|
||||
</form>
|
||||
</Form>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user