import React, { useState } from "react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../ui/select"; import { giteaApi } from "@/lib/api"; import type { GiteaConfig, GiteaOrgVisibility } from "@/types/config"; import { toast } from "sonner"; interface GiteaConfigFormProps { config: GiteaConfig; setConfig: React.Dispatch>; } export function GiteaConfigForm({ config, setConfig }: GiteaConfigFormProps) { const [isLoading, setIsLoading] = useState(false); const handleChange = ( e: React.ChangeEvent ) => { const { name, value } = e.target; setConfig({ ...config, [name]: value, }); }; const testConnection = async () => { if (!config.url || !config.token) { toast.error("Gitea URL and token are required to test the connection"); return; } setIsLoading(true); try { const result = await giteaApi.testConnection(config.url, config.token); if (result.success) { toast.success("Successfully connected to Gitea!"); } else { toast.error( "Failed to connect to Gitea. Please check your URL and token." ); } } catch (error) { toast.error( error instanceof Error ? error.message : "An unknown error occurred" ); } finally { setIsLoading(false); } }; return ( Gitea Configuration

Create a token in your Gitea instance under Settings > Applications.

If specified, repositories will be mirrored to this organization.

Organization for starred repositories (default: github)

{/* Footer content can be added here if needed */}
); }