diff --git a/client/src/pages/Settings.jsx b/client/src/pages/Settings.jsx index 89e38af..748705a 100644 --- a/client/src/pages/Settings.jsx +++ b/client/src/pages/Settings.jsx @@ -259,11 +259,15 @@ const BrandingSettings = ({ tenantConfig, onRefresh }) => { if (response.data.success) { setBranding(prev => ({ ...prev, logo_url: response.data.data.logo_url })); setLogoPreview(null); + // Clear the file input to allow selecting the same file again + event.target.value = ''; toast.success('Logo uploaded successfully'); if (onRefresh) onRefresh(); } } catch (error) { toast.error('Failed to upload logo'); + // Clear the file input on error too + event.target.value = ''; } finally { setUploading(false); } @@ -278,6 +282,33 @@ const BrandingSettings = ({ tenantConfig, onRefresh }) => { } }; + const handleLogoRemove = async () => { + if (!branding.logo_url) return; + + // Confirm removal + if (!window.confirm(t('settings.confirmRemoveLogo'))) { + return; + } + + setUploading(true); + + try { + const response = await api.delete('/tenant/logo'); + + if (response.data.success) { + setBranding(prev => ({ ...prev, logo_url: null })); + setLogoPreview(null); + toast.success(t('settings.logoRemoved')); + if (onRefresh) onRefresh(); + } + } catch (error) { + console.error('Error removing logo:', error); + toast.error(t('settings.logoRemoveFailed')); + } finally { + setUploading(false); + } + }; + return (
Current logo
+Current logo
+PNG, JPG up to 5MB
+PNG, JPG up to 5MB {branding.logo_url ? '• Click "' + t('settings.changeLogo') + '" to replace current logo' : ''}