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

const SettingsSubMenu: 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'>
                <Setting2
                    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('shop')}
                    link={Pages.setting.shop}
                />
                <SubMenuItem
                    title={'تنظیمات فوتر'}
                    isActive={isActive('site-setting')}
                    link={Pages.setting.siteSetting}
                />
                <SubMenuItem
                    title={'تنظیمات بنرها'}
                    isActive={isActive('banners')}
                    link={Pages.setting.banners}
                />
                <SubMenuItem
                    title={'تنظیمات اسلایدرها'}
                    isActive={isActive('sliders')}
                    link={Pages.setting.sliders}
                />
            </div>
        </div>
    )
}

export default SettingsSubMenu
