Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"clsx": "^2.1.1",
"i18next": "^25.8.0",
"i18next-browser-languagedetector": "^8.2.0",
"i18next-http-backend": "^3.0.2",
"i18next-http-backend": "^3.0.6",
"lucide-react": "^0.563.0",
"planby": "^2.0.0",
"react": "^19.2.0",
Expand Down
9 changes: 5 additions & 4 deletions src/components/region-admin/CreateCenterDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface UserWithRegion {
firstName: string;
lastName: string;
email: string;
regionId?: string;
regionId?: string | { _id: string; name: string; code: string } | undefined;
}

export const CreateCenterDialog: React.FC<CreateCenterDialogProps> = ({
Expand Down Expand Up @@ -61,14 +61,15 @@ export const CreateCenterDialog: React.FC<CreateCenterDialogProps> = ({
if (response.success && response.data) {
const managers = response.data.users.filter((u: UserWithRegion) => {
if (regionId) {
return u.regionId === regionId;
const uRegionId = typeof u.regionId === 'object' ? u.regionId?._id : u.regionId;
return uRegionId === regionId;
}
return true;
});
setAvailableManagers(managers.map((u: UserWithRegion) => ({
_id: u.id,
_id: u.id as string,
name: `${u.firstName} ${u.lastName}`,
email: u.email,
email: u.email as string,
})));
}
};
Expand Down
34 changes: 16 additions & 18 deletions src/components/region-admin/EditCenterDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ interface EditCenterDialogProps {
onSuccess: () => void;
}

interface UserWithRegion {
id: string;
firstName: string;
lastName: string;
email: string;
regionId?: string;
}

export const EditCenterDialog: React.FC<EditCenterDialogProps> = ({
centerId,
initialData,
Expand Down Expand Up @@ -88,17 +80,23 @@ export const EditCenterDialog: React.FC<EditCenterDialogProps> = ({
const fetchManagers = async () => {
const response = await usersApi.getUsers({ role: 'center_manager', isActive: true });
if (response.success && response.data) {
const managers = response.data.users.filter((u: UserWithRegion) => {
if (initialData.regionId) {
return u.regionId === initialData.regionId;
const managers = response.data.users.filter(
(u: Record<string, unknown>) => {
if (initialData.regionId) {
return u.regionId === initialData.regionId;
}
return true;
}
return true;
});
setAvailableManagers(managers.map((u: UserWithRegion) => ({
_id: u.id,
name: `${u.firstName} ${u.lastName}`,
email: u.email,
})));
);
setAvailableManagers(
managers.map(
(u: Record<string, unknown>) => ({
_id: u.id as string,
name: `${u.firstName} ${u.lastName}`,
email: u.email as string,
})
)
);
}
};
fetchManagers();
Expand Down
38 changes: 38 additions & 0 deletions src/components/region-admin/EducationalMaterials.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { MaterialIcon } from '../ui/Icon';

/**
* Educational Materials page component.
* Placeholder - to be implemented with actual educational content.
*/
export const EducationalMaterials: React.FC = () => {
const { t } = useTranslation();

return (
<div className="p-6">
<div className="mb-6">
<h1 className="text-2xl font-bold text-slate-900 dark:text-white">
{t('educationalMaterials.title', 'Educational Materials')}
</h1>
<p className="mt-2 text-slate-600 dark:text-slate-400">
{t('educationalMaterials.description', 'Browse and manage educational resources and materials.')}
</p>
</div>

<div className="bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 p-12">
<div className="flex flex-col items-center justify-center text-center">
<div className="w-20 h-20 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mb-4">
<MaterialIcon name="menu_book" className="text-4xl text-blue-600 dark:text-blue-400" />
</div>
<h2 className="text-xl font-semibold text-slate-900 dark:text-white mb-2">
{t('educationalMaterials.comingSoon', 'Coming Soon')}
</h2>
<p className="text-slate-500 dark:text-slate-400 max-w-md">
{t('educationalMaterials.placeholder', 'Educational materials management is under development. This section will allow you to upload, organize, and distribute learning resources.')}
</p>
</div>
</div>
</div>
);
};
22 changes: 11 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1296,12 +1296,12 @@ cosmiconfig@^7.0.0:
path-type "^4.0.0"
yaml "^1.10.0"

cross-fetch@4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz"
integrity sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==
cross-fetch@4.1.0:
version "4.1.0"
resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.1.0.tgz"
integrity sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==
dependencies:
node-fetch "^2.6.12"
node-fetch "^2.7.0"

cross-spawn@^7.0.3, cross-spawn@^7.0.6:
version "7.0.6"
Expand Down Expand Up @@ -2009,12 +2009,12 @@ i18next-browser-languagedetector@^8.2.0:
dependencies:
"@babel/runtime" "^7.23.2"

i18next-http-backend@^3.0.2:
version "3.0.2"
resolved "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-3.0.2.tgz"
integrity sha512-PdlvPnvIp4E1sYi46Ik4tBYh/v/NbYfFFgTjkwFl0is8A18s7/bx9aXqsrOax9WUbeNS6mD2oix7Z0yGGf6m5g==
i18next-http-backend@^3.0.6:
version "3.0.6"
resolved "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-3.0.6.tgz"
integrity sha512-mBOqy8993jtqAoj6XaI1XeC/8/9v6EPS+681ziegrPvTB0DoaCY7PpTS0SpY56qLMoS4OI1TZEM2Zf59zNh05w==
dependencies:
cross-fetch "4.0.0"
cross-fetch "4.1.0"

i18next@^25.8.0, "i18next@>= 25.6.2":
version "25.8.0"
Expand Down Expand Up @@ -2466,7 +2466,7 @@ natural-compare@^1.4.0:
resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz"
integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==

node-fetch@^2.6.12:
node-fetch@^2.7.0:
version "2.7.0"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz"
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
Expand Down