From 8d8e93ac99d970c447eb35ebeb2426b3786a8deb Mon Sep 17 00:00:00 2001
From: ghaddaditw <40211818-ghaddaditw@users.noreply.replit.com>
Date: Sun, 8 Jun 2025 08:48:06 +0000
Subject: [PATCH] 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
---
client/src/components/LanguageSwitcher.tsx | 9 +++++++--
client/src/pages/ProfessionalDirectory.tsx | 8 ++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/client/src/components/LanguageSwitcher.tsx b/client/src/components/LanguageSwitcher.tsx
index 87d5924..02a9ba8 100644
--- a/client/src/components/LanguageSwitcher.tsx
+++ b/client/src/components/LanguageSwitcher.tsx
@@ -24,8 +24,13 @@ export function LanguageSwitcher() {
document.documentElement.lang = langCode;
// Store in localStorage for persistence
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
diff --git a/client/src/pages/ProfessionalDirectory.tsx b/client/src/pages/ProfessionalDirectory.tsx
index b586558..413a3ad 100644
--- a/client/src/pages/ProfessionalDirectory.tsx
+++ b/client/src/pages/ProfessionalDirectory.tsx
@@ -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() {
- {t('common.all')}
+ {t('common.all')}
{professionalTypes.map(type => (
{t(`professionals.types.${type}`)}
@@ -382,7 +382,7 @@ export default function ProfessionalDirectory() {
- {t('common.all')}
+ {t('common.all')}
{locations.map(location => (
{t(`professionals.locations.${location}`)}