@ozdao/prometheus-framework 0.1.38 → 0.1.40
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/ButtonToggleMembership-738720bd.js +1 -0
- package/dist/ButtonToggleMembership-e337e704.mjs +90 -0
- package/dist/CardBlogpost-ae3b4d23.js +1 -0
- package/dist/CardBlogpost-c7adb0a7.mjs +246 -0
- package/dist/CardBlogpost-d6f49156.mjs +246 -0
- package/dist/CardBlogpost-f308ff64.js +1 -0
- package/dist/CardOrganization-22beb83d.js +1 -0
- package/dist/CardOrganization-ae384e54.mjs +234 -0
- package/dist/Chips-3a07f374.js +1 -0
- package/dist/Chips-a8681edd.mjs +213 -0
- package/dist/Chips-edf2b573.js +1 -0
- package/dist/Chips-f06ec38f.mjs +213 -0
- package/dist/Community-04b25965.mjs +130 -0
- package/dist/Community-2f6fee0f.js +1 -0
- package/dist/Community-72dbb933.js +1 -0
- package/dist/Community-b4d10da6.mjs +130 -0
- package/dist/Dashboard-73b50724.js +1 -0
- package/dist/Dashboard-bc81b5f6.mjs +151 -0
- package/dist/Dropdown-ef2df9a9.mjs +169 -0
- package/dist/Dropdown-f2564c92.js +1 -0
- package/dist/Events-0c6e3ef4.mjs +134 -0
- package/dist/Events-41d71b0e.js +1 -0
- package/dist/Events-4742f070.js +1 -0
- package/dist/Events-af7170ed.mjs +134 -0
- package/dist/Feed-04fe1f7a.mjs +361 -0
- package/dist/Feed-09b0790d.js +1 -0
- package/dist/Feed-12b12380.js +1 -0
- package/dist/Feed-23758089.mjs +124 -0
- package/dist/Feed-36e83be3.mjs +156 -0
- package/dist/Feed-5653cf8b.js +1 -0
- package/dist/Feed-585d5821.mjs +124 -0
- package/dist/Feed-5a359bb7.js +1 -0
- package/dist/Feed-6ca0541a.js +1 -0
- package/dist/Feed-807d265b.mjs +156 -0
- package/dist/Feed-90f74d6c.mjs +361 -0
- package/dist/Feed-a47977d3.js +1 -0
- package/dist/Image-268e2a1b.js +9 -0
- package/dist/Image-39955d9d.mjs +480 -0
- package/dist/Image-5423e8ce.mjs +480 -0
- package/dist/Image-c2d190d8.js +9 -0
- package/dist/LeftoverAdd-21311275.js +1 -0
- package/dist/LeftoverAdd-ccf4595f.mjs +228 -0
- package/dist/Members-7251dd52.mjs +109 -0
- package/dist/Members-9b013515.js +1 -0
- package/dist/Members-d35ab7e8.js +1 -0
- package/dist/Members-d64149f3.mjs +109 -0
- package/dist/Menu-93d34d9f.js +1 -0
- package/dist/Menu-eaf6b44c.mjs +13 -0
- package/dist/MenuItem-4a5881bd.mjs +85 -0
- package/dist/MenuItem-f35cad93.js +1 -0
- package/dist/Organizations-0fd5bc8b.mjs +72 -0
- package/dist/Organizations-a964d4b6.mjs +72 -0
- package/dist/Organizations-d360c360.js +1 -0
- package/dist/Organizations-ed6d36d6.js +1 -0
- package/dist/Popup-0d8e1392.mjs +96 -0
- package/dist/Popup-eb11fa82.js +1 -0
- package/dist/Product-299070ad.mjs +652 -0
- package/dist/Product-aacb05f3.js +7 -0
- package/dist/Product-e43dd2f1.js +7 -0
- package/dist/Product-e4e583f0.mjs +652 -0
- package/dist/ProductEdit-70bed802.mjs +296 -0
- package/dist/ProductEdit-e5a2e0f6.js +1 -0
- package/dist/ProductsBackoffice-3c182d6a.mjs +86 -0
- package/dist/ProductsBackoffice-b684913d.js +1 -0
- package/dist/ProfileBlogposts-6bf526fb.js +1 -0
- package/dist/ProfileBlogposts-8f6191d6.js +1 -0
- package/dist/ProfileBlogposts-aa839fcb.mjs +77 -0
- package/dist/ProfileBlogposts-d4b17535.mjs +77 -0
- package/dist/ProfileEvents-3eeb4320.mjs +68 -0
- package/dist/ProfileEvents-6b3fb52e.mjs +68 -0
- package/dist/ProfileEvents-893285bb.js +1 -0
- package/dist/ProfileEvents-90e09978.js +1 -0
- package/dist/ProfileOrganizations-738f444a.js +1 -0
- package/dist/ProfileOrganizations-c4fb03a1.mjs +72 -0
- package/dist/ProfileOrganizations-e838925f.js +1 -0
- package/dist/ProfileOrganizations-edf657ca.mjs +72 -0
- package/dist/Publics-a31d7fe7.js +1 -0
- package/dist/Publics-a8f31413.mjs +45 -0
- package/dist/Wallet-2043b611.mjs +24682 -0
- package/dist/Wallet-8fa7386a.js +55 -0
- package/dist/auth-076a83d0.mjs +625 -0
- package/dist/auth-df5a20c6.js +7 -0
- package/dist/auth.client.cjs +1 -1
- package/dist/auth.client.js +4 -4
- package/dist/auth.validation-80b133df.js +1 -0
- package/dist/auth.validation-fd9ae66f.mjs +24 -0
- package/dist/backoffice.client.cjs +1 -1
- package/dist/backoffice.client.js +12 -12
- package/dist/categories-4327a81c.js +1 -0
- package/dist/categories-52a561a4.mjs +122 -0
- package/dist/community.client.cjs +1 -1
- package/dist/community.client.js +205 -198
- package/dist/events.client.cjs +2 -2
- package/dist/events.client.js +17 -20
- package/dist/landing.client.cjs +1 -1
- package/dist/landing.client.js +64 -40
- package/dist/legal.client.cjs +1 -1
- package/dist/legal.client.js +5 -6
- package/dist/main.css +1 -1
- package/dist/modules/gallery/components/pages/Gallery.vue.d.ts +2 -0
- package/dist/modules/gallery/components/sections/GalleryWithCategories.vue.d.ts +2 -0
- package/dist/modules/globals/components/sections/Title.vue.d.ts +6 -0
- package/dist/organizations-966e1cd2.mjs +122 -0
- package/dist/organizations-d12c42b6.js +1 -0
- package/dist/organizations.client-63b476ff.mjs +2996 -0
- package/dist/organizations.client-696eacbb.js +3 -0
- package/dist/organizations.client-8f263e28.js +3 -0
- package/dist/organizations.client-9ffc023f.mjs +2996 -0
- package/dist/organizations.client.cjs +1 -1
- package/dist/organizations.client.js +49 -54
- package/dist/products-7e4253eb.js +1 -0
- package/dist/products-aabe5c02.mjs +108 -0
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +2 -2
- package/dist/states.validation-4594b33c.mjs +13 -0
- package/dist/states.validation-69003e66.js +1 -0
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +286 -202
- package/package.json +1 -5
- package/src/components/LocationMarker/LocationMarker.vue +1 -1
- package/src/components/LocationSelection/LocationSelection.vue +1 -1
- package/src/components/Navigation/Navigation.vue +12 -1
- package/src/modules/auth/store/auth.js +7 -4
- package/src/modules/files/middlewares/server/md.js +1 -0
- package/src/modules/gallery/components/pages/Gallery.vue +21 -0
- package/src/modules/gallery/components/sections/GalleryWithCategories.vue +408 -0
- package/src/modules/gallery/gallery.client.js +11 -14
- package/src/modules/gallery/router/gallery.router.js +10 -0
- package/src/modules/globals/components/sections/Title.vue +22 -0
- package/src/modules/marketplace/router/marketplace.js +4 -3
- package/src/modules/organizations/components/sections/Feed.vue +2 -2
- package/src/modules/products/components/pages/ProductRecommmendation.vue +5 -3
- package/src/modules/products/components/sections/SectionProduct.vue +17 -5
- package/src/modules/products/controllers/products.controller.js +83 -0
- package/src/modules/products/routes/products.routes.js +5 -5
- package/src/modules/spots/components/layouts/Spots.vue +16 -11
- package/src/modules/spots/components/pages/Map.vue +9 -7
- package/src/modules/users/components/pages/Profile.vue +15 -5
- package/src/modules/users/router/users.js +10 -0
- package/src/modules/wallet/components/pages/Wallet.vue +104 -23
@@ -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
|
-
|
79
|
-
|
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
|
87
|
-
|
88
|
-
|
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>
|
@@ -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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
app.post(
|
45
|
+
"/product/recommended",
|
46
|
+
controller.getProductRecommendation
|
47
|
+
);
|
48
48
|
// // Get product
|
49
49
|
// app.get(
|
50
50
|
// "/products/:_id",
|
@@ -16,13 +16,13 @@
|
|
16
16
|
<h2 class="t-left">
|
17
17
|
<span class="">Weed in </span>
|
18
18
|
|
19
|
-
<span @click="a => {
|
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 => {
|
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="
|
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="
|
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="
|
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
|
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
|
-
|
187
|
+
marketplace.state.filter = newFilterValue;
|
183
188
|
}
|
184
189
|
|
185
190
|
|
186
191
|
// Data fetching
|
187
|
-
await
|
192
|
+
await categories.actions.fetchCategories()
|
188
193
|
})
|
189
194
|
|
190
|
-
watch(() =>
|
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(() =>
|
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
|
-
|
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 ||
|
26
|
-
let lng = parseFloat(route.query.lng ||
|
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 ||
|
32
|
+
if (route.params.location || globals.state.position.location) {
|
31
33
|
zoomLevel = 13; // Уровень детализации для координат
|
32
|
-
} else if (route.params.country ||
|
34
|
+
} else if (route.params.country || globals.state.position.country) {
|
33
35
|
zoomLevel = 10; // Уровень детализации для города
|
34
|
-
} else if (route.params.state ||
|
36
|
+
} else if (route.params.state || globals.state.position.state) {
|
35
37
|
zoomLevel = 8; // Уровень детализации для штата
|
36
|
-
} else if (route.params.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
|
-
|
191
|
-
|
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="
|
3
|
-
<h1 class="">
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
14
|
-
|
15
|
-
|
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
|
20
|
-
|
21
|
-
|
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
|
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
|
/////////////////////////////
|