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

const SellersSubMenu: 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'>
                <People
                    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('list')}
                    link={Pages.sellers.list}
                />
                <SubMenuItem
                    title={'کیف پول فروشندگان'}
                    isActive={isActive('withdrawal')}
                    link={Pages.sellers.withdrawalRequests}
                />
                <SubMenuItem
                    title={'درخواست ها عمده فروشی'}
                    isActive={isActive('wholesale-requests')}
                    link={Pages.sellers.wholesaleRequests}
                />
                <SubMenuItem
                    title={'ارسال اطلاعیه'}
                    isActive={isActive('announcement')}
                    link={Pages.sellers.announcement}
                />
                <SubMenuItem
                    title={'درخواست های ثبت محصول'}
                    isActive={isActive('request-create-product')}
                    link={Pages.sellers.requestCreateProduct}
                />
                <SubMenuItem
                    title={'قرار داد'}
                    isActive={isActive('contract')}
                    link={Pages.sellers.contract}
                />
                <SubMenuItem
                    title={'آموزش ها'}
                    isActive={isActive('learning')}
                    link={Pages.sellers.learning}
                />
                <SubMenuItem
                    title={'دسته بندی آموزش ها'}
                    isActive={isActive('category')}
                    link={Pages.sellers.learningCategory}
                />
            </div>
        </div>
    )
}

export default SellersSubMenu
