fix(subscription): settings sidebar items match tauri source
Give the subscription sidebar its own nav list copied from clinic-pro-tauri's PurchaseSubscription navItems (order and labels), dropping 'مدیریت پزشک' (it belongs in the main nav). Items are shown ungated to mirror the source; the 'تنظیمات' (security) section has no doctor/clinic route yet so it renders disabled. SETTINGS_MENU / SettingsLayout (other pages) are left untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,23 +1,37 @@
|
|||||||
import React, { useMemo, useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { useAuthStore } from '../../stores/authStore';
|
|
||||||
import { menuForRole } from './SettingsLayout';
|
|
||||||
import { SearchHeaderP } from '../../pages/subscriptionIcons';
|
import { SearchHeaderP } from '../../pages/subscriptionIcons';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PurchaseSubscriptionSidebar — settings sub-navigation styled after
|
* Settings sub-navigation for the subscription page — item list and order copied
|
||||||
* clinic-pro-tauri's `PurchaseSubscriptionSidebar.jsx` (title + search + tab
|
* verbatim from clinic-pro-tauri's `PurchaseSubscription.jsx` navItems, minus
|
||||||
* list, orange active pill #f17732). Desktop-only, like the rest of the
|
* "مدیریت پزشک" (that lives in the main nav / doctor profile, not here). Shown
|
||||||
* clinicpro settings area (mobile nav is owned by the standalone settings list
|
* ungated to mirror the tauri source. Each entry maps to a real admin route; the
|
||||||
* page). Each item is a real admin route (SETTINGS_MENU / menuForRole) so the
|
* "تنظیمات" (security) section has no doctor/clinic route yet → disabled.
|
||||||
* routing architecture is preserved. `active` marks the open section.
|
*
|
||||||
|
* This list is intentionally separate from SETTINGS_MENU (SettingsLayout) so the
|
||||||
|
* other settings pages are not affected.
|
||||||
*/
|
*/
|
||||||
|
type NavItem = { key: string; label: string; to?: string };
|
||||||
|
|
||||||
|
const NAV_ITEMS: NavItem[] = [
|
||||||
|
{ key: 'subscription', label: 'خرید اشتراک', to: '/admin/subscription' },
|
||||||
|
{ key: 'payment', label: 'مدیریت پرداخت', to: '/admin/my-financial' },
|
||||||
|
{ key: 'appointment', label: 'مدیریت نوبت دهی', to: '/admin/appointment-settings' },
|
||||||
|
{ key: 'insurance', label: 'مدیریت بیمه', to: '/admin/insurance-pricing' },
|
||||||
|
{ key: 'services', label: 'خدمات', to: '/admin/clinic-services' },
|
||||||
|
{ key: 'tags', label: 'تگ ها', to: '/admin/tags-settings' },
|
||||||
|
{ key: 'sms', label: 'پیامک ها', to: '/admin/sms-wallet' },
|
||||||
|
{ key: 'clinic', label: 'مدیریت مطب', to: '/admin/my-clinic' },
|
||||||
|
{ key: 'account', label: 'حساب کاربری', to: '/admin/account-settings' },
|
||||||
|
{ key: 'security', label: 'تنظیمات' },
|
||||||
|
];
|
||||||
|
|
||||||
export default function PurchaseSubscriptionSidebar({ active }: { active: string }) {
|
export default function PurchaseSubscriptionSidebar({ active }: { active: string }) {
|
||||||
const primaryRole = useAuthStore((s) => s.primaryRole);
|
|
||||||
const [query, setQuery] = useState('');
|
const [query, setQuery] = useState('');
|
||||||
const items = useMemo(
|
const items = useMemo(
|
||||||
() => menuForRole(primaryRole).filter((i) => i.label.includes(query.trim())),
|
() => NAV_ITEMS.filter((i) => i.label.includes(query.trim())),
|
||||||
[primaryRole, query],
|
[query],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user