@ozdao/prometheus-framework 0.2.50 → 0.2.51

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <header
3
+ class="pos-sticky w-100 z-index-4 br-b br-solid br-black-transp flex-center flex t-center pd-medium bg-white"
4
+ >
5
+
6
+ <transition name="slideIn" mode="out-in">
7
+
8
+ <svg
9
+ v-if="route.meta.title_hide"
10
+ @click="handleToggle()"
11
+ class="header-profile" width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path fill="rgb(var(--main))" d="M13.0005 1.3116e-05C10.3952 -0.0036893 7.84916 0.776533 5.6933 2.23923C3.53744 3.70193 1.87154 5.77943 0.912205 8.20159C-0.0471263 10.6238 -0.255503 13.2785 0.31417 15.8207C0.883843 18.3629 2.20521 20.6749 4.10645 22.456C4.16716 22.5296 4.23824 22.5939 4.31745 22.647C6.69461 24.8048 9.79003 26.0001 13.0005 26.0001C16.2109 26.0001 19.3063 24.8048 21.6835 22.647C21.7624 22.5939 21.8331 22.5295 21.8935 22.456C23.7946 20.6749 25.116 18.363 25.6857 15.821C26.2554 13.2789 26.0471 10.6242 25.0879 8.20206C24.1287 5.77994 22.4629 3.70243 20.3072 2.23965C18.1515 0.77688 15.6056 -0.0034882 13.0005 1.3116e-05ZM5.96345 21.445C6.30727 20.174 7.05858 19.0509 8.10211 18.248C9.14565 17.445 10.4238 17.0066 11.7405 17H14.2605C15.5774 17.006 16.856 17.444 17.8999 18.2468C18.9439 19.0496 19.6955 20.1728 20.0395 21.444C18.0658 23.095 15.5746 23.9996 13.0015 23.9996C10.4283 23.9996 7.93709 23.096 5.96345 21.445ZM21.6005 19.837C20.9791 18.4049 19.9541 17.1848 18.6506 16.3258C17.3471 15.4668 15.8215 15.0061 14.2605 15H11.7405C10.1789 15.0059 8.65303 15.4669 7.34941 16.3265C6.04579 17.1861 5.02101 18.4071 4.40045 19.84C3.10942 18.2212 2.30151 16.2708 2.06964 14.2132C1.83777 12.1556 2.19136 10.0744 3.08975 8.20883C3.98813 6.34326 5.39482 4.76915 7.14805 3.66751C8.90128 2.56587 10.9298 1.98144 13.0005 1.98144C15.0711 1.98144 17.0996 2.56587 18.8529 3.66751C20.6061 4.76915 22.0128 6.34326 22.9112 8.20883C23.8095 10.0744 24.1631 12.1556 23.9313 14.2132C23.6994 16.2708 22.8915 18.2212 21.6005 19.84V19.837Z"/>
14
+ <path fill="rgb(var(--main))" d="M13.0005 4C12.0116 4 11.0449 4.29324 10.2226 4.84265C9.40039 5.39206 8.75953 6.17295 8.38109 7.08658C8.00265 8.00021 7.90364 9.00555 8.09656 9.97545C8.28949 10.9454 8.76569 11.8363 9.46496 12.5355C10.1642 13.2348 11.0551 13.711 12.025 13.9039C12.9949 14.0969 14.0003 13.9978 14.9139 13.6194C15.8275 13.241 16.6084 12.6001 17.1578 11.7779C17.7072 10.9556 18.0005 9.98891 18.0005 9C17.9989 7.67441 17.4716 6.40356 16.5343 5.46622C15.5969 4.52888 14.3261 4.00159 13.0005 4ZM13.0005 12C12.4071 12 11.8271 11.8241 11.3338 11.4944C10.8404 11.1648 10.4559 10.6962 10.2289 10.1481C10.0018 9.59987 9.94238 8.99667 10.0581 8.41473C10.1739 7.83279 10.4596 7.29824 10.8792 6.87868C11.2987 6.45912 11.8333 6.1734 12.4152 6.05764C12.9972 5.94189 13.6004 6.0013 14.1485 6.22836C14.6967 6.45542 15.1653 6.83994 15.4949 7.33329C15.8245 7.82664 16.0005 8.40666 16.0005 9C16.0005 9.79565 15.6844 10.5587 15.1218 11.1213C14.5592 11.6839 13.7961 12 13.0005 12Z"/>
15
+ </svg>
16
+
17
+
18
+ <svg
19
+ v-else
20
+ @click="handleBackNavigation()"
21
+ class="i-semi header-arrow"
22
+ width="12"
23
+ height="22"
24
+ viewBox="0 0 12 22"
25
+ fill="none"
26
+ xmlns="http://www.w3.org/2000/svg"
27
+ >
28
+ <path fill="rgb(var(--main))" d="M9.70312 20.7969C10.125 21.2188 10.8281 21.2188 11.2969 20.7969C11.7188 20.375 11.7188 19.6719 11.2969 19.2031L3.42188 11L11.2969 2.79688C11.7188 2.32813 11.7188 1.625 11.2969 1.20313C10.8281 0.734377 10.125 0.781252 9.70312 1.20313L1.07812 10.2031C0.84375 10.4375 0.75 10.7188 0.75 11C0.75 11.2813 0.84375 11.5625 1.07812 11.7969L9.70312 20.7969Z" />
29
+ </svg>
30
+ </transition>
31
+
32
+ <transition name="slideIn" mode="out-in">
33
+ <div :key="route.meta.title_hide" class="header-title">
34
+ <img v-if="route.meta.title_hide" class="h-2r" src="/logo/logotype.svg">
35
+
36
+ <p v-else class="t-semi h-2r h4 d-block" >
37
+ {{route.meta.title[locale.toLowerCase()]}}
38
+ </p>
39
+ </div>
40
+ </transition>
41
+ </header>
42
+ </template>
43
+
44
+ <script setup>
45
+ import { ref, onMounted, onUnmounted } from 'vue'
46
+ import { useRoute, useRouter } from 'vue-router'
47
+ import { useI18n } from 'vue-i18n';
48
+ import { useStore } from '@/store';
49
+
50
+
51
+ const router = useRouter()
52
+ const route = useRoute()
53
+ const store = useStore()
54
+
55
+ const { t, mergeLocaleMessage, locale } = useI18n();
56
+
57
+ function handleBackNavigation() {
58
+ if (route.query?.afterAuth) {
59
+ router.push({name: 'Home'})
60
+ } else {
61
+ router.back();
62
+ }
63
+ }
64
+
65
+ function handleToggle() {
66
+ if (store.auth.state.access.status === false) {
67
+ router.push({name: 'Sign In'})
68
+ } else {
69
+ router.push({ name: 'User Profile', params: { _id: store.auth.state.user._id }})
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <style lang="scss">
75
+ // * {
76
+ // -ms-overflow-style: none; /* IE and Edge */
77
+ // scrollbar-width: none; /* Firefox */
78
+ // }
79
+
80
+ // *::-webkit-scrollbar {
81
+ // display: none; /* Chrome, Safari and Opera*/
82
+ // }
83
+
84
+ // #header {
85
+ // top: 0;
86
+ // // height: 6rem;
87
+ // // padding-top: 4rem;
88
+ // position: fixed;
89
+ // width: 100%;
90
+ // }
91
+ .header-arrow {
92
+ position: absolute;
93
+ left: 1.25rem;
94
+ height: 2rem;
95
+ }
96
+
97
+ .header-profile {
98
+ position: absolute;
99
+ right: 1.25rem;
100
+ height: 2rem;
101
+ }
102
+
103
+ .header-title {
104
+ pointer-events: none;
105
+ }
106
+
107
+ .slideIn-enter-active,
108
+ .slideIn-leave-active {
109
+ transition: all 0.33s cubic-bezier(0.4, 0, 0.2, 1);
110
+ }
111
+
112
+ .slideIn-enter-from,
113
+ .slideIn-leave-to {
114
+ opacity: 0;
115
+ transform: translateX(50px);
116
+
117
+ span { position: absolute; }
118
+ }
119
+
120
+ .slideY-enter-active,
121
+ .slideY-leave-active {
122
+ transition: all 0.33s cubic-bezier(0.4, 0, 0.2, 1);
123
+ }
124
+
125
+ .slideY-enter-from,
126
+ .slideY-leave-to {
127
+ opacity: 0;
128
+ transform: translateY(50px);
129
+
130
+ span { position: absolute; }
131
+ }
132
+ </style>
@@ -0,0 +1,195 @@
1
+ <template>
2
+ <div class="pos-fixed pos-t-0 pos-l-0 w-100 h-100vh z-index-6 bg-white flex embla" ref="emblaNode">
3
+ <div class="w-100 embla__container z-index-1">
4
+ <div
5
+ v-for="(slide, index) in walkthrough"
6
+ :key="index"
7
+ class="flex-center pd-thin t-center flex-column flex embla__slide"
8
+ :style="{ opacity: tweenSlides.length ? tweenSlides[index] : undefined, transform: tweenSlides[index] ? `scale(${tweenSlides[index]})` : '' }"
9
+ >
10
+ <img class="w-100" :src="require(`@/assets/images/walkthrough/walkthrough_${index}.png`).default">
11
+ <h3 class="mn-b-thin">{{slide.title}}</h3>
12
+ <p class="p-big t-transp">{{slide.subtitle}}</p>
13
+ </div>
14
+
15
+ <div
16
+ class="flex-center flex-column flex pd-big embla__slide"
17
+ >
18
+ <img
19
+ src="/logo/logo_square.svg"
20
+ class="i-extra radius-medium mn-b-small"
21
+ >
22
+ <h2 class="t-center mn-b-small">Welcome to The&nbsp;Commune</h2>
23
+ <p class="p-medium t-transp mn-b-semi mn-r-auto mn-l-auto t-center">Join our community to connect, share, and learn from the best. Discover new opportunities and grow with us!</p>
24
+
25
+ <button @click="openFirstRoute('Sign Up')" class="w-100 bg-main button mn-b-thin">Sign Up</button>
26
+ <button @click="openFirstRoute('Sign In')" class="w-100 bg-white button mn-b-semi">Sign In</button>
27
+
28
+ <p class="p-medium text-center mn-b-thin">Or explore as a guest:</p>
29
+ <button @click="setFirstUseFalse()" class="button bg-white w-100">Continue without registration</button>
30
+ </div>
31
+
32
+ </div>
33
+
34
+ <WavesBackground
35
+ :style="{ transform: tweenValues[0] ? `translateX(${tweenValues[0]}%)` : '' }"
36
+ class="pos-fixed pos-t-0 pos-l-0 z-index-0"
37
+ />
38
+ <!-- <ColorsBackground
39
+ :style="{ transform: tweenValues[0] ? `translateX(${tweenValues[0]}%)` : '' }"
40
+ class="pos-fixed pos-t-0 pos-l-0 z-index-0"
41
+ /> -->
42
+
43
+ <div class="z-index-5 flex-nowrap flex flex-center gap-small w-100 embla__dots">
44
+ <div
45
+ v-for="(snap, index) in scrollSnaps"
46
+ :key="index"
47
+ @click="scrollTo(index)"
48
+ :class="[
49
+ 'embla__dot i-small radius-extra br-solid br-main br-2px',
50
+ { 'bg-grey': index !== selectedIndex },
51
+ { 'bg-main': index === selectedIndex }
52
+ ]"
53
+ >
54
+ </div>
55
+
56
+ <div @click.native="setFirstUseFalse()" class="pd-small radius-small br-solid br-main br-2px uppercase t-semi t-main pos-absolute pos-r-10">
57
+ skip
58
+ </div>
59
+ </div>
60
+ </div>
61
+
62
+ </template>
63
+
64
+ <script setup>
65
+ import { ref, onMounted } from 'vue';
66
+ import { useRoute, useRouter } from 'vue-router'
67
+
68
+ import emblaCarouselVue from 'embla-carousel-vue'; // Assuming a Vue version exists
69
+
70
+ import WavesBackground from '@/components/icons/backgrounds/WavesBackground.vue'
71
+ import ColorsBackground from '@/components/icons/backgrounds/ColorsBackground.vue'
72
+
73
+ const props = defineProps(['slides', 'options']);
74
+ const emits = defineEmits(['updateFirstUse'])
75
+ const router = useRouter()
76
+
77
+ // Set firstUse
78
+ import { Preferences } from '@capacitor/preferences';
79
+
80
+ async function setFirstUseFalse() {
81
+ await Preferences.set({
82
+ key: 'first-use',
83
+ value: JSON.stringify(false),
84
+ });
85
+
86
+ emits('updateFirstUse', false);
87
+ }
88
+
89
+ async function openFirstRoute(routeName) {
90
+ await router.push({name: routeName})
91
+
92
+ await Preferences.set({
93
+ key: 'first-use',
94
+ value: JSON.stringify(false),
95
+ });
96
+
97
+ emits('updateFirstUse', false);
98
+ }
99
+ // Set Slider
100
+ let walkthrough = [{
101
+ title: 'Communicate',
102
+ subtitle: 'Write posts, comments and put likes.'
103
+ },{
104
+ title: 'Party & Fun',
105
+ subtitle: 'Check the calendar for new events.'
106
+ },{
107
+ title: 'Discover',
108
+ subtitle: 'Browse the gallery of photos.'
109
+ }]
110
+
111
+ const [emblaNode, emblaApi] = emblaCarouselVue({ loop: false })
112
+
113
+ const selectedIndex = ref(0);
114
+ const scrollSnaps = ref([]);
115
+ const TWEEN_FACTOR = 3
116
+ const tweenValues = ref([])
117
+ const tweenSlides = ref([])
118
+
119
+ const scrollTo = (index) => emblaApi.value && emblaApi.value.scrollTo(index);
120
+
121
+ const onInit = (embla) => {
122
+ scrollSnaps.value = emblaApi.value.scrollSnapList();
123
+ };
124
+
125
+ const onSelect = (embla) => {
126
+ selectedIndex.value = emblaApi.value.selectedScrollSnap();
127
+ };
128
+
129
+ const onScroll = (embla) => {
130
+ const engine = emblaApi.value.internalEngine()
131
+ const scrollProgress = emblaApi.value.scrollProgress()
132
+
133
+ const stylesOpacity = emblaApi.value.scrollSnapList().map((scrollSnap, index) => {
134
+ let diffToTarget = scrollSnap - scrollProgress
135
+
136
+ if (engine.options.loop) {
137
+ engine.slideLooper.loopPoints.forEach((loopItem) => {
138
+ const target = loopItem.target()
139
+ if (index === loopItem.index && target !== 0) {
140
+ const sign = Math.sign(target)
141
+ if (sign === -1) diffToTarget = scrollSnap - (1 + scrollProgress)
142
+ if (sign === 1) diffToTarget = scrollSnap + (1 - scrollProgress)
143
+ }
144
+ })
145
+ }
146
+ const tweenValue = 1 - Math.abs(diffToTarget * TWEEN_FACTOR)
147
+ return Math.min(Math.max(tweenValue, 0), 1)
148
+ })
149
+
150
+ tweenSlides.value = stylesOpacity
151
+
152
+ const styles = emblaApi.value.scrollSnapList().map((scrollSnap, index) => {
153
+ let diffToTarget = scrollSnap - scrollProgress
154
+
155
+ if (engine.options.loop) {
156
+ engine.slideLooper.loopPoints.forEach((loopItem) => {
157
+ const target = loopItem.target()
158
+ if (index === loopItem.index && target !== 0) {
159
+ const sign = Math.sign(target)
160
+ if (sign === -1) diffToTarget = scrollSnap - (1 + scrollProgress)
161
+ if (sign === 1) diffToTarget = scrollSnap + (1 - scrollProgress)
162
+ }
163
+ })
164
+ }
165
+ return diffToTarget * (1 / TWEEN_FACTOR) * 100
166
+ })
167
+
168
+ tweenValues.value = styles
169
+ }
170
+
171
+
172
+ onMounted(async() => {
173
+ onInit(emblaApi);
174
+ onSelect(emblaApi);
175
+ onScroll(emblaApi);
176
+
177
+ emblaApi.value.on('reInit', onInit);
178
+ emblaApi.value.on('reInit', onSelect);
179
+ emblaApi.value.on('select', onSelect);
180
+ emblaApi.value.on('scroll', onScroll)
181
+ });
182
+ </script>
183
+
184
+ <style lang="scss">
185
+ .embla {
186
+ overflow: hidden;
187
+ }
188
+ .embla__container {
189
+ display: flex;
190
+ }
191
+ .embla__slide {
192
+ flex: 0 0 100%;
193
+ min-width: 0;
194
+ }
195
+ </style>
@@ -12,13 +12,13 @@
12
12
  }
13
13
  })"
14
14
  />
15
-
15
+ {{user}}123
16
16
  <PlaceholderUserpic
17
17
  v-if="!user.profile?.photo && type !== 'short'"
18
18
  class="radius-medium mn-r-thin i-thin"
19
19
 
20
20
  @click.stop="$router.push({
21
- name: user.type === 'user' ? 'User Profile' : 'Organization',
21
+ name: 'User Profile',
22
22
  params: {
23
23
  _id: user._id
24
24
  }
@@ -74,7 +74,6 @@
74
74
  :key="index"
75
75
  :user="member"
76
76
  :position="member.position"
77
- @click="$router.push(`/app/profile/${member.user._id}`)"
78
77
  class="bg-grey radius-small flex-nowrap flex pd-medium"
79
78
  />
80
79
 
@@ -4,34 +4,37 @@ const controllerFactory = (db) => {
4
4
  const Membership = db.membership;
5
5
 
6
6
  const read = async (req, res) => {
7
- let query = {};
8
- let options = {};
9
-
10
- if (req.query.user) {
11
- query.user = req.query.user;
12
- }
13
-
14
- if (req.query.type) {
15
- query.type = req.query.type;
16
- }
17
-
18
- if (req.query.target) {
19
- query.target = req.query.target;
20
- }
21
-
22
- if (req.query.role) {
23
- query.role = req.query.role;
24
- }
25
-
26
7
  try {
27
- const memberships = await Membership.find(query, null, options).populate('user');
28
- if (!memberships) {
29
- return res.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
8
+ const memberships = await Membership.aggregate([
9
+ {
10
+ $match: {
11
+ ...(req.query.user && { user: req.query.user }),
12
+ ...(req.query.type && { type: req.query.type }),
13
+ ...(req.query.target && { target: req.query.target }),
14
+ ...(req.query.role && { role: req.query.role }),
15
+ },
16
+ },
17
+ {
18
+ $lookup: {
19
+ from: 'users',
20
+ localField: 'user',
21
+ foreignField: '_id',
22
+ as: 'user',
23
+ },
24
+ },
25
+ {
26
+ $unwind: '$user',
27
+ },
28
+ ]);
29
+
30
+ if (!memberships || memberships.length === 0) {
31
+ return res.status(404).send({ errorCode: 'MEMBERSHIPS_NOT_FOUND' });
30
32
  }
33
+
31
34
  res.send(memberships);
32
35
  } catch (err) {
33
- console.log(err)
34
- res.status(500).send({ errorCode: "SERVER_ERROR" });
36
+ console.log(err);
37
+ res.status(500).send({ errorCode: 'SERVER_ERROR' });
35
38
  }
36
39
  };
37
40
 
@@ -5,7 +5,10 @@ const path = require('path');
5
5
 
6
6
  const OpenAI = require("openai");
7
7
 
8
- const openai = new OpenAI();
8
+ console.log(process.env.OPENAI_API_KEY)
9
+ const openai = new OpenAI({
10
+ apiKey: process.env.OPENAI_API_KEY
11
+ });
9
12
 
10
13
  // Factory
11
14
  const controllerFactory = (db) => {
@@ -327,13 +330,13 @@ const controllerFactory = (db) => {
327
330
  return res.status(404).send({ message: "Products not found." });
328
331
  }
329
332
 
330
- const productsList = products.map(p => `
331
- ${p._id}:
332
- ${p.name}
333
- (${p.information[0].value})
334
- (${p.information[1].value}%)
335
- (${p.information[2].value})
336
- `).join(', ');
333
+ const productsList = products.map(p => {
334
+ const info = p.information || [];
335
+ const value0 = info[0] ? info[0].value : '';
336
+ const value1 = info[1] ? `(${info[1].value}%)` : '';
337
+ const value2 = info[2] ? `(${info[2].value})` : '';
338
+ return `${p._id}: ${p.name} (${value0}) ${value1} ${value2}`;
339
+ }).join(', ');
337
340
 
338
341
  const prompt = `
339
342
  1. When asked how the client wants to feel, they responded "${mood}".
@@ -352,7 +355,7 @@ const controllerFactory = (db) => {
352
355
  while (true) {
353
356
  try {
354
357
  response = await openai.chat.completions.create({
355
- model: "gpt-4",
358
+ model: "gpt-3.5-turbo",
356
359
  messages: [{role: "user", content: prompt}],
357
360
  });
358
361
 
@@ -25,7 +25,7 @@ body {
25
25
  overflow-x: hidden;
26
26
  }
27
27
 
28
- #app {
28
+ #app-wrapper {
29
29
  display: grid;
30
30
  position: relative;
31
31
  height: 100vh;