mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-08 12:36:44 +03:00
feat: implement comprehensive auto-save for all config forms and remove manual save button
- Add auto-save functionality to all GitHub config form fields (text inputs and checkboxes) - Add auto-save functionality to all Gitea config form fields (text inputs and select dropdown) - Extend existing auto-save pattern to cover text inputs with 500ms debounce - Remove Save Configuration button and related manual save logic - Update Import GitHub Data button to depend on form validation instead of saved state - Remove isConfigSaved dependency from all auto-save functions for immediate activation - Add proper cleanup for all auto-save timeouts on component unmount - Maintain silent auto-save operation without intrusive notifications All configuration changes now auto-save seamlessly, providing a better UX while maintaining data consistency and error handling.
This commit is contained in:
@@ -21,19 +21,27 @@ import { toast } from "sonner";
|
||||
interface GiteaConfigFormProps {
|
||||
config: GiteaConfig;
|
||||
setConfig: React.Dispatch<React.SetStateAction<GiteaConfig>>;
|
||||
onAutoSave?: (giteaConfig: GiteaConfig) => Promise<void>;
|
||||
isAutoSaving?: boolean;
|
||||
}
|
||||
|
||||
export function GiteaConfigForm({ config, setConfig }: GiteaConfigFormProps) {
|
||||
export function GiteaConfigForm({ config, setConfig, onAutoSave, isAutoSaving }: GiteaConfigFormProps) {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const handleChange = (
|
||||
e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>
|
||||
) => {
|
||||
const { name, value } = e.target;
|
||||
setConfig({
|
||||
const newConfig = {
|
||||
...config,
|
||||
[name]: value,
|
||||
});
|
||||
};
|
||||
setConfig(newConfig);
|
||||
|
||||
// Auto-save for all field changes
|
||||
if (onAutoSave) {
|
||||
onAutoSave(newConfig);
|
||||
}
|
||||
};
|
||||
|
||||
const testConnection = async () => {
|
||||
|
||||
Reference in New Issue
Block a user