@ozdao/prometheus-framework 0.0.80 → 0.0.82
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-a477dfc6.mjs +138 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-c6f3a0f0.js +1 -0
- package/dist/ButtonFollow-2ce169ca.js +1 -0
- package/dist/ButtonFollow-c9484003.mjs +130 -0
- package/dist/CardHeader-2ef6618e.mjs +96 -0
- package/dist/CardHeader-925a972b.js +1 -0
- package/dist/CardOrganization-d462e158.mjs +320 -0
- package/dist/CardOrganization-ffa585a7.js +1 -0
- package/dist/Comments-1aec0e5e.js +1 -0
- package/dist/Comments-641516f8.mjs +76 -0
- package/dist/EditProductImages-11510b66.js +1 -0
- package/dist/EditProductImages-f983f473.mjs +236 -0
- package/dist/Feed-55c5907a.js +1 -0
- package/dist/Feed-81d5802e.mjs +355 -0
- package/dist/Feed-ca8e0e22.mjs +423 -0
- package/dist/Feed-f4cad6c3.js +1 -0
- package/dist/PlaceholderUserpic-d64d6dd5.js +1 -0
- package/dist/PlaceholderUserpic-e44ccca8.mjs +28 -0
- package/dist/Popup-70f6a8c0.mjs +76 -0
- package/dist/Popup-9479e39a.js +1 -0
- package/dist/Product-19cc3654.js +7 -0
- package/dist/Product-df622dc0.mjs +837 -0
- package/dist/ProductEdit-177c1f16.mjs +113 -0
- package/dist/ProductEdit-b98883d8.js +1 -0
- package/dist/ProfileBlogposts-e9a7381e.js +1 -0
- package/dist/ProfileBlogposts-ffa10f34.mjs +63 -0
- package/dist/ProfileComments-08d1670d.mjs +43 -0
- package/dist/ProfileComments-730c2f73.js +1 -0
- package/dist/ProfileEvents-858e9471.mjs +55 -0
- package/dist/ProfileEvents-b8a76b6e.js +1 -0
- package/dist/ProfileLikes-a78900c0.js +1 -0
- package/dist/ProfileLikes-c32c420b.mjs +43 -0
- package/dist/ProfileOrganizations-1990d0cc.js +1 -0
- package/dist/ProfileOrganizations-dc7210f1.mjs +214 -0
- package/dist/Publics-122d9fc7.mjs +1078 -0
- package/dist/Publics-aca585c3.js +1 -0
- package/dist/UploadImage-74280ea3.mjs +99 -0
- package/dist/UploadImage-7c502f96.js +1 -0
- package/dist/auth-5aa8e90c.js +8 -0
- package/dist/auth-8b5aac7a.mjs +1502 -0
- package/dist/auth.client.cjs +1 -1
- package/dist/auth.client.js +5 -5
- package/dist/auth.validation-2e8ee994.js +1 -0
- package/dist/auth.validation-69488f55.mjs +20 -0
- package/dist/categories-75b7d14b.js +1 -0
- package/dist/categories-86b2d45b.mjs +225 -0
- package/dist/community.client.cjs +7 -8
- package/dist/community.client.js +1526 -588
- package/dist/community.server.js +74 -4
- package/dist/community.server.mjs +75 -5
- package/dist/components/Checkbox/Checkbox.vue.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/Chips/Chips.vue.d.ts +6 -0
- package/dist/components/FieldTags/FieldTags.vue.d.ts +2 -0
- package/dist/components/FieldTags/create-tags.d.ts +21 -0
- package/dist/components/FieldTags/tag-input.vue.d.ts +10 -0
- package/dist/components/FieldTags/vue-tags-input.d.ts +120 -0
- package/dist/components/FieldTags/vue-tags-input.props.d.ts +28 -0
- package/dist/components/SelectMulti/SelectMulti.vue.d.ts +4 -0
- package/dist/components/SelectMulti/SelectMulti.vue.d.ts.map +1 -0
- package/dist/components/SelectMulti/multiselectMixin.d.ts +295 -0
- package/dist/components/SelectMulti/pointerMixin.d.ts +51 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/events.client.cjs +1 -1
- package/dist/events.client.js +13 -13
- package/dist/globals-928eb13c.js +1 -0
- package/dist/globals-96ba60e4.mjs +91 -0
- package/dist/globals.client.cjs +1 -1
- package/dist/globals.client.js +1 -1
- package/dist/inputs.validation-6960f71b.mjs +93 -0
- package/dist/inputs.validation-c53e01a2.js +1 -0
- package/dist/main.css +1 -1
- package/dist/main.d.ts +2 -2
- package/dist/modules/community/components/elements/H2.vue.d.ts +2 -1
- package/dist/modules/community/components/sections/Feed.vue.d.ts +2 -0
- package/dist/modules/orders/components/blocks/CardOrderItem.vue.d.ts +1 -1
- package/dist/modules/organizations/components/blocks/EditArray.vue.d.ts +1 -1
- package/dist/modules/organizations/components/sections/Feed.vue.d.ts +2 -0
- package/dist/organizations.client.cjs +2 -2
- package/dist/organizations.client.js +746 -745
- package/dist/organizations.server.js +17 -11
- package/dist/organizations.server.mjs +17 -11
- package/dist/prometheus-framework.cjs.js +19 -19
- package/dist/prometheus-framework.es.js +4025 -2985
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +12 -12
- package/package.json +1 -1
- package/src/components/CardHeader/CardHeader.vue +33 -8
- package/src/components/Checkbox/Checkbox.vue +21 -17
- package/src/components/Chips/Chips.vue +28 -0
- package/src/components/FieldTags/FieldTags.vue +193 -0
- package/src/components/FieldTags/create-tags.js +84 -0
- package/src/components/FieldTags/tag-input.vue +55 -0
- package/src/components/FieldTags/vue-tags-input.js +424 -0
- package/src/components/FieldTags/vue-tags-input.props.js +349 -0
- package/src/components/FieldTags/vue-tags-input.scss +148 -0
- package/src/components/SelectMulti/SelectMulti.vue +854 -0
- package/src/components/SelectMulti/index.js +7 -0
- package/src/components/SelectMulti/multiselectMixin.js +725 -0
- package/src/components/SelectMulti/pointerMixin.js +143 -0
- package/src/components/index.ts +1 -0
- package/src/main.ts +9 -6
- package/src/modules/community/components/blocks/CardBlogpost.vue +24 -15
- package/src/modules/community/components/elements/H2.vue +46 -19
- package/src/modules/community/components/pages/BlogPost.vue +20 -22
- package/src/modules/community/components/pages/CreateBlogPost.vue +291 -114
- package/src/modules/community/components/sections/Feed.vue +12 -0
- package/src/modules/community/controllers/blog.controller.js +11 -2
- package/src/modules/community/middlewares/server/index.js +10 -0
- package/src/modules/community/middlewares/server/verifyBlogpost.js +41 -0
- package/src/modules/community/models/blogpost.model.js +14 -4
- package/src/modules/community/routes/blog.routes.js +14 -2
- package/src/modules/community/store/blogposts.js +8 -0
- package/src/modules/events/components/blocks/CardEvent.vue +5 -12
- package/src/modules/globals/store/globals.js +6 -2
- package/src/modules/organizations/components/pages/OrganizationEdit.vue +13 -17
- package/src/modules/organizations/components/sections/Feed.vue +12 -0
- package/src/modules/organizations/controllers/organizations.controller.js +29 -23
- package/src/modules/organizations/store/organizations.js +10 -0
- package/src/modules/users/components/pages/ProfileBlogposts.vue +10 -2
- package/src/modules/users/components/pages/ProfileEdit.vue +1 -1
- package/src/modules/users/components/pages/ProfileOrganizations.vue +1 -1
- package/src/styles/base/all.scss +5 -2
- package/src/styles/base/backgrounds.scss +9 -0
- package/src/styles/config.scss +8 -1
package/README.md
CHANGED
@@ -134,5 +134,9 @@ The framework also encompasses the following modules:
|
|
134
134
|
## Contributing
|
135
135
|
Community contributions are encouraged. For guidelines, see the [contributing guide](https://docs.ozdao.dev/docs/contribution/).
|
136
136
|
|
137
|
+
## Special Thanks
|
138
|
+
For [Sipec][https://github.com/sipec] for his [vue-tags-input](https://github.com/sipec/vue-tags-input)
|
139
|
+
For [VictorNico][https://github.com/VictorNico] for his [vue3-reactive-tel-input](https://github.com/VictorNico/vue3-reactive-tel-input)
|
140
|
+
|
137
141
|
## License
|
138
142
|
Prometheus Framework is licensed under the [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.txt).
|
@@ -0,0 +1,138 @@
|
|
1
|
+
import { ref as h, watch as C, computed as S, openBlock as t, createElementBlock as l, Fragment as b, createElementVNode as s, normalizeClass as f, toDisplayString as u, createCommentVNode as v, withModifiers as _, createVNode as g, Transition as x, withCtx as k, renderList as $, unref as B } from "vue";
|
2
|
+
import { _ as A } from "./auth-8b5aac7a.mjs";
|
3
|
+
const O = {
|
4
|
+
key: 0,
|
5
|
+
class: "t-transp mn-r-small"
|
6
|
+
}, I = ["onClick"], M = ["onClick"], N = {
|
7
|
+
key: 0,
|
8
|
+
class: "mn-t-thin invalid-feedback"
|
9
|
+
}, V = {
|
10
|
+
__name: "Select",
|
11
|
+
props: {
|
12
|
+
label: String,
|
13
|
+
select: [String, Object],
|
14
|
+
placeholder: { type: String, default: "Please select an item" },
|
15
|
+
options: { type: Array, default: () => [] },
|
16
|
+
validation: Boolean
|
17
|
+
},
|
18
|
+
emits: ["update:select", "focus", "blur"],
|
19
|
+
setup(e, { emit: o }) {
|
20
|
+
const a = e, c = h(a.select), n = h(!1);
|
21
|
+
C(() => a.select, (i) => {
|
22
|
+
c.value = i;
|
23
|
+
});
|
24
|
+
const r = S(() => a.select ? a.options.filter((i) => i !== a.select) : a.options), d = () => {
|
25
|
+
n.value = !n.value, o(n.value ? "focus" : "blur");
|
26
|
+
}, w = (i) => {
|
27
|
+
c.value = i, d(), o("update:select", c.value);
|
28
|
+
};
|
29
|
+
return (i, P) => {
|
30
|
+
var y;
|
31
|
+
return t(), l(b, null, [
|
32
|
+
s("div", {
|
33
|
+
class: f([i.$attrs.class, "flex-nowrap flex"])
|
34
|
+
}, [
|
35
|
+
e.label ? (t(), l("div", O, [
|
36
|
+
s("span", null, u(e.label), 1)
|
37
|
+
])) : v("", !0),
|
38
|
+
s("li", {
|
39
|
+
onClick: _(d, ["stop"]),
|
40
|
+
class: "w-100"
|
41
|
+
}, [
|
42
|
+
s("span", null, u(((y = c.value) == null ? void 0 : y.name) || c.value || e.placeholder), 1)
|
43
|
+
], 8, I),
|
44
|
+
g(x, {
|
45
|
+
mode: "out-in",
|
46
|
+
name: "fade"
|
47
|
+
}, {
|
48
|
+
default: k(() => [
|
49
|
+
n.value ? (t(), l("ul", {
|
50
|
+
key: 0,
|
51
|
+
class: f([i.$attrs.class, "pos-absolute pos-l-0 z-index-5 w-100 mn-t-big"])
|
52
|
+
}, [
|
53
|
+
(t(!0), l(b, null, $(B(r), (m) => (t(), l("li", null, [
|
54
|
+
m ? (t(), l("span", {
|
55
|
+
key: 0,
|
56
|
+
onClick: (T) => w(m),
|
57
|
+
class: "w-100"
|
58
|
+
}, u(m.name || m), 9, M)) : v("", !0)
|
59
|
+
]))), 256))
|
60
|
+
], 2)) : v("", !0)
|
61
|
+
]),
|
62
|
+
_: 1
|
63
|
+
})
|
64
|
+
], 2),
|
65
|
+
g(x, {
|
66
|
+
mode: "out-in",
|
67
|
+
name: "fade"
|
68
|
+
}, {
|
69
|
+
default: k(() => [
|
70
|
+
e.validation ? (t(), l("div", N, " * " + u(e.validation.message), 1)) : v("", !0)
|
71
|
+
]),
|
72
|
+
_: 1
|
73
|
+
})
|
74
|
+
], 64);
|
75
|
+
};
|
76
|
+
}
|
77
|
+
}, F = /* @__PURE__ */ A(V, [["__scopeId", "data-v-a78dbba1"]]);
|
78
|
+
const j = { class: "flex-v-center flex-nowrap flex" }, z = {
|
79
|
+
key: 0,
|
80
|
+
class: "mn-r-auto t-transp mn-r-small"
|
81
|
+
}, E = ["name", "value", "checked"], L = {
|
82
|
+
__name: "Checkbox",
|
83
|
+
props: {
|
84
|
+
label: String,
|
85
|
+
name: String,
|
86
|
+
value: String,
|
87
|
+
radio: {
|
88
|
+
type: [Array, Boolean, Object],
|
89
|
+
default: () => []
|
90
|
+
}
|
91
|
+
},
|
92
|
+
emits: ["update:radio"],
|
93
|
+
setup(e, { emit: o }) {
|
94
|
+
const a = e, c = (n) => {
|
95
|
+
if (Array.isArray(a.radio)) {
|
96
|
+
let r = [...a.radio];
|
97
|
+
if (n.target.checked)
|
98
|
+
r.push(a.value);
|
99
|
+
else {
|
100
|
+
const d = r.indexOf(a.value);
|
101
|
+
d !== -1 && r.splice(d, 1);
|
102
|
+
}
|
103
|
+
o("update:radio", r);
|
104
|
+
} else
|
105
|
+
typeof a.radio == "boolean" && o("update:radio", n.target.checked);
|
106
|
+
};
|
107
|
+
return (n, r) => (t(), l("label", j, [
|
108
|
+
e.label ? (t(), l("div", z, [
|
109
|
+
s("span", null, u(e.label), 1)
|
110
|
+
])) : v("", !0),
|
111
|
+
s("input", {
|
112
|
+
onChange: c,
|
113
|
+
class: "round radiobutton",
|
114
|
+
type: "checkbox",
|
115
|
+
name: e.name,
|
116
|
+
value: e.value,
|
117
|
+
checked: Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio
|
118
|
+
}, null, 40, E),
|
119
|
+
s("div", {
|
120
|
+
class: f(["transition-elastic pd-thin h-2r w-4r radius-extra", {
|
121
|
+
"bg-grey": !(Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio),
|
122
|
+
"bg-main": Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio
|
123
|
+
}])
|
124
|
+
}, [
|
125
|
+
s("div", {
|
126
|
+
class: f(["transition-linear w-1r h-1r radius-extra h-100 bg-white", {
|
127
|
+
"mn-r-auto": !(Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio),
|
128
|
+
"mn-l-auto": Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio
|
129
|
+
}])
|
130
|
+
}, null, 2)
|
131
|
+
], 2)
|
132
|
+
]));
|
133
|
+
}
|
134
|
+
}, R = /* @__PURE__ */ A(L, [["__scopeId", "data-v-f641f618"]]);
|
135
|
+
export {
|
136
|
+
R as C,
|
137
|
+
F as S
|
138
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const e=require("vue"),u=require("./auth-5aa8e90c.js");const v={key:0,class:"t-transp mn-r-small"},y=["onClick"],k=["onClick"],f={key:0,class:"mn-t-thin invalid-feedback"},h={__name:"Select",props:{label:String,select:[String,Object],placeholder:{type:String,default:"Please select an item"},options:{type:Array,default:()=>[]},validation:Boolean},emits:["update:select","focus","blur"],setup(t,{emit:r}){const a=t,o=e.ref(a.select),l=e.ref(!1);e.watch(()=>a.select,n=>{o.value=n});const c=e.computed(()=>a.select?a.options.filter(n=>n!==a.select):a.options),i=()=>{l.value=!l.value,r(l.value?"focus":"blur")},m=n=>{o.value=n,i(),r("update:select",o.value)};return(n,N)=>{var d;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass([n.$attrs.class,"flex-nowrap flex"])},[t.label?(e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("span",null,e.toDisplayString(t.label),1)])):e.createCommentVNode("",!0),e.createElementVNode("li",{onClick:e.withModifiers(i,["stop"]),class:"w-100"},[e.createElementVNode("span",null,e.toDisplayString(((d=o.value)==null?void 0:d.name)||o.value||t.placeholder),1)],8,y),e.createVNode(e.Transition,{mode:"out-in",name:"fade"},{default:e.withCtx(()=>[l.value?(e.openBlock(),e.createElementBlock("ul",{key:0,class:e.normalizeClass([n.$attrs.class,"pos-absolute pos-l-0 z-index-5 w-100 mn-t-big"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c),s=>(e.openBlock(),e.createElementBlock("li",null,[s?(e.openBlock(),e.createElementBlock("span",{key:0,onClick:S=>m(s),class:"w-100"},e.toDisplayString(s.name||s),9,k)):e.createCommentVNode("",!0)]))),256))],2)):e.createCommentVNode("",!0)]),_:1})],2),e.createVNode(e.Transition,{mode:"out-in",name:"fade"},{default:e.withCtx(()=>[t.validation?(e.openBlock(),e.createElementBlock("div",f," * "+e.toDisplayString(t.validation.message),1)):e.createCommentVNode("",!0)]),_:1})],64)}}},b=u._export_sfc(h,[["__scopeId","data-v-a78dbba1"]]);const g={class:"flex-v-center flex-nowrap flex"},x={key:0,class:"mn-r-auto t-transp mn-r-small"},B=["name","value","checked"],C={__name:"Checkbox",props:{label:String,name:String,value:String,radio:{type:[Array,Boolean,Object],default:()=>[]}},emits:["update:radio"],setup(t,{emit:r}){const a=t,o=l=>{if(Array.isArray(a.radio)){let c=[...a.radio];if(l.target.checked)c.push(a.value);else{const i=c.indexOf(a.value);i!==-1&&c.splice(i,1)}r("update:radio",c)}else typeof a.radio=="boolean"&&r("update:radio",l.target.checked)};return(l,c)=>(e.openBlock(),e.createElementBlock("label",g,[t.label?(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("span",null,e.toDisplayString(t.label),1)])):e.createCommentVNode("",!0),e.createElementVNode("input",{onChange:o,class:"round radiobutton",type:"checkbox",name:t.name,value:t.value,checked:Array.isArray(t.radio)?t.radio.includes(t.value):t.radio},null,40,B),e.createElementVNode("div",{class:e.normalizeClass(["transition-elastic pd-thin h-2r w-4r radius-extra",{"bg-grey":!(Array.isArray(t.radio)?t.radio.includes(t.value):t.radio),"bg-main":Array.isArray(t.radio)?t.radio.includes(t.value):t.radio}])},[e.createElementVNode("div",{class:e.normalizeClass(["transition-linear w-1r h-1r radius-extra h-100 bg-white",{"mn-r-auto":!(Array.isArray(t.radio)?t.radio.includes(t.value):t.radio),"mn-l-auto":Array.isArray(t.radio)?t.radio.includes(t.value):t.radio}])},null,2)],2)]))}},E=u._export_sfc(C,[["__scopeId","data-v-f641f618"]]);exports.Checkbox=E;exports.Select=b;
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const n=require("vue"),b=require("./auth-5aa8e90c.js"),u=require("./globals-928eb13c.js"),p=b.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),a=n.reactive({memberships:[],error:null}),m={async read({user:r,type:e,target:t,role:s}){try{const o=await p.get("/api/memberships",{params:{user:r,type:e,target:t,role:s}});return a.error=null,a.memberships=o.data,Promise.resolve(o.data)}catch(o){return u.setError(o),Promise.reject(o)}},async create(r){try{const e=await p.post("/api/memberships/create",r);return a.error=null,Promise.resolve(e.data)}catch(e){return u.setError(e),Promise.reject(e)}},async update(r){try{const e=await p.post("/api/memberships/update",r);return a.error=null,Promise.resolve(e.data)}catch(e){return u.setError(e),Promise.reject(e)}},async delete(r){try{const e=await p.post("/api/memberships/delete",r);return a.error=null,Promise.resolve(e.data)}catch(e){return u.setError(e),Promise.reject(e)}}},h={handleMembershipUpdate(r,e,t){let s;if(Array.isArray(r)?s=r.find(o=>o._id===e.target):typeof r=="object"&&r._id===e.target&&(s=r),s)if(s.isMember=t,t)s.memberships.push(e),s.numberOfMemberships+=1;else{const o=s.memberships.findIndex(d=>d._id===e._id);o!==-1&&(s.memberships.splice(o,1),s.numberOfMemberships-=1)}}};n.watch(a,r=>{});const y=Object.freeze(Object.defineProperty({__proto__:null,actions:m,mutations:h,state:a},Symbol.toStringTag,{value:"Module"}));const _={__name:"ButtonFollow",props:{type:{type:String,required:!0},userId:{type:String,required:!0},isMember:{type:Boolean,required:!0},targetId:{type:String,required:!0}},emits:["updateMembership"],setup(r,{emit:e}){const t=r,s=async()=>{t.isMember?await d(t.targetId):await o(t.targetId)};async function o(l){try{const i={type:t.type,target:l,user:t.userId},c=await m.create(i);e("updateMembership",{membership:c,isMember:!0,targetId:t.targetId})}catch(i){throw console.log(i),i}}async function d(l){const i={type:t.type,target:l,user:t.userId};try{const c=await m.delete(i);e("updateMembership",{membership:c,isMember:!1,targetId:t.targetId})}catch(c){throw console.log(c),c}}return(l,i)=>(n.openBlock(),n.createBlock(b._sfc_main,{submit:s,class:"bg-main button-small button"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.isMember?"Unfollow":"Follow"),1)]),_:1}))}},g=b._export_sfc(_,[["__scopeId","data-v-c50e046c"]]);exports.ButtonFollow=g;exports.actions=m;exports.memberships=y;exports.mutations=h;exports.state=a;
|
@@ -0,0 +1,130 @@
|
|
1
|
+
import { reactive as d, watch as b, openBlock as h, createBlock as y, withCtx as _, createTextVNode as f, toDisplayString as g } from "vue";
|
2
|
+
import { a as w, _ as I, b as M } from "./auth-8b5aac7a.mjs";
|
3
|
+
import { s as p } from "./globals-96ba60e4.mjs";
|
4
|
+
const l = w.create({
|
5
|
+
baseURL: process.env.API_URL,
|
6
|
+
withCredentials: !0
|
7
|
+
}), i = d({
|
8
|
+
memberships: [],
|
9
|
+
error: null
|
10
|
+
}), u = {
|
11
|
+
async read({ user: r, type: e, target: t, role: s }) {
|
12
|
+
try {
|
13
|
+
const o = await l.get("/api/memberships", { params: { user: r, type: e, target: t, role: s } });
|
14
|
+
return i.error = null, i.memberships = o.data, Promise.resolve(o.data);
|
15
|
+
} catch (o) {
|
16
|
+
return p(o), Promise.reject(o);
|
17
|
+
}
|
18
|
+
},
|
19
|
+
async create(r) {
|
20
|
+
try {
|
21
|
+
const e = await l.post("/api/memberships/create", r);
|
22
|
+
return i.error = null, Promise.resolve(e.data);
|
23
|
+
} catch (e) {
|
24
|
+
return p(e), Promise.reject(e);
|
25
|
+
}
|
26
|
+
},
|
27
|
+
async update(r) {
|
28
|
+
try {
|
29
|
+
const e = await l.post("/api/memberships/update", r);
|
30
|
+
return i.error = null, Promise.resolve(e.data);
|
31
|
+
} catch (e) {
|
32
|
+
return p(e), Promise.reject(e);
|
33
|
+
}
|
34
|
+
},
|
35
|
+
async delete(r) {
|
36
|
+
try {
|
37
|
+
const e = await l.post("/api/memberships/delete", r);
|
38
|
+
return i.error = null, Promise.resolve(e.data);
|
39
|
+
} catch (e) {
|
40
|
+
return p(e), Promise.reject(e);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}, P = {
|
44
|
+
handleMembershipUpdate(r, e, t) {
|
45
|
+
let s;
|
46
|
+
if (Array.isArray(r) ? s = r.find((o) => o._id === e.target) : typeof r == "object" && r._id === e.target && (s = r), s)
|
47
|
+
if (s.isMember = t, t)
|
48
|
+
s.memberships.push(e), s.numberOfMemberships += 1;
|
49
|
+
else {
|
50
|
+
const o = s.memberships.findIndex((m) => m._id === e._id);
|
51
|
+
o !== -1 && (s.memberships.splice(o, 1), s.numberOfMemberships -= 1);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
};
|
55
|
+
b(i, (r) => {
|
56
|
+
});
|
57
|
+
const S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
58
|
+
__proto__: null,
|
59
|
+
actions: u,
|
60
|
+
mutations: P,
|
61
|
+
state: i
|
62
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
63
|
+
const v = {
|
64
|
+
__name: "ButtonFollow",
|
65
|
+
props: {
|
66
|
+
type: {
|
67
|
+
type: String,
|
68
|
+
required: !0
|
69
|
+
},
|
70
|
+
userId: {
|
71
|
+
type: String,
|
72
|
+
required: !0
|
73
|
+
},
|
74
|
+
isMember: {
|
75
|
+
type: Boolean,
|
76
|
+
required: !0
|
77
|
+
},
|
78
|
+
targetId: {
|
79
|
+
type: String,
|
80
|
+
required: !0
|
81
|
+
}
|
82
|
+
},
|
83
|
+
emits: ["updateMembership"],
|
84
|
+
setup(r, { emit: e }) {
|
85
|
+
const t = r, s = async () => {
|
86
|
+
t.isMember ? await m(t.targetId) : await o(t.targetId);
|
87
|
+
};
|
88
|
+
async function o(c) {
|
89
|
+
try {
|
90
|
+
const a = {
|
91
|
+
type: t.type,
|
92
|
+
target: c,
|
93
|
+
user: t.userId
|
94
|
+
}, n = await u.create(a);
|
95
|
+
e("updateMembership", { membership: n, isMember: !0, targetId: t.targetId });
|
96
|
+
} catch (a) {
|
97
|
+
throw console.log(a), a;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
async function m(c) {
|
101
|
+
const a = {
|
102
|
+
type: t.type,
|
103
|
+
target: c,
|
104
|
+
user: t.userId
|
105
|
+
};
|
106
|
+
try {
|
107
|
+
const n = await u.delete(a);
|
108
|
+
e("updateMembership", { membership: n, isMember: !1, targetId: t.targetId });
|
109
|
+
} catch (n) {
|
110
|
+
throw console.log(n), n;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
return (c, a) => (h(), y(M, {
|
114
|
+
submit: s,
|
115
|
+
class: "bg-main button-small button"
|
116
|
+
}, {
|
117
|
+
default: _(() => [
|
118
|
+
f(g(r.isMember ? "Unfollow" : "Follow"), 1)
|
119
|
+
]),
|
120
|
+
_: 1
|
121
|
+
}));
|
122
|
+
}
|
123
|
+
}, F = /* @__PURE__ */ I(v, [["__scopeId", "data-v-c50e046c"]]);
|
124
|
+
export {
|
125
|
+
F as B,
|
126
|
+
u as a,
|
127
|
+
S as b,
|
128
|
+
P as m,
|
129
|
+
i as s
|
130
|
+
};
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import { openBlock as r, createElementBlock as o, createElementVNode as l, withModifiers as h, createCommentVNode as n, createBlock as y, toDisplayString as d, Fragment as b, renderList as k, normalizeStyle as $ } from "vue";
|
2
|
+
import { useRouter as x } from "vue-router";
|
3
|
+
import { P as v } from "./PlaceholderUserpic-e44ccca8.mjs";
|
4
|
+
const p = {
|
5
|
+
key: 0,
|
6
|
+
class: "pd-b-zero"
|
7
|
+
}, P = { class: "w-100 flex-v-center flex-nojustify flex" }, z = { class: "w-100 flex-nowrap flex-v-center flex" }, M = ["src"], C = {
|
8
|
+
key: 2,
|
9
|
+
class: "t-semi"
|
10
|
+
}, U = { key: 1 }, D = { key: 2 }, F = { class: "d-block mn-l-auto flex-nowrap flex flex-v-center" }, B = {
|
11
|
+
key: 0,
|
12
|
+
class: "w-4r i-thin"
|
13
|
+
}, E = {
|
14
|
+
style: { position: "absolute", top: "0px", right: "0px" },
|
15
|
+
class: "br-solid br-2px br-white z-index-1 radius-big i-thin bg-second flex flex-center t-white p-small mn-r-small t-semi"
|
16
|
+
}, O = ["src"], j = {
|
17
|
+
__name: "CardHeader",
|
18
|
+
props: [
|
19
|
+
"date",
|
20
|
+
"dateFormatted",
|
21
|
+
"owner",
|
22
|
+
"creator",
|
23
|
+
"members",
|
24
|
+
"membersPhotos",
|
25
|
+
"type"
|
26
|
+
],
|
27
|
+
setup(e) {
|
28
|
+
x();
|
29
|
+
function g(i) {
|
30
|
+
const t = /* @__PURE__ */ new Date(), s = new Date(i), a = Math.abs(t - s), w = Math.floor(a / 1e3), m = Math.floor(w / 60), u = Math.floor(m / 60), c = Math.floor(u / 24), f = Math.floor(c / 7);
|
31
|
+
return f > 0 ? `${f} week${f > 1 ? "s" : ""} ago` : c > 0 ? `${c} day${c > 1 ? "s" : ""} ago` : u > 0 ? `${u} hour${u > 1 ? "s" : ""} ago` : m > 0 ? `${m} minute${m > 1 ? "s" : ""} ago` : "Just now";
|
32
|
+
}
|
33
|
+
return (i, t) => e.owner ? (r(), o("header", p, [
|
34
|
+
l("div", P, [
|
35
|
+
l("div", z, [
|
36
|
+
e.owner.target.profile.photo.length > 0 && e.type !== "short" ? (r(), o("img", {
|
37
|
+
key: 0,
|
38
|
+
src: e.owner.target.profile.photo,
|
39
|
+
class: "radius-medium mn-r-thin i-thin",
|
40
|
+
onClick: t[0] || (t[0] = h((s) => i.$router.push({
|
41
|
+
name: e.owner.type === "user" ? "User Profile" : "Organization",
|
42
|
+
params: {
|
43
|
+
_id: e.owner.target._id
|
44
|
+
}
|
45
|
+
}), ["stop"]))
|
46
|
+
}, null, 8, M)) : n("", !0),
|
47
|
+
!e.owner.target.profile.photo && e.type !== "short" ? (r(), y(v, {
|
48
|
+
key: 1,
|
49
|
+
class: "radius-medium mn-r-thin i-thin",
|
50
|
+
onClick: t[1] || (t[1] = h((s) => i.$router.push({
|
51
|
+
name: e.owner.type === "user" ? "User Profile" : "Organization",
|
52
|
+
params: {
|
53
|
+
_id: e.owner.target._id
|
54
|
+
}
|
55
|
+
}), ["stop"]))
|
56
|
+
})) : n("", !0),
|
57
|
+
e.type !== "short" ? (r(), o("span", C, [
|
58
|
+
l("span", {
|
59
|
+
onClick: t[2] || (t[2] = h((s) => i.$router.push({
|
60
|
+
name: e.owner.type === "user" ? "User Profile" : "Organization",
|
61
|
+
params: {
|
62
|
+
_id: e.owner.target._id
|
63
|
+
}
|
64
|
+
}), ["stop"]))
|
65
|
+
}, d(e.owner.target.profile.name), 1),
|
66
|
+
!e.creator.hidden && e.owner.target.profile.name !== e.creator.target.profile.name ? (r(), o("span", {
|
67
|
+
key: 0,
|
68
|
+
onClick: t[3] || (t[3] = h((s) => i.$router.push({
|
69
|
+
name: "User Profile",
|
70
|
+
params: {
|
71
|
+
_id: e.owner.target._id
|
72
|
+
}
|
73
|
+
}), ["stop"]))
|
74
|
+
}, " · by " + d(e.creator.target.profile.name), 1)) : n("", !0),
|
75
|
+
e.date ? (r(), o("span", U, " · " + d(g(e.date)), 1)) : n("", !0),
|
76
|
+
e.dateFormatted ? (r(), o("span", D, " · " + d(e.dateFormatted), 1)) : n("", !0)
|
77
|
+
])) : n("", !0),
|
78
|
+
l("div", F, [
|
79
|
+
e.members ? (r(), o("div", B, [
|
80
|
+
l("span", E, d(e.members), 1),
|
81
|
+
(r(!0), o(b, null, k(e.membersPhotos.slice(0, 2), (s, a) => (r(), o("img", {
|
82
|
+
key: a,
|
83
|
+
src: s,
|
84
|
+
style: $({ position: "absolute", top: "0px", right: a * 20 + 40 + "%", zIndex: 1 - a }),
|
85
|
+
class: "br-solid br-2px br-white i-thin bg-grey radius-big"
|
86
|
+
}, null, 12, O))), 128))
|
87
|
+
])) : n("", !0)
|
88
|
+
])
|
89
|
+
])
|
90
|
+
])
|
91
|
+
])) : n("", !0);
|
92
|
+
}
|
93
|
+
};
|
94
|
+
export {
|
95
|
+
j as _
|
96
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const e=require("vue"),u=require("vue-router"),h=require("./PlaceholderUserpic-d64d6dd5.js"),f={key:0,class:"pd-b-zero"},k={class:"w-100 flex-v-center flex-nojustify flex"},g={class:"w-100 flex-nowrap flex-v-center flex"},w=["src"],y={key:2,class:"t-semi"},b={key:1},B={key:2},p={class:"d-block mn-l-auto flex-nowrap flex flex-v-center"},$={key:0,class:"w-4r i-thin"},E={style:{position:"absolute",top:"0px",right:"0px"},class:"br-solid br-2px br-white z-index-1 radius-big i-thin bg-second flex flex-center t-white p-small mn-r-small t-semi"},v=["src"],x={__name:"CardHeader",props:["date","dateFormatted","owner","creator","members","membersPhotos","type"],setup(t){u.useRouter();function m(n){const o=new Date,r=new Date(n),i=Math.abs(o-r),d=Math.floor(i/1e3),s=Math.floor(d/60),a=Math.floor(s/60),l=Math.floor(a/24),c=Math.floor(l/7);return c>0?`${c} week${c>1?"s":""} ago`:l>0?`${l} day${l>1?"s":""} ago`:a>0?`${a} hour${a>1?"s":""} ago`:s>0?`${s} minute${s>1?"s":""} ago`:"Just now"}return(n,o)=>t.owner?(e.openBlock(),e.createElementBlock("header",f,[e.createElementVNode("div",k,[e.createElementVNode("div",g,[t.owner.target.profile.photo.length>0&&t.type!=="short"?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.owner.target.profile.photo,class:"radius-medium mn-r-thin i-thin",onClick:o[0]||(o[0]=e.withModifiers(r=>n.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))},null,8,w)):e.createCommentVNode("",!0),!t.owner.target.profile.photo&&t.type!=="short"?(e.openBlock(),e.createBlock(h.PlaceholderUserpic,{key:1,class:"radius-medium mn-r-thin i-thin",onClick:o[1]||(o[1]=e.withModifiers(r=>n.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))})):e.createCommentVNode("",!0),t.type!=="short"?(e.openBlock(),e.createElementBlock("span",y,[e.createElementVNode("span",{onClick:o[2]||(o[2]=e.withModifiers(r=>n.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))},e.toDisplayString(t.owner.target.profile.name),1),!t.creator.hidden&&t.owner.target.profile.name!==t.creator.target.profile.name?(e.openBlock(),e.createElementBlock("span",{key:0,onClick:o[3]||(o[3]=e.withModifiers(r=>n.$router.push({name:"User Profile",params:{_id:t.owner.target._id}}),["stop"]))}," · by "+e.toDisplayString(t.creator.target.profile.name),1)):e.createCommentVNode("",!0),t.date?(e.openBlock(),e.createElementBlock("span",b," · "+e.toDisplayString(m(t.date)),1)):e.createCommentVNode("",!0),t.dateFormatted?(e.openBlock(),e.createElementBlock("span",B," · "+e.toDisplayString(t.dateFormatted),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",p,[t.members?(e.openBlock(),e.createElementBlock("div",$,[e.createElementVNode("span",E,e.toDisplayString(t.members),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.membersPhotos.slice(0,2),(r,i)=>(e.openBlock(),e.createElementBlock("img",{key:i,src:r,style:e.normalizeStyle({position:"absolute",top:"0px",right:i*20+40+"%",zIndex:1-i}),class:"br-solid br-2px br-white i-thin bg-grey radius-big"},null,12,v))),128))])):e.createCommentVNode("",!0)])])])])):e.createCommentVNode("",!0)}};exports._sfc_main=x;
|