feat: move "منابع" to main sidebar and update related components

This commit is contained in:
hamed
2026-08-03 09:52:41 +03:30
parent 17ce271b2c
commit 82abd1bb52
9 changed files with 199 additions and 172 deletions
@@ -36,15 +36,22 @@ describe('SettingsLayout', () => {
/**
* سایدبار و فهرست موبایل یک منبع دارند؛ آیتمی که به منو اضافه می‌شود باید در هر دو
* دیده شود. قبلاً دو کپی بود و «منابع»/«دسته‌بندی‌ها» فقط در موبایل ظاهر شدند.
* دیده شود. قبلاً دو کپی بود و «دسته‌بندی‌ها» فقط در موبایل ظاهر شد.
*/
it('shows the resource-first entries in the desktop sidebar too', () => {
useAuthStore.setState({ primaryRole: 'clinic' });
renderWithProviders(<SettingsLayout active="resources"><div /></SettingsLayout>);
renderWithProviders(<SettingsLayout active="service-categories"><div /></SettingsLayout>);
expect(screen.getByText('منابع').closest('a')).toHaveAttribute('href', '/admin/resources');
expect(screen.getByText('دسته‌بندی‌ها').closest('a')).toHaveAttribute('href', '/admin/service-categories');
expect(screen.getByText('منابع').closest('a')).toHaveAttribute('aria-current', 'page');
expect(screen.getByText('دسته‌بندی‌ها').closest('a')).toHaveAttribute('aria-current', 'page');
});
/** «منابع» کارِ روزمره است و به سایدبار اصلی رفت؛ نباید در منوی تنظیمات تکرار شود. */
it('does not list منابع in the settings menu any more', () => {
useAuthStore.setState({ primaryRole: 'clinic' });
renderWithProviders(<SettingsLayout active="service-categories"><div /></SettingsLayout>);
expect(screen.queryByText('منابع')).not.toBeInTheDocument();
});
it('role-gates the desktop sidebar: a doctor does not see the clinic-doctors tab', () => {