diff --git a/cakeBack/cakeApi/__pycache__/__init__.cpython-311.pyc b/cakeBack/cakeApi/__pycache__/__init__.cpython-311.pyc
index 8104c32..5ec5249 100644
Binary files a/cakeBack/cakeApi/__pycache__/__init__.cpython-311.pyc and b/cakeBack/cakeApi/__pycache__/__init__.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/__pycache__/admin.cpython-311.pyc b/cakeBack/cakeApi/__pycache__/admin.cpython-311.pyc
index 9325506..c5b6ab4 100644
Binary files a/cakeBack/cakeApi/__pycache__/admin.cpython-311.pyc and b/cakeBack/cakeApi/__pycache__/admin.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/__pycache__/apps.cpython-311.pyc b/cakeBack/cakeApi/__pycache__/apps.cpython-311.pyc
index fccbf86..72f0abb 100644
Binary files a/cakeBack/cakeApi/__pycache__/apps.cpython-311.pyc and b/cakeBack/cakeApi/__pycache__/apps.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/__pycache__/models.cpython-311.pyc b/cakeBack/cakeApi/__pycache__/models.cpython-311.pyc
index 78024e7..df96047 100644
Binary files a/cakeBack/cakeApi/__pycache__/models.cpython-311.pyc and b/cakeBack/cakeApi/__pycache__/models.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/__pycache__/serializers.cpython-311.pyc b/cakeBack/cakeApi/__pycache__/serializers.cpython-311.pyc
index 9a439f9..583cc26 100644
Binary files a/cakeBack/cakeApi/__pycache__/serializers.cpython-311.pyc and b/cakeBack/cakeApi/__pycache__/serializers.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/__pycache__/tools.cpython-311.pyc b/cakeBack/cakeApi/__pycache__/tools.cpython-311.pyc
index 98988fb..eefa520 100644
Binary files a/cakeBack/cakeApi/__pycache__/tools.cpython-311.pyc and b/cakeBack/cakeApi/__pycache__/tools.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/__pycache__/urls.cpython-311.pyc b/cakeBack/cakeApi/__pycache__/urls.cpython-311.pyc
index b38fe84..4dfe08c 100644
Binary files a/cakeBack/cakeApi/__pycache__/urls.cpython-311.pyc and b/cakeBack/cakeApi/__pycache__/urls.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/__pycache__/views.cpython-311.pyc b/cakeBack/cakeApi/__pycache__/views.cpython-311.pyc
index 9f8c403..ab90c9d 100644
Binary files a/cakeBack/cakeApi/__pycache__/views.cpython-311.pyc and b/cakeBack/cakeApi/__pycache__/views.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/admin.py b/cakeBack/cakeApi/admin.py
index b81b955..fbf9aee 100644
--- a/cakeBack/cakeApi/admin.py
+++ b/cakeBack/cakeApi/admin.py
@@ -3,4 +3,6 @@
from .models import *
admin.site.register(Category)
-admin.site.register(Item)
\ No newline at end of file
+admin.site.register(Item)
+admin.site.register(Order)
+admin.site.register(User)
\ No newline at end of file
diff --git a/cakeBack/cakeApi/migrations/0001_initial.py b/cakeBack/cakeApi/migrations/0001_initial.py
index ff49a9e..6abfd19 100644
--- a/cakeBack/cakeApi/migrations/0001_initial.py
+++ b/cakeBack/cakeApi/migrations/0001_initial.py
@@ -1,7 +1,8 @@
-# Generated by Django 4.2.4 on 2023-09-03 14:07
+# Generated by Django 4.2.4 on 2023-10-05 18:21
import autoslug.fields
from django.db import migrations, models
+import django.db.models.deletion
class Migration(migrations.Migration):
@@ -21,16 +22,36 @@ class Migration(migrations.Migration):
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='nameOfCategory')),
],
),
+ migrations.CreateModel(
+ name='User',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('userEmail', models.EmailField(blank=True, max_length=200, null=True, unique=True)),
+ ('userPhoneNumber', models.CharField(max_length=10, unique=True)),
+ ('userName', models.CharField(max_length=40)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Order',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('items', models.JSONField()),
+ ('status', models.CharField(default='Workin` at order', max_length=50)),
+ ('dataTime', models.DateTimeField(null=True)),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cakeApi.user')),
+ ],
+ ),
migrations.CreateModel(
name='Item',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nameOfItem', models.CharField(max_length=100)),
('priceOfItem', models.IntegerField()),
- ('imgOfItem', models.URLField(max_length=10000)),
+ ('imgOfItem', models.URLField(max_length=10002)),
('BestsellerItem', models.BooleanField(default=False)),
('descriptionOfItem', models.CharField(max_length=2000)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='nameOfItem')),
+ ('categoryOfItem', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cakeApi.category')),
],
),
]
diff --git a/cakeBack/cakeApi/migrations/0002_alter_user_options_alter_user_managers_and_more.py b/cakeBack/cakeApi/migrations/0002_alter_user_options_alter_user_managers_and_more.py
new file mode 100644
index 0000000..e4823a1
--- /dev/null
+++ b/cakeBack/cakeApi/migrations/0002_alter_user_options_alter_user_managers_and_more.py
@@ -0,0 +1,106 @@
+# Generated by Django 4.2.4 on 2023-11-02 14:43
+
+import django.contrib.auth.models
+import django.contrib.auth.validators
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('auth', '0012_alter_user_first_name_max_length'),
+ ('cakeApi', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='user',
+ options={'verbose_name': 'user', 'verbose_name_plural': 'users'},
+ ),
+ migrations.AlterModelManagers(
+ name='user',
+ managers=[
+ ('objects', django.contrib.auth.models.UserManager()),
+ ],
+ ),
+ migrations.RemoveField(
+ model_name='user',
+ name='userEmail',
+ ),
+ migrations.RemoveField(
+ model_name='user',
+ name='userName',
+ ),
+ migrations.RemoveField(
+ model_name='user',
+ name='userPhoneNumber',
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='date_joined',
+ field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='email',
+ field=models.EmailField(blank=True, max_length=254, verbose_name='email address'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='first_name',
+ field=models.CharField(blank=True, max_length=150, verbose_name='first name'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='groups',
+ field=models.ManyToManyField(related_name='custom_user_set', to='auth.group'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='is_active',
+ field=models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='is_staff',
+ field=models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='is_superuser',
+ field=models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='last_login',
+ field=models.DateTimeField(blank=True, null=True, verbose_name='last login'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='last_name',
+ field=models.CharField(blank=True, max_length=150, verbose_name='last name'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='password',
+ field=models.CharField(default=False, max_length=128, verbose_name='password'),
+ preserve_default=False,
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='phoneNumber',
+ field=models.CharField(default=False, max_length=12),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='user_permissions',
+ field=models.ManyToManyField(related_name='custom_user_set', to='auth.permission'),
+ ),
+ migrations.AddField(
+ model_name='user',
+ name='username',
+ field=models.CharField(default=False, error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username'),
+ preserve_default=False,
+ ),
+ ]
diff --git a/cakeBack/cakeApi/migrations/0002_item_categoryofitem.py b/cakeBack/cakeApi/migrations/0002_item_categoryofitem.py
deleted file mode 100644
index 3ee8022..0000000
--- a/cakeBack/cakeApi/migrations/0002_item_categoryofitem.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated by Django 4.2.4 on 2023-09-03 14:26
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('cakeApi', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='item',
- name='categoryOfItem',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cakeApi.category'),
- ),
- ]
diff --git a/cakeBack/cakeApi/migrations/0003_alter_item_bestselleritem.py b/cakeBack/cakeApi/migrations/0003_alter_item_bestselleritem.py
new file mode 100644
index 0000000..6d71fe3
--- /dev/null
+++ b/cakeBack/cakeApi/migrations/0003_alter_item_bestselleritem.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.2.4 on 2023-11-07 11:29
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('cakeApi', '0002_alter_user_options_alter_user_managers_and_more'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='item',
+ name='BestsellerItem',
+ field=models.BooleanField(),
+ ),
+ ]
diff --git a/cakeBack/cakeApi/migrations/0004_alter_item_imgofitem_alter_item_priceofitem.py b/cakeBack/cakeApi/migrations/0004_alter_item_imgofitem_alter_item_priceofitem.py
new file mode 100644
index 0000000..9462de1
--- /dev/null
+++ b/cakeBack/cakeApi/migrations/0004_alter_item_imgofitem_alter_item_priceofitem.py
@@ -0,0 +1,23 @@
+# Generated by Django 4.2.4 on 2023-11-28 10:34
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('cakeApi', '0003_alter_item_bestselleritem'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='item',
+ name='imgOfItem',
+ field=models.URLField(blank=True, max_length=10000, null=True),
+ ),
+ migrations.AlterField(
+ model_name='item',
+ name='priceOfItem',
+ field=models.FloatField(),
+ ),
+ ]
diff --git a/cakeBack/cakeApi/migrations/0005_alter_item_priceofitem.py b/cakeBack/cakeApi/migrations/0005_alter_item_priceofitem.py
new file mode 100644
index 0000000..ce7030a
--- /dev/null
+++ b/cakeBack/cakeApi/migrations/0005_alter_item_priceofitem.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.2.4 on 2023-11-28 10:48
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('cakeApi', '0004_alter_item_imgofitem_alter_item_priceofitem'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='item',
+ name='priceOfItem',
+ field=models.DecimalField(decimal_places=2, max_digits=10),
+ ),
+ ]
diff --git a/cakeBack/cakeApi/migrations/0003_alter_item_imgofitem.py b/cakeBack/cakeApi/migrations/0006_alter_item_priceofitem.py
similarity index 53%
rename from cakeBack/cakeApi/migrations/0003_alter_item_imgofitem.py
rename to cakeBack/cakeApi/migrations/0006_alter_item_priceofitem.py
index 63aea98..e87f98d 100644
--- a/cakeBack/cakeApi/migrations/0003_alter_item_imgofitem.py
+++ b/cakeBack/cakeApi/migrations/0006_alter_item_priceofitem.py
@@ -1,4 +1,4 @@
-# Generated by Django 4.2.4 on 2023-09-03 14:35
+# Generated by Django 4.2.4 on 2023-11-28 10:49
from django.db import migrations, models
@@ -6,13 +6,13 @@
class Migration(migrations.Migration):
dependencies = [
- ('cakeApi', '0002_item_categoryofitem'),
+ ('cakeApi', '0005_alter_item_priceofitem'),
]
operations = [
migrations.AlterField(
model_name='item',
- name='imgOfItem',
- field=models.URLField(max_length=10002),
+ name='priceOfItem',
+ field=models.FloatField(),
),
]
diff --git a/cakeBack/cakeApi/migrations/0007_alter_item_descriptionofitem.py b/cakeBack/cakeApi/migrations/0007_alter_item_descriptionofitem.py
new file mode 100644
index 0000000..a36cc9c
--- /dev/null
+++ b/cakeBack/cakeApi/migrations/0007_alter_item_descriptionofitem.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.2.4 on 2023-11-29 14:41
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('cakeApi', '0006_alter_item_priceofitem'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='item',
+ name='descriptionOfItem',
+ field=models.TextField(max_length=2000),
+ ),
+ ]
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0001_initial.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0001_initial.cpython-311.pyc
index 5e49b01..b8363ce 100644
Binary files a/cakeBack/cakeApi/migrations/__pycache__/0001_initial.cpython-311.pyc and b/cakeBack/cakeApi/migrations/__pycache__/0001_initial.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0002_item_categoryofitem.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0002_alter_order_user.cpython-311.pyc
similarity index 56%
rename from cakeBack/cakeApi/migrations/__pycache__/0002_item_categoryofitem.cpython-311.pyc
rename to cakeBack/cakeApi/migrations/__pycache__/0002_alter_order_user.cpython-311.pyc
index 2a85218..ce5e735 100644
Binary files a/cakeBack/cakeApi/migrations/__pycache__/0002_item_categoryofitem.cpython-311.pyc and b/cakeBack/cakeApi/migrations/__pycache__/0002_alter_order_user.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0002_alter_user_options_alter_user_managers_and_more.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0002_alter_user_options_alter_user_managers_and_more.cpython-311.pyc
new file mode 100644
index 0000000..4d4eede
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0002_alter_user_options_alter_user_managers_and_more.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0002_category_imgofcategory.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0002_category_imgofcategory.cpython-311.pyc
deleted file mode 100644
index af96bb7..0000000
Binary files a/cakeBack/cakeApi/migrations/__pycache__/0002_category_imgofcategory.cpython-311.pyc and /dev/null differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0003_alter_item_bestselleritem.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0003_alter_item_bestselleritem.cpython-311.pyc
new file mode 100644
index 0000000..9a52be8
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0003_alter_item_bestselleritem.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0003_alter_order_user.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0003_alter_order_user.cpython-311.pyc
new file mode 100644
index 0000000..097efe4
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0003_alter_order_user.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0004_alter_item_imgofitem_alter_item_priceofitem.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0004_alter_item_imgofitem_alter_item_priceofitem.cpython-311.pyc
new file mode 100644
index 0000000..b99ba34
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0004_alter_item_imgofitem_alter_item_priceofitem.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0004_alter_order_user.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0004_alter_order_user.cpython-311.pyc
new file mode 100644
index 0000000..bdbc4a1
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0004_alter_order_user.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0005_alter_item_priceofitem.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0005_alter_item_priceofitem.cpython-311.pyc
new file mode 100644
index 0000000..3c0afba
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0005_alter_item_priceofitem.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0005_alter_user_options_alter_user_managers_and_more.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0005_alter_user_options_alter_user_managers_and_more.cpython-311.pyc
new file mode 100644
index 0000000..9632a0c
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0005_alter_user_options_alter_user_managers_and_more.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0006_alter_item_priceofitem.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0006_alter_item_priceofitem.cpython-311.pyc
new file mode 100644
index 0000000..c7e72fa
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0006_alter_item_priceofitem.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0006_remove_user_firstname_remove_user_isadmin_and_more.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0006_remove_user_firstname_remove_user_isadmin_and_more.cpython-311.pyc
new file mode 100644
index 0000000..867cbaf
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0006_remove_user_firstname_remove_user_isadmin_and_more.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0003_alter_item_imgofitem.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0007_alter_item_descriptionofitem.cpython-311.pyc
similarity index 56%
rename from cakeBack/cakeApi/migrations/__pycache__/0003_alter_item_imgofitem.cpython-311.pyc
rename to cakeBack/cakeApi/migrations/__pycache__/0007_alter_item_descriptionofitem.cpython-311.pyc
index 619dd79..d8dabbc 100644
Binary files a/cakeBack/cakeApi/migrations/__pycache__/0003_alter_item_imgofitem.cpython-311.pyc and b/cakeBack/cakeApi/migrations/__pycache__/0007_alter_item_descriptionofitem.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0007_user_phonenumber.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0007_user_phonenumber.cpython-311.pyc
new file mode 100644
index 0000000..60b2383
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0007_user_phonenumber.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0008_alter_user_options_alter_user_managers_and_more.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0008_alter_user_options_alter_user_managers_and_more.cpython-311.pyc
new file mode 100644
index 0000000..b3fd541
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0008_alter_user_options_alter_user_managers_and_more.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0009_alter_user_options_alter_user_managers_order_user_and_more.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0009_alter_user_options_alter_user_managers_order_user_and_more.cpython-311.pyc
new file mode 100644
index 0000000..afae475
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0009_alter_user_options_alter_user_managers_order_user_and_more.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/0010_remove_item_categoryofitem.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/0010_remove_item_categoryofitem.cpython-311.pyc
new file mode 100644
index 0000000..d3714e6
Binary files /dev/null and b/cakeBack/cakeApi/migrations/__pycache__/0010_remove_item_categoryofitem.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/migrations/__pycache__/__init__.cpython-311.pyc b/cakeBack/cakeApi/migrations/__pycache__/__init__.cpython-311.pyc
index 907ce70..2b80469 100644
Binary files a/cakeBack/cakeApi/migrations/__pycache__/__init__.cpython-311.pyc and b/cakeBack/cakeApi/migrations/__pycache__/__init__.cpython-311.pyc differ
diff --git a/cakeBack/cakeApi/models.py b/cakeBack/cakeApi/models.py
index 5a29c76..3fc514c 100644
--- a/cakeBack/cakeApi/models.py
+++ b/cakeBack/cakeApi/models.py
@@ -1,5 +1,7 @@
from django.db import models
from autoslug import AutoSlugField
+from django.contrib.auth.models import AbstractUser,Group, Permission
+
class Category(models.Model):
@@ -11,9 +13,22 @@ class Category(models.Model):
class Item(models.Model):
nameOfItem = models.CharField(max_length=100)
- priceOfItem = models.IntegerField()
- imgOfItem = models.URLField(max_length=10002)
- categoryOfItem = models.ForeignKey(Category, on_delete = models.CASCADE, blank=True, null=True)
- BestsellerItem = models.BooleanField(default=False)
- descriptionOfItem = models.CharField(max_length=2000)
- slug = AutoSlugField(populate_from='nameOfItem')
\ No newline at end of file
+ priceOfItem = models.FloatField()
+ imgOfItem = models.URLField(max_length=10000, blank=True, null=True)
+ categoryOfItem = models.ForeignKey(Category, on_delete=models.CASCADE, blank=True, null=True)
+ BestsellerItem = models.BooleanField()
+ descriptionOfItem = models.TextField(max_length=2000)
+ slug = AutoSlugField(populate_from='nameOfItem')
+
+
+class User(AbstractUser):
+ phoneNumber = models.CharField(max_length=12, default=False)
+ groups = models.ManyToManyField(Group, related_name='custom_user_set')
+ user_permissions = models.ManyToManyField(Permission, related_name='custom_user_set')
+
+
+class Order(models.Model):
+ user = models.ForeignKey(User, on_delete=models.CASCADE)
+ items = models.JSONField()
+ status = models.CharField(max_length=50, default='Workin` at order')
+ dataTime = models.DateTimeField(null=True)
\ No newline at end of file
diff --git a/cakeBack/cakeApi/serializers.py b/cakeBack/cakeApi/serializers.py
index fa8c31e..4c2309f 100644
--- a/cakeBack/cakeApi/serializers.py
+++ b/cakeBack/cakeApi/serializers.py
@@ -1,5 +1,6 @@
from rest_framework.serializers import ModelSerializer
-
+from django.contrib.auth.hashers import make_password
+from rest_framework import serializers
from .models import *
@@ -7,13 +8,42 @@ class SerializeCategories(ModelSerializer):
class Meta:
model = Category
- fields = ['nameOfCategory','slug']
- read_only_fields = ['slug',]
+ fields = ['nameOfCategory','slug','pk','imgOfCategory']
+ read_only_fields = ['slug','pk']
class SerializeItems(ModelSerializer):
class Meta:
model = Item
- fields = ['nameOfItem', 'priceOfItem', 'imgOfItem','descriptionOfItem', 'slug', 'BestsellerItem']
- read_only_fields = ['slug',]
\ No newline at end of file
+ fields = ['pk','nameOfItem', 'priceOfItem', 'imgOfItem','descriptionOfItem', 'slug', 'BestsellerItem','categoryOfItem']
+ read_only_fields = ['slug','pk',]
+
+class SerializeUser(ModelSerializer):
+ class Meta:
+ model = User
+ fields = ['pk','email','first_name','is_staff','last_name','phoneNumber']
+
+class SerializeCreateUser(ModelSerializer):
+ def create(self, validated_data):
+ validated_data['password'] = make_password(validated_data['password'])
+ return super().create(validated_data)
+
+ class Meta:
+ model = User
+ fields = ['email','first_name','last_name','password','phoneNumber', 'username']
+
+class SerializeCurrentUser(ModelSerializer):
+ class Meta:
+ model = User
+ fields = ['pk', 'email','first_name','is_staff','last_name','phoneNumber','password']
+
+
+
+class SerializeOrders(ModelSerializer):
+ class Meta:
+ model = Order
+ fields = ['user', 'items', 'status','pk']
+ read_only_fields = ['pk',]
+
+
diff --git a/cakeBack/cakeApi/tools.py b/cakeBack/cakeApi/tools.py
index 44dc96e..c17dc3b 100644
--- a/cakeBack/cakeApi/tools.py
+++ b/cakeBack/cakeApi/tools.py
@@ -1,7 +1,25 @@
-
def findBiggestNumber(querySet):
a = 0
for i in querySet:
if i.priceOfItem > a:
a = i.priceOfItem
- return a
\ No newline at end of file
+ return a
+
+# i.priceOfItem = querySet[i].priceOfItem
+# set - несколько объектов
+# i - объект 0 1 2 3
+def findPkOfNeededCategory(querySet):
+ for i in querySet:
+ return i.pk
+
+def findGeneralPriceOfOrder(itemsOfOrder):
+ total = 0
+ amount = 0
+ for i in itemsOfOrder:
+ total += i['priceOfItem'] * i['Amount']
+ amount += i['Amount']
+
+ return total, amount
+
+
+
\ No newline at end of file
diff --git a/cakeBack/cakeApi/urls.py b/cakeBack/cakeApi/urls.py
index b9b6bf8..97d7b6f 100644
--- a/cakeBack/cakeApi/urls.py
+++ b/cakeBack/cakeApi/urls.py
@@ -1,10 +1,21 @@
-from django.urls import path
+from django.urls import path, include
+
from .views import *
urlpatterns = [
path('getCategories/', getCategories ),
path('getBestsellers/', getBestsellers),
- path('getItems/', getItems)
-
+ path('getItems/', getItems),
+ path('getOrders/', getOrders),
+ path('postNewOrder/', postOrder),
+ path('delete-object/', deleteObject),
+ path('put-object/', putObject),
+ path('get-info/', getInfo),
+ path('patch-order/', patchOrder),
+ path('create-object/', postObject),
+ path('auth/', include('djoser.urls.authtoken')),
+ path('auth/', include('djoser.urls.jwt')),
+ path('auth/', include('djoser.urls')),
+ # path('api-auth', include('rest_framework.urls')),
]
\ No newline at end of file
diff --git a/cakeBack/cakeApi/views.py b/cakeBack/cakeApi/views.py
index 2036286..ad56775 100644
--- a/cakeBack/cakeApi/views.py
+++ b/cakeBack/cakeApi/views.py
@@ -1,15 +1,18 @@
from django.shortcuts import render
-from rest_framework.decorators import api_view
+from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from rest_framework import status
from rest_framework.pagination import PageNumberPagination
+from rest_framework.permissions import IsAuthenticated, IsAdminUser
from django.db.models import Q
+from django.http import QueryDict
+from slugify import slugify
from .models import *
from .serializers import *
-from .tools import findBiggestNumber
+from .tools import *
@@ -21,6 +24,10 @@ def getCategories(request):
showcase = request.query_params.get('showcase')
if showcase == 'true':
neededCategories = Category.objects.all()[:3]
+ elif showcase == 'option-select':
+ neededCategories = Category.objects.all()
+ serializedneededCategory = SerializeCategories(neededCategories, many=True)
+ return Response(serializedneededCategory.data)
else:
neededCategories = Category.objects.all()
@@ -43,51 +50,197 @@ def getBestsellers(request):
paginator = catalogPaginator()
serializedItems = SerializeItems(paginatedData, many=True)
dataOfNeededItems = serializedItems.data
- return Response(dataOfNeededItems)
+ return Response(dataOfNeededItems, status=status.HTTP_200_OK)
@api_view(['GET',])
def getItems(request):
if request.method == "GET":
- allItems = Item.objects.all()
+ itemSlug = request.GET.get('slug')
+ if(type(itemSlug) == str):
+ neededItem = Item.objects.get(slug=itemSlug)
+ serializedItems = SerializeItems(neededItem,many=False)
+ data = serializedItems.data
+ return Response(data)
+ else:
+ slugOfNeededCategory = request.GET.get('category')
+ pkOfNeededCategory = findPkOfNeededCategory(Category.objects.filter(nameOfCategory__iexact = slugOfNeededCategory))
+
+ allItems = Item.objects.filter(categoryOfItem_id = pkOfNeededCategory)
- biggestNumber = findBiggestNumber(allItems)
- filterBestsellers = request.GET.get('bestsellerFilter')
- maxPrice = request.GET.get('maxPrice')
- minPrice = request.GET.get('minPrice')
- lowHighFilter = request.GET.get('lowHighFilter')
+
+ biggestNumber = findBiggestNumber(allItems)
- filters = Q()
- if filterBestsellers == 'true':
- filters |= Q(BestsellerItem=True)
- if minPrice:
- filters &= Q(priceOfItem__gte=minPrice)
- if maxPrice:
- filters &= Q(priceOfItem__lte=maxPrice)
+ filterBestsellers = request.GET.get('bestsellerFilter')
+ maxPrice = request.GET.get('maxPrice')
+ minPrice = request.GET.get('minPrice')
+ lowHighFilter = request.GET.get('lowHighFilter')
- neededItems = allItems.filter(filters)
-
- if lowHighFilter == 'lowToHigh':
- neededItems = neededItems.filter().order_by('priceOfItem')
- elif lowHighFilter == 'highToLow':
- neededItems = neededItems.filter().order_by('-priceOfItem')
+ filters = Q()
+ if filterBestsellers == 'true':
+ filters |= Q(BestsellerItem=True)
+ if minPrice:
+ filters &= Q(priceOfItem__gte=minPrice)
+ if maxPrice:
+ filters &= Q(priceOfItem__lte=maxPrice)
+ neededItems = allItems.filter(filters)
- paginator = catalogPaginator()
- paginatedData = paginator.paginate_queryset(neededItems, request)
- serializedItems = SerializeItems(paginatedData, many=True)
- data = serializedItems.data
- return Response([data, biggestNumber], status=status.HTTP_200_OK)
-
+ if lowHighFilter == 'lowToHigh':
+ neededItems = neededItems.filter().order_by('priceOfItem')
+ elif lowHighFilter == 'highToLow':
+ neededItems = neededItems.filter().order_by('-priceOfItem')
+ paginator = catalogPaginator()
+ paginatedData = paginator.paginate_queryset(neededItems, request)
+ serializedItems = SerializeItems(paginatedData, many=True)
+ data = serializedItems.data
+ return Response([data, biggestNumber], status=status.HTTP_200_OK)
+
+@api_view(['GET',])
+def getOrders(request):
+ if request.method == "GET":
+ id = request.GET.get('id')
+ if type(id) == str:
+ neededOrders = Order.objects.filter(pk=id)
+ elif request.user.is_staff == False:
+ neededOrders = Order.objects.filter(user = request.user.pk)
+ else:
+ neededOrders = Order.objects.all()
+
+ serializedNeededItems = SerializeOrders(neededOrders, many=True)
+ neededData = serializedNeededItems.data
+ totalPrice, amountOfItems = findGeneralPriceOfOrder(neededData[0]['items'])
+
+ idOfNeededUser = neededData[0]['user']
+ user = User.objects.get(pk=idOfNeededUser)
+ serializer = SerializeUser(user)
+ userData = serializer.data
+ return Response([neededData, totalPrice, amountOfItems, userData], status=status.HTTP_200_OK)
+
+
+@api_view(['POST'])
+def postOrder(request):
+ if request.method == "POST":
+ data = request.data
+ data['user'] = request.user.pk
+ serializedData = SerializeOrders(data=data, many=False)
+ if serializedData.is_valid():
+ serializedData.save()
+ return Response(status=status.HTTP_201_CREATED)
+ return Response(serializedData.errors, status=status.HTTP_400_BAD_REQUEST)
+
+
+@api_view(['GET'])
+def getInfo(request):
+ if request.method == "GET":
+ if request.user.is_authenticated:
+ user_data = {
+ 'username': request.user.username,
+ 'email': request.user.email,
+ 'is_admin': request.user.is_staff
+ }
+ return Response(user_data)
+ else:
+ return Response({'detail': 'User isn`t auth'}, status=status.HTTP_401_UNAUTHORIZED)
+
+
+@api_view(['DELETE'])
+@permission_classes([IsAdminUser])
+def deleteObject(request):
+ if request.method == "DELETE":
+ id = request.query_params.get('id')
+ typeOfObject = request.query_params.get('typeOfObject')
+ if typeOfObject == "product":
+ obj = Item.objects.get(pk=id)
+ obj.delete()
+ return Response('Deleted product')
+ else:
+ obj = Category.objects.get(pk=id)
+ obj.delete()
+ return Response('Deleted Category')
+ return Response('Something went wrong')
+
+@api_view(['PUT'])
+@permission_classes([IsAdminUser])
+def putObject(request):
+ if request.method == "PUT":
+ id = request.query_params.get('id')
+ typeOfObject = request.query_params.get('typeOfObject')
+ neededItem = Item.objects.get(pk=id)
+
+ query_dict = QueryDict('', mutable=True)
+ query_dict.update(request.data)
+ if typeOfObject == "product":
+ serializedData = SerializeItems(neededItem, data=query_dict)
+ if serializedData.is_valid():
+ print('save')
+ serializedData.save()
+ return Response(status=status.HTTP_200_OK)
+ else:
+ return Response('Something went wrong')
+ return Response('Something went wrong')
+
+@api_view(['PATCH'])
+@permission_classes([IsAdminUser])
+def patchOrder(requst):
+ if requst.method == "PATCH":
+ idOfNeededOrder = requst.data['idOfOrder']
+ newStatus = requst.data['status']
+ try:
+ neededOrder = Order.objects.get(pk=idOfNeededOrder)
+ except neededOrder.DoesNotExist:
+ return Response('Order is not found')
+
+ neededOrder.status = newStatus
+ neededOrder.save()
+ return Response('Order updated')
+
+ return Response('Something went wrong')
+
+@api_view(['POST'])
+@permission_classes([IsAdminUser])
+def postObject(request):
+ if request.method == "POST":
+ typeOfObject = request.data['typeOfObject']
+ if typeOfObject == "category":
+ data = {
+ 'nameOfCategory': request.data['name'],
+ 'imgOfCategory': request.data['img'],
+ }
+ serializedData = SerializeCategories(data=data)
+ if serializedData.is_valid():
+ serializedData.save()
+ return Response("Created")
+ else:
+ return Response("Something went wrong")
+ else:
+ categoryOfItem = Category.objects.filter(slug=request.data['category'])
+ categoryData = SerializeCategories(categoryOfItem[0], many=False)
+ data = {
+ 'nameOfItem': request.data['name'],
+ 'priceOfItem': request.data['price'],
+ 'imgOfItem': request.data['img'],
+ 'bestsellerItem': request.data['bestseller'],
+ 'descriptionOfItem': request.data['descriptionOfItem'],
+ 'categoryOfItem': categoryData.data['pk']
+ }
+ query_dict = QueryDict('', mutable=True)
+ query_dict.update(data)
+ serializedData = SerializeItems(data=query_dict)
+ if serializedData.is_valid():
+ serializedData.save()
+ return Response("Created")
+ else:
+ return Response("Created")
-
+
class showcasePaginator(PageNumberPagination):
page_size = 3
diff --git a/cakeBack/cakeApi/while.py b/cakeBack/cakeApi/while.py
deleted file mode 100644
index 6a35578..0000000
--- a/cakeBack/cakeApi/while.py
+++ /dev/null
@@ -1,91 +0,0 @@
-# i = 3
-
-# list_t = ['lol','kek','btw']
-
-# while i < 12:
-# # BLOCK
-# i += 1
-# print(i)
-# #BLOCK
-
-
-# string = 'BTW'
-# int = 1
-# float = 3.4
-
-
-# list_t = ['Lok', 'kek','btw']
-
-
-# list_t.append(Value) # Добавление: value может быть любым
-# print(list_t)
-
-# dict_t = {
-# 'Something': 'Jhon', # name - key, value - Jhon
-# 'Surname': 'Doe' # Surname - key, value - Doe
-# }
-
-# list_t = [
-# {
-# 'Name': 'Something'
-# },
-# {
-# 'Name': 'Else'
-# },
-# {
-# 'Name': 'Bob',
-# 'Surname': 'Something else',
-# }
-# ]
-
-# print(list_t[2]['Name'])
-
-# dict_t = {
-# 'Name': 'Arina',
-# }
-
-
-# #dict_t['Surname'] = 'Travlo' //// dictElement['Key'] = value /// Добавление к dict_t
-
-# print(dict_t)
-
-
-# tuple = (123, 321) # Tuple = List but not mutable
-
-# tuple[0] = 321
-
-# list = [1,2,3,5,8,1]
-
-
-# for i in list:
-# print(i) # i = list[i += 1]
-
-
-# def function(p, r): ## Вместое fUNCTION может быть всё что угодно
-# s = p * (r * r)
-# print(s)
-
-
-# ПЕРЕМЕННАЯ - ЭТО ССЫЛКА НА ПАМЯТЬ ГДЕ ХРАНЯТСЯ ДАННЫЕ ИЛИ ФУНКЦИИ , сама ПЕРЕМЕННАЯ НЕ ЯВЛЯЕТСЯ ДАННЫМИ ИЛИ ФУНКЦИЯМИ А ЛИШЬ ОТСЛЫАЕТ НА НИХ
-
-
-# def findAmper(war, var):
-# return war / var
-
-# amper = findAmper
-# b = findAmper
-# print(findAmper)
-# print(b)
-# a = amper(12312312, 7)
-# print(a)
-# # amper = findAmper(200, 14.1)
-
-# print(amper)
-
-# a = [1,2,3]
-# b = a
-
-
-# b[0] = 10000
-# print(a)
-#cart
\ No newline at end of file
diff --git a/cakeBack/cakeBack/__pycache__/__init__.cpython-311.pyc b/cakeBack/cakeBack/__pycache__/__init__.cpython-311.pyc
index f65f218..ac3cb94 100644
Binary files a/cakeBack/cakeBack/__pycache__/__init__.cpython-311.pyc and b/cakeBack/cakeBack/__pycache__/__init__.cpython-311.pyc differ
diff --git a/cakeBack/cakeBack/__pycache__/settings.cpython-311.pyc b/cakeBack/cakeBack/__pycache__/settings.cpython-311.pyc
index 1a8d3b0..6f13558 100644
Binary files a/cakeBack/cakeBack/__pycache__/settings.cpython-311.pyc and b/cakeBack/cakeBack/__pycache__/settings.cpython-311.pyc differ
diff --git a/cakeBack/cakeBack/__pycache__/urls.cpython-311.pyc b/cakeBack/cakeBack/__pycache__/urls.cpython-311.pyc
index 5846e37..68be63f 100644
Binary files a/cakeBack/cakeBack/__pycache__/urls.cpython-311.pyc and b/cakeBack/cakeBack/__pycache__/urls.cpython-311.pyc differ
diff --git a/cakeBack/cakeBack/__pycache__/wsgi.cpython-311.pyc b/cakeBack/cakeBack/__pycache__/wsgi.cpython-311.pyc
index 3c89945..fd4f0a2 100644
Binary files a/cakeBack/cakeBack/__pycache__/wsgi.cpython-311.pyc and b/cakeBack/cakeBack/__pycache__/wsgi.cpython-311.pyc differ
diff --git a/cakeBack/cakeBack/settings.py b/cakeBack/cakeBack/settings.py
index cc3e57a..ab057e7 100644
--- a/cakeBack/cakeBack/settings.py
+++ b/cakeBack/cakeBack/settings.py
@@ -10,6 +10,7 @@
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
+from datetime import timedelta
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -40,6 +41,8 @@
'cakeApi.apps.CakeapiConfig',
'rest_framework',
"corsheaders",
+ 'djoser',
+ 'rest_framework.authtoken',
]
@@ -130,5 +133,29 @@
CORS_ALLOWED_ORIGINS = [
- "http://localhost:5173"
-]
\ No newline at end of file
+ "http://localhost:5173",
+ "http://localhost:4173",
+ 'http://localhost:5174'
+]
+
+REST_FRAMEWORK = {
+ 'DEFAULT_AUTHENTICATION_CLASSES': [
+ 'rest_framework_simplejwt.authentication.JWTAuthentication',
+ ]
+
+}
+
+SIMPLE_JWT = {
+ "ACCESS_TOKEN_LIFETIME": timedelta(days=5),
+ "REFRESH_TOKEN_LIFETIME": timedelta(days=15),
+ }
+
+DJOSER = {
+ 'SERIALIZERS': {
+ 'user': 'cakeApi.serializers.SerializeUser',
+ 'current_user': 'cakeApi.serializers.SerializeCurrentUser',
+ 'user_create': 'cakeApi.serializers.SerializeCreateUser',
+ },
+}
+
+AUTH_USER_MODEL = 'cakeApi.User'
\ No newline at end of file
diff --git a/cakeBack/db.sqlite3 b/cakeBack/db.sqlite3
index 37a294e..de73e13 100644
Binary files a/cakeBack/db.sqlite3 and b/cakeBack/db.sqlite3 differ
diff --git a/cakeFront/.github/workflows/deploy.yml b/cakeFront/.github/workflows/deploy.yml
new file mode 100644
index 0000000..59983ce
--- /dev/null
+++ b/cakeFront/.github/workflows/deploy.yml
@@ -0,0 +1,51 @@
+name: Deploy
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ build:
+ name: Build
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v2
+
+ - name: Setup Node
+ uses: actions/setup-node@v1
+ with:
+ node-version: 16
+
+ - name: Install dependencies
+ uses: bahmutov/npm-install@v1
+
+ - name: Build project
+ run: npm run build
+
+ - name: Upload production-ready build files
+ uses: actions/upload-artifact@v2
+ with:
+ name: production-files
+ path: ./dist
+
+ deploy:
+ name: Deploy
+ needs: build
+ runs-on: ubuntu-latest
+ if: github.ref == 'refs/heads/main'
+
+ steps:
+ - name: Download artifact
+ uses: actions/download-artifact@v2
+ with:
+ name: production-files
+ path: ./dist
+
+ - name: Deploy to GitHub Pages
+ uses: peaceiris/actions-gh-pages@v3
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ publish_dir: ./dist
\ No newline at end of file
diff --git a/cakeFront/package-lock.json b/cakeFront/package-lock.json
index b9bb292..8dcdc09 100644
--- a/cakeFront/package-lock.json
+++ b/cakeFront/package-lock.json
@@ -9,12 +9,14 @@
"version": "0.0.0",
"dependencies": {
"firebase": "^10.3.0",
+ "framer-motion": "^10.16.5",
"localforage": "^1.10.0",
"match-sorter": "^6.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.15.0",
"sort-by": "^1.2.0",
+ "uuid": "^9.0.1",
"zustand": "^4.4.1"
},
"devDependencies": {
@@ -388,6 +390,21 @@
"node": ">=6.9.0"
}
},
+ "node_modules/@emotion/is-prop-valid": {
+ "version": "0.8.8",
+ "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz",
+ "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==",
+ "optional": true,
+ "dependencies": {
+ "@emotion/memoize": "0.7.4"
+ }
+ },
+ "node_modules/@emotion/memoize": {
+ "version": "0.7.4",
+ "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz",
+ "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==",
+ "optional": true
+ },
"node_modules/@esbuild/android-arm": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz",
@@ -2576,6 +2593,29 @@
"is-callable": "^1.1.3"
}
},
+ "node_modules/framer-motion": {
+ "version": "10.16.5",
+ "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-10.16.5.tgz",
+ "integrity": "sha512-GEzVjOYP2MIpV9bT/GbhcsBNoImG3/2X3O/xVNWmktkv9MdJ7P/44zELm/7Fjb+O3v39SmKFnoDQB32giThzpg==",
+ "dependencies": {
+ "tslib": "^2.4.0"
+ },
+ "optionalDependencies": {
+ "@emotion/is-prop-valid": "^0.8.2"
+ },
+ "peerDependencies": {
+ "react": "^18.0.0",
+ "react-dom": "^18.0.0"
+ },
+ "peerDependenciesMeta": {
+ "react": {
+ "optional": true
+ },
+ "react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -4442,6 +4482,18 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
},
+ "node_modules/uuid": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
+ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/vite": {
"version": "4.4.9",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz",
diff --git a/cakeFront/package.json b/cakeFront/package.json
index 73ac5c2..759a58b 100644
--- a/cakeFront/package.json
+++ b/cakeFront/package.json
@@ -11,12 +11,14 @@
},
"dependencies": {
"firebase": "^10.3.0",
+ "framer-motion": "^10.16.5",
"localforage": "^1.10.0",
"match-sorter": "^6.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.15.0",
"sort-by": "^1.2.0",
+ "uuid": "^9.0.1",
"zustand": "^4.4.1"
},
"devDependencies": {
diff --git a/cakeFront/public/Rectangle 8.png b/cakeFront/public/Rectangle 8.png
deleted file mode 100644
index de0dd1b..0000000
Binary files a/cakeFront/public/Rectangle 8.png and /dev/null differ
diff --git a/cakeFront/public/Union.png b/cakeFront/public/Union.png
new file mode 100644
index 0000000..c5ef93a
Binary files /dev/null and b/cakeFront/public/Union.png differ
diff --git a/cakeFront/public/fonts/DancingScript-VariableFont_wght.ttf b/cakeFront/public/fonts/DancingScript-VariableFont_wght.ttf
new file mode 100644
index 0000000..af175f9
Binary files /dev/null and b/cakeFront/public/fonts/DancingScript-VariableFont_wght.ttf differ
diff --git a/cakeFront/public/fonts/Inter-VariableFont_slnt,wght.ttf b/cakeFront/public/fonts/Inter-VariableFont_slnt,wght.ttf
new file mode 100644
index 0000000..e724708
Binary files /dev/null and b/cakeFront/public/fonts/Inter-VariableFont_slnt,wght.ttf differ
diff --git a/cakeFront/public/fonts/NanumMyeongjo-Bold.ttf b/cakeFront/public/fonts/NanumMyeongjo-Bold.ttf
new file mode 100644
index 0000000..25a49fc
Binary files /dev/null and b/cakeFront/public/fonts/NanumMyeongjo-Bold.ttf differ
diff --git a/cakeFront/public/fonts/NanumMyeongjo-ExtraBold.ttf b/cakeFront/public/fonts/NanumMyeongjo-ExtraBold.ttf
new file mode 100644
index 0000000..7f12278
Binary files /dev/null and b/cakeFront/public/fonts/NanumMyeongjo-ExtraBold.ttf differ
diff --git a/cakeFront/public/fonts/NanumMyeongjo-Regular.ttf b/cakeFront/public/fonts/NanumMyeongjo-Regular.ttf
new file mode 100644
index 0000000..2b26d8d
Binary files /dev/null and b/cakeFront/public/fonts/NanumMyeongjo-Regular.ttf differ
diff --git a/cakeFront/public/fonts/OFL.txt b/cakeFront/public/fonts/OFL.txt
new file mode 100644
index 0000000..07ff8df
--- /dev/null
+++ b/cakeFront/public/fonts/OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2016 The Dancing Script Project Authors (https://github.com/googlefonts/DancingScript), with Reserved Font Name 'Dancing Script'.
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/cakeFront/public/fonts/README.txt b/cakeFront/public/fonts/README.txt
new file mode 100644
index 0000000..1070a1c
--- /dev/null
+++ b/cakeFront/public/fonts/README.txt
@@ -0,0 +1,66 @@
+Dancing Script Variable Font
+============================
+
+This download contains Dancing Script as both a variable font and static fonts.
+
+Dancing Script is a variable font with this axis:
+ wght
+
+This means all the styles are contained in a single file:
+ DancingScript-VariableFont_wght.ttf
+
+If your app fully supports variable fonts, you can now pick intermediate styles
+that aren’t available as static fonts. Not all apps support variable fonts, and
+in those cases you can use the static font files for Dancing Script:
+ static/DancingScript-Regular.ttf
+ static/DancingScript-Medium.ttf
+ static/DancingScript-SemiBold.ttf
+ static/DancingScript-Bold.ttf
+
+Get started
+-----------
+
+1. Install the font files you want to use
+
+2. Use your app's font picker to view the font family and all the
+available styles
+
+Learn more about variable fonts
+-------------------------------
+
+ https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
+ https://variablefonts.typenetwork.com
+ https://medium.com/variable-fonts
+
+In desktop apps
+
+ https://theblog.adobe.com/can-variable-fonts-illustrator-cc
+ https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
+
+Online
+
+ https://developers.google.com/fonts/docs/getting_started
+ https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
+ https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
+
+Installing fonts
+
+ MacOS: https://support.apple.com/en-us/HT201749
+ Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
+ Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
+
+Android Apps
+
+ https://developers.google.com/fonts/docs/android
+ https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
+
+License
+-------
+Please read the full license text (OFL.txt) to understand the permissions,
+restrictions and requirements for usage, redistribution, and modification.
+
+You can use them in your products & projects – print or digital,
+commercial or otherwise.
+
+This isn't legal advice, please consider consulting a lawyer and see the full
+license for all details.
diff --git a/cakeFront/public/fonts/static/DancingScript-Bold.ttf b/cakeFront/public/fonts/static/DancingScript-Bold.ttf
new file mode 100644
index 0000000..bd0a871
Binary files /dev/null and b/cakeFront/public/fonts/static/DancingScript-Bold.ttf differ
diff --git a/cakeFront/public/fonts/static/DancingScript-Medium.ttf b/cakeFront/public/fonts/static/DancingScript-Medium.ttf
new file mode 100644
index 0000000..748131f
Binary files /dev/null and b/cakeFront/public/fonts/static/DancingScript-Medium.ttf differ
diff --git a/cakeFront/public/fonts/static/DancingScript-Regular.ttf b/cakeFront/public/fonts/static/DancingScript-Regular.ttf
new file mode 100644
index 0000000..b6f096b
Binary files /dev/null and b/cakeFront/public/fonts/static/DancingScript-Regular.ttf differ
diff --git a/cakeFront/public/fonts/static/DancingScript-SemiBold.ttf b/cakeFront/public/fonts/static/DancingScript-SemiBold.ttf
new file mode 100644
index 0000000..497036f
Binary files /dev/null and b/cakeFront/public/fonts/static/DancingScript-SemiBold.ttf differ
diff --git a/cakeFront/public/fonts/static/Inter-Black.ttf b/cakeFront/public/fonts/static/Inter-Black.ttf
new file mode 100644
index 0000000..b27822b
Binary files /dev/null and b/cakeFront/public/fonts/static/Inter-Black.ttf differ
diff --git a/cakeFront/public/fonts/static/Inter-Bold.ttf b/cakeFront/public/fonts/static/Inter-Bold.ttf
new file mode 100644
index 0000000..fe23eeb
Binary files /dev/null and b/cakeFront/public/fonts/static/Inter-Bold.ttf differ
diff --git a/cakeFront/public/fonts/static/Inter-ExtraBold.ttf b/cakeFront/public/fonts/static/Inter-ExtraBold.ttf
new file mode 100644
index 0000000..874b1b0
Binary files /dev/null and b/cakeFront/public/fonts/static/Inter-ExtraBold.ttf differ
diff --git a/cakeFront/public/fonts/static/Inter-ExtraLight.ttf b/cakeFront/public/fonts/static/Inter-ExtraLight.ttf
new file mode 100644
index 0000000..c993e82
Binary files /dev/null and b/cakeFront/public/fonts/static/Inter-ExtraLight.ttf differ
diff --git a/cakeFront/public/fonts/static/Inter-Light.ttf b/cakeFront/public/fonts/static/Inter-Light.ttf
new file mode 100644
index 0000000..71188f5
Binary files /dev/null and b/cakeFront/public/fonts/static/Inter-Light.ttf differ
diff --git a/cakeFront/public/fonts/static/Inter-Medium.ttf b/cakeFront/public/fonts/static/Inter-Medium.ttf
new file mode 100644
index 0000000..a01f377
Binary files /dev/null and b/cakeFront/public/fonts/static/Inter-Medium.ttf differ
diff --git a/cakeFront/public/fonts/static/Inter-Regular.ttf b/cakeFront/public/fonts/static/Inter-Regular.ttf
new file mode 100644
index 0000000..5e4851f
Binary files /dev/null and b/cakeFront/public/fonts/static/Inter-Regular.ttf differ
diff --git a/cakeFront/public/fonts/static/Inter-SemiBold.ttf b/cakeFront/public/fonts/static/Inter-SemiBold.ttf
new file mode 100644
index 0000000..ecc7041
Binary files /dev/null and b/cakeFront/public/fonts/static/Inter-SemiBold.ttf differ
diff --git a/cakeFront/public/fonts/static/Inter-Thin.ttf b/cakeFront/public/fonts/static/Inter-Thin.ttf
new file mode 100644
index 0000000..fe77243
Binary files /dev/null and b/cakeFront/public/fonts/static/Inter-Thin.ttf differ
diff --git a/cakeFront/public/line.png b/cakeFront/public/line.png
new file mode 100644
index 0000000..0fd78f1
Binary files /dev/null and b/cakeFront/public/line.png differ
diff --git a/cakeFront/public/loader.png b/cakeFront/public/loader.png
new file mode 100644
index 0000000..d265d93
Binary files /dev/null and b/cakeFront/public/loader.png differ
diff --git a/cakeFront/public/logimg.png b/cakeFront/public/logimg.png
new file mode 100644
index 0000000..b6324ef
Binary files /dev/null and b/cakeFront/public/logimg.png differ
diff --git a/cakeFront/public/regimg.png b/cakeFront/public/regimg.png
new file mode 100644
index 0000000..e6fe173
Binary files /dev/null and b/cakeFront/public/regimg.png differ
diff --git a/cakeFront/public/remove.png b/cakeFront/public/remove.png
new file mode 100644
index 0000000..5f7efad
Binary files /dev/null and b/cakeFront/public/remove.png differ
diff --git a/cakeFront/public/upload.png b/cakeFront/public/upload.png
new file mode 100644
index 0000000..fc282d6
Binary files /dev/null and b/cakeFront/public/upload.png differ
diff --git a/cakeFront/src/App.jsx b/cakeFront/src/App.jsx
index ac666fc..9040c90 100644
--- a/cakeFront/src/App.jsx
+++ b/cakeFront/src/App.jsx
@@ -1,28 +1,61 @@
import {Routes, Route} from 'react-router-dom'
+import { useEffect } from 'react'
-import Home from './pages/Home'
-import About from './pages/About'
-import Catalog from './pages/Catalog'
-import Delivery from './pages/Delivery'
-import Contact from './pages/Contact'
+import HomePage from './pages/Home'
+import AboutPage from './pages/About'
+import CatalogPage from './pages/Catalog'
+import DeliveryPage from './pages/Delivery'
+import LogInLogOutPage from './pages/logInPage'
import ItemsWrapper from './sections/catalogItemsWrapper'
+import ItemPage from './pages/itemPage'
+
+
+import OrderPage from './pages/Order'
+import UserOrders from './pages/userOrders'
+import OrderWrapper from './components/orderWrapper'
+
+
+
+
+import '/src/styles/default.css'
+import '/src/styles/texts.css'
+import '/src/styles/fonts.css'
+
+
import Layout from './pages/layout'
+
function App() {
+ useEffect(() => {
+ const isNull = localStorage.getItem('bigItems')
+ if(isNull == null){
+ localStorage.setItem('bigItems', '[]')
+ window.location.reload();
+ }
+ }),[]
+
return (
<>
- } >
- } >
- } >
- } >
- } >
- }>
+ } >
+ }>
+ } >
+ } >
+ } >
+ }>
+ }>
+
+
+ }>
+ } >
+ } >
+ }>
+ }>
+ }>
- }>
>
diff --git a/cakeFront/src/components/ChooseUsItem.jsx b/cakeFront/src/components/ChooseUsItem.jsx
index dd42228..219d0cf 100644
--- a/cakeFront/src/components/ChooseUsItem.jsx
+++ b/cakeFront/src/components/ChooseUsItem.jsx
@@ -1,4 +1,5 @@
-import '../styles/ChooseUsItem.css'
+
+import '/src/styles/chooseUsItem.css'
function ChooseUsItem (props) {
return (
diff --git a/cakeFront/src/components/addButton.jsx b/cakeFront/src/components/addButton.jsx
new file mode 100644
index 0000000..d9d192b
--- /dev/null
+++ b/cakeFront/src/components/addButton.jsx
@@ -0,0 +1,9 @@
+
+function AddButton(props) {
+
+ return (
+ {props.func(props.fullItem)}}>
+ )
+}
+
+export default AddButton
\ No newline at end of file
diff --git a/cakeFront/src/components/attention.jsx b/cakeFront/src/components/attention.jsx
new file mode 100644
index 0000000..ceedb2e
--- /dev/null
+++ b/cakeFront/src/components/attention.jsx
@@ -0,0 +1,51 @@
+import { userAction } from '../store'
+import { motion, AnimatePresence } from 'framer-motion'
+
+import '/src/styles/attention.css'
+import { useEffect } from 'react'
+
+function Attention (props) {
+
+ const deleteObject = userAction((state) => state.deleteObject)
+ const isAction = userAction((state) => state.isAction)
+
+ return (
+
+
+
+
+
Delete category
+
Hi
+
U`ll delete all items that connected to this category, are u sure?
+
+ Decline
+ (deleteObject(props.id, "category", props.img, props.setFuncShow))}>Delete
+
+
+
+
+ )
+}
+
+export default Attention
+
+
+// import { userAction } from '../store'
+
+// import '/src/styles/attention.css'
+
+// function Attention (props) {
+
+// const deleteObject = userAction((state) => state.deleteObject)
+
+// return (
+//
+//
+//
{props.message}
+// (deleteObject(props.id, "category", props.img))}>Delete! Decline!
+//
+//
+// )
+// }
+
+// export default Attention
\ No newline at end of file
diff --git a/cakeFront/src/components/bestsellerLine.jsx b/cakeFront/src/components/bestsellerLine.jsx
index 71faabc..904a663 100644
--- a/cakeFront/src/components/bestsellerLine.jsx
+++ b/cakeFront/src/components/bestsellerLine.jsx
@@ -1,4 +1,5 @@
-import '../styles/bestsellerLine.css'
+
+import '/src/styles/bestsellerLine.css'
function BestsellerLine() {
return (
diff --git a/cakeFront/src/components/carouselBlock.jsx b/cakeFront/src/components/carouselBlock.jsx
new file mode 100644
index 0000000..a5788b6
--- /dev/null
+++ b/cakeFront/src/components/carouselBlock.jsx
@@ -0,0 +1,32 @@
+import { useEffect, useState } from "react"
+
+import { tools } from "../store"
+
+
+function Carousel (props) {
+
+ const incrementPage = tools((state) => state.incrementPage)
+ const decrimentPage = tools((state) => state.decrimentPage)
+ const fixWrongPage = tools((state) => state.fixWrongPage)
+
+ useEffect(() => {
+ fixWrongPage(props.page, props.setPage)
+ }, [props.status])
+
+ return (
+
+
+ decrimentPage(props.page, props.setPage)} className="decriment-btn carousel-btn">
+ «
+
+ <>{props.page}>
+ incrementPage(props.page, props.setPage)} className="increment-btn carousel-btn">
+ »
+
+
+
+ )
+
+}
+
+export default Carousel
\ No newline at end of file
diff --git a/cakeFront/src/components/categoryItem.jsx b/cakeFront/src/components/categoryItem.jsx
index 673e2e0..e795f4d 100644
--- a/cakeFront/src/components/categoryItem.jsx
+++ b/cakeFront/src/components/categoryItem.jsx
@@ -1,20 +1,33 @@
import { Link } from 'react-router-dom'
+import { useState } from 'react'
-import '../styles/default.css'
-import '../styles/categoryItem.css'
+import { userAction } from '../store'
+
+import Attention from '../components/attention.jsx'
+
+
+
+import '/src/styles/categoryItem.css'
function CategoryItem(props) {
+
+ const [attention, setAttention] = useState(false)
+
+ const isAdmin = userAction((state) => state.isAdmin)
+
+
return (
-
+
-
+
-
-
+
{props.title}
+ {isAdmin && <>
(setAttention(!attention))}>Delete >}
+ {attention &&<>
(setAttention(!attention))} setFuncShow={setAttention} id={props.id} img={props.img} message={"If u`ll click you also delete all items that connected to this category! Are u sure?"} />>}
)
diff --git a/cakeFront/src/components/deleteButton.jsx b/cakeFront/src/components/deleteButton.jsx
new file mode 100644
index 0000000..f2866cd
--- /dev/null
+++ b/cakeFront/src/components/deleteButton.jsx
@@ -0,0 +1,18 @@
+
+import { useEffect } from 'react'
+import { cart } from '../store'
+
+
+import '/src/styles/deleteButton.css'
+
+function DeleteButton (props) {
+
+ const deleteItemInCart = cart((state) => state.deleteItemInCart)
+
+
+ return (
+
(deleteItemInCart(props.name))}>Delete
+ )
+}
+
+export default DeleteButton
\ No newline at end of file
diff --git a/cakeFront/src/components/isLoading.jsx b/cakeFront/src/components/isLoading.jsx
new file mode 100644
index 0000000..f47e0c3
--- /dev/null
+++ b/cakeFront/src/components/isLoading.jsx
@@ -0,0 +1,14 @@
+
+import '/src/styles/isLoading.css'
+
+import { motion } from 'framer-motion'
+
+function IsLoading () {
+ return (
+
+
+
+ )
+}
+
+export default IsLoading
\ No newline at end of file
diff --git a/cakeFront/src/components/itemInCart.jsx b/cakeFront/src/components/itemInCart.jsx
new file mode 100644
index 0000000..446bc00
--- /dev/null
+++ b/cakeFront/src/components/itemInCart.jsx
@@ -0,0 +1,57 @@
+import { useEffect, useState } from "react"
+import { cart } from "../store"
+
+import AddButton from "./addButton"
+import DeleteButton from "./deleteButton"
+
+
+
+
+
+
+function ItemInCart(props) {
+
+ const [amount, setAmount] = useState(props.amount)
+
+ const addItemIntoCart = cart((state) => state.addItemIntoCart)
+ const changeAmountOfItem = cart((state) => state.changeAmountOfItem)
+ const setLocalItemsData = cart((state) => state.setLocalItemsData)
+ const deleteItemInCart = cart((state) => state.deleteItemInCart)
+ const restrictions = cart((state) => state.restrictions)
+ const totalPrice = cart((state) => state.totalPrice)
+
+
+
+ useEffect(() => {
+ changeAmountOfItem(props.name, amount, "change")
+ const parsedLocalData = JSON.parse(localStorage.getItem("bigItems"))
+ setLocalItemsData(parsedLocalData)
+ console.log(parsedLocalData)
+ }, [amount])
+
+ return (
+ <>
+
+
+
(deleteItemInCart(props.name))}>
+
+
+
+
+
Name: {props.name}
+
Amount: {props.amount}
+
Price for a unite: {props.price}$
+
+
+
+
{changeAmountOfItem(props.name, amount, "decriment"),setAmount(parseInt(props.amount - 1))}}>
+
(setAmount(parseInt(e.target.value)))}/>
+
+
+
+
+ >
+ )
+}
+
+export default ItemInCart
\ No newline at end of file
diff --git a/cakeFront/src/components/itemInOrderList.jsx b/cakeFront/src/components/itemInOrderList.jsx
new file mode 100644
index 0000000..5ea1250
--- /dev/null
+++ b/cakeFront/src/components/itemInOrderList.jsx
@@ -0,0 +1,25 @@
+
+
+
+function ItemInOrderList(props) {
+
+ const total = props.amount * props.priceOfItem
+
+ return (
+
+
+
+
+
+
Name: {props.nameOfItem}
+ Amount:
{props.amount}
+
+
Price for per: {props.priceOfItem}$
+ total price
{total.toFixed(2)}$
+
+
+
+ )
+}
+
+export default ItemInOrderList
\ No newline at end of file
diff --git a/cakeFront/src/components/linkButton.jsx b/cakeFront/src/components/linkButton.jsx
index aa447d8..430f21c 100644
--- a/cakeFront/src/components/linkButton.jsx
+++ b/cakeFront/src/components/linkButton.jsx
@@ -1,7 +1,7 @@
-import '../styles/componentsLinkButton.css'
import {Link} from 'react-router-dom'
+import '/src/styles/componentsLinkButton.css'
function LinkButton (props) {
return (
diff --git a/cakeFront/src/components/loginForm.jsx b/cakeFront/src/components/loginForm.jsx
new file mode 100644
index 0000000..f83e28e
--- /dev/null
+++ b/cakeFront/src/components/loginForm.jsx
@@ -0,0 +1,37 @@
+
+import { motion } from "framer-motion"
+import { useState } from "react"
+import { userAction } from '../store'
+
+function LoginForm (props) {
+
+
+ const [userFirstName, setUserFirstName] = useState('')
+ const [userPassword, setUserPassword] = useState('')
+
+ const sign = userAction((state) => state.sign)
+
+ return (
+
+
+
+
<>Login>
+
Don`t have an account? (props.setSignIn(!props.signIn))} className='create-account-text'>Create now ! it takes less than a minute
+
+
+
(sign(userFirstName, userPassword, '','','', 'in'))} className='register-btn'>Login
+
+
+ )
+}
+
+export default LoginForm
\ No newline at end of file
diff --git a/cakeFront/src/components/orderPreview.jsx b/cakeFront/src/components/orderPreview.jsx
new file mode 100644
index 0000000..5296c0d
--- /dev/null
+++ b/cakeFront/src/components/orderPreview.jsx
@@ -0,0 +1,44 @@
+import { useState } from 'react'
+import {Link,} from 'react-router-dom'
+
+import { userAction, fetchOrders } from '../store'
+
+
+
+function OrderPreview(props) {
+
+ const [status, setStatus] = useState('Waiting for customer')
+
+ const isAdmin = userAction((state) => state.isAdmin)
+ const updateOrderStatus = fetchOrders((state) => state.updateOrderStatus)
+
+ return (
+ <>
+
+
+
+
+
+ Id of order: {props.id}
+
+
+
+
status: {props.status}
+
+ {isAdmin &&
+ <>
+ (setStatus(e.target.value))}>
+ Status: Waiting for customer
+ Status: working at order
+ Status: Decliened
+
+ (updateOrderStatus(props.id, status))}>Update
+ >}
+
+
+
+ >
+ )
+}
+
+export default OrderPreview
\ No newline at end of file
diff --git a/cakeFront/src/components/orderWrapper.jsx b/cakeFront/src/components/orderWrapper.jsx
new file mode 100644
index 0000000..fd116e1
--- /dev/null
+++ b/cakeFront/src/components/orderWrapper.jsx
@@ -0,0 +1,65 @@
+import { useParams } from "react-router-dom"
+import { useEffect } from "react"
+
+import ItemInOrderList from "./itemInOrderList"
+
+import { fetchOrders } from "../store"
+
+
+
+
+function OrderWrapper(props) {
+
+ const {id} = useParams()
+
+ const fetchNeededOrders = fetchOrders((state) => state.fetchNeededOrders)
+
+ const items = fetchOrders((state) => state.items)
+ const user = fetchOrders((state) => state.user)
+ const workStatus = fetchOrders((state) => state.workStatus)
+ const totalPrice = fetchOrders((state) => state.totalPrice)
+ const amountOfItems = fetchOrders((state) => state.amountOfItems)
+
+ useEffect(() => {
+ fetchNeededOrders(id, false)
+ },[])
+
+ return (
+ <>
+
+
+
+
+
User data
+
+
+
User id: {user['pk']}
+
Phone number: {user['phoneNumber']}
+
First name: {user['first_name']}
+
Last name: {user['last_name']}
+
Email: {user['email']}
+
+
+
+ Order status: {workStatus}
+
+
+ When ordered: 03.10.2023, 20:31
+
+
+
General Information
+
Total price: {totalPrice.toFixed(2)}$
+
Amount of items: {amountOfItems}
+
+
+
+ {items.map((item) => (
+
+ ))}
+
+
+ >
+ )
+}
+
+export default OrderWrapper
\ No newline at end of file
diff --git a/cakeFront/src/components/productItemShowcase.jsx b/cakeFront/src/components/productItemShowcase.jsx
index 5fdb5ce..a3505fd 100644
--- a/cakeFront/src/components/productItemShowcase.jsx
+++ b/cakeFront/src/components/productItemShowcase.jsx
@@ -1,47 +1,98 @@
import { useState } from 'react'
-import {Link} from 'react-router-dom'
-import '../styles/ProductItemShowcase.css'
import BestsellerLine from './bestsellerLine'
+import AddButton from "./addButton"
+import {Link} from 'react-router-dom'
+import UpdateProductShow from './updateProductShow'
+import { cart, userAction } from '../store'
+import IsLoading from './isLoading'
+
+
+
+import '/src/styles/productItemShowcase.css'
function ProductItem (props) {
const [infoBestseller, setInfoBestseller] = useState(false)
+ const [isUpdate, setIsUpdate] = useState(false)
+ const [price, setPrice] = useState(props.price)
+ const [name, setName] = useState(props.name)
+ const [bestseller, setBestseller] = useState(props.bestseller)
+ const [img, setImage] = useState(false)
+ // const [description, setDescription] = useState(props.description)
+ const addItemIntoCart = cart((state) => state.addItemIntoCart)
+ const isAdmin = userAction((state) => state.isAdmin)
+ const deleteObject = userAction((state) => state.deleteObject)
+ const updateObject = userAction((state) => state.updateObject)
+ const isLoading = userAction((state) => state.isLoading)
+
+ async function handleUpdateObject() {
+ await updateObject(props.id, "product",price,name,bestseller,img, props.img,'da',props.category)
+ setIsUpdate(!isUpdate)
+ }
+ async function handleDeleteObject() {
+ await deleteObject(props.id, "product", props.img)
+ }
function handleOnMouseUp() {
setInfoBestseller(!infoBestseller)
}
-
function handleOnMouseDown() {
setInfoBestseller(!infoBestseller)
}
+ function handleImage(e) {
+ if(e.target.files[0]){
+ setImage(e.target.files[0])
+ }
+ }
+
return (
+ {isLoading &&
}
-
{props.bestseller &&
}{infoBestseller &&
}
-
+ {isUpdate || <>
{props.bestseller &&
}{infoBestseller &&
}
>}
+ {isUpdate || <>
>}
+ {isUpdate &&
+
+ }
- {props.name}
+ {isUpdate || <>{props.name}>}
- {props.price} $
+ {isUpdate || <>{props.price} $ >}
-
+ {isUpdate ||
}
+ {isUpdate ||
+ <>
+ {isAdmin &&
+
+ {handleDeleteObject()}} className='logout-btn'>Delete
+ (setIsUpdate(!isUpdate))}>Update
+
}
+ >}
+ {isUpdate &&
+ (handleUpdateObject())} className='logout-btn'>Commit
+ (setIsUpdate(!isUpdate))} >Deciline
+
}
)
}
-export default ProductItem
\ No newline at end of file
+export default ProductItem
+
+//
+
+ //
\ No newline at end of file
diff --git a/cakeFront/src/components/registrationForm.jsx b/cakeFront/src/components/registrationForm.jsx
new file mode 100644
index 0000000..2177bd1
--- /dev/null
+++ b/cakeFront/src/components/registrationForm.jsx
@@ -0,0 +1,60 @@
+import { motion } from "framer-motion"
+import { useState } from "react"
+import { userAction } from '../store'
+
+
+function RegistrationForm (props) {
+ const [userFirstName, setUserFirstName] = useState('')
+ const [userPassword, setUserPassword] = useState('')
+ const [userEmail, setUserEmail] = useState('')
+ const [userLastName, setUserLastName] = useState('')
+ const [userPhoneNumber, setUserphoneNumber] = useState('')
+ const sign = userAction((state) => state.sign)
+
+async function handleRegistration() {
+ await sign(userFirstName, userPassword, userLastName, userPhoneNumber, userEmail,'up')
+ setUserEmail('')
+ setUserPassword('')
+ setUserLastName('')
+ setUserFirstName('')
+ setUserphoneNumber('')
+}
+
+ return (
+
+
+
+
+
<>Registration>
+
Already have account? (props.setSignIn(!props.signIn))} className='create-account-text'>Enter now !
+
+
+
(handleRegistration())}>Registration
+
+
+
+ )
+}
+
+export default RegistrationForm
\ No newline at end of file
diff --git a/cakeFront/src/components/updateProductShow.jsx b/cakeFront/src/components/updateProductShow.jsx
new file mode 100644
index 0000000..ce92577
--- /dev/null
+++ b/cakeFront/src/components/updateProductShow.jsx
@@ -0,0 +1,30 @@
+
+
+function UpdateProductShow(props) {
+ return (
+
+ )
+}
+
+export default UpdateProductShow
\ No newline at end of file
diff --git a/cakeFront/src/firebase.js b/cakeFront/src/firebase.js
new file mode 100644
index 0000000..1508bd3
--- /dev/null
+++ b/cakeFront/src/firebase.js
@@ -0,0 +1,15 @@
+import { initializeApp } from "firebase/app";
+import { getStorage } from "firebase/storage";
+
+const firebaseConfig = {
+ apiKey: "AIzaSyBjQzkpWSXtu0wRxf1pxsugGYLksMMrF2s",
+ authDomain: "cake-shop-2c6c5.firebaseapp.com",
+ projectId: "cake-shop-2c6c5",
+ storageBucket: "cake-shop-2c6c5.appspot.com",
+ messagingSenderId: "570706637861",
+ appId: "1:570706637861:web:7d9b2788f3414e9c24fbcc"
+};
+
+
+const app = initializeApp(firebaseConfig);
+export const storage = getStorage(app)
\ No newline at end of file
diff --git a/cakeFront/src/pages/About.jsx b/cakeFront/src/pages/About.jsx
index 8b72972..d0f4da1 100644
--- a/cakeFront/src/pages/About.jsx
+++ b/cakeFront/src/pages/About.jsx
@@ -1,7 +1,7 @@
-function About () {
+function AboutPage () {
return (
About
)
}
-export default About
\ No newline at end of file
+export default AboutPage
\ No newline at end of file
diff --git a/cakeFront/src/pages/Catalog.jsx b/cakeFront/src/pages/Catalog.jsx
index acc9509..a1f2f04 100644
--- a/cakeFront/src/pages/Catalog.jsx
+++ b/cakeFront/src/pages/Catalog.jsx
@@ -1,6 +1,9 @@
import CategoriesWrapper from "../sections/catalogCategoryWrapper"
-function Catalog () {
+import '/src/styles/catalogCategoryWrapper.css'
+import '/src/styles/catalogItemsWrapper.css'
+
+function CatalogPage () {
return (
<>
@@ -8,4 +11,4 @@ function Catalog () {
)
}
-export default Catalog
\ No newline at end of file
+export default CatalogPage
\ No newline at end of file
diff --git a/cakeFront/src/pages/Contact.jsx b/cakeFront/src/pages/Contact.jsx
deleted file mode 100644
index a86d070..0000000
--- a/cakeFront/src/pages/Contact.jsx
+++ /dev/null
@@ -1,8 +0,0 @@
-
-function Contact() {
- return (
-
Contact
- )
-}
-
-export default Contact
\ No newline at end of file
diff --git a/cakeFront/src/pages/Delivery.jsx b/cakeFront/src/pages/Delivery.jsx
index 1221899..d19fab9 100644
--- a/cakeFront/src/pages/Delivery.jsx
+++ b/cakeFront/src/pages/Delivery.jsx
@@ -1,7 +1,7 @@
-function Delivery () {
+function DeliveryPage () {
return (
)
}
-export default Delivery
\ No newline at end of file
+export default DeliveryPage
\ No newline at end of file
diff --git a/cakeFront/src/pages/Home.jsx b/cakeFront/src/pages/Home.jsx
index c65c6c4..6142f8c 100644
--- a/cakeFront/src/pages/Home.jsx
+++ b/cakeFront/src/pages/Home.jsx
@@ -1,6 +1,3 @@
-import '../styles/default.css'
-import '../styles/texts.css'
-
import HomeOpenSection from "../sections/homeOpenSection"
import HomeAboutUsSection from "../sections/homeAboutUsSection"
import HomeChooseUsSection from "../sections/homeChooseUsSection"
@@ -9,8 +6,20 @@ import HomeCommentsSection from "../sections/homeCommentsSection"
import HomeBestsellerSection from "../sections/homeBestsellerSection"
import HomeIndividualOrderSection from '../sections/homeIndividualOrderSection'
+import '/src/styles/homeAboutUsSection.css'
+import '/src/styles/homeBestsellerSection.css'
+import '/src/styles/homeCatalogSection.css'
+import '/src/styles/homeChooseUsSection.css'
+import '/src/styles/homeCommentsSection.css'
+import '/src/styles/homeIndividualOrderSection.css'
+import '/src/styles/homeOpenSection.css'
+
+
+
+function HomePage () {
+
+
-function Home () {
return (
<>
@@ -24,4 +33,4 @@ function Home () {
)
}
-export default Home
\ No newline at end of file
+export default HomePage
\ No newline at end of file
diff --git a/cakeFront/src/pages/Order.jsx b/cakeFront/src/pages/Order.jsx
new file mode 100644
index 0000000..514037c
--- /dev/null
+++ b/cakeFront/src/pages/Order.jsx
@@ -0,0 +1,25 @@
+import {userAction} from '../store'
+
+import OrderWrapperPreview from "../sections/orderWrapperPreview"
+
+import '/src/styles/orderPreview.css'
+import '/src/styles/orderWrapper.css'
+import '/src/styles/adminOrdersPage.css'
+
+
+function OrderPage () {
+
+ const isAdmin = userAction((state) => state.isAdmin)
+
+ return (
+ <>
+ {isAdmin &&
}
+ {isAdmin ||
U don`t have acsess }
+ >
+
+
+ )
+
+}
+
+export default OrderPage
\ No newline at end of file
diff --git a/cakeFront/src/pages/cart.jsx b/cakeFront/src/pages/cart.jsx
new file mode 100644
index 0000000..6db00c2
--- /dev/null
+++ b/cakeFront/src/pages/cart.jsx
@@ -0,0 +1,51 @@
+import { cart,fetchOrders } from "../store"
+
+import ItemInCart from "../components/itemInCart"
+
+import '/src/styles/cart.css'
+import '/src/styles/itemInCart.css'
+import '/src/styles/itemInOrderList.css'
+
+
+function Cart () {
+
+ const toggleShowCart = cart((state) => state.toggleShowCart)
+ const Amount = cart((state) => state.Amount)
+ const totalPrice = cart((state) => state.totalPrice)
+ const restrictions = cart((state) => state.restrictions)
+ const items = cart((state) => state.items)
+
+ const createNewOrder = fetchOrders((state) => state.createNewOrder)
+ const raiseError = fetchOrders((state) => state.raiseError)
+ const isCreate = fetchOrders((state) => state.isCreate)
+
+ return (
+ <>
+
{toggleShowCart()}}>
+
(e.stopPropagation())} >
+
+
Cart
+
+
+ {items.map((item) => (
+
+ ))}
+
+
+
+ Total price {totalPrice.toFixed(2)}$
+
+
(createNewOrder(items))}>
+ ORDER
+
+
+ Total amount {Amount}
+
+
+
+
+ >
+ )
+}
+
+export default Cart
\ No newline at end of file
diff --git a/cakeFront/src/pages/itemPage.jsx b/cakeFront/src/pages/itemPage.jsx
new file mode 100644
index 0000000..d4d5978
--- /dev/null
+++ b/cakeFront/src/pages/itemPage.jsx
@@ -0,0 +1,49 @@
+
+import '/src/styles/itemPage.css'
+
+import { productItemFetch,cart } from '../store'
+
+import { useParams } from 'react-router-dom'
+import { useEffect } from 'react'
+
+function ItemPage() {
+
+ const fetchNeededItem = productItemFetch((state) => state.fetchNeededItem)
+ const neededItem = productItemFetch((state) => state.neededItem)
+ const addItemIntoCart = cart((state) => state.addItemIntoCart)
+ const {item} = useParams()
+
+ useEffect(() => {
+ fetchNeededItem(item)
+ },[])
+
+ return (
+
+
+
+
+
+
+
+
+
+ {neededItem.nameOfItem}
+
+
+ {neededItem.priceOfItem}$
+
+
+ Bestseller: {neededItem.BestsellerItem && <>Yes> || <>No> }
+
+
+ (addItemIntoCart(neededItem))} type='button'>ADD TO CART
+
+
+
+ {neededItem.descriptionOfItem}
+
+
+ )
+}
+
+export default ItemPage
\ No newline at end of file
diff --git a/cakeFront/src/pages/layout.jsx b/cakeFront/src/pages/layout.jsx
index 1478c3f..a5f9094 100644
--- a/cakeFront/src/pages/layout.jsx
+++ b/cakeFront/src/pages/layout.jsx
@@ -1,13 +1,35 @@
import {Outlet} from 'react-router-dom'
+import { useEffect } from 'react'
+import { cart, userAction } from '../store'
import Header from '../sections/layoutHeaderSection'
import Footer from '../sections/layoutFooterSection'
+import Cart from "./cart"
+
+import '../styles/layoutFooterSection.css'
+import '/src/styles/layoutheaderSection.css'
+import '/src/styles/layoutStyles.css'
+
+
+
+
+
+
function Layout() {
+ const userAuth = userAction((state) => state.userAuth)
+ const showCart = cart((state) => state.showCart)
+ useEffect(() => {
+ userAuth()
+ },[])
+
return (
<>
+ {showCart &&
}
-
+
+
+
>
)
diff --git a/cakeFront/src/pages/logInPage.jsx b/cakeFront/src/pages/logInPage.jsx
new file mode 100644
index 0000000..50766c4
--- /dev/null
+++ b/cakeFront/src/pages/logInPage.jsx
@@ -0,0 +1,55 @@
+import { useEffect, useState } from 'react'
+import { userAction } from '../store'
+
+import { motion } from 'framer-motion'
+import RegistrationForm from '../components/registrationForm'
+import LoginForm from '../components/loginForm'
+import IsLoading from '../components/isLoading'
+
+import '/src/styles/logInLogOutPage.css'
+
+function LogInLogOutPage() {
+ const [signIn, setSignIn] = useState(false)
+
+
+ const isLogged = userAction((state) => state.isLogged)
+ const isAdmin = userAction((state) => state.isAdmin)
+ const logOut = userAction((state) => state.logOut)
+ const isLoading = userAction((state) => state.isLoading)
+ const isCreated = userAction((state) => state.isCreated)
+
+ useEffect(() => {
+ if(isCreated === true) {
+ setSignIn(!signIn)
+ }
+ },[isCreated])
+
+ if(isLogged){
+ return (
+
+
Logout
+
Hi {isAdmin && 'U are admin!'}
+
Are you sure you want to log out from account?
+
(logOut())}>Logout
+
)
+ }
+
+ return (
+
+ {isLoading &&
}
+
{signIn || }
+
{signIn && }
+ {signIn || <>
+
+
+
+ >}
+ {signIn && <>
+
+
+
+ >}
+
+ )
+}
+export default LogInLogOutPage
\ No newline at end of file
diff --git a/cakeFront/src/pages/userOrders.jsx b/cakeFront/src/pages/userOrders.jsx
new file mode 100644
index 0000000..b61ba81
--- /dev/null
+++ b/cakeFront/src/pages/userOrders.jsx
@@ -0,0 +1,14 @@
+import OrderWrapperPreview from "../sections/orderWrapperPreview"
+
+
+
+
+function UserOrders() {
+ return (
+ <>
+
+ >
+ )
+}
+
+export default UserOrders
\ No newline at end of file
diff --git a/cakeFront/src/sections/catalogCategoryWrapper.jsx b/cakeFront/src/sections/catalogCategoryWrapper.jsx
index ec07485..a0170fd 100644
--- a/cakeFront/src/sections/catalogCategoryWrapper.jsx
+++ b/cakeFront/src/sections/catalogCategoryWrapper.jsx
@@ -1,19 +1,29 @@
import { useEffect, useState } from 'react'
+import Carousel from '../components/carouselBlock'
-import {categoryItemFetch, tools} from '../store'
-import '../styles/catalogCategoryWrapper.css'
+import {categoryItemFetch, tools, userAction} from '../store'
+import IsLoading from '../components/isLoading'
import CategoryItem from "../components/categoryItem"
+
+
function CategoriesWrapper () {
- const [page, setPage] = useState(1)
+ const isAdmin = userAction(state => (state.isAdmin))
- const incrementPage = tools(state => (state.incrementPage))
- const decrimentPage = tools (state => (state.decrimentPage))
+ const [name, setName] = useState('')
+ const [image, setImage] = useState('')
+
+ const [page, setPage] = useState(1)
+ const [isCreating, setIsCreating] = useState(true)
+
const fixWrongPage = tools(state => (state.fixWrongPage))
const categoryItems = categoryItemFetch(state => (state.categoryItems))
+ const createObject = userAction(state => (state.createObject))
+ const isLoading = userAction(state => (state.isLoading))
+ const isAction = userAction((state) => state.isAction)
const loading = categoryItemFetch(state => (state.loading))
const status = categoryItemFetch(state => (state.status))
const fetchCategoryItems = categoryItemFetch((state) => state.fetchCategoryItems)
@@ -26,25 +36,58 @@ function CategoriesWrapper () {
fixWrongPage(page, setPage)
},[status])
+ function imageHandler(e) {
+ if(e.target.files[0]){
+ setImage(e.target.files[0])
+ }
+ }
+
+ useEffect(() => {
+ fetchCategoryItems(page)
+ if(isCreating === true) {
+ setIsCreating(!isCreating)
+ }
+ },[isAction])
+
return (
<>
-
-
-
+ {isAdmin &&
(setIsCreating(!isCreating))}>Create new
}
+ {isLoading &&
}
+ {isCreating ||
+ <>
+
{loading || categoryItems.map((categoryItem) => (
-
+
))}
+
+ <>
+
+ >
+ >}
+ {isCreating &&
+ <>
+ {isLoading &&
}
+
+
+
+
+ (setName(e.target.value))} placeholder='Name' />
+
+
+
+ (setIsCreating(!isCreating))}>Decline
+ (createObject("category",name, image))}>Create
+
-
-
- decrimentPage(page, setPage)} className="decriment-btn carousel-btn">
- «
-
- incrementPage(page, setPage)} className="increment-btn carousel-btn">
- »
-
-
-
+ >}
>
)
@@ -55,3 +98,5 @@ export default CategoriesWrapper
+
+
diff --git a/cakeFront/src/sections/catalogItemsWrapper.jsx b/cakeFront/src/sections/catalogItemsWrapper.jsx
index 2fc64a3..a8a76dd 100644
--- a/cakeFront/src/sections/catalogItemsWrapper.jsx
+++ b/cakeFront/src/sections/catalogItemsWrapper.jsx
@@ -1,16 +1,33 @@
import { useEffect, useState } from 'react'
+import Carousel from '../components/carouselBlock'
-import {productItemFetch, tools} from '../store'
-import '../styles/catalogItemsWrapper.css'
+import {productItemFetch, userAction} from '../store'
import ProductItem from '../components/productItemShowcase'
+import { useParams } from 'react-router-dom'
+import IsLoading from '../components/isLoading.jsx'
+
+
function itemsWrapper () {
+
+ const [name, setName] = useState('')
+ const [price, setPrice] = useState('')
+ const [bestseller, setBestseller] = useState('')
+ const [image, setImage] = useState('')
+ const [about, setAbout] = useState('')
+
+ function imageHandle(e) {
+ if(e.target.files[0]){
+ setImage(e.target.files[0])
+ }
+ }
- const incrementPage = tools((state) => state.incrementPage)
- const decrimentPage = tools((state) => state.decrimentPage)
- const fixWrongPage = tools((state) => state.fixWrongPage)
+
+ const {category} = useParams();
+ const [isCreating, setIsCreating] = useState(false)
+
const findBiggestPrice = productItemFetch((state) => state.findBiggestPrice)
const biggestPrice = productItemFetch((state) => state.biggestPrice)
@@ -18,13 +35,18 @@ function itemsWrapper () {
const neededItems = productItemFetch((state) => state.neededItems)
const loaded = productItemFetch((state) => state.loaded)
const status = productItemFetch((state) => state.status)
+ const createObject = userAction((state) => state.createObject)
+ const isLogged = userAction((state) => state.isLogged)
+ const isLoading = userAction((state) => state.isLoading)
+ const [page, setPage] = useState(1)
const [lowHighFilter, setLowHighFilter] = useState('none')
const [bestsellerFilter, setBestsellerFilter] = useState(false)
- const [page, setPage] = useState(1)
- const [maxPrice, setMaxPrice] = useState(500)
+ const [maxPrice, setMaxPrice] = useState(biggestPrice)
const [minPrice, setMinPrice] = useState(0)
+ const isAction = userAction((state) => state.isAction)
+
function changeMaxPrice(e) {
setMaxPrice(e.target.value);
}
@@ -34,65 +56,114 @@ function itemsWrapper () {
}
useEffect( () => {
- findBiggestPrice()
+ findBiggestPrice(category)
}, [])
useEffect(()=> {
setMaxPrice(biggestPrice)
},[biggestPrice])
+ useEffect(() => {
+ if(isCreating === true){
+ setIsCreating(!isCreating)
+ }
+ },[isAction])
+
useEffect(() => {
const timer = setTimeout(() => {
- fetchNeededItems(bestsellerFilter, minPrice, maxPrice, page, lowHighFilter);
+ fetchNeededItems(bestsellerFilter, minPrice, maxPrice, page, lowHighFilter, category);
}, 200);
return () => clearTimeout(timer);
}, [minPrice, maxPrice, bestsellerFilter,lowHighFilter]);
+ async function createObjectHandle() {
+ await createObject('product',name,image,price,bestseller,about,category)
+ await fetchNeededItems(bestsellerFilter, minPrice, maxPrice, page, lowHighFilter, category);
+ }
+
useEffect(() => {
- console.log(lowHighFilter)
- fetchNeededItems(bestsellerFilter, minPrice, maxPrice, page, lowHighFilter )
+ fetchNeededItems(bestsellerFilter, minPrice, maxPrice, page, lowHighFilter,category )
}, [page])
useEffect(() => {
- fixWrongPage(page, setPage)
- },[status])
+ fetchNeededItems(bestsellerFilter, minPrice, maxPrice, page, lowHighFilter, category);
+ },[isAction])
return (
<>
+ {isLoading &&
}
+ {isCreating ||
+ <>
{loaded &&
-
- Min price: {minPrice}
- Max price: {maxPrice}
- {setBestsellerFilter(!bestsellerFilter)}} />
- {setLowHighFilter(e.target.value)}}>
- None
- Low to high
- High to low
-
- Start with
-
}
+
+
+
+
+ Bestseller {setBestsellerFilter(!bestsellerFilter)}}/>
+
+
+ {setLowHighFilter(e.target.value)}}>
+ None
+ Low to high
+ High to low
+
+
+
+ {isLogged &&
(setIsCreating(!isCreating))}>Create new item }
+
}
{loaded &&
-
- {neededItems.map((item) => (
-
- ))}
-
}
+
+ {neededItems.map((item) => (
+
+ ))}
+
}
{loaded &&
-
-
- decrimentPage(page, setPage)} className="decriment-btn carousel-btn">
- «
-
- <>{page}>
- incrementPage(page, setPage)} className="increment-btn carousel-btn">
- »
-
-
-
+
}
+ >}
+
+ {isCreating &&
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
(setIsCreating(!setIsCreating))}>Decline!
+
(createObjectHandle()) }>Add to site!
+
+ >
+ }
>
@@ -102,4 +173,3 @@ function itemsWrapper () {
export default itemsWrapper
-
diff --git a/cakeFront/src/sections/homeAboutUsSection.jsx b/cakeFront/src/sections/homeAboutUsSection.jsx
index f06b180..566d982 100644
--- a/cakeFront/src/sections/homeAboutUsSection.jsx
+++ b/cakeFront/src/sections/homeAboutUsSection.jsx
@@ -1,4 +1,4 @@
-import '../styles/homeAboutUsSection.css'
+
import LinkButton from '../components/linkButton'
@@ -13,7 +13,7 @@ function HomeAboutUsSection () {
About us
A small cozy pastry shop that will make your sweet dream come true. All products are selected for high quality and freshness. We prepare traditional pastries, as well as individual ones according to the wishes of the client
We think over the all details of the cake, design, the color scheme and decor.
-
+
)
diff --git a/cakeFront/src/sections/homeBestsellerSection.jsx b/cakeFront/src/sections/homeBestsellerSection.jsx
index 1ea90de..6dd4469 100644
--- a/cakeFront/src/sections/homeBestsellerSection.jsx
+++ b/cakeFront/src/sections/homeBestsellerSection.jsx
@@ -1,30 +1,28 @@
-import '../styles/homeBestsellerSection.css'
+
import ProductItem from '../components/productItemShowcase'
-import LinkButton from '../components/linkButton'
+// import LinkButton from '../components/linkButton'
+import Carousel from '../components/carouselBlock'
-import { forShowCaseFetch, tools } from '../store'
+import { forShowCaseFetch, tools, userAction} from '../store'
import { useEffect, useState } from 'react'
-
-
-
-
function HomeBestsellerSection () {
const [page, setPage] = useState(1)
- const incrementPage = tools(state => (state.incrementPage))
- const decrimentPage = tools(state => (state.decrimentPage))
const fixWrongPage = tools(state => (state.fixWrongPage))
const bestsellers = forShowCaseFetch(state => (state.bestsellers))
const status = forShowCaseFetch(state => (state.status))
const fetchBestsellersForShowcase = forShowCaseFetch(state => (state.fetchBestsellersForShowcase))
+ const isAction = userAction(state => (state.isAction))
+
+
useEffect(() => {
fetchBestsellersForShowcase(page, 'false')
- },[page])
+ },[page, isAction])
useEffect(() => {
fixWrongPage(page, setPage)
@@ -33,25 +31,15 @@ function HomeBestsellerSection () {
return (
BESTSELLERS
+
- {bestsellers.map((item) => (
-
-
- ))}
-
-
-
- {decrimentPage(page, setPage)}} className="decriment-btn carousel-btn">
- «
-
- {incrementPage(page, setPage)}} className="increment-btn carousel-btn">
- »
-
-
-
-
+
+ {bestsellers.map((item) => (
+
+ ))}
+
)
}
diff --git a/cakeFront/src/sections/homeCatalogSection.jsx b/cakeFront/src/sections/homeCatalogSection.jsx
index e5d0e48..46984da 100644
--- a/cakeFront/src/sections/homeCatalogSection.jsx
+++ b/cakeFront/src/sections/homeCatalogSection.jsx
@@ -1,28 +1,29 @@
import { useEffect, useState } from 'react'
-import { categoryItemFetch } from '../store'
-import '../styles/homeCatalogSection.css'
+import { categoryItemFetch, userAction} from '../store'
+
import CategoryItem from '../components/categoryItem'
function HomeCatalogSection () {
- const [page, setPage] = useState(1)
+
const fetchCategoryItems = categoryItemFetch((state) => state.fetchCategoryItems)
const categoryItems = categoryItemFetch((state) => state.categoryItems)
-
- const [show, setShow] = useState(false)
+ const isAction = userAction((state) => state.isAction)
useEffect(() => {
- fetchCategoryItems(page,'false')
- },[])
+ fetchCategoryItems(1,'true')
+ },[isAction])
+
+
return (
Catalog
{ categoryItems.map((categoryItem) => (
-
+
))}
diff --git a/cakeFront/src/sections/homeChooseUsSection.jsx b/cakeFront/src/sections/homeChooseUsSection.jsx
index 5919815..c7755ca 100644
--- a/cakeFront/src/sections/homeChooseUsSection.jsx
+++ b/cakeFront/src/sections/homeChooseUsSection.jsx
@@ -1,4 +1,4 @@
-import '../styles/homeChooseUsSection.css'
+
import ChooseUsItem from '../components/ChooseUsItem'
function HomeChooseUsSection () {
@@ -14,7 +14,7 @@ function HomeChooseUsSection () {
-
+
>
)
diff --git a/cakeFront/src/sections/homeCommentsSection.jsx b/cakeFront/src/sections/homeCommentsSection.jsx
index a145013..978560a 100644
--- a/cakeFront/src/sections/homeCommentsSection.jsx
+++ b/cakeFront/src/sections/homeCommentsSection.jsx
@@ -1,17 +1,13 @@
-import '../styles/HomeCommentsSection.css'
+
function HomeCommentsSection() {
return (
<>
-
-
-
OUR CUSTOMERS LOVE WHAT WE DO
-
-
-
-
+
+
+
>
)
}
diff --git a/cakeFront/src/sections/homeIndividualOrderSection.jsx b/cakeFront/src/sections/homeIndividualOrderSection.jsx
index b796ae4..f246cb4 100644
--- a/cakeFront/src/sections/homeIndividualOrderSection.jsx
+++ b/cakeFront/src/sections/homeIndividualOrderSection.jsx
@@ -1,4 +1,4 @@
-import '../styles/homeIndividualOrderSection.css'
+
function HomeIndividualOrderSection() {
diff --git a/cakeFront/src/sections/homeOpenSection.jsx b/cakeFront/src/sections/homeOpenSection.jsx
index 5afd27e..deba82e 100644
--- a/cakeFront/src/sections/homeOpenSection.jsx
+++ b/cakeFront/src/sections/homeOpenSection.jsx
@@ -1,23 +1,19 @@
-import {Link} from 'react-router-dom'
-
-
-
-import '../styles/HomeOpenSection.css'
-
import LinkButton from '../components/linkButton'
+import { motion } from 'framer-motion'
+
function HomeOpenSection () {
return (
-
DELICIOUS CAKES TO ORDER !
-
Unique handmade cakes and cookies
+
DELICIOUS CAKES TO ORDER !
+
Unique handmade cakes and cookies
-
+
-
+
)
diff --git a/cakeFront/src/sections/layoutFooterSection.jsx b/cakeFront/src/sections/layoutFooterSection.jsx
index 9f5e316..fdeb089 100644
--- a/cakeFront/src/sections/layoutFooterSection.jsx
+++ b/cakeFront/src/sections/layoutFooterSection.jsx
@@ -1,7 +1,6 @@
import {Link} from 'react-router-dom'
-import '../styles/layoutFooterSection.css'
function Footer () {
return (
@@ -13,9 +12,6 @@ function Footer () {
Dorty
diff --git a/cakeFront/src/sections/layoutHeaderSection.jsx b/cakeFront/src/sections/layoutHeaderSection.jsx
index a2d3a56..0dd1f4a 100644
--- a/cakeFront/src/sections/layoutHeaderSection.jsx
+++ b/cakeFront/src/sections/layoutHeaderSection.jsx
@@ -1,27 +1,83 @@
import {Link} from 'react-router-dom'
+import { useEffect, useState } from 'react'
+import { motion, AnimatePresence } from 'framer-motion'
-import '../styles/layoutHeaderSection.css'
-import About from '../pages/About'
+import { cart, userAction } from '../store'
function Header () {
+
+ const [isSearch, setIsSearch] = useState(false)
+ const [searchText, setSearchText] = useState('')
+
+ const toggleShowCart = cart((state) => state.toggleShowCart)
+ const Amount = cart((state) => state.Amount)
+ const setLocalItemsData = cart((state) => state.setLocalItemsData)
+ const isAdmin = userAction((state) => state.isAdmin)
+
+
+ useEffect(() => {
+ const parsedLocalItems = JSON.parse(localStorage.getItem("bigItems"))
+ setLocalItemsData(parsedLocalItems)
+
+ },[])
+
+ const [showHeader, setShowHeader] = useState(true);
+ const [prevScrolLY, setPrevScrollY] = useState(0)
+ const [scrollY, setScrollY] = useState(0);
+
+
+ function handleScroll() {
+ setScrollY(window.scrollY);
+ }
+
+ useEffect(() => {
+ window.addEventListener("scroll", handleScroll);
+
+ return () => {
+ window.removeEventListener("scroll", handleScroll);
+ }
+ }, []);
+
+ useEffect(() => {
+ setPrevScrollY(scrollY)
+ if(prevScrolLY >= scrollY){
+ setPrevScrollY(scrollY)
+ setShowHeader(true)
+ }
+ else {
+ setShowHeader(false)
+ }
+ },[scrollY])
+
+
return (
-
+ <>
+
+ {showHeader &&
-
About us
-
Catalog
-
Delivery
-
Contact us
+
About us
+
Catalog
+
Delivery
+ {isAdmin &&
User orders
}
+ {isAdmin ||
You`re orders
}
+
Log in/Log out
-
-
+
(setIsSearch(!isSearch))} />
+
(toggleShowCart())}/>
+
+ {isSearch && <>
>}
-
+ }
+
+ >
)
}
diff --git a/cakeFront/src/sections/orderWrapperPreview.jsx b/cakeFront/src/sections/orderWrapperPreview.jsx
new file mode 100644
index 0000000..495e0e1
--- /dev/null
+++ b/cakeFront/src/sections/orderWrapperPreview.jsx
@@ -0,0 +1,30 @@
+import { useEffect } from "react"
+
+import OrderPreview from "../components/orderPreview"
+
+import { fetchOrders } from "../store"
+
+
+
+function OrderWrapperPreview() {
+
+ const fetchNeededOrders = fetchOrders((state) => state.fetchNeededOrders)
+ const orders = fetchOrders((state) => state.orders)
+
+
+
+ useEffect(() => {
+ fetchNeededOrders(undefined, true)
+ }, [])
+
+ return (
+ <>
+ Orders
+ {orders.map((order) => (
+
+ ))}
+ >
+ )
+}
+
+export default OrderWrapperPreview
\ No newline at end of file
diff --git a/cakeFront/src/store.js b/cakeFront/src/store.js
index d4a47ec..0b5544d 100644
--- a/cakeFront/src/store.js
+++ b/cakeFront/src/store.js
@@ -1,5 +1,8 @@
-import { json } from 'react-router-dom'
import {create} from 'zustand'
+import {storage} from './firebase'
+import { v4 as uuidv4 } from 'uuid';
+import {ref,uploadBytes,getDownloadURL, deleteObject, getMetadata} from 'firebase/storage'
+import { json } from 'react-router-dom';
export const categoryItemFetch = create((set) => ({
@@ -9,7 +12,7 @@ export const categoryItemFetch = create((set) => ({
fetchCategoryItems: (page,params) => set(async (state) => {
- const result = await fetch('http://127.0.0.1:8000/getCategories/?showcase=' + params + '&&page=' + page)
+ const result = await fetch(`http://127.0.0.1:8000/getCategories/?showcase=${params}&page=${page=page}`)
if(result.status === 404){
set((state) => ({status: !state.status}))
}
@@ -29,9 +32,9 @@ export const forShowCaseFetch = create((set) => ({
bestsellers: [],
fetchBestsellersForShowcase: (page) => set(async(state) => {
- const result = await fetch('http://127.0.0.1:8000/getBestsellers/?page=' + page)
+ const result = await fetch(`http://127.0.0.1:8000/getBestsellers/?page=${page}`)
if(result.status === 404){
- set((state) => ({status: !state.status}))
+ set((state) => ({status: !state.status}))
}
else {
const json = await result.json()
@@ -43,19 +46,20 @@ export const forShowCaseFetch = create((set) => ({
export const productItemFetch = create((set) => ({
neededItems: [],
+ neededItem: {},
status: false,
loaded: false,
biggestPrice: 0,
- findBiggestPrice: () => set(async(state) => {
- const result = await fetch('http://127.0.0.1:8000/getItems/')
+ findBiggestPrice: (category) => set(async(state) => {
+ const result = await fetch(`http://127.0.0.1:8000/getItems/?category=${category}` )
const json = await result.json()
set((state) => ({biggestPrice: json[1]}))
}),
- fetchNeededItems: (bestsellerFilter, minPrice, maxPrice, page, lowHighFilter) => set(async(state) => {
- const result = await fetch('http://127.0.0.1:8000/getItems/?page=' + page + '&&bestsellerFilter=' + bestsellerFilter + '&&maxPrice=' + maxPrice + '&&minPrice=' + minPrice + '&&lowHighFilter=' + lowHighFilter )
+ fetchNeededItems: (bestsellerFilter, minPrice, maxPrice, page, lowHighFilter, category) => set(async(state) => {
+ const result = await fetch(`http://127.0.0.1:8000/getItems/?page=${page}&&bestsellerFilter=${bestsellerFilter}&&maxPrice=${maxPrice}&&minPrice=${minPrice}&&lowHighFilter=${lowHighFilter}&&category=${category}` )
if(result.status === 404){
set((state) => ({status: !state.status}))
}
@@ -64,24 +68,480 @@ export const productItemFetch = create((set) => ({
const json = await result.json()
set((state) => ({neededItems: json[0]}))
set((state) => ({loaded: true}))
- console.log(json[0])
+ }
+ }),
+ fetchNeededItem: (slug) => set(async(state) => {
+ const result = await fetch(`http://127.0.0.1:8000/getItems/?slug=${slug}`)
+ const json = await result.json()
+ if(result.status === 404){
+ set((state) => ({status: !state.status}))
+ }
+ else {
+ set((state) => ({neededItem:json}))
}
})
}))
+
+export const fetchOrders = create((set) => ({
+
+ items: [],
+ orders: [],
+ user: [],
+ totalPrice: 0,
+ amountOfItems: 0,
+ workStatus: ' ',
+ isCreate: false,
+ raiseError: false,
+
+ fetchNeededOrders: async (id, many,) => {
+ const acsessToken = "Bearer " + localStorage.getItem('acsessToken')
+ try {
+ let url = 'http://127.0.0.1:8000/getOrders/';
+ if (many === false) {
+ url = `http://127.0.0.1:8000/getOrders/?id=${id}` ;
+ }
+ const result = await fetch(url, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': acsessToken,
+ }
+ });
+ const json = await result.json();
+ set((state) => ({
+ items: json[0][0]['items'],
+ workStatus: json[0][0]['status'],
+ orders: json[0],
+ totalPrice: json[1],
+ amountOfItems: json[2],
+ user: json[3]
+ }));
+ } catch (error) {
+ console.error('Error fetching orders:', error);
+ }
+ },
+ createNewOrder: (items) => set(async state => {
+ const acsessToken = "Bearer " + localStorage.getItem('acsessToken')
+ const formData = {
+ user: '',
+ items: items,
+ status: "Workin` at order"
+ }
+
+ const response = await fetch('http://127.0.0.1:8000/postNewOrder/', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': acsessToken,
+
+ },
+ body: JSON.stringify(formData)
+ })
+ if (response.status === 201) {
+ set((state) => ({isCreate: true}))
+ localStorage.setItem('bigItems', '[]')
+ window.location.reload();
+
+ } else {
+ set((state) => ({raiseError: true}))
+ }
+ }),
+
+ updateOrderStatus: (id, status) => set(async state => {
+ const acsessToken = "Bearer " + localStorage.getItem('acsessToken')
+ const result = await fetch(`http://127.0.0.1:8000/patch-order/`, {
+ method: "PATCH",
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': acsessToken,
+ },
+ body: JSON.stringify({
+ idOfOrder: id,
+ status: status,
+ })
+ })
+ if (result.ok){
+ console.log("Everything fine!")
+ window.location.reload()
+ }
+ else {
+ console.log("Something went wrong")
+ }
+ })
+}))
+
+
+export const cart = create((set) => ({
+ items: [],
+ showCart: false,
+ Amount: 0,
+ totalPrice: 0,
+ restrictions: false,
+
+ toggleShowCart: () => set((state) => ({showCart: !state.showCart})),
+
+ addItemIntoCart: (item) => set(async(state) => {
+ if(state.items.length === 0){
+ item.Amount = 1
+ let newItemsArray;
+ state.items.push(item)
+ newItemsArray = state.items
+ set((state) => ({items: newItemsArray}))
+ state.incrementAmount()
+ state.updateTotalPrice(item.priceOfItem)
+ }
+ else{
+ state.foundSame = false
+ const newItemsArray = state.items
+ for (let i = 0; i != state.items.length; i++){
+ if(state.items[i]['nameOfItem'] === item['nameOfItem']){
+ state.foundSame = true
+ if(newItemsArray[i].Amount < 49) {
+ newItemsArray[i]['Amount'] += 1
+ set((state) => ({items: newItemsArray}))
+ state.incrementAmount()
+ state.updateTotalPrice(item.priceOfItem)
+ set((state) => ({restrictions: false}))
+ }
+ else {
+ set((state) => ({restrictions: true}))
+ }
+
+
+
+ }
+ }
+ if(state.foundSame === false){
+ item.Amount = 1
+ let newItemsArray;
+ state.items.push(item)
+ newItemsArray = state.items
+ set((state) => ({items: newItemsArray}))
+ state.incrementAmount()
+ state.updateTotalPrice(item.priceOfItem)
+ }}
+ localStorage.setItem("bigItems", JSON.stringify(state.items))
+}),
+
+incrementAmount: () => set((state) => ({Amount: state.Amount + 1})),
+
+changeAmountOfItem: (nameOfItem, newAmount, typeOfChange) => set(async(state) => {
+ const newItemsArray = state.items
+ for(let i=0; i !== state.items.length; i++){
+ if(nameOfItem === state.items[i].nameOfItem){
+ if(typeOfChange === "change"){
+ if(newAmount <= 50 && newAmount >= 1){
+ newItemsArray[i].Amount = newAmount
+ set((state) => ({
+ items: newItemsArray,
+ restrictions: false,
+ }))
+ localStorage.setItem("bigItems", JSON.stringify(state.items))
+ }
+ else {
+ set((state) => ({restrictions: true}))
+ }
+ }
+ else{
+ if(newItemsArray[i].Amount > 1 && newItemsArray[i].Amount < 50){
+ newItemsArray[i].Amount -= 1;
+ set((state) => ({
+ items: newItemsArray,
+ Amount: --state.Amount,
+ restrictions: false
+ }))
+ localStorage.setItem("bigItems", JSON.stringify(newItemsArray))
+ }
+ }
+ }
+ }
+}),
+
+
+updateTotalPrice: (itemPrice) => set((state) => ({totalPrice: state.totalPrice + itemPrice })),
+
+setLocalItemsData: (localItems) => {
+ set((state) => ({items: localItems}))
+
+ let m = 0;
+ for(let i=0; i != localItems.length; i++){
+ m += localItems[i].Amount;
+ }
+ set((state) => ({Amount: m}))
+
+
+ let p = 0;
+ for(let i=0; i != localItems.length; i++){
+ p += localItems[i].priceOfItem * localItems[i].Amount;
+ }
+ set((state) => ({totalPrice: p}))
+
+},
+
+deleteItemInCart: (nameOfItem) => set(async(state) => {
+ let newItemsArray = []
+ for(let i=0; i !== state.items.length; i++ ){
+ if(state.items[i].nameOfItem !== nameOfItem) {
+ newItemsArray.push(state.items[i])
+ }
+ }
+ localStorage.setItem("bigItems", JSON.stringify(newItemsArray))
+ set((state) => ({items: newItemsArray}))
+ state.setLocalItemsData(newItemsArray)
+})
+
+}))
+
+
+
+export const userAction = create((set) => ({
+ isLogged: false,
+ isCreated: undefined,
+ isAction: false,
+ isAdmin: false,
+ isLoading: false,
+ userName: '',
+ userEmail: '',
+ imgURL: '',
+
+ sign: (firstName, userPassword, last_name, phoneNumber, userEmail, sign) => set(async(state) =>{
+ if(sign === 'up') {
+ set((state) => ({isLoading: true}))
+ const result = await fetch('http://127.0.0.1:8000/auth/users/', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(
+ {
+ "email": userEmail,
+ "first_name": firstName,
+ "last_name": last_name,
+ "password": userPassword,
+ "phoneNumber": phoneNumber,
+ "username": firstName,
+ }
+ )})
+ if(result.ok) {
+ set((state) => ({isCreated: true}))
+ }
+ else {
+ set((state) => ({isCreated: false}))
+ }
+ set((state) => ({isLoading: false}))
+ }
+ else {
+ set((state) => ({isLoading: true}))
+ const result = await fetch('http://127.0.0.1:8000/auth/jwt/create/', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({
+ "username": firstName,
+ "password": userPassword
+ })
+ });
+
+ if (result.ok) {
+ const data = await result.json();
+ const accessToken = data.access;
+ const refreshToken = data.refresh;
+ localStorage.setItem('acsessToken', accessToken)
+ localStorage.setItem('refreshToken', refreshToken)
+ set((state) => ({
+ isLogged: true,
+ isLoading: false
+ }))
+
+ } else {
+ console.error("Something went wrong");
+ set((state) => ({isLogged: false}))
+ set((state) => ({isLoading: false}))
+ }
+ }
+ }),
+ userAuth: () => set(async(state) => {
+ const acsessToken = "Bearer " + localStorage.getItem('acsessToken')
+
+ const result = await fetch('http://127.0.0.1:8000/get-info/' ,{
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': acsessToken,
+ }
+ })
+ if(result.ok){
+ const data = await result.json();
+ set((state) => ({
+ isAdmin: data.is_admin,
+ userName: data.username,
+ userEmail: data.email,
+ isLogged: true,
+ }))
+ }
+ else {
+ console.log('Something went wrong')
+ set((state) => ({isLogged: false}))
+ }
+ }),
+ logOut: () => set(async(state) => {
+ localStorage.setItem('acsessToken', '')
+ localStorage.setItem('refreshToken', '')
+ set((state) => ({isLogged: false}))
+
+ }),
+ deleteObject: (id,typeOfObject,img,setFuncShow) => set(async(state) => {
+ set((state) => ({isLoading:true}))
+ const acsessToken = "Bearer " + localStorage.getItem('acsessToken')
+ const result = await fetch(`http://127.0.0.1:8000/delete-object/?id=${id}&&typeOfObject=${typeOfObject}`,{
+ method: "Delete",
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': acsessToken,
+ }
+ })
+ if(result.ok){
+ getMetadata(ref(storage,img)).then((metadata) => {
+ const filePath = metadata.fullPath
+ const fileRef = ref(storage, filePath)
+ deleteObject(fileRef).then(() => {
+ console.log('Deleted');
+ set((state) => ({isAction: !state.isAction}))
+ setTimeout(2000)
+ set((state) => ({isLoading: false}))
+ setFuncShow(false)
+ })
+ })
+ }
+ else {
+ console.log('Something went wrong!')
+ }
+ }),
+ updateObject: (id, typeOfObject,price,name,bestseller,img, defaultImg,description, category) => set(async(state) => {
+ set((state) => ({isLoading: true}))
+ const accessToken = "Bearer " + localStorage.getItem('acsessToken');
+ let data
+ if(img){
+ const imgRef = ref(storage, uuidv4());
+ await uploadBytes(imgRef, img);
+ const imgURL = await getDownloadURL(imgRef);
+ data = {
+ nameOfItem: name,
+ priceOfItem: price,
+ imgOfItem: imgURL,
+ categoryOfItem: category,
+ bestsellerItem: bestseller,
+ descriptionOfItem: description
+ };
+ }
+ else{
+ data = {
+ nameOfItem: name,
+ priceOfItem: price,
+ imgOfItem: defaultImg,
+ categoryOfItem: category,
+ BestsellerItem: bestseller,
+ descriptionOfItem: description
+ };
+ }
+ const result = await fetch(`http://127.0.0.1:8000/put-object/?id=${id}&typeOfObject=${typeOfObject}`, {
+ method: "PUT",
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': accessToken
+ },
+ body: JSON.stringify(data)
+ });
+ if(result.ok){
+ console.log('everything fine')
+ set((state) => ({isAction: !state.isAction}))
+ set((state) => ({isLoading:false}))
+ }
+ else {
+ console.log('something went wrong')
+ }
+ }),
+ createObject: (typeOfObject, name, img, price, bestseller, description,category ) => set(async(state) => {
+ set((state) => ({isLoading:true}))
+ const accessToken = "Bearer " + localStorage.getItem('acsessToken');
+ if(typeOfObject === "category"){
+ const imgRef = ref(storage, uuidv4());
+ await uploadBytes(imgRef, img);
+ const imgURL = await getDownloadURL(imgRef);
+ const data = {
+ name: name,
+ img: imgURL,
+ typeOfObject: typeOfObject
+ }
+ const result = await fetch('http://127.0.0.1:8000/create-object/', {
+ method: "POST",
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': accessToken
+ },
+ body: JSON.stringify(data)
+ })
+ if(result.ok){
+ console.log('Created')
+ set((state) => ({isAction: !state.isAction}))
+ set((state) => ({isLoading: false}))
+ }
+ else {
+ console.log("Something went wrong")
+ }
+ }
+ else {
+ const imgRef = ref(storage, uuidv4());
+ await uploadBytes(imgRef, img);
+ const imgURL = await getDownloadURL(imgRef);
+ const data = {
+ name: name,
+ price: price,
+ typeOfObject: typeOfObject,
+ img: imgURL,
+ descriptionOfItem: description,
+ category: category,
+ bestseller: bestseller
+ }
+ console.log(data)
+ const result = await fetch("http://127.0.0.1:8000/create-object/",{
+ method: "POST",
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': accessToken
+ },
+ body: JSON.stringify(data),
+ })
+ if(result.ok){
+ console.log('Everything is fine!')
+ set((state) => ({isAction: !state.isAction}))
+ set((state) => ({isLoading: false}))
+ }
+ else{
+ console.log('something went wrong')
+ }
+ }
+ }),
+ searchProducts: (text) => set(async(state) => {
+
+ })
+
+}))
+
export const tools = create((set) =>({
incrementPage: (page, setPageFunc) => {
setPageFunc(page + 1)
- } ,
+ } ,
decrimentPage: (page, setPageFunc) => {
setPageFunc(page - 1)
},
fixWrongPage: (page, setPageFunc) => set(async(state) => {
- if(page > 0) {
+ if(page > 1) {
setPageFunc(page - 1)
@@ -89,8 +549,5 @@ export const tools = create((set) =>({
else {
setPageFunc(1)
}
- })
-
-
-
+ }),
}))
\ No newline at end of file
diff --git a/cakeFront/src/styles/adminOrdersPage.css b/cakeFront/src/styles/adminOrdersPage.css
new file mode 100644
index 0000000..cfae183
--- /dev/null
+++ b/cakeFront/src/styles/adminOrdersPage.css
@@ -0,0 +1,4 @@
+.raise-error {
+ margin-left: 40%;
+ margin-top: 200px;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/attention.css b/cakeFront/src/styles/attention.css
new file mode 100644
index 0000000..f8f3f06
--- /dev/null
+++ b/cakeFront/src/styles/attention.css
@@ -0,0 +1,18 @@
+.wrapper-attention {
+ width: 100vw;
+ height: 100vh;
+ background-color: rgba(217, 217, 217, 0.5);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: fixed;
+ top: 0;
+ left: 0;
+ color: black;
+ font-size: 25px;
+ z-index: 1;
+}
+
+.wrapper-attention-block {
+ margin-top: -120px;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/cart.css b/cakeFront/src/styles/cart.css
new file mode 100644
index 0000000..bb85b8a
--- /dev/null
+++ b/cakeFront/src/styles/cart.css
@@ -0,0 +1,64 @@
+.cart-wrapper {
+ width: 100vw;
+ height: 100vh;
+ background-color: rgba(0, 0, 0,0.2);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: fixed;
+ top: 0;
+ left: 0;
+ z-index: 1;
+}
+
+
+.cart {
+ margin-top: 50px;
+ width: 50%;
+ height: 80%;
+ background-color: white;
+ border: darkgray solid 3px;
+ border-radius: 50px;
+
+}
+
+.cart-tittle-wrapper {
+ width: 100%;
+ text-align: center;
+}
+
+.cart-items-wrapper{
+ overflow-y: scroll;
+ width: 100%;
+ height: 80%;
+ border: solid lightgray 2px;
+}
+
+.total-info-wrapper {
+ display: flex;
+ justify-content: space-around;
+}
+
+.button-buy {
+ width: 150px;
+ height: 50px;
+ background-color: inherit;
+ border: solid gray 1px;
+ cursor: pointer;
+ transition: 400ms;
+ margin-top: 18px;
+ font-size: 18px;
+ font-weight: 800;
+ background-color: rgb(238, 235, 235);
+ border-radius: 5px;
+}
+
+.button-buy:hover {
+ border-radius: 15px;
+}
+
+.total {
+ margin-top: 25px;
+ font-size: 32px;
+ font-weight: 500;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/catalogCategoryWrapper.css b/cakeFront/src/styles/catalogCategoryWrapper.css
index c6ea9af..e4da2b5 100644
--- a/cakeFront/src/styles/catalogCategoryWrapper.css
+++ b/cakeFront/src/styles/catalogCategoryWrapper.css
@@ -1,15 +1,37 @@
.categories-wrapper {
display: grid;
grid-template-columns: repeat(3, 390px);
- grid-auto-rows: 520px;
- width: 80%;
+ grid-auto-rows: 640px;
justify-content: space-between;
column-gap: 20px;
- margin: 80px 11%;
+ width: 90%;
+ margin-left: 4%;
}
.carousel-btn-wrapper {
width: 0%;
margin-left: 47.5%;
+}
+
+.creating-category-wrapper {
+ width: 800px;
+ height: 500px;
+ margin: 0 auto;
margin-top: 100px;
-}
\ No newline at end of file
+}
+
+.category-form-wrapper {
+ width: 800px;
+ height: 400px;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+}
+
+.create-decline-buttons-wrapper {
+ display: flex;
+ width: 400px;
+ margin: 0 auto;
+ justify-content: space-around;
+ margin-top: 75px;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/catalogItemsWrapper.css b/cakeFront/src/styles/catalogItemsWrapper.css
index 834aeee..17b6ae7 100644
--- a/cakeFront/src/styles/catalogItemsWrapper.css
+++ b/cakeFront/src/styles/catalogItemsWrapper.css
@@ -1,17 +1,193 @@
-
.catalog-filter-section {
width: 100%;
- border: solid red 1px;
- height: 150px;
- margin-top: 50px;
+ height: 90px;
+ margin-top: -20px;
+ display: flex;
+ border-bottom: black 1px solid;
}
.items-wrapper {
display: grid;
- margin-top: 20px;
+ margin-top: 40px;
grid-template-columns: repeat(3, 440px);
grid-auto-rows: 520px;
row-gap: 100px;
-}
+}
+
+.descArea {
+ width: 400px;
+}
+.hide {
+ width: 100px;
+ height: 26px;
+ margin-left: -10px;
+}
+
+
+.create-product {
+ display: flex;
+}
+
+.sliders-wrapper {
+ display: flex;
+ width: 400px;
+ display: flex;
+ justify-content: space-around;
+}
+
+.slider-wrapper {
+ width: 150px;
+}
+
+.slider {
+ -webkit-appearance: none;
+ appearance: none;
+ width: 100%;
+ height: 2px;
+ border: solid rgba(154, 140, 152, 1) 3px;
+ padding: 5px;
+ border-radius: 140px;
+ -webkit-transition: 2s;
+ opacity: 0.7;
+ transition: opacity .2s;
+ cursor: pointer;
+ transition: 400ms;
+}
+.slider::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ height: 20px;
+ width: 20px;
+ border-radius: 100%;
+ background-color: rgba(201, 173, 167, 1);
+}
+
+.slider:hover::-webkit-slider-thumb {
+ background-color: gray ;
+}
+
+.filters {
+ display: flex;
+ width: 60%;
+ justify-content: space-around;
+ margin-top: 20px;
+ margin: auto;
+}
+
+.bestseller-checkbox {
+ margin-top: 15px;
+}
+
+.bestseller-checkbox {
+ width: 20px;
+ height: 20px;
+ cursor: pointer;
+}
+
+.select-wrapper {
+ margin-top: 12px;
+ width: 100px;
+}
+
+.low-high-filter {
+ width: 100px;
+ -webkit-appearance: none;
+ border: solid gray 3px;
+ cursor: pointer;
+ border-radius: 140px;
+ text-align: center;
+}
+
+.low-high-filter::-ms-expand {
+ display: none;
+}
+
+.option-item {
+ border: solid gray 2px;
+}
+
+.option-item:last-of-type {
+ border-bottom-left-radius: 15px;
+ border-bottom-right-radius: 15px;
+}
+
+.create-item-button {
+ width: 170px;
+ height: 60px;
+ border-radius: 200px;
+ cursor: pointer;
+ border: solid gray 2px;
+ margin: 0 auto;
+ margin-top: 20px;
+ transition: 400ms;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.create-item-button:hover {
+ font-size: 20px;
+}
+
+.item-page {
+ border: solid black 1px;
+}
+
+.input-file {
+ opacity: 0;
+ pointer-events: none;
+}
+
+.upload-img {
+ margin-top: 135px;
+ -webkit-appearance: none;
+ appearance: none;
+ border: solid gray 2px ;
+ width: 300px;
+ height: 300px;
+ border-radius: 50px;
+ background-color: lightgray;
+ cursor: pointer;
+ transition: 400ms;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-left: 50px;
+}
+
+.upload-img:hover {
+ background-color: gray;
+}
+
+
+.upload-img-btn-wrapper {
+ width: 200px;
+ height: 30px;
+ font-size: 24px;
+ display: flex;
+ justify-content: space-around;
+}
+
+.create-form-wrapper {
+ height: 250px;
+ margin: auto;
+}
+
+.about-wrapper-input {
+ border: solid black 1px;
+ width: 100px;
+ height: 100px;
+ margin: auto;
+}
+
+.input-form-about {
+ width: 340px;
+ height: 260px;
+ margin-left: -105px;
+ margin-top: -80px;
+ border: 2px solid gray;
+ outline: none;
+ font-size: 20px;
+}
diff --git a/cakeFront/src/styles/categoryItem.css b/cakeFront/src/styles/categoryItem.css
index 24f16e4..3059ebe 100644
--- a/cakeFront/src/styles/categoryItem.css
+++ b/cakeFront/src/styles/categoryItem.css
@@ -1,24 +1,29 @@
.wrapper-category-item {
- border: solid black 1px;
height: 440px;
- width: 360px;
+ width: 440px;
margin-top: 60px;
}
.img-wrapper {
- border: solid black 2px;
height: 100%;
}
-.title-wrapper {
+.img {
+ border-radius: 10px;
+}
+
+.title-category-wrapper {
height: 50px;
+ width: 91%;
font-size: 32px;
- border: solid red 3px;
text-align: center;
-
}
.title {
margin-top: 10px;
+}
+.img {
+ width: 100%;
+ height: 100%;
}
\ No newline at end of file
diff --git a/cakeFront/src/styles/default.css b/cakeFront/src/styles/default.css
index 01aa903..1de964e 100644
--- a/cakeFront/src/styles/default.css
+++ b/cakeFront/src/styles/default.css
@@ -2,7 +2,43 @@
box-sizing: border-box;
margin: 0;
padding: 0;
- list-style-type: none;
color: inherit;
text-decoration: none;
+ font-family: 'NanumMyeongjo'
}
+
+.small-text {
+ font-family: 'NanumMyeongjo';
+}
+
+.logo {
+ font-family: 'DancingScript';
+ font-weight: 100;
+}
+
+.loader {
+ width: 200px;
+ height: 200px;
+ border-radius: 100%;
+ opacity: 0.8;
+}
+
+.buttons-wrapper {
+ justify-content: space-around;
+ width: 400px;
+ display: flex;
+ margin: 0 auto;
+ margin-top: -20px;
+}
+
+.carousel-wrapper {
+ margin-top: 100px;
+}
+
+.category-create-btn-wrapper {
+ margin-left: 45.5%;
+}
+
+.add-button {
+ border: solid black 1px ;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/deleteButton.css b/cakeFront/src/styles/deleteButton.css
new file mode 100644
index 0000000..5073983
--- /dev/null
+++ b/cakeFront/src/styles/deleteButton.css
@@ -0,0 +1,17 @@
+.deleteButton {
+ width: 70px;
+ height: 30px;
+ border: solid black 2px;
+ background-color: red;
+ color: aliceblue;
+ font-size: 20px;
+ cursor: pointer;
+ transition: 400ms;
+}
+
+.deleteButton:active {
+ width: 60px;
+ height: 25px;
+ background-color: white;
+ color: black;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/fonts.css b/cakeFront/src/styles/fonts.css
new file mode 100644
index 0000000..d85c4d6
--- /dev/null
+++ b/cakeFront/src/styles/fonts.css
@@ -0,0 +1,19 @@
+@font-face {
+ font-family: 'NanumMyeongjo';
+ src: local('NanumMyeongjo'), url('/public/fonts/NanumMyeongjo-Regular.ttf') format('woff2');
+ font-weight: normal;
+ font-style: normal;
+ }
+
+@font-face {
+ font-family: 'inter';
+ src: url('/public/fonts/static/Inter-Regular.ttf');
+ font-weight: normal;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'DancingScript';
+ src: url('/public//fonts//static/DancingScript-SemiBold.ttf');
+ font-style: italic;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/homeBestsellerSection.css b/cakeFront/src/styles/homeBestsellerSection.css
index 58dc6b1..79465b3 100644
--- a/cakeFront/src/styles/homeBestsellerSection.css
+++ b/cakeFront/src/styles/homeBestsellerSection.css
@@ -18,7 +18,7 @@
.carousel-btn-wrapper {
width: 100%;
height: 200px;
- margin-top: 30px;
+ margin-top: 195px;
}
.carousel-wrapper {
@@ -34,6 +34,7 @@
border: none;
background-color: inherit;
cursor: pointer;
+ transition: 200ms;
}
.carousel-btn:active {
@@ -43,3 +44,4 @@
.button-wrapper {
margin-left: -53px;
}
+
diff --git a/cakeFront/src/styles/homeCatalogSection.css b/cakeFront/src/styles/homeCatalogSection.css
index 002abe9..08f5850 100644
--- a/cakeFront/src/styles/homeCatalogSection.css
+++ b/cakeFront/src/styles/homeCatalogSection.css
@@ -2,8 +2,8 @@
height: 634px;
width: 1500px;
margin: 0 auto;
- margin-top: 200px;
text-align: center;
+ margin-top: 130px;
}
.catalog-items-wrapper {
diff --git a/cakeFront/src/styles/homeCommentsSection.css b/cakeFront/src/styles/homeCommentsSection.css
index 29c612c..e69de29 100644
--- a/cakeFront/src/styles/homeCommentsSection.css
+++ b/cakeFront/src/styles/homeCommentsSection.css
@@ -1,19 +0,0 @@
-.home-comments-section {
- width: 970px;
- height: 540px;
- margin: 0 auto;
- margin-top: 160px;
- text-align: center;
-}
-
-.home-comments-section-large-text-wrapper {
- width: 715px;
- margin: 0 auto;
-}
-
-.comments-wrapper {
- height: 370px;
- width: 970px;
- border: solid black 1px;
- margin-top: 60px;
-}
\ No newline at end of file
diff --git a/cakeFront/src/styles/homeIndividualOrderSection.css b/cakeFront/src/styles/homeIndividualOrderSection.css
index dc5fd73..298ae81 100644
--- a/cakeFront/src/styles/homeIndividualOrderSection.css
+++ b/cakeFront/src/styles/homeIndividualOrderSection.css
@@ -1,18 +1,13 @@
.individual-order-section {
- width: 90%;
- margin: 190px auto;
- height: 770px;
- background-image: url('./background.png');
+ background-image: url(background.png);
+ background-attachment:fixed;
background-repeat: no-repeat;
- background-position: center center;
- background-attachment: fixed;
- -webkit-background-size: cover;
- -moz-background-size: cover;
- -o-background-size: cover;
background-size: cover;
-
+ width: 100%;
+ height: 750px;
}
+
.individual-order-form-wrapper {
height: 610px;
width: 560px;
diff --git a/cakeFront/src/styles/isLoading.css b/cakeFront/src/styles/isLoading.css
new file mode 100644
index 0000000..0b6b672
--- /dev/null
+++ b/cakeFront/src/styles/isLoading.css
@@ -0,0 +1,11 @@
+.wrapper-is-loading {
+ width: 100vw;
+ height: 100vh;
+ background-color: rgba(0, 0, 0,0.2);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: fixed;
+ top: 0;
+ left: 0;
+}
diff --git a/cakeFront/src/styles/itemInCart.css b/cakeFront/src/styles/itemInCart.css
new file mode 100644
index 0000000..c688aa1
--- /dev/null
+++ b/cakeFront/src/styles/itemInCart.css
@@ -0,0 +1,70 @@
+.item-wrapper {
+ margin-top: 50px;
+ margin-left: 10px;
+ width: 300px;
+ border-radius: 15px;
+ border: solid gray 2px;
+ padding: 15px;
+}
+
+.item-img-wrapper-cart {
+ width: 100px;
+ height: 100px;
+ border-radius: 10px;
+}
+
+.name-wrapper {
+ margin-left: 10px;
+}
+
+.change-amount-wrapper {
+ display: flex;
+ justify-content: space-around;
+ width: 200px;
+}
+
+.change-amount {
+ margin-top: 15px;
+ width: 50px;
+ height: 20px;
+ border: none;
+ border-bottom: solid gray 1px;
+ outline: none;
+ text-align: center;
+}
+
+.change-amount::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+}
+
+.delete-cross-wrapper {
+ width: 15px;
+ height: 15px;
+ position: absolute;
+ margin-left: 17.5%;
+ margin-top: -10px;
+}
+
+.delete-cross {
+ width: 15px;
+ height: 15px;
+ position: fixed;
+ cursor: pointer;
+ transition: 400ms;
+}
+
+.delete-cross:hover {
+ width: 20px;
+ height: 20px;
+}
+
+.minus {
+ margin-top: 5px;
+}
+
+.info-wrapper {
+ display: flex;
+ width: 100%;
+ justify-content: space-between;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/itemInOrderList.css b/cakeFront/src/styles/itemInOrderList.css
new file mode 100644
index 0000000..f0aae6b
--- /dev/null
+++ b/cakeFront/src/styles/itemInOrderList.css
@@ -0,0 +1,22 @@
+.item-order-list-wrapper {
+
+
+ display: flex;
+
+}
+
+.order-img-wrapper {
+ width: 100px;
+ height: 100%;
+ border: solid black 1px;
+}
+
+.amount-price-wrapper {
+ margin-left: 2px;
+ flex-direction: column;
+}
+
+.order-img {
+ width: 100%;
+ height: 100%;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/itemPage.css b/cakeFront/src/styles/itemPage.css
new file mode 100644
index 0000000..e8564bd
--- /dev/null
+++ b/cakeFront/src/styles/itemPage.css
@@ -0,0 +1,69 @@
+.item-page {
+ width: 1300px;
+ height: 630px;
+ margin: 0 auto;
+ margin-top: 30px;
+ display: flex;
+ justify-content: space-around;
+}
+
+.item-img {
+ margin-top: 80px;
+ width: 430px;
+ height: 430px;
+ border-radius: 50px;
+ border: gray 2px solid;
+}
+
+.line-wrapper {
+ margin-top: 100px;
+ margin-left: 80px;
+}
+
+.info-items {
+ margin-top: 130px;
+ font-size: 22px;
+}
+
+.item-description {
+ width: 450px;
+ height: auto;
+ margin-top: 80px;
+ font-family: 'NanumMyeongjo';
+ white-space: pre-wrap;
+ font-size: 24px;
+}
+
+.info-of-item {
+ margin-top: 30px;
+ font-size: 30px;
+ font-family: 'NanumMyeongjo';
+}
+
+.name-of-item {
+ font-size: 30px;
+}
+
+.item-add-btn {
+ margin-top: 30px;
+ width: 185px;
+ height: 60px;
+ border-radius: 200px;
+ border: solid black 1px;
+ cursor: pointer;
+ font-size: 18px;
+ transition: 400ms;
+ font-family: 'NanumMyeongjo';
+ border: solid gray 2px;
+}
+
+
+.item-add-btn:hover{
+ box-shadow: 0 0 100px wheat;
+ font-size: 20px;
+}
+
+.item-add-btn:active {
+ font-size: 18px;
+ background-color: lightgray;
+}
diff --git a/cakeFront/src/styles/layoutFooterSection.css b/cakeFront/src/styles/layoutFooterSection.css
index 13b47f6..84503f6 100644
--- a/cakeFront/src/styles/layoutFooterSection.css
+++ b/cakeFront/src/styles/layoutFooterSection.css
@@ -2,7 +2,7 @@
height: 430px;
width: 90%;
margin: 0 auto;
- margin-top: 318px;
+ margin-top: 175px;
display: flex;
flex-direction: column;
}
diff --git a/cakeFront/src/styles/layoutStyles.css b/cakeFront/src/styles/layoutStyles.css
new file mode 100644
index 0000000..855b3dc
--- /dev/null
+++ b/cakeFront/src/styles/layoutStyles.css
@@ -0,0 +1,6 @@
+.outlet-section {
+ padding: 0;
+ margin: 0;
+ font-size: 18px;
+ margin-top: 80px;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/layoutheaderSection.css b/cakeFront/src/styles/layoutheaderSection.css
index f29497d..78cef1d 100644
--- a/cakeFront/src/styles/layoutheaderSection.css
+++ b/cakeFront/src/styles/layoutheaderSection.css
@@ -1,13 +1,15 @@
.header {
- margin-top: 15px;
width: 100%;
- height: 54px;
+ height: 65px;
+ top: 0;
display: flex;
justify-content: space-around;
+ position: fixed;
+ background-color: lightgray;
+ opacity: 0.8;
+ z-index: 1;
}
-
-
.logo {
font-size: 54px;
font-weight: 700;
@@ -21,9 +23,13 @@
.nav-menu__item {
margin-top: 25px;
- color: #26262677;
- font-weight: 700;
+ color: rgb(16, 16, 16);
font-size: 18px;
+ transition: 400ms;
+}
+
+.nav-menu__item:hover {
+ color: rgb(49, 49, 177);
}
.icons-wrapper {
@@ -36,4 +42,30 @@
height: 30px;
width: 30px;
margin-top: 22px;
+ cursor: pointer;
+}
+
+.amount {
+ border: solid 1px ;
+ border-radius: 100%;
+ font-size: 14px;
+ font-weight: 800;
+ background-color: lightgray;
+ color: gray;
+ border: solid 2px;
+ margin-left: -35px;
+ margin-top: 20px;
+ width: 22px;
+ height:22px;
+ text-align: center;
+}
+
+.amount-num {
+ margin-top: 2px;
+}
+
+.header__search {
+ position: absolute;
+ margin-top: 28px;
+ margin-left: -290px;
}
\ No newline at end of file
diff --git a/cakeFront/src/styles/logInLogOutPage.css b/cakeFront/src/styles/logInLogOutPage.css
new file mode 100644
index 0000000..bea8edd
--- /dev/null
+++ b/cakeFront/src/styles/logInLogOutPage.css
@@ -0,0 +1,162 @@
+.form-image-wrapper {
+ width: 1040px;
+ height: 666px;
+ margin: 0 auto;
+ display: flex;
+ font-family: 'NanumMyeongjo';
+}
+
+.action-block-wrapper {
+ border-bottom-left-radius: 50px;
+ border-top-left-radius: 50px;
+ width: 620px;
+ height: 100%;
+ background-color: rgba(191, 195, 196, 1);
+}
+
+.form-wrapper {
+ width: 455px;
+ height: 90%;
+ margin-top: 42px;
+ margin-left: 62px;
+ background-color: inherit;
+}
+
+.img-wrapper {
+ width: 400px;
+ height: 100%;
+ border-top-right-radius: 50px;
+ border-bottom-right-radius: 50px;
+}
+
+.log-text-wrapper {
+ height: 110px;
+}
+
+.log-title {
+ font-size: 42px;
+ font-weight: 700;
+ font-family: 'NanumMyeongjo';
+}
+
+.ask-account-text {
+ margin-top: 10px;
+ font-size: 20px;
+ color: rgba(94, 85, 85, 1);
+ font-family: 'inter';
+ margin-top: 20px;
+}
+
+.create-account-text {
+ /* color: blue;
+ cursor: pointer;
+ text-decoration: underline;
+ transition: 400ms; */
+ font-weight: 900;
+ text-decoration: underline;
+ cursor: pointer;
+ transition: 400ms;
+}
+
+.create-account-text:hover {
+ color: blue;
+}
+
+
+.form-block {
+ margin-top: 10px
+}
+
+.register-input-wrapper {
+ margin-top: 25px;
+}
+
+.register-form-input {
+ margin-top: 5px;
+ width: 100%;
+ outline: none;
+ border: none;
+ border-bottom: rgba(119, 119, 119, 0.7) solid 1px;
+ background-color: inherit;
+ font-size: 18px;
+}
+
+.register-label {
+ font-family: 'NanumMyeongjo';
+ font-size: 18px;
+}
+
+
+.register-btn {
+ width: 180px;
+ height: 60px;
+ border-radius: 100px;
+ cursor: pointer;
+ margin-top: 40px;
+ border: none;
+ font-size: 18px;
+ transition: 400ms;
+ font-family: 'inter';
+}
+
+.register-btn:hover {
+ box-shadow: 0 0 60px whitesmoke;
+ font-size: 20px;
+}
+
+.login {
+ border: solid rgba(191, 195, 196, 1) 1px;
+ border-radius: 0px;
+ border-top-right-radius: 50px;
+ border-bottom-right-radius: 50px;
+}
+
+.logout-wrapper {
+ width: 620px;
+ height: 320px;
+ border: solid gray 2px;
+ margin: 0 auto;
+ border-radius: 50px;
+ background-color: rgba(176, 184, 183, 1);
+ text-align: center;
+ margin-top: 150px;
+}
+
+.logout-icon-wrapper {
+ margin: 0 auto;
+ margin-top: 25px;
+}
+
+.logout-title {
+ font-size: 32px;
+ margin-top: 10px;
+}
+
+.logout-greating {
+ margin-top: 10px;
+}
+
+.logout-text {
+ margin-top: 8px;
+}
+
+.logout-btn {
+ width: 150px;
+ height: 70px;
+ border-radius: 80px;
+ cursor: pointer;
+ font-size: 20px;
+ transition: 400ms;
+ margin-top: 35px;
+ border: solid gray 2px;
+}
+
+.logout-btn:hover {
+ background-color: aliceblue;
+ font-size: 24px;
+ box-shadow: 0 0 60px lightyellow;
+}
+
+.logout-btn:active {
+ font-size: 18px;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/orderPreview.css b/cakeFront/src/styles/orderPreview.css
new file mode 100644
index 0000000..45d9271
--- /dev/null
+++ b/cakeFront/src/styles/orderPreview.css
@@ -0,0 +1,43 @@
+
+.tittle {
+ font-size: 64px;
+ text-align: center;
+ margin-top: 100px;
+}
+
+.orderPreview-wrapper {
+ border: solid black 1px;
+ width: 900px;
+ height: 80px;
+ margin: 0 auto;
+ margin-top: 40px;
+ display: flex;
+
+}
+
+.user-data-wrapper {
+ height: 100%;
+ width: 45%;
+ flex-direction: column;
+}
+
+.info-item {
+ margin-top: 7px;
+ display: flex;
+}
+
+.order-data {
+ width: 40%;
+ height: 100%;
+
+}
+
+.status-of-order {
+ margin-top: 25px;
+ font-size: 20px;
+ padding-right: 100px;
+}
+
+.status-block {
+ margin-top: 20px;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/orderWrapper.css b/cakeFront/src/styles/orderWrapper.css
new file mode 100644
index 0000000..0a0af1b
--- /dev/null
+++ b/cakeFront/src/styles/orderWrapper.css
@@ -0,0 +1,45 @@
+.wrapper-of-order {
+ width: 95%;
+ height: 700px;
+ margin: 130px auto;
+ border: solid black 1px;
+ display: flex;
+}
+
+.user-data-wrapper {
+ width: 370px;
+ height: 150px;
+ border: solid black 1px;
+}
+
+.info-about-order {
+ border: solid red 1px;
+ height: 100%;
+ flex-direction: column;
+}
+
+.order-wrapper {
+ width: 82%;
+ height: 100%;
+ border: solid black 1px;
+}
+
+.small-wrapper {
+ margin-top: 10px;
+ border: solid black 1px;
+}
+
+.items-wrapper-info {
+ display: grid;
+ grid-template-columns: repeat(3, 380px);
+ grid-auto-rows: 100px;
+ row-gap: 20px;
+}
+
+.general-information-wrapper {
+ width: 100%;
+ height: 100px;
+ border: solid black 1px;
+ text-align: center;
+ margin-top: 20px;
+}
\ No newline at end of file
diff --git a/cakeFront/src/styles/productItemShowcase.css b/cakeFront/src/styles/productItemShowcase.css
index fb13959..f699960 100644
--- a/cakeFront/src/styles/productItemShowcase.css
+++ b/cakeFront/src/styles/productItemShowcase.css
@@ -1,7 +1,6 @@
.product-item-wrapper {
- height: 520px;
+ height: 440px;
width: 440px;
- border: solid black 1px;
}
.star-wrapper {
@@ -20,7 +19,6 @@
.product-img-wrapper {
height: 440px;
width: 440px;
- border: solid red 2px;
}
@@ -33,8 +31,8 @@
}
.name-of-product-wrapper {
- width: 230px;
- font-size: 30px;
+ width: 245px;
+ font-size: 24px;
text-align: left;
}
@@ -76,4 +74,78 @@ border-radius: 30%;
.add-button-pic {
margin-left: 1px;
margin-top: 2px;
-}
\ No newline at end of file
+}
+
+.delete-btn {
+ background-color: red;
+ color: white;
+ font-size: 20px;
+ cursor: pointer;
+}
+
+.update-btn {
+ background-color: lightblue;
+ font-size: 20px;
+ cursor: pointer;
+ margin-left: 20px;
+}
+
+.update-form-wrapper {
+ border: solid green 1px;
+ height: 100%;
+}
+
+.input-wrapper {
+ margin-top: 40px;
+}
+
+.input-form {
+ width: 140px;
+ font-size: 18px;
+ outline: none;
+ border: none;
+ border-bottom: #7777 solid 2px;
+ float: left;
+}
+
+.desc {
+ width: 320px;
+ height: 90px;
+}
+
+.update-product-show {
+ width: 100%;
+ height: 100%;
+ border: solid gray 3px;
+ border-radius: 50px;
+}
+
+.update-img {
+ -webkit-appearance: none;
+ appearance: none;
+ border: solid gray 2px ;
+ width: 200px;
+ height: 200px;
+ border-radius: 50px;
+ background-color: lightgray;
+ cursor: pointer;
+ transition: 400ms;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin: auto;
+ margin-top: 35px;
+}
+
+.update-img:hover {
+ background-color: gray;
+}
+
+
+.update-img-btn-wrapper {
+ width: 200px;
+ height: 30px;
+ font-size: 24px;
+ display: flex;
+ justify-content: space-around;
+}
diff --git a/cakeFront/src/styles/texts.css b/cakeFront/src/styles/texts.css
index 2dc23eb..b992fce 100644
--- a/cakeFront/src/styles/texts.css
+++ b/cakeFront/src/styles/texts.css
@@ -1,10 +1,10 @@
.large-text {
- font-size: 70px;
+ font-size: 54px;
}
.small-text {
font-size: 18px;
margin-top: 10px;
font-weight: 900;
- color: black;
+ color: gray;
}
\ No newline at end of file
diff --git a/cakeFront/vite.config.js b/cakeFront/vite.config.js
index 5a33944..64cad1d 100644
--- a/cakeFront/vite.config.js
+++ b/cakeFront/vite.config.js
@@ -4,4 +4,8 @@ import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
+ base: '/cakefront'
+
})
+
+