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:
@@ -24,8 +24,13 @@ export function LanguageSwitcher() {
|
|||||||
document.documentElement.lang = langCode;
|
document.documentElement.lang = langCode;
|
||||||
// Store in localStorage for persistence
|
// Store in localStorage for persistence
|
||||||
localStorage.setItem('language', langCode);
|
localStorage.setItem('language', langCode);
|
||||||
// Force re-render of components
|
|
||||||
window.location.reload();
|
// Apply Arabic-specific optimizations
|
||||||
|
if (langCode === 'ar') {
|
||||||
|
document.body.classList.add('arabic-text');
|
||||||
|
} else {
|
||||||
|
document.body.classList.remove('arabic-text');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize language on component mount
|
// Initialize language on component mount
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ export default function ProfessionalDirectory() {
|
|||||||
const filteredProfessionals = mockProfessionals.filter(professional => {
|
const filteredProfessionals = mockProfessionals.filter(professional => {
|
||||||
const matchesSearch = professional.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
const matchesSearch = professional.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
professional.specialization.toLowerCase().includes(searchTerm.toLowerCase());
|
professional.specialization.toLowerCase().includes(searchTerm.toLowerCase());
|
||||||
const matchesType = !selectedType || professional.type === selectedType;
|
const matchesType = !selectedType || selectedType === 'all' || professional.type === selectedType;
|
||||||
const matchesLocation = !selectedLocation || professional.location === selectedLocation;
|
const matchesLocation = !selectedLocation || selectedLocation === 'all' || professional.location === selectedLocation;
|
||||||
return matchesSearch && matchesType && matchesLocation;
|
return matchesSearch && matchesType && matchesLocation;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -368,7 +368,7 @@ export default function ProfessionalDirectory() {
|
|||||||
<SelectValue placeholder={t('professionals.filterByType')} />
|
<SelectValue placeholder={t('professionals.filterByType')} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="">{t('common.all')}</SelectItem>
|
<SelectItem value="all">{t('common.all')}</SelectItem>
|
||||||
{professionalTypes.map(type => (
|
{professionalTypes.map(type => (
|
||||||
<SelectItem key={type} value={type}>
|
<SelectItem key={type} value={type}>
|
||||||
{t(`professionals.types.${type}`)}
|
{t(`professionals.types.${type}`)}
|
||||||
@@ -382,7 +382,7 @@ export default function ProfessionalDirectory() {
|
|||||||
<SelectValue placeholder={t('professionals.filterByLocation')} />
|
<SelectValue placeholder={t('professionals.filterByLocation')} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="">{t('common.all')}</SelectItem>
|
<SelectItem value="all">{t('common.all')}</SelectItem>
|
||||||
{locations.map(location => (
|
{locations.map(location => (
|
||||||
<SelectItem key={location} value={location}>
|
<SelectItem key={location} value={location}>
|
||||||
{t(`professionals.locations.${location}`)}
|
{t(`professionals.locations.${location}`)}
|
||||||
|
|||||||
Reference in New Issue
Block a user