Improve language switching and professional directory filtering functionality

Fixes language persistence and directory filtering by removing page reload and adding "all" value.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 5a4f78b4-6a2e-4391-b005-5544e086dac8
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/9777c70b-fc38-4831-8d6b-78dfffe041b0/c7e18787-ad24-49c6-aa75-a51e3a1139f9.jpg
This commit is contained in:
ghaddaditw
2025-06-08 08:48:06 +00:00
parent d26857072f
commit 8d8e93ac99
2 changed files with 11 additions and 6 deletions
+4 -4
View File
@@ -148,8 +148,8 @@ export default function ProfessionalDirectory() {
const filteredProfessionals = mockProfessionals.filter(professional => {
const matchesSearch = professional.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
professional.specialization.toLowerCase().includes(searchTerm.toLowerCase());
const matchesType = !selectedType || professional.type === selectedType;
const matchesLocation = !selectedLocation || professional.location === selectedLocation;
const matchesType = !selectedType || selectedType === 'all' || professional.type === selectedType;
const matchesLocation = !selectedLocation || selectedLocation === 'all' || professional.location === selectedLocation;
return matchesSearch && matchesType && matchesLocation;
});
@@ -368,7 +368,7 @@ export default function ProfessionalDirectory() {
<SelectValue placeholder={t('professionals.filterByType')} />
</SelectTrigger>
<SelectContent>
<SelectItem value="">{t('common.all')}</SelectItem>
<SelectItem value="all">{t('common.all')}</SelectItem>
{professionalTypes.map(type => (
<SelectItem key={type} value={type}>
{t(`professionals.types.${type}`)}
@@ -382,7 +382,7 @@ export default function ProfessionalDirectory() {
<SelectValue placeholder={t('professionals.filterByLocation')} />
</SelectTrigger>
<SelectContent>
<SelectItem value="">{t('common.all')}</SelectItem>
<SelectItem value="all">{t('common.all')}</SelectItem>
{locations.map(location => (
<SelectItem key={location} value={location}>
{t(`professionals.locations.${location}`)}