account sidebar urls
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.2.1 on 2025-05-19 10:28
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('api', '0002_userprofile_account_type_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='userprofile',
|
||||||
|
name='account_type',
|
||||||
|
field=models.CharField(choices=[('lite', 'Lite'), ('standart', 'Standart'), ('premium', 'Premium')], default='free', verbose_name='Тип аккаунта'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.2.1 on 2025-05-19 10:28
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('api', '0003_alter_userprofile_account_type'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='userprofile',
|
||||||
|
name='account_type',
|
||||||
|
field=models.CharField(choices=[('lite', 'Lite'), ('standart', 'Standart'), ('premium', 'Premium')], default='lite', verbose_name='Тип аккаунта'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -5,7 +5,7 @@ import uuid
|
|||||||
|
|
||||||
class UserProfile(models.Model):
|
class UserProfile(models.Model):
|
||||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||||
account_type = models.CharField(choices=account_types, default='free')
|
account_type = models.CharField(choices=account_types, default='lite', verbose_name="Тип аккаунта")
|
||||||
is_active = models.BooleanField(default=True)
|
is_active = models.BooleanField(default=True)
|
||||||
phone_number = models.CharField(max_length=13, verbose_name="Номер телефона")
|
phone_number = models.CharField(max_length=13, verbose_name="Номер телефона")
|
||||||
birthday = models.DateField(null=True, blank=True, verbose_name="Дата рождения")
|
birthday = models.DateField(null=True, blank=True, verbose_name="Дата рождения")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
account_types = [
|
account_types = [
|
||||||
("free", "Free"),
|
|
||||||
("lite", "Lite"),
|
("lite", "Lite"),
|
||||||
('pro', "Pro"),
|
("standart", "Standart"),
|
||||||
|
('premium', "Premium"),
|
||||||
]
|
]
|
||||||
@@ -5,8 +5,10 @@ import { useRouter } from 'next/navigation'
|
|||||||
import AccountSidebar from '@/components/AccountSidebar'
|
import AccountSidebar from '@/components/AccountSidebar'
|
||||||
import Loader from '@/components/ui/Loader'
|
import Loader from '@/components/ui/Loader'
|
||||||
import { RiUser3Line } from 'react-icons/ri'
|
import { RiUser3Line } from 'react-icons/ri'
|
||||||
|
import { FaRoute } from 'react-icons/fa'
|
||||||
|
import { GoPackageDependents, GoPackageDependencies } from 'react-icons/go'
|
||||||
|
import { MdOutlinePayments } from 'react-icons/md'
|
||||||
import { CgNotes } from 'react-icons/cg'
|
import { CgNotes } from 'react-icons/cg'
|
||||||
import { FaStar } from 'react-icons/fa6'
|
|
||||||
import useUserStore from '@/app/store/userStore'
|
import useUserStore from '@/app/store/userStore'
|
||||||
|
|
||||||
export default function AccountLayout({
|
export default function AccountLayout({
|
||||||
@@ -37,7 +39,18 @@ export default function AccountLayout({
|
|||||||
|
|
||||||
const userNavigation = [
|
const userNavigation = [
|
||||||
{ name: 'Профиль', href: '/account', icon: RiUser3Line },
|
{ name: 'Профиль', href: '/account', icon: RiUser3Line },
|
||||||
{ name: 'Мои маршруты', href: '/account/routes', icon: CgNotes },
|
{ name: 'Мои маршруты', href: '/account/routes', icon: FaRoute },
|
||||||
|
{
|
||||||
|
name: 'Отправить посылку',
|
||||||
|
href: '/account/create_as_sender',
|
||||||
|
icon: GoPackageDependents,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Перевезти посылку',
|
||||||
|
href: '/account/create_as_deliveler',
|
||||||
|
icon: GoPackageDependencies,
|
||||||
|
},
|
||||||
|
{ name: 'Тарифы', href: '/account/payments', icon: MdOutlinePayments },
|
||||||
]
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ export interface ButtonProps {
|
|||||||
onClick?: () => void
|
onClick?: () => void
|
||||||
className?: string
|
className?: string
|
||||||
text?: string
|
text?: string
|
||||||
|
leftIcon?: React.ReactNode
|
||||||
|
rightIcon?: React.ReactNode
|
||||||
type?: 'button' | 'submit' | 'reset'
|
type?: 'button' | 'submit' | 'reset'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ const AccountSidebar: React.FC<AccountSidebarProps> = ({
|
|||||||
|
|
||||||
const getAccountTypeStyles = (accountType: string) => {
|
const getAccountTypeStyles = (accountType: string) => {
|
||||||
switch (accountType.toLowerCase()) {
|
switch (accountType.toLowerCase()) {
|
||||||
case 'free':
|
|
||||||
return 'bg-gray-400 text-white'
|
|
||||||
case 'lite':
|
case 'lite':
|
||||||
return 'bg-orage/70 text-white'
|
return 'bg-gray-400 text-white'
|
||||||
case 'pro':
|
case 'standart':
|
||||||
|
return 'bg-orange/70 text-white'
|
||||||
|
case 'premium':
|
||||||
return 'bg-blue-300'
|
return 'bg-blue-300'
|
||||||
default:
|
default:
|
||||||
return 'bg-gray-200'
|
return 'bg-gray-200'
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ const Logout = () => {
|
|||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
text="Выйти из аккаунта"
|
text="Выйти из аккаунта"
|
||||||
|
leftIcon={<IoExitOutline className="mr-1 h-5 w-5" />}
|
||||||
className="w-full text-sm font-medium text-gray-600 hover:bg-gray-100 px-4 py-4 flex items-center rounded-lg transition-colors"
|
className="w-full text-sm font-medium text-gray-600 hover:bg-gray-100 px-4 py-4 flex items-center rounded-lg transition-colors"
|
||||||
onClick={handleLogout}
|
onClick={handleLogout}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { ButtonProps } from '@/app/types/index'
|
import { ButtonProps } from '@/app/types/index'
|
||||||
|
|
||||||
const Button = ({ onClick, className, text, type }: ButtonProps) => {
|
const Button = ({
|
||||||
|
onClick,
|
||||||
|
className,
|
||||||
|
text,
|
||||||
|
type,
|
||||||
|
leftIcon,
|
||||||
|
rightIcon,
|
||||||
|
}: ButtonProps) => {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
className={`text-base font-medium rounded-2xl cursor-pointer ${className}`}
|
className={`text-base font-medium rounded-2xl cursor-pointer ${className}`}
|
||||||
type={type}
|
type={type}
|
||||||
>
|
>
|
||||||
|
{leftIcon && <span className="mr-2 flex items-center">{leftIcon}</span>}
|
||||||
<span>{text}</span>
|
<span>{text}</span>
|
||||||
|
{rightIcon && <span className="ml-2 flex items-center">{rightIcon}</span>}
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user