This commit is contained in:
IGNY8 VPS (Salman)
2025-12-01 04:07:47 +00:00
parent 55a00bf1ad
commit aeaac01990
3 changed files with 10 additions and 22 deletions

View File

@@ -202,19 +202,9 @@ export default function SiteSettings() {
const response = await fetchIndustries();
let allIndustries = response.industries || [];
// Filter to show only user's pre-selected industries/sectors from account preferences
try {
const { fetchAccountSetting } = await import('../../services/api');
const setting = await fetchAccountSetting('user_preferences');
const preferences = setting.config as { selectedIndustry?: string; selectedSectors?: string[] } | undefined;
if (preferences?.selectedIndustry) {
// Filter industries to only show the user's pre-selected industry
allIndustries = allIndustries.filter(i => i.slug === preferences.selectedIndustry);
}
} catch (error: any) {
// Silently handle errors - show all industries
}
// Note: For existing sites with industries already configured,
// we show ALL industries so users can change their selection.
// The filtering by user preferences only applies during initial site creation.
setIndustries(allIndustries);
} catch (error: any) {
@@ -262,14 +252,11 @@ export default function SiteSettings() {
const getIndustrySectors = () => {
if (!selectedIndustry) return [];
const industry = industries.find(i => i.slug === selectedIndustry);
let sectors = industry?.sectors || [];
// Filter to show only user's pre-selected sectors from account preferences
if (userPreferences?.selectedSectors && userPreferences.selectedSectors.length > 0) {
sectors = sectors.filter(s => userPreferences.selectedSectors!.includes(s.slug));
}
return sectors;
// Note: For existing sites in Settings page, show ALL sectors from the selected industry
// so users can change their sector selection. The filtering by user preferences
// only applies during initial site creation (in the Sites wizard).
return industry?.sectors || [];
};
const handleSelectSectors = async () => {