From 66c5b80c152d5bd28ad60e3452c42a0ca14a66ca Mon Sep 17 00:00:00 2001 From: Schailes Date: Sun, 16 Mar 2025 11:37:55 +0300 Subject: [PATCH 01/16] =?UTF-8?q?=D0=94=D0=97=2016032025?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.vue | 66 +- frontend/src/common/data/doughSizes.js | 6 +- frontend/src/common/data/ingredients.js | 32 +- frontend/src/common/data/sauces.js | 7 +- frontend/src/common/data/sizes.js | 10 +- frontend/src/common/helpers/normalize.js | 32 + frontend/src/components/layouts/index.js | 1 + frontend/src/components/views/index.js | 1 + frontend/src/layouts/AppHeader.vue | 149 ++++ frontend/src/layouts/AppLayout.vue | 10 + frontend/src/main.js | 4 +- frontend/src/mocks/dough.json | 30 +- frontend/src/mocks/ingredients.json | 32 +- frontend/src/mocks/sauces.json | 28 +- frontend/src/mocks/sizes.json | 38 +- frontend/src/style.css | 79 ++ frontend/src/views/HomeView.vue | 961 +++++++++++++++++++++++ 17 files changed, 1336 insertions(+), 150 deletions(-) create mode 100644 frontend/src/common/helpers/normalize.js create mode 100644 frontend/src/components/layouts/index.js create mode 100644 frontend/src/components/views/index.js create mode 100644 frontend/src/layouts/AppHeader.vue create mode 100644 frontend/src/layouts/AppLayout.vue create mode 100644 frontend/src/style.css create mode 100644 frontend/src/views/HomeView.vue diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 2f88d12a..6d103ddb 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,62 +1,10 @@ - + \ No newline at end of file diff --git a/frontend/src/common/data/doughSizes.js b/frontend/src/common/data/doughSizes.js index 2495107b..ae750a90 100644 --- a/frontend/src/common/data/doughSizes.js +++ b/frontend/src/common/data/doughSizes.js @@ -1,4 +1,4 @@ export default { - 1: "light", - 2: "large", -}; + 1: "light", + 2: "large", + }; \ No newline at end of file diff --git a/frontend/src/common/data/ingredients.js b/frontend/src/common/data/ingredients.js index b7b6960a..eafd8356 100644 --- a/frontend/src/common/data/ingredients.js +++ b/frontend/src/common/data/ingredients.js @@ -1,17 +1,17 @@ export default { - 1: "mushrooms", - 2: "cheddar", - 3: "salami", - 4: "ham", - 5: "ananas", - 6: "bacon", - 7: "onion", - 8: "chile", - 9: "jalapeno", - 10: "olives", - 11: "tomatoes", - 12: "salmon", - 13: "mozzarella", - 14: "parmesan", - 15: "blue_cheese", -}; + 1: "mushrooms", + 2: "cheddar", + 3: "salami", + 4: "ham", + 5: "ananas", + 6: "bacon", + 7: "onion", + 8: "chile", + 9: "jalapeno", + 10: "olives", + 11: "tomatoes", + 12: "salmon", + 13: "mozzarella", + 14: "parmesan", + 15: "blue_cheese", + }; \ No newline at end of file diff --git a/frontend/src/common/data/sauces.js b/frontend/src/common/data/sauces.js index 4d2c5c5a..b8a407eb 100644 --- a/frontend/src/common/data/sauces.js +++ b/frontend/src/common/data/sauces.js @@ -1,4 +1,5 @@ export default { - 1: "tomato", - 2: "creamy", -}; + 1: "tomato", + 2: "chees", + 3: "terijaki", + }; \ No newline at end of file diff --git a/frontend/src/common/data/sizes.js b/frontend/src/common/data/sizes.js index 70bf1042..c07216bd 100644 --- a/frontend/src/common/data/sizes.js +++ b/frontend/src/common/data/sizes.js @@ -1,5 +1,5 @@ -export default { - 1: "small", - 2: "normal", - 3: "big", -}; + export default { + 1: "small", + 2: "normal", + 3: "big", + }; \ No newline at end of file diff --git a/frontend/src/common/helpers/normalize.js b/frontend/src/common/helpers/normalize.js new file mode 100644 index 00000000..aeaa79ac --- /dev/null +++ b/frontend/src/common/helpers/normalize.js @@ -0,0 +1,32 @@ +import doughSizes from "@/common/data/doughSizes"; +import ingredients from "@/common/data/ingredients"; +import sauces from "@/common/data/sauces"; +import sizes from "@/common/data/sizes"; + +export const normalizeDough = (dough) => { + return { + ...dough, + value: doughSizes[dough.id], + }; + }; + + export const normalizeSize = (size) => { + return { + ...size, + value: sizes[size.id], + }; + }; + + export const normalizeIngredients = (ingredient) => { + return { + ...ingredient, + value: ingredients[ingredient.id], + }; + }; + + export const normalizeSauces = (sauce) => { + return { + ...sauce, + value: sauces[sauce.id], + }; + }; \ No newline at end of file diff --git a/frontend/src/components/layouts/index.js b/frontend/src/components/layouts/index.js new file mode 100644 index 00000000..48236f12 --- /dev/null +++ b/frontend/src/components/layouts/index.js @@ -0,0 +1 @@ +export { default as AppLayout } from "./AppLayout.vue"; \ No newline at end of file diff --git a/frontend/src/components/views/index.js b/frontend/src/components/views/index.js new file mode 100644 index 00000000..aebdd2c4 --- /dev/null +++ b/frontend/src/components/views/index.js @@ -0,0 +1 @@ +export { default as HomeView } from "./HomeView.vue"; \ No newline at end of file diff --git a/frontend/src/layouts/AppHeader.vue b/frontend/src/layouts/AppHeader.vue new file mode 100644 index 00000000..1f8bb08c --- /dev/null +++ b/frontend/src/layouts/AppHeader.vue @@ -0,0 +1,149 @@ + + \ No newline at end of file diff --git a/frontend/src/layouts/AppLayout.vue b/frontend/src/layouts/AppLayout.vue new file mode 100644 index 00000000..91b2cf78 --- /dev/null +++ b/frontend/src/layouts/AppLayout.vue @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/frontend/src/main.js b/frontend/src/main.js index 786af441..d6ef6b14 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -2,11 +2,9 @@ import { createApp } from "vue"; import { createPinia } from "pinia"; import App from "./App.vue"; -import router from "./router"; const app = createApp(App); app.use(createPinia()); -app.use(router); -app.mount("#app"); +app.mount("#app"); \ No newline at end of file diff --git a/frontend/src/mocks/dough.json b/frontend/src/mocks/dough.json index 70b0fa1a..9254c985 100644 --- a/frontend/src/mocks/dough.json +++ b/frontend/src/mocks/dough.json @@ -1,16 +1,16 @@ [ - { - "id": 1, - "name": "Тонкое", - "image": "dough-light.svg", - "description": "Из твердых сортов пшеницы", - "price": 300 - }, - { - "id": 2, - "name": "Толстое", - "image": "dough-large.svg", - "description": "Из твердых сортов пшеницы", - "price": 300 - } -] + { + "id": 1, + "name": "Тонкое", + "image": "dough-light.svg", + "description": "Из твердых сортов пшеницы", + "price": 300 + }, + { + "id": 2, + "name": "Толстое", + "image": "dough-large.svg", + "description": "Из твердых сортов пшеницы", + "price": 300 + } + ] \ No newline at end of file diff --git a/frontend/src/mocks/ingredients.json b/frontend/src/mocks/ingredients.json index c9cbf543..4e04991c 100644 --- a/frontend/src/mocks/ingredients.json +++ b/frontend/src/mocks/ingredients.json @@ -1,17 +1,17 @@ [ - { "id": 1, "name": "Грибы", "image": "filling/mushrooms.svg", "price": 33 }, - { "id": 2, "name": "Чеддер", "image": "filling/cheddar.svg", "price": 42 }, - { "id": 3, "name": "Салями", "image": "filling/salami.svg", "price": 42 }, - { "id": 4, "name": "Ветчина", "image": "filling/ham.svg", "price": 42 }, - { "id": 5, "name": "Ананас", "image": "filling/ananas.svg", "price": 25 }, - { "id": 6, "name": "Бекон", "image": "filling/bacon.svg", "price": 42 }, - { "id": 7, "name": "Лук", "image": "filling/onion.svg", "price": 21 }, - { "id": 8, "name": "Чили", "image": "filling/chile.svg", "price": 21 }, - { "id": 9, "name": "Халапеньо", "image": "filling/jalapeno.svg", "price": 25 }, - { "id": 10, "name": "Маслины", "image": "filling/olives.svg", "price": 25 }, - { "id": 11, "name": "Томаты", "image": "filling/tomatoes.svg", "price": 35 }, - { "id": 12, "name": "Лосось", "image": "filling/salmon.svg", "price": 50 }, - { "id": 13, "name": "Моцарелла", "image": "filling/mozzarella.svg", "price": 35 }, - { "id": 14, "name": "Пармезан", "image": "filling/parmesan.svg", "price": 35 }, - { "id": 15, "name": "Блю чиз", "image": "filling/blue_cheese.svg", "price": 50 } -] + { "id": 1, "name": "Грибы", "image": "filling/mushrooms.svg", "price": 33 }, + { "id": 2, "name": "Чеддер", "image": "filling/cheddar.svg", "price": 42 }, + { "id": 3, "name": "Салями", "image": "filling/salami.svg", "price": 42 }, + { "id": 4, "name": "Ветчина", "image": "filling/ham.svg", "price": 42 }, + { "id": 5, "name": "Ананас", "image": "filling/ananas.svg", "price": 25 }, + { "id": 6, "name": "Бекон", "image": "filling/bacon.svg", "price": 42 }, + { "id": 7, "name": "Лук", "image": "filling/onion.svg", "price": 21 }, + { "id": 8, "name": "Чили", "image": "filling/chile.svg", "price": 21 }, + { "id": 9, "name": "Халапеньо", "image": "filling/jalapeno.svg", "price": 25 }, + { "id": 10, "name": "Маслины", "image": "filling/olives.svg", "price": 25 }, + { "id": 11, "name": "Томаты", "image": "filling/tomatoes.svg", "price": 35 }, + { "id": 12, "name": "Лосось", "image": "filling/salmon.svg", "price": 50 }, + { "id": 13, "name": "Моцарелла", "image": "filling/mozzarella.svg", "price": 35 }, + { "id": 14, "name": "Пармезан", "image": "filling/parmesan.svg", "price": 35 }, + { "id": 15, "name": "Блю чиз", "image": "filling/blue_cheese.svg", "price": 50 } + ] \ No newline at end of file diff --git a/frontend/src/mocks/sauces.json b/frontend/src/mocks/sauces.json index 3a1a1b8a..32f31ecf 100644 --- a/frontend/src/mocks/sauces.json +++ b/frontend/src/mocks/sauces.json @@ -1,12 +1,18 @@ [ - { - "id": 1, - "name": "Томатный", - "price": 50 - }, - { - "id": 2, - "name": "Сливочный", - "price": 50 - } -] + { + "id": 1, + "name": "Томатный", + "price": 50 + }, + { + "id": 2, + "name": "Сырный", + "price": 50 + } + , + { + "id": 3, + "name": "Терияки", + "price": 50 + } + ] \ No newline at end of file diff --git a/frontend/src/mocks/sizes.json b/frontend/src/mocks/sizes.json index eb299dbe..5f506df9 100644 --- a/frontend/src/mocks/sizes.json +++ b/frontend/src/mocks/sizes.json @@ -1,20 +1,20 @@ [ - { - "id": 1, - "name": "23 см", - "image": "diameter.svg", - "multiplier": 1 - }, - { - "id": 2, - "name": "32 см", - "image": "diameter.svg", - "multiplier": 2 - }, - { - "id": 3, - "name": "45 см", - "image": "diameter.svg", - "multiplier": 3 - } -] + { + "id": 1, + "name": "23 см", + "image": "diameter.svg", + "multiplier": 1 + }, + { + "id": 2, + "name": "32 см", + "image": "diameter.svg", + "multiplier": 2 + }, + { + "id": 3, + "name": "45 см", + "image": "diameter.svg", + "multiplier": 3 + } + ] \ No newline at end of file diff --git a/frontend/src/style.css b/frontend/src/style.css new file mode 100644 index 00000000..f6913154 --- /dev/null +++ b/frontend/src/style.css @@ -0,0 +1,79 @@ +:root { + font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +.card { + padding: 2em; +} + +#app { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue new file mode 100644 index 00000000..c0f776a3 --- /dev/null +++ b/frontend/src/views/HomeView.vue @@ -0,0 +1,961 @@ + + + + + \ No newline at end of file From 7d23d764ec5c9e740f828a2abe040a5bed65c3a1 Mon Sep 17 00:00:00 2001 From: Schailes Date: Sun, 16 Mar 2025 11:49:55 +0300 Subject: [PATCH 02/16] change viteconf --- frontend/vite.config.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/vite.config.js b/frontend/vite.config.js index be796387..2b82c4e1 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -1,7 +1,7 @@ -import { fileURLToPath, URL } from "url"; +import { fileURLToPath, URL } from "url" -import { defineConfig } from "vite"; -import vue from "@vitejs/plugin-vue"; +import { defineConfig } from "vite" +import vue from "@vitejs/plugin-vue" // https://vitejs.dev/config/ export default defineConfig({ @@ -19,9 +19,10 @@ export default defineConfig({ port: 8080, proxy: { "/api": { - target: "http://backend:3000/", + target: "https://pizza.vue.htmlacademy.pro/", + changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ""), }, }, - }, -}); + } +}) \ No newline at end of file From c43ac17c84bbed493971467b1548275f327f6245 Mon Sep 17 00:00:00 2001 From: Schailes Date: Mon, 17 Mar 2025 07:31:48 +0300 Subject: [PATCH 03/16] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/package-lock.json | 7 +++++++ frontend/package.json | 1 + frontend/src/assets/scss/app.scss | 1 + 3 files changed, 9 insertions(+) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 3d6e9a8c..33603022 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0", "dependencies": { "axios": "^1.6.1", + "normalize.css": "^8.0.1", "pinia": "^2.1.7", "vue": "^3.3.8", "vue-router": "^4.2.5" @@ -2660,6 +2661,12 @@ "node": ">=0.10.0" } }, + "node_modules/normalize.css": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/normalize.css/-/normalize.css-8.0.1.tgz", + "integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==", + "license": "MIT" + }, "node_modules/npm-run-path": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index d48471d7..890090a3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "axios": "^1.6.1", + "normalize.css": "^8.0.1", "pinia": "^2.1.7", "vue": "^3.3.8", "vue-router": "^4.2.5" diff --git a/frontend/src/assets/scss/app.scss b/frontend/src/assets/scss/app.scss index 9d86ab36..ba6fa8c8 100644 --- a/frontend/src/assets/scss/app.scss +++ b/frontend/src/assets/scss/app.scss @@ -5,3 +5,4 @@ @import "visually-hidden.scss"; @import "scaffolding.scss"; @import "mixins/mixins"; +@import 'normalize.css' From 3e6be5ad257ccae2e5ada4357b25805074d18ae9 Mon Sep 17 00:00:00 2001 From: Schailes Date: Mon, 17 Mar 2025 08:45:56 +0300 Subject: [PATCH 04/16] =?UTF-8?q?2.6.=20=D0=97=D0=B0=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5:=20=D0=BE=D0=B1=D1=89=D0=B8=D0=B5=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D1=8B=20=D0=B2=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B5=20Vue-Pizza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/common/components/AppDrag.vue | 30 ++++++++++++++++++++++ frontend/src/common/components/AppDrop.vue | 25 ++++++++++++++++++ frontend/src/common/constants/index.js | 1 + 3 files changed, 56 insertions(+) create mode 100644 frontend/src/common/components/AppDrag.vue create mode 100644 frontend/src/common/components/AppDrop.vue create mode 100644 frontend/src/common/constants/index.js diff --git a/frontend/src/common/components/AppDrag.vue b/frontend/src/common/components/AppDrag.vue new file mode 100644 index 00000000..0723c041 --- /dev/null +++ b/frontend/src/common/components/AppDrag.vue @@ -0,0 +1,30 @@ + + + \ No newline at end of file diff --git a/frontend/src/common/components/AppDrop.vue b/frontend/src/common/components/AppDrop.vue new file mode 100644 index 00000000..2ef19b67 --- /dev/null +++ b/frontend/src/common/components/AppDrop.vue @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/frontend/src/common/constants/index.js b/frontend/src/common/constants/index.js new file mode 100644 index 00000000..12678bbc --- /dev/null +++ b/frontend/src/common/constants/index.js @@ -0,0 +1 @@ +export const DATA_TRANSFER_PAYLOAD = "payload"; \ No newline at end of file From a8d254fe47e545513e1f28b4be9c43faf1f5713d Mon Sep 17 00:00:00 2001 From: Schailes Date: Mon, 17 Mar 2025 09:56:49 +0300 Subject: [PATCH 05/16] =?UTF-8?q?2.15.=20=D0=97=D0=B0=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5:=20=D0=BF=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82?= =?UTF-8?q?=D1=80=D1=83=D0=BA=D1=82=D0=BE=D1=80=D0=B0=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B5=20Vue-Pizza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/common/constants/index.js | 1 + .../modules/constructor/DiameterSelector.vue | 112 +++ .../src/modules/constructor/DoughSelector.vue | 89 +++ .../constructor/IngredientsSelector.vue | 302 ++++++++ .../modules/constructor/PizzaConstructor.vue | 235 ++++++ .../src/modules/constructor/SauceSelector.vue | 59 ++ frontend/src/views/HomeView.vue | 724 +++--------------- 7 files changed, 903 insertions(+), 619 deletions(-) create mode 100644 frontend/src/modules/constructor/DiameterSelector.vue create mode 100644 frontend/src/modules/constructor/DoughSelector.vue create mode 100644 frontend/src/modules/constructor/IngredientsSelector.vue create mode 100644 frontend/src/modules/constructor/PizzaConstructor.vue create mode 100644 frontend/src/modules/constructor/SauceSelector.vue diff --git a/frontend/src/common/constants/index.js b/frontend/src/common/constants/index.js index 12678bbc..e138c51a 100644 --- a/frontend/src/common/constants/index.js +++ b/frontend/src/common/constants/index.js @@ -1 +1,2 @@ +export const MAX_INGREDIENT_COUNT = 3; export const DATA_TRANSFER_PAYLOAD = "payload"; \ No newline at end of file diff --git a/frontend/src/modules/constructor/DiameterSelector.vue b/frontend/src/modules/constructor/DiameterSelector.vue new file mode 100644 index 00000000..a95fc07e --- /dev/null +++ b/frontend/src/modules/constructor/DiameterSelector.vue @@ -0,0 +1,112 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/modules/constructor/DoughSelector.vue b/frontend/src/modules/constructor/DoughSelector.vue new file mode 100644 index 00000000..cc70e61d --- /dev/null +++ b/frontend/src/modules/constructor/DoughSelector.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/frontend/src/modules/constructor/IngredientsSelector.vue b/frontend/src/modules/constructor/IngredientsSelector.vue new file mode 100644 index 00000000..5c6fda4d --- /dev/null +++ b/frontend/src/modules/constructor/IngredientsSelector.vue @@ -0,0 +1,302 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/modules/constructor/PizzaConstructor.vue b/frontend/src/modules/constructor/PizzaConstructor.vue new file mode 100644 index 00000000..5193a99f --- /dev/null +++ b/frontend/src/modules/constructor/PizzaConstructor.vue @@ -0,0 +1,235 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/modules/constructor/SauceSelector.vue b/frontend/src/modules/constructor/SauceSelector.vue new file mode 100644 index 00000000..4c6a3f95 --- /dev/null +++ b/frontend/src/modules/constructor/SauceSelector.vue @@ -0,0 +1,59 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue index c0f776a3..7b716576 100644 --- a/frontend/src/views/HomeView.vue +++ b/frontend/src/views/HomeView.vue @@ -1,101 +1,74 @@ \ No newline at end of file diff --git a/frontend/src/common/components/AppDrag.vue b/frontend/src/common/components/AppDrag.vue index 0723c041..4e599913 100644 --- a/frontend/src/common/components/AppDrag.vue +++ b/frontend/src/common/components/AppDrag.vue @@ -1,13 +1,13 @@ +
+ +
+ \ No newline at end of file + diff --git a/frontend/src/common/components/AppDrop.vue b/frontend/src/common/components/AppDrop.vue index 2ef19b67..0371744e 100644 --- a/frontend/src/common/components/AppDrop.vue +++ b/frontend/src/common/components/AppDrop.vue @@ -1,25 +1,27 @@ +
+ +
- \ No newline at end of file + + + + diff --git a/frontend/src/modules/constructor/DiameterSelector.vue b/frontend/src/modules/constructor/DiameterSelector.vue index a95fc07e..c231fd30 100644 --- a/frontend/src/modules/constructor/DiameterSelector.vue +++ b/frontend/src/modules/constructor/DiameterSelector.vue @@ -1,112 +1,103 @@ - - - - \ No newline at end of file +} + \ No newline at end of file diff --git a/frontend/src/modules/constructor/IngredientsSelector.vue b/frontend/src/modules/constructor/IngredientsSelector.vue index 5c6fda4d..d1e077cd 100644 --- a/frontend/src/modules/constructor/IngredientsSelector.vue +++ b/frontend/src/modules/constructor/IngredientsSelector.vue @@ -1,302 +1,280 @@ - - - - \ No newline at end of file +} + \ No newline at end of file diff --git a/frontend/src/modules/constructor/SauceSelector.vue b/frontend/src/modules/constructor/SauceSelector.vue index 4c6a3f95..ff3b953e 100644 --- a/frontend/src/modules/constructor/SauceSelector.vue +++ b/frontend/src/modules/constructor/SauceSelector.vue @@ -1,59 +1,50 @@ - - - - \ No newline at end of file +} + +.ingredients__input { + margin-right: 24px; + margin-bottom: 10px; +} + \ No newline at end of file diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue index 7b716576..25be4150 100644 --- a/frontend/src/views/HomeView.vue +++ b/frontend/src/views/HomeView.vue @@ -17,11 +17,8 @@
- +
@@ -29,20 +26,11 @@
- +

Итого: {{ price }} ₽

@@ -130,318 +118,4 @@ const updateIngredientAmount = (ingredient, count) => { \ No newline at end of file From 3c2155a5cce7ea3ed858e9248fa820e1f13ff6b5 Mon Sep 17 00:00:00 2001 From: Schailes Date: Wed, 19 Mar 2025 09:18:46 +0300 Subject: [PATCH 08/16] =?UTF-8?q?3.5.=20=D0=97=D0=B0=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5:=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= =?UTF-8?q?=20=D0=B8=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=20=D0=B2=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=B5=20Vue-Pizza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/common/components/AppCounter.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/common/components/AppCounter.vue b/frontend/src/common/components/AppCounter.vue index 9242ef2a..943fc8f4 100644 --- a/frontend/src/common/components/AppCounter.vue +++ b/frontend/src/common/components/AppCounter.vue @@ -35,7 +35,8 @@ const emit = defineEmits(['input']) - {{ label }} - + \ No newline at end of file diff --git a/frontend/src/layouts/AppLayout.vue b/frontend/src/layouts/AppLayout.vue index 91b2cf78..dd6a5f55 100644 --- a/frontend/src/layouts/AppLayout.vue +++ b/frontend/src/layouts/AppLayout.vue @@ -7,4 +7,5 @@ \ No newline at end of file + + diff --git a/frontend/src/main.js b/frontend/src/main.js index d6ef6b14..ae3d7447 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -1,10 +1,11 @@ import { createApp } from "vue"; import { createPinia } from "pinia"; -import App from "./App.vue"; +import App from "./App.vue"; +import router from './router' const app = createApp(App); app.use(createPinia()); - +app.use(router); app.mount("#app"); \ No newline at end of file diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 6c13dc55..2fd4d244 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -1,8 +1,45 @@ -import { createRouter, createWebHistory } from "vue-router"; +import {createRouter, createWebHistory} from 'vue-router' + +import HomeView from '@/views/HomeView.vue' +import Login from '@/views/LoginView.vue' +import Card from '@/views/CardView.vue' +import User from '@/views/UserView.vue' +import OrderUsers from '@/views/OrderView.vue' + + + const router = createRouter({ - history: createWebHistory(import.meta.env.BASE_URL), - routes: [], -}); + history: createWebHistory(), + routes: [ + { + path: '/', + name: 'HomeView', + component: HomeView + } + , + { + path: '/login', + name: 'Login', + component: Login + }, + { + path: '/card', + name: 'Card', + component: Card + }, + { + path: '/user', + name: 'User', + component: User + }, + { + path: '/order/:id', + name: 'OrderUsers', + component: OrderUsers + } + + ] +}) export default router; diff --git a/frontend/src/views/CardView.vue b/frontend/src/views/CardView.vue new file mode 100644 index 00000000..c8e0e2e1 --- /dev/null +++ b/frontend/src/views/CardView.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/frontend/src/views/LoginView.vue b/frontend/src/views/LoginView.vue new file mode 100644 index 00000000..00770857 --- /dev/null +++ b/frontend/src/views/LoginView.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/frontend/src/views/OrderView.vue b/frontend/src/views/OrderView.vue new file mode 100644 index 00000000..3032780f --- /dev/null +++ b/frontend/src/views/OrderView.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/frontend/src/views/UserView.vue b/frontend/src/views/UserView.vue new file mode 100644 index 00000000..121a751f --- /dev/null +++ b/frontend/src/views/UserView.vue @@ -0,0 +1,3 @@ + \ No newline at end of file From f7b9b761935c7ffc5e3477ab66e29682e5aa7a49 Mon Sep 17 00:00:00 2001 From: Schailes Date: Tue, 25 Mar 2025 08:36:26 +0300 Subject: [PATCH 10/16] =?UTF-8?q?3.24.=20=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=BE=D0=B2=D1=8B=D1=85?= =?UTF-8?q?=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B5=D0=BA=D1=82=20Vue-Pizza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/package-lock.json | 17 + frontend/package.json | 2 + frontend/src/App.vue | 5 + frontend/src/assets/scss/card.scss | 288 +++++++++++++++++ frontend/src/assets/scss/sidebar.scss | 70 ++++ frontend/src/layouts/AppHeader.vue | 36 +-- frontend/src/layouts/SidebarLayout.vue | 20 ++ frontend/src/main.js | 5 + .../constructor/IngredientsSelector.vue | 1 + frontend/src/router/index.js | 56 ++-- frontend/src/views/CardView.vue | 249 +++++++++++++- frontend/src/views/HomeView.vue | 16 +- frontend/src/views/LoginView.vue | 135 +++++++- frontend/src/views/OrderView.vue | 305 +++++++++++++++++- frontend/src/views/ProfileView.vue | 241 ++++++++++++++ frontend/src/views/UserView.vue | 24 +- 16 files changed, 1402 insertions(+), 68 deletions(-) create mode 100644 frontend/src/assets/scss/card.scss create mode 100644 frontend/src/assets/scss/sidebar.scss create mode 100644 frontend/src/layouts/SidebarLayout.vue create mode 100644 frontend/src/views/ProfileView.vue diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 8e12dac9..4db55027 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,6 +11,8 @@ "axios": "^1.6.1", "normalize.css": "^8.0.1", "pinia": "^2.1.7", + "primeicons": "^7.0.0", + "primevue": "^3.53.1", "vue": "^3.3.8", "vue-router": "^4.5.0" }, @@ -3048,6 +3050,21 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/primeicons": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/primeicons/-/primeicons-7.0.0.tgz", + "integrity": "sha512-jK3Et9UzwzTsd6tzl2RmwrVY/b8raJ3QZLzoDACj+oTJ0oX7L9Hy+XnVwgo4QVKlKpnP/Ur13SXV/pVh4LzaDw==", + "license": "MIT" + }, + "node_modules/primevue": { + "version": "3.53.1", + "resolved": "https://registry.npmjs.org/primevue/-/primevue-3.53.1.tgz", + "integrity": "sha512-Bp4peZPdhfKYXwvtsOGGh5dfgmTelm+LZEZKGs/c5mOHhsUJ6xi3EcOZoQVI6oklS946ayMQvgD5L0S7itGO0g==", + "license": "MIT", + "peerDependencies": { + "vue": "^3.0.0" + } + }, "node_modules/proto-list": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", diff --git a/frontend/package.json b/frontend/package.json index cd91cb1f..e62db7d7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,6 +13,8 @@ "axios": "^1.6.1", "normalize.css": "^8.0.1", "pinia": "^2.1.7", + "primeicons": "^7.0.0", + "primevue": "^3.53.1", "vue": "^3.3.8", "vue-router": "^4.5.0" }, diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 2a7af846..7b770056 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -9,3 +9,8 @@ import AppLayout from "@/layouts/AppLayout.vue"; import HomeView from "@/views/HomeView.vue"; + + \ No newline at end of file diff --git a/frontend/src/assets/scss/card.scss b/frontend/src/assets/scss/card.scss new file mode 100644 index 00000000..b071af8b --- /dev/null +++ b/frontend/src/assets/scss/card.scss @@ -0,0 +1,288 @@ +.layout-form { + display: flex; + flex-direction: column; + flex-grow: 1; + } + + .cart__title { + margin-bottom: 15px; + } + + .cart__additional { + margin-top: 15px; + margin-bottom: 25px; + } + + .cart__empty { + padding: 20px 30px; + } + + .cart-form { + display: flex; + align-items: center; + flex-wrap: wrap; + } + + .cart-form__select { + display: flex; + align-items: center; + + margin-right: auto; + + span { + margin-right: 16px; + } + } + + .cart-form__label { + @include b-s16-h19; + + white-space: nowrap; + } + + .cart-form__address { + display: flex; + align-items: center; + + width: 100%; + margin-top: 20px; + } + + .cart-form__input { + flex-grow: 1; + + margin-bottom: 20px; + margin-left: 16px; + + &--small { + max-width: 120px; + } + } + + .cart-list { + @include clear-list; + + padding: 15px 0; + } + + .cart-list__item { + display: flex; + align-items: flex-start; + + margin-bottom: 15px; + padding-right: 15px; + padding-bottom: 15px; + padding-left: 15px; + + border-bottom: 1px solid rgba($green-500, 0.1); + + &:last-child { + margin-bottom: 0; + padding-bottom: 0; + + border-bottom: none; + } + } + + .cart-list__product { + flex-grow: 1; + + margin-right: auto; + } + + .cart-list__counter { + width: 54px; + margin-right: auto; + margin-left: 20px; + } + + .cart-list__price { + min-width: 100px; + margin-right: 36px; + margin-left: 10px; + + text-align: right; + + b { + @include b-s16-h19; + } + } + + .cart-list__edit { + @include l-s11-h13; + + cursor: pointer; + transition: 0.3s; + + border: none; + outline: none; + background-color: transparent; + + &:hover { + color: $green-500; + } + + &:active { + color: $green-600; + } + + &:focus { + color: $green-400; + } + } + + .product { + display: flex; + align-items: center; + } + + .product__text { + margin-left: 15px; + + h2 { + @include b-s18-h21; + + margin-top: 0; + margin-bottom: 10px; + } + + ul { + @include clear-list; + @include l-s11-h13; + } + } + + .footer { + display: flex; + align-items: center; + + margin-top: auto; + padding: 25px 2.12%; + + background-color: rgba($green-500, 0.1); + } + + .footer__more { + width: 220px; + margin-right: 16px; + + a { + padding-top: 16px; + padding-bottom: 16px; + } + } + + .footer__text { + @include l-s11-h13; + + color: rgba($black, 0.5); + } + + .footer__price { + @include b-s24-h28; + + margin-right: 12px; + margin-left: auto; + } + + .footer__submit { + button { + padding: 16px 14px; + } + } + + .additional-list { + @include clear-list; + + display: flex; + flex-wrap: wrap; + } + + .additional-list__description { + display: flex; + align-items: flex-start; + + margin: 0; + margin-bottom: 8px; + } + + .additional-list__item { + display: flex; + align-items: flex-start; + flex-direction: column; + + width: 200px; + margin-right: 15px; + margin-bottom: 15px; + padding-top: 15px; + padding-bottom: 15px; + + img { + margin-right: 10px; + margin-left: 15px; + } + + span { + @include b-s14-h16; + + display: inline; + + width: 100px; + margin-right: 15px; + } + } + + .additional-list__wrapper { + display: flex; + align-items: center; + + box-sizing: border-box; + width: 100%; + margin-top: auto; + padding-top: 18px; + padding-right: 15px; + padding-left: 15px; + + border-top: 1px solid rgba($green-500, 0.1); + } + + .additional-list__counter { + width: 54px; + margin-right: auto; + } + + .additional-list__price { + @include b-s16-h19; + } + + .select { + @include r-s16-h19; + + display: block; + + margin: 0; + padding: 8px 16px; + padding-right: 30px; + + cursor: pointer; + transition: 0.3s; + + color: $black; + border: 1px solid $purple-400; + border-radius: 8px; + outline: none; + background-color: $silver-100; + background-image: url("@/assets/img/select.svg"); + background-repeat: no-repeat; + background-position: right 8px center; + font-family: inherit; + appearance: none; + + &:hover { + border-color: $orange-100; + } + + &:focus { + border-color: $green-500; + } + } \ No newline at end of file diff --git a/frontend/src/assets/scss/sidebar.scss b/frontend/src/assets/scss/sidebar.scss new file mode 100644 index 00000000..812aa63c --- /dev/null +++ b/frontend/src/assets/scss/sidebar.scss @@ -0,0 +1,70 @@ +.layout__sidebar { + position: fixed; + z-index: 2; + top: 0; + left: 0; + + width: 180px; + height: 100%; + + background-color: rgba($green-500, 0.05); + } + + .layout__logo { + display: block; + + margin-bottom: 30px; + padding-top: 10px; + padding-bottom: 10px; + + background-color: $green-500; + + img { + display: block; + + margin: 0 auto; + } + } + + .layout__link { + @include b-s14-h16; + + display: block; + + padding: 8px 14px; + + transition: 0.3s; + + color: $black; + + &--active { + background-color: rgba($green-500, 0.1); + } + + &:hover { + background-color: rgba($green-500, 0.2); + } + + &:active { + color: rgba($black, 0.5); + } + } + + .layout__content { + padding-top: 22px; + padding-right: 2.12%; + padding-left: 200px; + } + + .layout__title { + margin-bottom: 27px; + } + + .layout__button { + $self: &; + margin-top: 40px; + + button[type="button"] { + padding: 12px 23px; + } + } \ No newline at end of file diff --git a/frontend/src/layouts/AppHeader.vue b/frontend/src/layouts/AppHeader.vue index a6733a2b..63a5eb68 100644 --- a/frontend/src/layouts/AppHeader.vue +++ b/frontend/src/layouts/AppHeader.vue @@ -10,9 +10,11 @@ 0 ₽
- Пользователь + Пользователь +
+
- Выйти + Выход
@@ -68,14 +70,11 @@ display: flex; align-items: center; - a { - display: block; - - padding: 14px 20px; - - transition: 0.3s; - - background-color: $green-500; + a { + display: block; + padding: 14px 20px; + transition: 0.3s; + background-color:#f7ce6f; &:hover:not(:active) { background-color: #f7ce6f; @@ -89,22 +88,6 @@ opacity: 0.5; } } - - img { - display: inline-block; - width: 32px; - height: 32px; - margin-right: 8px; - vertical-align: middle; - border-radius: 50%; - } - - span { - @include r-s14-h16; - display: inline-block; - vertical-align: middle; - color: $white; - } } &__logout { @@ -115,7 +98,6 @@ margin-right: 8px; content: ""; vertical-align: middle; - background: url("@/assets/img/login.svg") no-repeat center; background-size: auto 50%; } } diff --git a/frontend/src/layouts/SidebarLayout.vue b/frontend/src/layouts/SidebarLayout.vue new file mode 100644 index 00000000..c031eacb --- /dev/null +++ b/frontend/src/layouts/SidebarLayout.vue @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/frontend/src/main.js b/frontend/src/main.js index ae3d7447..97e90bf9 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -1,11 +1,16 @@ +import 'primevue/resources/themes/aura-light-green/theme.css' +import 'primeicons/primeicons.css' + import { createApp } from "vue"; import { createPinia } from "pinia"; import App from "./App.vue"; import router from './router' +import PrimeVue from 'primevue/config'; const app = createApp(App); app.use(createPinia()); app.use(router); +app.use(PrimeVue); app.mount("#app"); \ No newline at end of file diff --git a/frontend/src/modules/constructor/IngredientsSelector.vue b/frontend/src/modules/constructor/IngredientsSelector.vue index d1e077cd..26d7546e 100644 --- a/frontend/src/modules/constructor/IngredientsSelector.vue +++ b/frontend/src/modules/constructor/IngredientsSelector.vue @@ -1,4 +1,5 @@ + + \ No newline at end of file diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue index 25be4150..53cae1e6 100644 --- a/frontend/src/views/HomeView.vue +++ b/frontend/src/views/HomeView.vue @@ -3,11 +3,8 @@

Конструктор пиццы

- - - - - + +

@@ -90,11 +87,6 @@ const price = computed(() => { const saucePrice = sauceItems.find((item) => item.value === sauce)?.price ?? 0; - /* - * Здесь мы при помощи метода map превращаем массив ингредиентов - * в массив значений, соответствующих итоговой стоимости каждого из них - просто умножив известную цену на количество. - * После чего методом reduce вычисляем сумму всех элементов массива, что даст нам общую стоимость всех ингредиентов. - */ const ingredientsPrice = ingredientItems .map((item) => ingredients[item.value] * item.price) .reduce((acc, item) => acc + item, 0); @@ -115,7 +107,3 @@ const updateIngredientAmount = (ingredient, count) => { }; - \ No newline at end of file diff --git a/frontend/src/views/LoginView.vue b/frontend/src/views/LoginView.vue index 00770857..61d8e6f1 100644 --- a/frontend/src/views/LoginView.vue +++ b/frontend/src/views/LoginView.vue @@ -1,3 +1,134 @@ + + \ No newline at end of file +
+ + Закрыть форму авторизации + +
+

Авторизоваться на сайте

+
+ +
+ +
+
+ +
+ + +
+ + + diff --git a/frontend/src/views/OrderView.vue b/frontend/src/views/OrderView.vue index 3032780f..189d55f0 100644 --- a/frontend/src/views/OrderView.vue +++ b/frontend/src/views/OrderView.vue @@ -1,3 +1,304 @@ + + \ No newline at end of file +
+

История заказов

+
+ +
+
+
+ Заказ #11199929 +
+ +
+ Сумма заказа: 1 564 ₽ +
+ +
+ +
+
+ +
+
+ +
    +
  • +
    + Капричоза +
    +

    Капричоза

    +
      +
    • 30 см, на тонком тесте
    • +
    • Соус: томатный
    • +
    • + Начинка: грибы, лук, ветчина, пармезан, ананас, бекон, блю чиз +
    • +
    +
    +
    + +

    782 ₽

    +
  • +
  • +
    + Капричоза +
    +

    Моя любимая

    +
      +
    • 30 см, на тонком тесте
    • +
    • Соус: томатный
    • +
    • Начинка: грибы, лук, ветчина, пармезан, ананас
    • +
    +
    +
    + +

    2х782 ₽

    +
  • +
+ +
    +
  • + Coca-Cola 0,5 литра +

    + Coca-Cola 0,5 литра + 56 ₽ +

    +
  • +
  • + Острый соус + Острый соус
    30 ₽
    +
  • +
  • + Картошка из печи +

    + Картошка из печи + 170 ₽ +

    +
  • +
+ +

+ Адрес доставки: Тест (или если адрес новый - писать целиком) +

+
+ +
+
+
+ Заказ #11199929 +
+ +
+ Сумма заказа: 1 564 ₽ +
+ +
+ +
+
+ +
+
+ +
    +
  • +
    + Капричоза +
    +

    Капричоза

    +

    + 30 см, на тонком тесте
    + Соус: томатный
    + Начинка: грибы, лук, ветчина, пармезан, ананас +

    +
    +
    + +

    782 ₽

    +
  • +
  • +
    + Капричоза +
    +

    Моя любимая

    +

    + 30 см, на тонком тесте
    + Соус: томатный
    + Начинка: грибы, лук, ветчина, пармезан, ананас +

    +
    +
    + +

    2х782 ₽

    +
  • +
+ +
    +
  • + Coca-Cola 0,5 литра +

    + Coca-Cola 0,5 литра + 56 ₽ +

    +
  • +
  • + Острый соус +

    + Острый соус + 30 ₽ +

    +
  • +
  • + Картошка из печи +

    + Картошка из печи + 170 ₽ +

    +
  • +
+ +

+ Адрес доставки: Тест (или если адрес новый - писать целиком) +

+
+ + + \ No newline at end of file diff --git a/frontend/src/views/ProfileView.vue b/frontend/src/views/ProfileView.vue new file mode 100644 index 00000000..12595686 --- /dev/null +++ b/frontend/src/views/ProfileView.vue @@ -0,0 +1,241 @@ + + + \ No newline at end of file diff --git a/frontend/src/views/UserView.vue b/frontend/src/views/UserView.vue index 121a751f..45453b4d 100644 --- a/frontend/src/views/UserView.vue +++ b/frontend/src/views/UserView.vue @@ -1,3 +1,25 @@ + + \ No newline at end of file From e15959f3d5c6bea81e28220ea7de7b7ceba5d0e5 Mon Sep 17 00:00:00 2001 From: Schailes Date: Thu, 27 Mar 2025 10:33:08 +0300 Subject: [PATCH 11/16] =?UTF-8?q?4.7.=20=D0=97=D0=B0=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B3=D0=BB=D0=BE=D0=B1=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D0=BB?= =?UTF-8?q?=D0=B8=D1=89=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/layouts/SidebarLayout.vue | 2 +- frontend/src/router/index.js | 30 +- frontend/src/stores/card.js | 9 + frontend/src/stores/pizza.js | 9 + frontend/src/stores/profile.js | 9 + frontend/src/stores/users.js | 9 + frontend/src/views/CardView.vue | 408 +++++++++++-------------- frontend/src/views/UserView.vue | 4 +- 8 files changed, 230 insertions(+), 250 deletions(-) create mode 100644 frontend/src/stores/card.js create mode 100644 frontend/src/stores/pizza.js create mode 100644 frontend/src/stores/profile.js create mode 100644 frontend/src/stores/users.js diff --git a/frontend/src/layouts/SidebarLayout.vue b/frontend/src/layouts/SidebarLayout.vue index c031eacb..da327732 100644 --- a/frontend/src/layouts/SidebarLayout.vue +++ b/frontend/src/layouts/SidebarLayout.vue @@ -1,7 +1,7 @@ + + \ No newline at end of file diff --git a/frontend/src/views/UserView.vue b/frontend/src/views/UserView.vue index 45453b4d..766e5b22 100644 --- a/frontend/src/views/UserView.vue +++ b/frontend/src/views/UserView.vue @@ -12,11 +12,11 @@ const routeName = computed(() => route.name); From 3e7b6c2ae6bd7e13a6253945772b13c038d491ee Mon Sep 17 00:00:00 2001 From: Schailes Date: Thu, 27 Mar 2025 11:12:38 +0300 Subject: [PATCH 12/16] =?UTF-8?q?4.11.=20=D0=97=D0=B0=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5:=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=B2=20=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D0=BB=D0=B8=D1=89?= =?UTF-8?q?=D0=B0=D1=85=20Vue-Pizza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/mocks/addresses.json | 11 +++++++++++ frontend/src/stores/card.js | 10 +++++++++- frontend/src/stores/pizza.js | 7 ++++++- frontend/src/stores/profile.js | 3 ++- frontend/src/stores/users.js | 18 +++++++++++++++++- 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 frontend/src/mocks/addresses.json diff --git a/frontend/src/mocks/addresses.json b/frontend/src/mocks/addresses.json new file mode 100644 index 00000000..454139ac --- /dev/null +++ b/frontend/src/mocks/addresses.json @@ -0,0 +1,11 @@ +[ + { + "id": 1, + "name": "Мой адрес", + "street": "Невский пр.", + "building": "22", + "flat": "46", + "comment": "Позвоните, пожалуйста, от проходной", + "userId": "1" + } + ] \ No newline at end of file diff --git a/frontend/src/stores/card.js b/frontend/src/stores/card.js index 20fbe9fe..0df9c74f 100644 --- a/frontend/src/stores/card.js +++ b/frontend/src/stores/card.js @@ -2,7 +2,15 @@ import { defineStore } from 'pinia' export const useCardStore = defineStore('cardStore', { state: () => ({ - + hone: "", + address: { + street: "", + building: "", + flat: "", + comment: "", + }, + pizzas: [], + misc: [], }), getters: {}, actions: {} diff --git a/frontend/src/stores/pizza.js b/frontend/src/stores/pizza.js index 35d116f1..ba57a26e 100644 --- a/frontend/src/stores/pizza.js +++ b/frontend/src/stores/pizza.js @@ -2,7 +2,12 @@ import { defineStore } from 'pinia' export const usePizzaStore = defineStore('pizzaStore', { state: () => ({ - + index: null, + name: "", + sauceId: 0, + doughId: 0, + sizeId: 0, + ingredients: [], }), getters: {}, actions: {} diff --git a/frontend/src/stores/profile.js b/frontend/src/stores/profile.js index e1961ae6..c3e11dce 100644 --- a/frontend/src/stores/profile.js +++ b/frontend/src/stores/profile.js @@ -1,8 +1,9 @@ import { defineStore } from 'pinia' +import addressesJSON from "@/mocks/addresses.json"; export const useProfileStore = defineStore('profileStore', { state: () => ({ - + addresses: addressesJSON, }), getters: {}, actions: {} diff --git a/frontend/src/stores/users.js b/frontend/src/stores/users.js index 665f167b..5f709c67 100644 --- a/frontend/src/stores/users.js +++ b/frontend/src/stores/users.js @@ -1,8 +1,24 @@ import { defineStore } from 'pinia' +import doughJSON from "@/mocks/dough.json"; +import { + normalizeDough, + normalizeIngredients, + normalizeSauces, + normalizeSize, +} from "@/common/helpers/normalize"; +import ingredientsJSON from "@/mocks/ingredients.json"; +import saucesJSON from "@/mocks/sauces.json"; +import sizesJSON from "@/mocks/sizes.json"; +import miscJSON from "@/mocks/misc.json"; + export const useUsersStore = defineStore('usersStore', { state: () => ({ - + doughs: doughJSON.map(normalizeDough), + ingredients: ingredientsJSON.map(normalizeIngredients), + sauces: saucesJSON.map(normalizeSauces), + sizes: sizesJSON.map(normalizeSize), + misc: miscJSON, }), getters: {}, actions: {} From 18a2b4084de319089f52ce869a9cd250e7fe3ed3 Mon Sep 17 00:00:00 2001 From: Schailes Date: Thu, 27 Mar 2025 17:25:33 +0300 Subject: [PATCH 13/16] =?UTF-8?q?4.15.=20=D0=97=D0=B0=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B3=D0=B5=D1=82=D1=82=D0=B5=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=20=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D0=BB=D0=B8=D1=89=D0=B0?= =?UTF-8?q?=20=D0=B2=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=20Vue-Pizza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/helpers/ingredients-quantity.js | 12 +++++ frontend/src/common/helpers/pizza-price.js | 27 +++++++++++ frontend/src/stores/card.js | 46 ++++++++++++++++++- frontend/src/stores/{users.js => data.js} | 1 + frontend/src/stores/pizza.js | 38 ++++++++++++++- 5 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 frontend/src/common/helpers/ingredients-quantity.js create mode 100644 frontend/src/common/helpers/pizza-price.js rename frontend/src/stores/{users.js => data.js} (99%) diff --git a/frontend/src/common/helpers/ingredients-quantity.js b/frontend/src/common/helpers/ingredients-quantity.js new file mode 100644 index 00000000..3b72c40d --- /dev/null +++ b/frontend/src/common/helpers/ingredients-quantity.js @@ -0,0 +1,12 @@ +import { useDataStore } from "@/stores/data"; + +/* Функция вернёт объект { ингредиент: количество } */ +export const ingredientsQuantity = (pizza) => { + const data = useDataStore(); + return data.ingredients.reduce((acc, val) => { + acc[val.id] = + pizza.ingredients.find((item) => item.ingredientId === val.id) + ?.quantity ?? 0; + return acc; + }, {}); +}; \ No newline at end of file diff --git a/frontend/src/common/helpers/pizza-price.js b/frontend/src/common/helpers/pizza-price.js new file mode 100644 index 00000000..26cd3a0d --- /dev/null +++ b/frontend/src/common/helpers/pizza-price.js @@ -0,0 +1,27 @@ +import { useDataStore } from "@/stores/data"; +import { ingredientsQuantity } from "@/common/helpers/ingredients-quantity"; + +export const pizzaPrice = (pizza) => { + const data = useDataStore(); + const ingredients = ingredientsQuantity(pizza); + + const sizeMultiplier = + data.sizes.find((item) => item.id === pizza.sizeId)?.multiplier ?? 1; + + const doughPrice = + data.doughs.find((item) => item.id === pizza.doughId)?.price ?? 0; + + const saucePrice = + data.sauces.find((item) => item.id === pizza.sauceId)?.price ?? 0; + + /* + * Здесь мы при помощи метода map превращаем массив ингредиентов + * в массив значений, соответствующих итоговой стоимости каждого ингредиента — просто умножаем известную цену на количество. + * После чего методом reduce вычисляем сумму всех элементов массива, что даст нам общую стоимость всех ингредиентов. + */ + const ingredientsPrice = data.ingredients + .map((item) => ingredients[item.id] * item.price) + .reduce((acc, item) => acc + item, 0); + + return (doughPrice + saucePrice + ingredientsPrice) * sizeMultiplier; +}; \ No newline at end of file diff --git a/frontend/src/stores/card.js b/frontend/src/stores/card.js index 0df9c74f..63c4d2a0 100644 --- a/frontend/src/stores/card.js +++ b/frontend/src/stores/card.js @@ -12,6 +12,50 @@ export const useCardStore = defineStore('cardStore', { pizzas: [], misc: [], }), - getters: {}, + getters: { + pizzasExtended: (state) => { + const data = useDataStore(); + + return state.pizzas.map((pizza) => { + const pizzaIngredientsIds = pizza.ingredients.map( + (i) => i.ingredientId + ); + + return { + name: pizza.name, + quantity: pizza.quantity, + dough: data.doughs.find((i) => i.id === pizza.doughId), + size: data.sizes.find((i) => i.id === pizza.sizeId), + sauce: data.sauces.find((i) => i.id === pizza.sauceId), + ingredients: data.ingredients.filter((i) => + pizzaIngredientsIds.includes(i.id) + ), + price: pizzaPrice(pizza), + }; + }); + }, + miscExtended: (state) => { + const data = useDataStore(); + + return data.misc.map((misc) => { + return { + ...misc, + quantity: state.misc.find((i) => i.miscId === misc.id)?.quantity ?? 0, + }; + }); + }, + total: (state) => { + const pizzaPrices = state.pizzasExtended + .map((item) => item.quantity * item.price) + .reduce((acc, val) => acc + val, 0); + + const miscPrices = state.miscExtended + .map((item) => item.quantity * item.price) + .reduce((acc, val) => acc + val, 0); + + return pizzaPrices + miscPrices; + }, + + }, actions: {} }) \ No newline at end of file diff --git a/frontend/src/stores/users.js b/frontend/src/stores/data.js similarity index 99% rename from frontend/src/stores/users.js rename to frontend/src/stores/data.js index 5f709c67..111591e9 100644 --- a/frontend/src/stores/users.js +++ b/frontend/src/stores/data.js @@ -1,5 +1,6 @@ import { defineStore } from 'pinia' + import doughJSON from "@/mocks/dough.json"; import { normalizeDough, diff --git a/frontend/src/stores/pizza.js b/frontend/src/stores/pizza.js index ba57a26e..5c9a426e 100644 --- a/frontend/src/stores/pizza.js +++ b/frontend/src/stores/pizza.js @@ -1,4 +1,7 @@ import { defineStore } from 'pinia' +import { ingredientsQuantity } from "@/common/helpers/ingredients-quantity"; +import { pizzaPrice } from "@/common/helpers/pizza-price"; +import { useDataStore } from "@/stores/users"; export const usePizzaStore = defineStore('pizzaStore', { state: () => ({ @@ -9,6 +12,39 @@ export const usePizzaStore = defineStore('pizzaStore', { sizeId: 0, ingredients: [], }), - getters: {}, + getters: { + sauce: (state) => { + const data = useDataStore(); + return data.sauces.find((i) => i.id === state.sauceId) ?? data.sauces[0]; + }, + dough: (state) => { + const data = useDataStore(); + return data.doughs.find((i) => i.id === state.doughId) ?? data.doughs[0]; + }, + size: (state) => { + const data = useDataStore(); + return data.sizes.find((i) => i.id === state.sizeId) ?? data.sizes[0]; + }, + ingredientsExtended: (state) => { + const data = useDataStore(); + const pizzaIngredientsIds = state.ingredients.map((i) => i.ingredientId); + return data.ingredients + .filter((i) => pizzaIngredientsIds.includes(i.id)) + .map((i) => { + return { + ...i, + quantity: + state.ingredients.find((item) => item.ingredientId === i.id) + ?.quantity ?? 0, + }; + }); + }, + price: (state) => { + return pizzaPrice(state); + }, + ingredientQuantities: (state) => { + return ingredientsQuantity(state); + }, + }, actions: {} }) \ No newline at end of file From d34ea7c0ee3e1f505b98b65ed292b2cc9012e98e Mon Sep 17 00:00:00 2001 From: Schailes Date: Mon, 31 Mar 2025 12:49:11 +0300 Subject: [PATCH 14/16] =?UTF-8?q?4.23.=20=D0=A0=D0=B5=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5:=20=D0=BF=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D0=BB?= =?UTF-8?q?=D0=B8=D1=89=20=D0=BA=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B0=D0=BC=20Vue-Pizza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/common/components/AppCounter.vue | 251 ++++---- .../src/common/components/popup/AppPopup.vue | 52 ++ .../components/popup/AppPopupButton.vue | 13 + .../common/components/popup/AppPopupTitle.vue | 14 + frontend/src/layouts/AppLayout.vue | 36 +- frontend/src/layouts/DefaultHeader.vue | 155 +++++ frontend/src/layouts/DefaultLayout.vue | 19 + frontend/src/layouts/SidebarLayout.vue | 58 +- frontend/src/layouts/SimpleLayout.vue | 3 + .../src/modules/constructor/DoughSelector.vue | 27 +- .../constructor/IngredientsSelector.vue | 212 +------ .../modules/constructor/PizzaConstructor.vue | 424 +++++++------- .../src/modules/constructor/SauceSelector.vue | 20 +- frontend/src/router/index.js | 59 +- frontend/src/stores/card.js | 61 -- frontend/src/stores/cart.js | 127 +++++ frontend/src/stores/data.js | 24 +- frontend/src/stores/pizza.js | 68 ++- frontend/src/views/CardView.vue | 198 ------- frontend/src/views/CartView.vue | 537 ++++++++++++++++++ frontend/src/views/HomeView.vue | 175 ++++-- .../views/{OrderView.vue => OrdersView.vue} | 0 frontend/src/views/SuccessView.vue | 20 + 23 files changed, 1641 insertions(+), 912 deletions(-) create mode 100644 frontend/src/common/components/popup/AppPopup.vue create mode 100644 frontend/src/common/components/popup/AppPopupButton.vue create mode 100644 frontend/src/common/components/popup/AppPopupTitle.vue create mode 100644 frontend/src/layouts/DefaultHeader.vue create mode 100644 frontend/src/layouts/DefaultLayout.vue create mode 100644 frontend/src/layouts/SimpleLayout.vue delete mode 100644 frontend/src/stores/card.js create mode 100644 frontend/src/stores/cart.js delete mode 100644 frontend/src/views/CardView.vue create mode 100644 frontend/src/views/CartView.vue rename frontend/src/views/{OrderView.vue => OrdersView.vue} (100%) create mode 100644 frontend/src/views/SuccessView.vue diff --git a/frontend/src/common/components/AppCounter.vue b/frontend/src/common/components/AppCounter.vue index 943fc8f4..63785437 100644 --- a/frontend/src/common/components/AppCounter.vue +++ b/frontend/src/common/components/AppCounter.vue @@ -1,3 +1,32 @@ + + - + \ No newline at end of file diff --git a/frontend/src/common/components/popup/AppPopup.vue b/frontend/src/common/components/popup/AppPopup.vue new file mode 100644 index 00000000..c1e98ae7 --- /dev/null +++ b/frontend/src/common/components/popup/AppPopup.vue @@ -0,0 +1,52 @@ + + + \ No newline at end of file diff --git a/frontend/src/common/components/popup/AppPopupButton.vue b/frontend/src/common/components/popup/AppPopupButton.vue new file mode 100644 index 00000000..82bba223 --- /dev/null +++ b/frontend/src/common/components/popup/AppPopupButton.vue @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/frontend/src/common/components/popup/AppPopupTitle.vue b/frontend/src/common/components/popup/AppPopupTitle.vue new file mode 100644 index 00000000..feba70e6 --- /dev/null +++ b/frontend/src/common/components/popup/AppPopupTitle.vue @@ -0,0 +1,14 @@ + + + \ No newline at end of file diff --git a/frontend/src/layouts/AppLayout.vue b/frontend/src/layouts/AppLayout.vue index dd6a5f55..2c443e46 100644 --- a/frontend/src/layouts/AppLayout.vue +++ b/frontend/src/layouts/AppLayout.vue @@ -1,11 +1,29 @@ - - + + + + + \ No newline at end of file diff --git a/frontend/src/layouts/DefaultHeader.vue b/frontend/src/layouts/DefaultHeader.vue new file mode 100644 index 00000000..5bbd48f5 --- /dev/null +++ b/frontend/src/layouts/DefaultHeader.vue @@ -0,0 +1,155 @@ + + + + \ No newline at end of file diff --git a/frontend/src/layouts/DefaultLayout.vue b/frontend/src/layouts/DefaultLayout.vue new file mode 100644 index 00000000..6b654a15 --- /dev/null +++ b/frontend/src/layouts/DefaultLayout.vue @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/layouts/SidebarLayout.vue b/frontend/src/layouts/SidebarLayout.vue index da327732..7d48000a 100644 --- a/frontend/src/layouts/SidebarLayout.vue +++ b/frontend/src/layouts/SidebarLayout.vue @@ -16,5 +16,61 @@ \ No newline at end of file diff --git a/frontend/src/layouts/SimpleLayout.vue b/frontend/src/layouts/SimpleLayout.vue new file mode 100644 index 00000000..799fa6f9 --- /dev/null +++ b/frontend/src/layouts/SimpleLayout.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/frontend/src/modules/constructor/DoughSelector.vue b/frontend/src/modules/constructor/DoughSelector.vue index a6f18be6..ccc7d50c 100644 --- a/frontend/src/modules/constructor/DoughSelector.vue +++ b/frontend/src/modules/constructor/DoughSelector.vue @@ -1,7 +1,16 @@