Update Settings.tsx
This commit is contained in:
@@ -16,7 +16,7 @@ export const SettingsPage: React.FC = () => {
|
||||
const isPrivileged = currentUser?.role === 'admin' || currentUser?.role === 'poweruser';
|
||||
|
||||
// Tab configuration
|
||||
type TabType = 'profile' | 'features' | 'general' | 'condos' | 'families' | 'users' | 'notices' | 'alerts' | 'storage';
|
||||
type TabType = 'profile' | 'features' | 'general' | 'storage' | 'condos' | 'families' | 'users' | 'notices' | 'alerts';
|
||||
|
||||
const [activeTab, setActiveTab] = useState<TabType>(isPrivileged ? 'general' : 'profile');
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -138,6 +138,11 @@ export const SettingsPage: React.FC = () => {
|
||||
const activeC = await CondoService.getActiveCondo();
|
||||
const gSettings = await CondoService.getSettings();
|
||||
|
||||
// Ensure storageConfig exists locally even if API missed it
|
||||
if (!gSettings.storageConfig) {
|
||||
gSettings.storageConfig = { provider: 'local_db' };
|
||||
}
|
||||
|
||||
setCondos(condoList);
|
||||
setActiveCondo(activeC);
|
||||
setGlobalSettings(gSettings);
|
||||
@@ -571,7 +576,8 @@ export const SettingsPage: React.FC = () => {
|
||||
}
|
||||
if (isPrivileged) {
|
||||
tabs.push(
|
||||
{ id: 'general', label: 'Condominio', icon: <Building className="w-4 h-4"/> }
|
||||
{ id: 'general', label: 'Condominio', icon: <Building className="w-4 h-4"/> },
|
||||
{ id: 'storage', label: 'Cloud & Storage', icon: <HardDrive className="w-4 h-4"/> } // Moved up here
|
||||
);
|
||||
if (globalSettings?.features.multiCondo) {
|
||||
tabs.push({ id: 'condos', label: 'Lista Condomini', icon: <List className="w-4 h-4"/> });
|
||||
@@ -584,8 +590,7 @@ export const SettingsPage: React.FC = () => {
|
||||
tabs.push({ id: 'notices', label: 'Bacheca', icon: <Megaphone className="w-4 h-4"/> });
|
||||
}
|
||||
tabs.push(
|
||||
{ id: 'alerts', label: 'Avvisi Email', icon: <Bell className="w-4 h-4"/> },
|
||||
{ id: 'storage', label: 'Cloud & Storage', icon: <HardDrive className="w-4 h-4"/> }
|
||||
{ id: 'alerts', label: 'Avvisi Email', icon: <Bell className="w-4 h-4"/> }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user