make page setting + add tabs

This commit is contained in:
hamid zarghami
2025-11-22 14:57:25 +03:30
parent 23abb2c8eb
commit 8b98f47bd5
7 changed files with 81 additions and 18 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import { type FC, useEffect, useState } from 'react' import { type FC, useEffect, useState } from 'react'
import { BrowserRouter } from 'react-router-dom' import { BrowserRouter } from 'react-router-dom'
// import 'swiper/swiper-bundle.css'; import 'swiper/swiper-bundle.css';
// import 'rc-rate/assets/index.css'; // import 'rc-rate/assets/index.css';
// import "react-multi-date-picker/styles/layouts/mobile.css" // import "react-multi-date-picker/styles/layouts/mobile.css"
import './assets/fonts/irancell/style.css' import './assets/fonts/irancell/style.css'
+2 -2
View File
@@ -25,14 +25,14 @@ const Tabs: FC<Props> = (props: Props) => {
<Swiper <Swiper
slidesPerView='auto' slidesPerView='auto'
spaceBetween={30} spaceBetween={30}
className='px-10 max-w-full w-fit items-center text-description mx-auto backdrop-blur-md border-2 border-white gap-10 flex h-[80px] rounded-[32px] bg-white bg-opacity-45'> className='px-10 max-w-full w-fit items-center text-description mx-auto backdrop-blur-md border-2 border-white gap-10 flex h-[80px] rounded-[32px] bg-white/45'>
{ {
props.items.map((item: Item, index: number) => { props.items.map((item: Item, index: number) => {
return ( return (
<SwiperSlide style={SWIPER_SLIDE_STYLE} onClick={() => props.onChange(item.value)} key={item.value} className={clx( <SwiperSlide style={SWIPER_SLIDE_STYLE} onClick={() => props.onChange(item.value)} key={item.value} className={clx(
'flex flex-col max-w-fit mt-[15px] items-center gap-2 cursor-pointer', 'flex flex-col max-w-fit mt-[15px] items-center gap-2 cursor-pointer',
index === 0 && 'pr-[30px]', index === 0 && 'pr-[30px]',
index === props.items.length - 1 && 'pl-[30px]', // index === props.items.length - 1 && 'pl-[30px]',
props.active === item.value && 'text-black' props.active === item.value && 'text-black'
)}> )}>
{item.icon} {item.icon}
+46
View File
@@ -0,0 +1,46 @@
import Tabs from '@/components/Tabs'
import { Card, KeySquare, Setting4, TruckFast } from 'iconsax-react'
import { useState, type FC } from 'react'
import { SettingTabEnum } from './enum/Enum'
const Setting: FC = () => {
const [activeTab, setActiveTab] = useState<SettingTabEnum>(SettingTabEnum.GENERAL)
return (
<div className='mt-5'>
<h1 className='text-lg font-light'>تنظیمات</h1>
<div className='mt-8'>
<Tabs
items={[
{
icon: <Setting4 color={activeTab === SettingTabEnum.GENERAL ? 'black' : '#8C90A3'} size={24} />,
label: 'عمومی',
value: SettingTabEnum.GENERAL,
},
{
icon: <KeySquare color={activeTab === SettingTabEnum.PASSWORD ? 'black' : '#8C90A3'} size={24} />,
label: 'رمز عبور',
value: SettingTabEnum.PASSWORD,
},
{
icon: <Card color={activeTab === SettingTabEnum.FINANCIAL ? 'black' : '#8C90A3'} size={24} />,
label: 'مالی',
value: SettingTabEnum.FINANCIAL,
},
{
icon: <TruckFast color={activeTab === SettingTabEnum.DELIVERY ? 'black' : '#8C90A3'} size={24} />,
label: 'روش های ارسال',
value: SettingTabEnum.DELIVERY,
},
]}
onChange={(value: string) => setActiveTab(value as SettingTabEnum)}
active={activeTab}
/>
</div>
</div>
)
}
export default Setting
+6
View File
@@ -0,0 +1,6 @@
export const enum SettingTabEnum {
GENERAL = "general",
PASSWORD = "password",
FINANCIAL = "financial",
DELIVERY = "delivery",
}
+2
View File
@@ -23,6 +23,7 @@ import RolesList from '@/pages/roles/List'
import CreateRole from '@/pages/roles/Create' import CreateRole from '@/pages/roles/Create'
import UpdateRole from '@/pages/roles/Update' import UpdateRole from '@/pages/roles/Update'
import UpdateSchedule from '@/pages/schedule/Update' import UpdateSchedule from '@/pages/schedule/Update'
import Setting from '@/pages/settings/Setting'
const MainRouter: FC = () => { const MainRouter: FC = () => {
const { hasSubMenu } = useSharedStore() const { hasSubMenu } = useSharedStore()
@@ -57,6 +58,7 @@ const MainRouter: FC = () => {
<Route path={Pages.roles.list} element={<RolesList />} /> <Route path={Pages.roles.list} element={<RolesList />} />
<Route path={Pages.roles.add} element={<CreateRole />} /> <Route path={Pages.roles.add} element={<CreateRole />} />
<Route path={Pages.roles.update + ':id'} element={<UpdateRole />} /> <Route path={Pages.roles.update + ':id'} element={<UpdateRole />} />
<Route path={Pages.setting} element={<Setting />} />
</Routes> </Routes>
</div> </div>
</div> </div>
+12 -7
View File
@@ -3,10 +3,13 @@
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022", "target": "ES2022",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"], "lib": [
"ES2022",
"DOM",
"DOM.Iterable"
],
"module": "ESNext", "module": "ESNext",
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
@@ -14,20 +17,22 @@
"moduleDetection": "force", "moduleDetection": "force",
"noEmit": true, "noEmit": true,
"jsx": "react-jsx", "jsx": "react-jsx",
/* Linting */ /* Linting */
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"erasableSyntaxOnly": true, "erasableSyntaxOnly": false,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true, "noUncheckedSideEffectImports": true,
/* Path Mapping */ /* Path Mapping */
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": [
"./src/*"
]
} }
}, },
"include": ["src"] "include": [
"src"
]
} }
+10 -6
View File
@@ -2,25 +2,29 @@
"compilerOptions": { "compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023", "target": "ES2023",
"lib": ["ES2023"], "lib": [
"ES2023"
],
"module": "ESNext", "module": "ESNext",
"skipLibCheck": true, "skipLibCheck": true,
"types": ["node"], "types": [
"node"
],
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true,
"moduleDetection": "force", "moduleDetection": "force",
"noEmit": true, "noEmit": true,
/* Linting */ /* Linting */
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"erasableSyntaxOnly": true, "erasableSyntaxOnly": false,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true "noUncheckedSideEffectImports": true
}, },
"include": ["vite.config.ts"] "include": [
"vite.config.ts"
]
} }