import { type FC } from 'react'
import { useLocation } from 'react-router-dom'
import { Home2 } from 'iconsax-react'
import SubMenuItem from './SubMenuItem'

const DashboardSubMenu: FC = () => {
    const location = useLocation()
    const isActive = (name: string) => {
        return location.pathname.includes(name)
    }

    return (
        <div className='py-12'>
            <div className='flex gap-3 items-center border-b border-border pb-10 px-6'>
                <Home2
                    size={24}
                    color='#da2129'
                    variant='Bold'
                />
                <div className='text-xs'>
                    داشبورد
                </div>
            </div>

            <div className='flex flex-col mt-10 gap-4'>
                <SubMenuItem
                    title={'تعداد محصولات'}
                    isActive={isActive('product-stats')}
                    link="/dashboard/product-stats"
                />
                <SubMenuItem
                    title={'تعداد سفارشات'}
                    isActive={isActive('order-stats')}
                    link="/dashboard/order-stats"
                />
                <SubMenuItem
                    title={'کامنت های خوانده نشده'}
                    isActive={isActive('unread-comments')}
                    link="/dashboard/unread-comments"
                />
                <SubMenuItem
                    title={'تعداد کاربران'}
                    isActive={isActive('user-stats')}
                    link="/dashboard/user-stats"
                />
                <SubMenuItem
                    title={'نمودار سفارشات'}
                    isActive={isActive('order-chart')}
                    link="/dashboard/order-chart"
                />
            </div>
        </div>
    )
}

export default DashboardSubMenu
