From 9bb7f411d2a1ed0fdcb56a7d8c5a44677794a7d1 Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Tue, 14 Jul 2026 15:04:18 +0330 Subject: [PATCH] fix(subscription): settings sidebar items match tauri source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../layout/PurchaseSubscriptionSidebar.tsx | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/assets/admin/components/layout/PurchaseSubscriptionSidebar.tsx b/assets/admin/components/layout/PurchaseSubscriptionSidebar.tsx index 72f0b15c..99ff1d16 100644 --- a/assets/admin/components/layout/PurchaseSubscriptionSidebar.tsx +++ b/assets/admin/components/layout/PurchaseSubscriptionSidebar.tsx @@ -1,23 +1,37 @@ import React, { useMemo, useState } from 'react'; import { Link } from 'react-router-dom'; -import { useAuthStore } from '../../stores/authStore'; -import { menuForRole } from './SettingsLayout'; import { SearchHeaderP } from '../../pages/subscriptionIcons'; /** - * PurchaseSubscriptionSidebar — settings sub-navigation styled after - * clinic-pro-tauri's `PurchaseSubscriptionSidebar.jsx` (title + search + tab - * list, orange active pill #f17732). Desktop-only, like the rest of the - * clinicpro settings area (mobile nav is owned by the standalone settings list - * page). Each item is a real admin route (SETTINGS_MENU / menuForRole) so the - * routing architecture is preserved. `active` marks the open section. + * Settings sub-navigation for the subscription page — item list and order copied + * verbatim from clinic-pro-tauri's `PurchaseSubscription.jsx` navItems, minus + * "مدیریت پزشک" (that lives in the main nav / doctor profile, not here). Shown + * ungated to mirror the tauri source. Each entry maps to a real admin route; the + * "تنظیمات" (security) section has no doctor/clinic route yet → disabled. + * + * 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 }) { - const primaryRole = useAuthStore((s) => s.primaryRole); const [query, setQuery] = useState(''); const items = useMemo( - () => menuForRole(primaryRole).filter((i) => i.label.includes(query.trim())), - [primaryRole, query], + () => NAV_ITEMS.filter((i) => i.label.includes(query.trim())), + [query], ); return (