import React from 'react'; import { Link } from 'react-router'; import { ChevronLeftIcon } from '@heroicons/react/24/outline'; import { groupedMenuForRole } from '../components/layout/settingsMenu'; import { useAuthStore } from '../stores/authStore'; import { usePermissions } from '../hooks/usePermissions'; /** * SettingsMenuPage — the settings landing list for doctor/clinic users. * A full-width tappable list of the settings sections available to the current * role (mobile-first, matches the Figma mobile design). Each section links to * its route; on desktop the same sections render the shell via SettingsLayout. * * روی موبایل کل این فهرست بالای محتوا می‌نشیند، پس ۱۶ ردیفِ یکدست یعنی اسکرول * طولانیِ بی‌نشانه. دسته‌ها همان دسته‌های سایدبار دسکتاپ‌اند (`settingsMenu.ts`). */ export default function SettingsMenuPage() { const primaryRole = useAuthStore((s) => s.primaryRole); const scope = useAuthStore((s) => s.context?.scope); const { can } = usePermissions(); const groups = groupedMenuForRole(primaryRole, can, scope); return (

تنظیمات

{groups.map((group) => (

{group.label}

{group.items.map((item, idx) => { const Icon = item.icon; const disabled = !item.to; const rowStyle: React.CSSProperties = { display: 'flex', alignItems: 'center', gap: 12, padding: '16px 18px', fontSize: 15, fontFamily: 'inherit', borderTop: idx === 0 ? 'none' : '1px solid var(--border)', color: disabled ? 'var(--text-3)' : 'var(--text)', cursor: disabled ? 'not-allowed' : 'pointer', background: 'transparent', width: '100%', textAlign: 'right', }; const inner = ( <> {item.label} {disabled ? به‌زودی : } ); return disabled ? ( ) : ( { (e.currentTarget as HTMLElement).style.background = 'var(--surface-2)'; }} onMouseLeave={(e) => { (e.currentTarget as HTMLElement).style.background = 'transparent'; }} > {inner} ); })}
))}
); }