@ozdao/prometheus-framework 0.1.39 → 0.1.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. package/dist/ButtonToggleMembership-738720bd.js +1 -0
  2. package/dist/ButtonToggleMembership-e337e704.mjs +90 -0
  3. package/dist/CardBlogpost-c7adb0a7.mjs +246 -0
  4. package/dist/CardBlogpost-f308ff64.js +1 -0
  5. package/dist/CardOrganization-22beb83d.js +1 -0
  6. package/dist/CardOrganization-ae384e54.mjs +234 -0
  7. package/dist/Chips-edf2b573.js +1 -0
  8. package/dist/Chips-f06ec38f.mjs +213 -0
  9. package/dist/Community-04b25965.mjs +130 -0
  10. package/dist/Community-2f6fee0f.js +1 -0
  11. package/dist/Events-41d71b0e.js +1 -0
  12. package/dist/Events-af7170ed.mjs +134 -0
  13. package/dist/Feed-04fe1f7a.mjs +361 -0
  14. package/dist/Feed-23758089.mjs +124 -0
  15. package/dist/Feed-36e83be3.mjs +156 -0
  16. package/dist/Feed-5653cf8b.js +1 -0
  17. package/dist/Feed-5a359bb7.js +1 -0
  18. package/dist/Feed-6ca0541a.js +1 -0
  19. package/dist/Image-39955d9d.mjs +480 -0
  20. package/dist/Image-c2d190d8.js +9 -0
  21. package/dist/LeftoverAdd-21311275.js +1 -0
  22. package/dist/LeftoverAdd-ccf4595f.mjs +228 -0
  23. package/dist/Members-7251dd52.mjs +109 -0
  24. package/dist/Members-d35ab7e8.js +1 -0
  25. package/dist/Organizations-a964d4b6.mjs +72 -0
  26. package/dist/Organizations-ed6d36d6.js +1 -0
  27. package/dist/Product-299070ad.mjs +652 -0
  28. package/dist/Product-aacb05f3.js +7 -0
  29. package/dist/ProductEdit-70bed802.mjs +296 -0
  30. package/dist/ProductEdit-e5a2e0f6.js +1 -0
  31. package/dist/ProductsBackoffice-3c182d6a.mjs +86 -0
  32. package/dist/ProductsBackoffice-b684913d.js +1 -0
  33. package/dist/ProfileBlogposts-6bf526fb.js +1 -0
  34. package/dist/ProfileBlogposts-d4b17535.mjs +77 -0
  35. package/dist/ProfileEvents-3eeb4320.mjs +68 -0
  36. package/dist/ProfileEvents-90e09978.js +1 -0
  37. package/dist/ProfileOrganizations-e838925f.js +1 -0
  38. package/dist/ProfileOrganizations-edf657ca.mjs +72 -0
  39. package/dist/Publics-a31d7fe7.js +1 -0
  40. package/dist/Publics-a8f31413.mjs +45 -0
  41. package/dist/Wallet-2043b611.mjs +24682 -0
  42. package/dist/Wallet-8fa7386a.js +55 -0
  43. package/dist/auth-076a83d0.mjs +625 -0
  44. package/dist/auth-df5a20c6.js +7 -0
  45. package/dist/auth.client.cjs +1 -1
  46. package/dist/auth.client.js +4 -4
  47. package/dist/auth.validation-80b133df.js +1 -0
  48. package/dist/auth.validation-fd9ae66f.mjs +24 -0
  49. package/dist/backoffice.client.cjs +1 -1
  50. package/dist/backoffice.client.js +11 -11
  51. package/dist/categories-4327a81c.js +1 -0
  52. package/dist/categories-52a561a4.mjs +122 -0
  53. package/dist/community.client.cjs +1 -1
  54. package/dist/community.client.js +10 -10
  55. package/dist/events.client.cjs +2 -2
  56. package/dist/events.client.js +9 -9
  57. package/dist/legal.client.cjs +1 -1
  58. package/dist/legal.client.js +1 -1
  59. package/dist/main.css +1 -1
  60. package/dist/modules/gallery/components/pages/Gallery.vue.d.ts +2 -0
  61. package/dist/modules/gallery/components/sections/GalleryWithCategories.vue.d.ts +2 -0
  62. package/dist/modules/globals/components/sections/Title.vue.d.ts +6 -0
  63. package/dist/organizations-966e1cd2.mjs +122 -0
  64. package/dist/organizations-d12c42b6.js +1 -0
  65. package/dist/organizations.client-8f263e28.js +3 -0
  66. package/dist/organizations.client-9ffc023f.mjs +2996 -0
  67. package/dist/organizations.client.cjs +1 -1
  68. package/dist/organizations.client.js +15 -15
  69. package/dist/products-7e4253eb.js +1 -0
  70. package/dist/products-aabe5c02.mjs +108 -0
  71. package/dist/prometheus-framework.cjs.js +1 -1
  72. package/dist/prometheus-framework.es.js +2 -2
  73. package/dist/states.validation-4594b33c.mjs +13 -0
  74. package/dist/states.validation-69003e66.js +1 -0
  75. package/dist/style.css +1 -1
  76. package/dist/users.client.cjs +1 -1
  77. package/dist/users.client.js +198 -166
  78. package/package.json +1 -1
  79. package/src/components/LocationMarker/LocationMarker.vue +1 -1
  80. package/src/components/LocationSelection/LocationSelection.vue +1 -1
  81. package/src/components/Navigation/Navigation.vue +12 -1
  82. package/src/components/Sidebar/Sidebar.vue +8 -10
  83. package/src/modules/auth/store/auth.js +7 -4
  84. package/src/modules/backoffice/components/admin/ProductEdit.vue +0 -2
  85. package/src/modules/files/middlewares/server/md.js +1 -0
  86. package/src/modules/gallery/components/pages/Gallery.vue +21 -0
  87. package/src/modules/gallery/components/sections/GalleryWithCategories.vue +408 -0
  88. package/src/modules/gallery/gallery.client.js +11 -14
  89. package/src/modules/gallery/router/gallery.router.js +10 -0
  90. package/src/modules/globals/components/sections/Title.vue +22 -0
  91. package/src/modules/marketplace/router/marketplace.js +4 -3
  92. package/src/modules/organizations/components/sections/Feed.vue +2 -2
  93. package/src/modules/products/components/pages/ProductRecommmendation.vue +5 -3
  94. package/src/modules/products/components/sections/FilterProducts.vue +2 -0
  95. package/src/modules/products/components/sections/SectionProduct.vue +17 -5
  96. package/src/modules/products/components/sections/SortProducts.vue +0 -2
  97. package/src/modules/products/controllers/products.controller.js +83 -0
  98. package/src/modules/products/routes/products.routes.js +5 -5
  99. package/src/modules/products/store/categories.js +9 -9
  100. package/src/modules/products/store/leftovers.js +9 -6
  101. package/src/modules/products/store/products.js +0 -2
  102. package/src/modules/spots/components/layouts/Spots.vue +16 -11
  103. package/src/modules/spots/components/pages/Map.vue +9 -7
  104. package/src/modules/users/components/pages/Profile.vue +15 -5
  105. package/src/modules/users/router/users.js +10 -0
  106. package/src/modules/wallet/components/pages/Wallet.vue +104 -23
@@ -3,7 +3,6 @@
3
3
  <Loader v-if="loading" :status="loadingText" class="pos-fixed"/>
4
4
 
5
5
  <div v-if="!loading && !showInput" class="section">
6
- <Breadcrumbs class="mn-big fill-white t-white"/>
7
6
 
8
7
  <div v-if="!loading" class="mn-big">
9
8
  <InputBig
@@ -14,11 +13,14 @@
14
13
  :action="t('action')"
15
14
  @update:input="inputValue = $event"
16
15
  @action="submitInput"
17
- class="t-black bs-blur-regular w-100"
16
+ class="t-white bs-blur-regular w-100"
18
17
  />
19
18
  </div>
20
19
 
21
- <SectionProduct :product="products.state.current" :recommendation="products.state.current.recommendation" />
20
+ <SectionProduct
21
+ :product="products.state.current"
22
+ :recommendation="products.state.current.recommendation"
23
+ />
22
24
  </div>
23
25
  </div>
24
26
  </template>
@@ -82,8 +82,10 @@
82
82
 
83
83
  <script setup>
84
84
  import { ref, watch } from 'vue'
85
+
85
86
  import Spoiler from "@pf/src/components/Spoiler/Spoiler.vue"
86
87
  import Checkbox from "@pf/src/components/Checkbox/Checkbox.vue"
88
+
87
89
  import { useI18n } from 'vue-i18n'
88
90
 
89
91
  import * as categories from '@pf/src/modules/products/store/categories';
@@ -75,17 +75,29 @@
75
75
  <p v-if="product.localization && product.localization.length > 1 && !recommendation" class="w-100 mn-medium t-transp">
76
76
  {{ t('description') }}
77
77
  </p>
78
- <div class="cols-2 w-100 gap-small mn-semi">
79
- <div v-if="product.information.length > 0" v-for="information in product.information" class="w-100 pd-small radius-small bg-white product-information">
78
+
79
+ <div
80
+ class="cols-2 w-100 gap-small mn-semi"
81
+ >
82
+ <div
83
+ v-if="product.information.length > 0"
84
+ v-for="information in product.information"
85
+ class="w-100 pd-small radius-small bg-white product-information"
86
+ >
80
87
  <p class="t-demi">{{ information.name }}</p>
81
88
  <p>{{ information.value }}</p>
82
89
  </div>
83
90
  </div>
91
+
84
92
  <!-- Actions -->
85
93
  <div class="max-w-33rem mobile-w-100 t-white gap-small cols-2">
86
- <button :disabled="validateToCard(product)" @click="addToCart(product)" class="w-100 mn-r-small bg-main button">{{ t('addtoorder') }}</button>
87
- <!-- <button @click="store.commit('toggleBackCall')" class="w-100 button-grey button">{{ t('fastorder') }}</button> -->
88
- <!-- <AddToFavorites :product="product" /> -->
94
+ <button
95
+ :disabled="validateToCard(product)"
96
+ @click="addToCart(product)"
97
+ class="w-100 mn-r-small bg-main button"
98
+ >
99
+ {{ t('addtoorder') }}
100
+ </button>
89
101
  </div>
90
102
  </div>
91
103
  </div>
@@ -28,8 +28,6 @@ import { ref, watch } from 'vue'
28
28
 
29
29
  import { useI18n } from 'vue-i18n'
30
30
 
31
-
32
- // Пропсы и данные, которые вы передаёте в компонент
33
31
  const props = defineProps({
34
32
  categories: Array,
35
33
  prices: Array,
@@ -1,4 +1,12 @@
1
1
  const {v1: uuidv1, v4: uuidv4, } = require('uuid');
2
+
3
+ const fetch = require('node-fetch')
4
+ const path = require('path');
5
+
6
+ const OpenAI = require("openai");
7
+
8
+ const openai = new OpenAI();
9
+
2
10
  // Factory
3
11
  const controllerFactory = (db) => {
4
12
  const Product = db.product;
@@ -190,6 +198,80 @@ const controllerFactory = (db) => {
190
198
  console.log(products)
191
199
  });
192
200
  };
201
+ const getProductRecommendation = async (req, res) => {
202
+ const { mood } = req.body;
203
+
204
+ try {
205
+ const products = await Product.find({
206
+ status: 'published',
207
+ popularity: { $gt: 10 },
208
+ }).limit(40);
209
+
210
+ if (!products) {
211
+ console.log('no products')
212
+ return res.status(404).send({ message: "Products not found." });
213
+ }
214
+
215
+ const productsList = products.map(p => `
216
+ ${p._id}:
217
+ ${p.name}
218
+ (${p.information[0].value})
219
+ (${p.information[1].value}%)
220
+ (${p.information[2].value})
221
+ `).join(', ');
222
+
223
+ const prompt = `
224
+ 1. На вопрос как клиент хочет себя почувствовать - он ответил "${mood}".
225
+ 2. Вот список товаров в нашем магазине: ${productsList}.
226
+ 3. На основе информации о товарах (сорт, количество THC) и желания пользователя выбери 1 товар который порекомендовать пользователю.
227
+ 4. Ответ должен быть на языке который пользователь использовал в ${mood}.
228
+ 5. Пожалуйста, форматируйте ваш ответ в виде json объекта '{"_id": "_id рекомендтованого товара (он должен соответсовать одному из _id товаров, которые я прислал ","recommendationText": Текст почему именно этот товар'. Напишите только json объект без какого либо еще текста вне него.
229
+ `
230
+
231
+ console.log(prompt)
232
+
233
+ let response;
234
+ let result;
235
+
236
+ while (true) {
237
+ try {
238
+ response = await openai.chat.completions.create({
239
+ model: "gpt-4",
240
+ messages: [{role: "user", content: prompt}],
241
+ });
242
+
243
+ console.log(response)
244
+
245
+ result = JSON.parse(response.choices[0].message.content);
246
+ break;
247
+ } catch (err) {
248
+ if (err instanceof SyntaxError) {
249
+ console.log("Received invalid JSON, retrying...");
250
+ } else {
251
+ console.log(err);
252
+ res.status(500).send({ message: err });
253
+ return;
254
+ }
255
+ }
256
+ }
257
+
258
+ console.log(result._id)
259
+ console.log(result.recommendationText)
260
+
261
+ const recommendedProduct = await Product.findById(result._id);
262
+
263
+ if (!recommendedProduct) {
264
+ console.log(`No product found with _id: ${result._id}`)
265
+ return res.status(404).send({ message: "Recommended product not found." });
266
+ }
267
+
268
+ res.status(200).json({product: recommendedProduct, recommendationText: result.recommendationText});
269
+ } catch (err) {
270
+ console.log(err)
271
+ res.status(500).send({ message: err });
272
+ }
273
+ };
274
+
193
275
  const getProductsPopular = (req, res) => {
194
276
  Product.find({
195
277
  status: 'published',
@@ -305,6 +387,7 @@ const controllerFactory = (db) => {
305
387
  getProducts,
306
388
  getProductsPopular,
307
389
  getProduct,
390
+ getProductRecommendation
308
391
  };
309
392
  };
310
393
 
@@ -1,6 +1,6 @@
1
1
  const controllerFactory = require("../controllers/products.controller");
2
2
 
3
- module.exports = function(app, db) {
3
+ module.exports = function(app, db, allowedOrigins) {
4
4
  const controller = controllerFactory(db);
5
5
 
6
6
  app.use(function(req, res, next) {
@@ -41,10 +41,10 @@ module.exports = function(app, db) {
41
41
  // controller.getProductsPopular
42
42
  // );
43
43
  // // Get recommendation
44
- // app.post(
45
- // "/product/recommended",
46
- // controller.getProductRecommendation
47
- // );
44
+ app.post(
45
+ "/product/recommended",
46
+ controller.getProductRecommendation
47
+ );
48
48
  // // Get product
49
49
  // app.get(
50
50
  // "/products/:_id",
@@ -1,12 +1,12 @@
1
- import { reactive, watch, computed } from "vue";
2
-
3
- import Cookies from "js-cookie";
4
- import axios from "axios";
5
-
6
- import { setError } from "@pf/src/modules/globals/store/globals";
7
-
8
- const clientUrl = process.env.API_URL;
9
- const $axios = axios.create({ baseURL: clientUrl, withCredentials: true });
1
+ /////////////////////////////
2
+ // DEPENDENCIES
3
+ /////////////////////////////
4
+ import { reactive, watch, computed } from "vue";
5
+ import axios from 'axios';
6
+ // Globals
7
+ import { setError } from '@pf/src/modules/globals/store/globals'
8
+ // Setup Axios
9
+ const $axios = axios.create({baseURL: process.env.API_URL, withCredentials: true})
10
10
 
11
11
  const state = reactive({
12
12
  all: [],
@@ -1,9 +1,12 @@
1
- import { reactive, watch } from "vue";
2
- import axios from "axios";
3
- import { setError } from "@pf/src/modules/globals/store/globals";
4
-
5
- const clientUrl = process.env.API_URL;
6
- const $axios = axios.create({ baseURL: clientUrl, withCredentials: true });
1
+ /////////////////////////////
2
+ // DEPENDENCIES
3
+ /////////////////////////////
4
+ import { reactive, watch, computed } from "vue";
5
+ import axios from 'axios';
6
+ // Globals
7
+ import { setError } from '@pf/src/modules/globals/store/globals'
8
+ // Setup Axios
9
+ const $axios = axios.create({baseURL: process.env.API_URL, withCredentials: true})
7
10
 
8
11
  const state = reactive({
9
12
  all: [],
@@ -2,8 +2,6 @@
2
2
  // DEPENDENCIES
3
3
  /////////////////////////////
4
4
  import { reactive, watch, computed } from "vue";
5
- // Dependencies
6
- import Cookies from 'js-cookie'
7
5
  import axios from 'axios';
8
6
  // Globals
9
7
  import { setError } from '@pf/src/modules/globals/store/globals'
@@ -16,13 +16,13 @@
16
16
  <h2 class="t-left">
17
17
  <span class="">Weed in </span>
18
18
 
19
- <span @click="a => { store.globals.state.isLocationPopupOpen = true }" v-if="localPosition.city || localPosition.state || localPosition.country" class="t-semi t-main">
19
+ <span @click="a => { globals.state.isLocationPopupOpen = true }" v-if="localPosition.city || localPosition.state || localPosition.country" class="t-semi t-main">
20
20
  <span v-if="localPosition.city">{{localPosition.city}}, </span>
21
21
  <span v-if="localPosition.state">{{localPosition.state}}, </span>
22
22
  <span v-if="localPosition.country">{{localPosition.country}}</span>
23
23
  </span>
24
24
 
25
- <span v-else @click="a => { store.globals.state.isLocationPopupOpen = true }" class="t-semi t-main">
25
+ <span v-else @click="a => { globals.state.isLocationPopupOpen = true }" class="t-semi t-main">
26
26
  The World
27
27
  </span>
28
28
  </h2>
@@ -43,7 +43,7 @@
43
43
  name="categories"
44
44
  :value="category.url"
45
45
  class="w-100 mn-t-small mn-small bg-white radius-small pd-small"
46
- :radio="store.marketplace.state.filter.categories"
46
+ :radio="marketplace.state.filter.categories"
47
47
  />
48
48
  </Dropdown>
49
49
 
@@ -54,7 +54,7 @@
54
54
  name="prices"
55
55
  :value="price.value"
56
56
  class="w-100 mn-t-small bg-white radius-small pd-small"
57
- :radio="store.marketplace.state.filter.prices"
57
+ :radio="marketplace.state.filter.prices"
58
58
  />
59
59
  </Dropdown>
60
60
 
@@ -65,7 +65,7 @@
65
65
  name="prices"
66
66
  :value="delivery.value"
67
67
  class="w-100 mn-t-small bg-white radius-small pd-small"
68
- :radio="store.marketplace.state.filter.delivery"
68
+ :radio="marketplace.state.filter.delivery"
69
69
  />
70
70
  </Dropdown>
71
71
  <!-- Reset filter -->
@@ -124,13 +124,18 @@
124
124
  import Footer from '@pf/src/components/Footer/Footer.vue'
125
125
  import Dropdown from "@pf/src/components/Dropdown/Dropdown.vue";
126
126
 
127
+
128
+ import * as globals from '@pf/src/modules/globals/store/globals';
129
+ import * as categories from '@pf/src/modules/products/store/categories';
130
+ import * as marketplace from '@pf/src/modules/marketplace/store/marketplace';
131
+
127
132
  // Accessing router and store
128
133
  const route = useRoute()
129
134
  const router = useRouter()
130
135
 
131
136
 
132
137
  // Accessing state
133
- const categories = computed(() => store.categories.state.all)
138
+ const categories2 = computed(() => categories.state.all)
134
139
 
135
140
  const delivery = [
136
141
  { label: 'Pickup', value: 'pickup' },
@@ -179,15 +184,15 @@
179
184
  delivery: query.delivery ? query.delivery.split(',') : [],
180
185
  // Продолжайте этот паттерн для остальных полей фильтра
181
186
  };
182
- store.marketplace.state.filter = newFilterValue;
187
+ marketplace.state.filter = newFilterValue;
183
188
  }
184
189
 
185
190
 
186
191
  // Data fetching
187
- await store.categories.actions.fetchCategories()
192
+ await categories.actions.fetchCategories()
188
193
  })
189
194
 
190
- watch(() => store.marketplace.state.filter, (newFilterValue, oldFilterValue) => {
195
+ watch(() => marketplace.state.filter, (newFilterValue, oldFilterValue) => {
191
196
  // Переводим фильтр в формат query
192
197
  const query = { ...route.query };
193
198
 
@@ -218,7 +223,7 @@
218
223
  .replace(/[^a-z0-9-]/g, ''); // Удаление всех символов, которые не являются буквами, цифрами или дефисами
219
224
  }
220
225
 
221
- watch(() => store.globals.state.position, (newPosition) => {
226
+ watch(() => globals.state.position, (newPosition) => {
222
227
  // get the current route
223
228
  const currentRoute = { ...router.currentRoute.value };
224
229
 
@@ -299,7 +304,7 @@
299
304
  }
300
305
  }
301
306
 
302
- store.categories.state.all.forEach( category => {
307
+ categories.state.all.forEach( category => {
303
308
  category.localization.forEach( localization => {
304
309
  text.messages[localization.locale].categories.push(localization.text)
305
310
  })
@@ -5,14 +5,16 @@
5
5
  <script setup>
6
6
  import { onMounted, watch, ref } from 'vue';
7
7
  import { useRoute, useRouter } from 'vue-router'
8
+
8
9
  import { state, actions } from '@pf/src/modules/organizations/store/organizations'
9
10
 
11
+ import * as globals from '@pf/src/modules/globals/store/globals';
12
+
10
13
  let map = ref(null);
11
14
  let markers = ref([]);
12
15
 
13
16
  const router = useRouter();
14
17
  const route = useRoute();
15
- const store = useStore()
16
18
 
17
19
  let skip = ref(0);
18
20
  let limit = ref(50);
@@ -22,18 +24,18 @@ const props = defineProps({
22
24
  });
23
25
 
24
26
  onMounted(async () => {
25
- let lat = parseFloat(route.query.lat || store.globals.state.position.location.lat || '0');
26
- let lng = parseFloat(route.query.lng || store.globals.state.position.location.lng || '0');
27
+ let lat = parseFloat(route.query.lat || globals.state.position.location.lat || '0');
28
+ let lng = parseFloat(route.query.lng || globals.state.position.location.lng || '0');
27
29
 
28
30
  let zoomLevel;
29
31
 
30
- if (route.params.location || store.globals.state.position.location) {
32
+ if (route.params.location || globals.state.position.location) {
31
33
  zoomLevel = 13; // Уровень детализации для координат
32
- } else if (route.params.country || store.globals.state.position.country) {
34
+ } else if (route.params.country || globals.state.position.country) {
33
35
  zoomLevel = 10; // Уровень детализации для города
34
- } else if (route.params.state || store.globals.state.position.state) {
36
+ } else if (route.params.state || globals.state.position.state) {
35
37
  zoomLevel = 8; // Уровень детализации для штата
36
- } else if (route.params.city || store.globals.state.position.city) {
38
+ } else if (route.params.city || globals.state.position.city) {
37
39
  zoomLevel = 5; // Уровень детализации для страны
38
40
  } else {
39
41
  zoomLevel = 2; // Дефолтный уровень зума
@@ -173,28 +173,38 @@
173
173
  </Menu>
174
174
 
175
175
  <Menu class="mn-regular bg-grey">
176
+
176
177
  <MenuItem @click="router.push({name: 'User Events', params: {_id: route.params._id}})" class="cursor-pointer">
177
178
  <IconEvents class="i-semi" :icon="true"/>
178
179
  <span>Events</span>
179
180
  </MenuItem>
181
+
180
182
  <MenuItem @click="router.push({name: 'User Organizations', params: {_id: route.params._id}})" class="cursor-pointer">
181
183
  <IconGroups class="i-semi" :icon="true"/>
182
184
  <span>Groups</span>
183
185
  </MenuItem>
186
+
184
187
  <MenuItem @click="router.push({name: 'User Blogposts', params: {_id: route.params._id}})" class="cursor-pointer">
185
188
  <IconCommunity class="i-semi" :icon="true"/>
186
189
  <span>Posts</span>
187
190
  </MenuItem>
188
191
  </Menu>
189
- <!--
190
- <Menu>
191
- <MenuItem @click="router.push({name: 'User Comments', params: {_id: route.params._id}})" class="cursor-pointer">
192
+
193
+
194
+
195
+ <Menu class="mn-regular bg-grey">
196
+ <MenuItem @click="router.push({name: 'User Wallet', params: {_id: route.params._id}})" class="cursor-pointer">
197
+ <IconGroups class="i-semi" :icon="true"/>
198
+ <span>Wallet</span>
199
+ </MenuItem>
200
+
201
+ <!-- <MenuItem @click="router.push({name: 'User Comments', params: {_id: route.params._id}})" class="cursor-pointer">
192
202
  <span>Comments</span>
193
203
  </MenuItem>
194
204
  <MenuItem @click="router.push({name: 'User Likes', params: {_id: route.params._id}})" class="cursor-pointer">
195
205
  <span>Likes</span>
196
- </MenuItem>
197
- </Menu> -->
206
+ </MenuItem> -->
207
+ </Menu>
198
208
 
199
209
  <Menu
200
210
  v-if="auth.state.user._id === route.params._id"
@@ -54,6 +54,16 @@ const users = [{
54
54
  }
55
55
  },
56
56
  component: () => import(/* webpackChunkName: "profile" */ '../components/pages/ProfileOrganizations.vue'),
57
+ },{
58
+ path: 'profile/:_id/wallet',
59
+ name: 'User Wallet',
60
+ meta: {
61
+ title: {
62
+ en: 'Wallet',
63
+ ru: 'Кошелек'
64
+ }
65
+ },
66
+ component: () => import(/* webpackChunkName: "profile" */ '@pf/src/modules/wallet/components/pages/Wallet.vue'),
57
67
  }
58
68
  // ,{
59
69
  // path: 'profile/:_id/likes',
@@ -1,50 +1,126 @@
1
1
  <template>
2
- <section class="section">
3
- <h1 class="">Wallet</h1>
4
- <p class="mn-big p-big">Earn Weeder Token Crypto with buying our weed, use it as money when buying our products or withdraw and trade</p>
5
-
6
- <div class="cols-3">
7
- <div class="pd-medium radius-medium br-1px br-solid br-grey-transp">
8
- <h3 class="mn-small">You own: 0.14% of Weeder</h3>
9
- <p class="t-main t-semi mn-small">0.0032 WDT</p>
10
- <button class="w-100 bg-main button">Get More</button>
2
+ <section class="pd-big">
3
+ <h1 class="mn-small">
4
+ Your Wallet
5
+ </h1>
6
+
7
+ <p class="mn-semi p-big">
8
+ Earn Weeder Token Crypto with buying our weed, use it as money when buying our products or withdraw and trade
9
+ </p>
10
+
11
+ <div class="mn-semi flex-nowrap flex gap-thin">
12
+ <div
13
+ v-if="!account"
14
+ class="w-100 pd-medium radius-medium t-center bg-grey"
15
+ >
16
+ <h3 class="mn-small">Make first order and start earning Weeder Token </h3>
17
+ <!-- <p class="w-max-25r p-big t-transp mn-small">You can also connect a wallet in advance, to which you can withdraw your earned OZET</p> -->
18
+ <button class="mn-l-auto mn-r-auto bg-main button">Explore marketplace</button>
11
19
  </div>
12
20
 
13
- <div class="pd-medium radius-medium br-1px br-solid br-grey-transp">
14
- <h3 class="mn-small">You own: 0.14% of Weeder</h3>
15
- <p class="t-main t-semi mn-small">0.0032 WDT</p>
21
+ <div
22
+ v-if="account"
23
+ class="w-100 pd-medium radius-medium bg-grey"
24
+ >
25
+ <p class="h4 mn-thin">You own: </p>
26
+ <h3 class="mn-small">0.14% of Weeder</h3>
27
+ <!-- <p class="p-big mn-small">0.0032 WDT</p> -->
16
28
  <button class="w-100 bg-main button">Get More</button>
17
29
  </div>
18
30
 
19
- <div class="pd-medium radius-medium br-1px br-solid br-grey-transp">
20
- <h3 class="mn-small">You own: 0.14% of Weeder</h3>
21
- <p class="t-main t-semi mn-small">0.0032 WDT</p>
31
+ <div
32
+ v-if="account"
33
+ class="w-100 pd-medium radius-medium bg-grey"
34
+ >
35
+ <p class="h4 mn-thin">You earn: </p>
36
+ <h3 class="mn-small">245.43 WDT</h3>
37
+ <!-- <p class="p-big mn-small">0.0032 WDT</p> -->
22
38
  <button class="w-100 bg-main button">Get More</button>
23
39
  </div>
40
+
41
+ <div class="w-50 bg-black radius-semi pd-medium t-white">
42
+ <p class="h4 mn-thin">Your Metamask</p>
43
+
44
+ <div v-if="account" class="mn-small pd-small br-solid br-1px br-white-transp-10 radius-small">
45
+ {{account}}
46
+ </div>
47
+
48
+ <p v-if="!account" class="p-medium t-transp mn-small">Connect Metamask to withdrawal your earnings.</p>
49
+
50
+ <button
51
+ v-if="!account"
52
+ @click="connectWallet"
53
+ class="w-100 button"
54
+ >
55
+ Connect Wallet
56
+ </button>
57
+
58
+ <button
59
+ v-if="account"
60
+ @click="disconnectWallet"
61
+ class="w-100 bg-red button"
62
+ >
63
+ Disonnect Wallet
64
+ </button>
65
+
66
+ </div>
24
67
  </div>
68
+
69
+
70
+ <h3
71
+ class="mn-small"
72
+ >
73
+ Incomes
74
+ </h3>
75
+
76
+ <section class="cols-4 gap-thin">
77
+ <div
78
+ class="pd-medium radius-medium bg-grey"
79
+ v-for="income in [{
80
+ balance: 34,
81
+ type: 'income',
82
+ reason: 'order',
83
+ target: 'ef34dsdase4389snjnu (_id)'
84
+ },{
85
+ balance: 25,
86
+ type: 'income',
87
+ reason: 'post',
88
+ target: 'ef34dsdase4389snjnu (_id)'
89
+ },{
90
+ balance: 17,
91
+ type: 'income',
92
+ reason: 'comment',
93
+ target: 'ef34dsdase4389snjnu (_id)'
94
+ },{
95
+ balance: 43,
96
+ type: 'event',
97
+ reason: 'order',
98
+ target: 'ef34dsdase4389snjnu (_id)'
99
+ }]"
100
+ >
101
+ <h3 class="mn-small">+ {{income.balance}} WDT</h3>
102
+ <p class="p-small mn-small">For {{income.reason}} {{income.target}}</p>
103
+ </div>
104
+ </section>
105
+
106
+
25
107
  </section>
26
108
  </template>
27
109
 
28
110
 
29
111
  <script setup>
30
- import { computed, onMounted,reactive, ref,toRefs } from 'vue'
31
112
  import Web3 from 'web3'
32
113
 
114
+ import { computed, onMounted,reactive, ref,toRefs } from 'vue'
33
115
 
34
116
  import { useRoute,useRouter } from 'vue-router'
35
- import { useStore } from '@/store';
36
-
37
- const store = useStore()
38
117
 
39
118
  const route = useRoute()
40
119
 
41
- let account = ref(null)
42
120
  let connected = ref(false);
43
121
 
44
122
  const web3 = new Web3(Web3.givenProvider || 'http://localhost:8080');
45
- const accounts = await web3.eth.requestAccounts();
46
-
47
- account = accounts[0];
123
+ const account = ref(null)
48
124
  /////////////////////////////
49
125
  // METHODS
50
126
  /////////////////////////////
@@ -58,6 +134,11 @@ function connect() {
58
134
  }
59
135
  }
60
136
 
137
+ async function connectWallet () {
138
+ const accounts = await web3.eth.requestAccounts();
139
+
140
+ account.value = accounts[0];
141
+ }
61
142
  /////////////////////////////
62
143
  // MOUNTED
63
144
  /////////////////////////////