@ozdao/prometheus-framework 0.1.37 → 0.1.39
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/CardBlogpost-ae3b4d23.js +1 -0
- package/dist/CardBlogpost-d6f49156.mjs +246 -0
- package/dist/Chips-3a07f374.js +1 -0
- package/dist/Chips-a8681edd.mjs +213 -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-4742f070.js +1 -0
- package/dist/Feed-09b0790d.js +1 -0
- package/dist/Feed-12b12380.js +1 -0
- package/dist/Feed-585d5821.mjs +124 -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-5423e8ce.mjs +480 -0
- package/dist/Members-9b013515.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-d360c360.js +1 -0
- package/dist/Popup-0d8e1392.mjs +96 -0
- package/dist/Popup-eb11fa82.js +1 -0
- package/dist/Product-e43dd2f1.js +7 -0
- package/dist/Product-e4e583f0.mjs +652 -0
- package/dist/ProfileBlogposts-8f6191d6.js +1 -0
- package/dist/ProfileBlogposts-aa839fcb.mjs +77 -0
- package/dist/ProfileEvents-6b3fb52e.mjs +68 -0
- package/dist/ProfileEvents-893285bb.js +1 -0
- package/dist/ProfileOrganizations-738f444a.js +1 -0
- package/dist/ProfileOrganizations-c4fb03a1.mjs +72 -0
- package/dist/backoffice.client.cjs +1 -1
- package/dist/backoffice.client.js +5 -5
- package/dist/community.client.cjs +1 -1
- package/dist/community.client.js +202 -195
- package/dist/events.client.cjs +2 -2
- package/dist/events.client.js +14 -17
- 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 +4 -5
- package/dist/organizations.client-63b476ff.mjs +2996 -0
- package/dist/organizations.client-696eacbb.js +3 -0
- package/dist/organizations.client.cjs +1 -1
- package/dist/organizations.client.js +45 -50
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +267 -215
- package/package.json +119 -2
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const B=require("./index-b41aac19.js"),t=require("vue"),f=require("./globals-928eb13c.js"),p=require("./Chips-3a07f374.js"),E=require("vue-router"),P=require("./IconEdit-c0469b45.js"),d=B.axios.create({baseURL:process.env.API_URL,withCredentials:!0});d.defaults.withCredentials=!0;const n=t.reactive({all:[],filter:{tags:[],period:""},pagination:{page:1,perPage:18},sort:{current:"popularity",ascending:!1},current:{_id:"",url:"",status:"",name:"",tags:[],owner:{},date:"",views:0,content:[]}});async function y(e={}){e.params=e.params||{},e.params.skip=e.skip||0,e.params.limit=e.limit||9,e.params.tags=e.tags||[],e.period&&(e.params.period=e.period),e.url&&(e.params={url:e.url}),e.category&&(e.params.category=e.category),e.owner&&(e.params.owner=e.owner),e.following&&(e.params.following=e.following),e.creator&&(e.params.creator=e.creator),e.status&&(e.params.status=e.status),e.user&&(e.params.user=e.user),e.params.skip=e.skip||0,e.params.limit=e.limit||10;try{console.log("Request params:"+e.params);const r=await d.get("/api/blog/read",{params:e.params});return e.url?u(r.data,"current"):u(r.data,"all"),Promise.resolve(r.data)}catch(r){return f.setError(r),Promise.reject(r)}}async function b(e){return d.post("/api/blog/create",e).then(r=>(u(r.data,"current"),Promise.resolve(r.data)),r=>(f.setError(r),Promise.reject(r)))}async function k(e){return d.post("/api/blog/update",e).then(r=>(u(r.data,"current"),Promise.resolve(r.data)),r=>(f.setError(r),Promise.reject(r)))}async function h(e){return await d.delete(`/api/blog/delete/${e}`).then(r=>{const o=n.all.findIndex(s=>s._id===e);return o!==-1&&n.all.splice(o,1),Promise.resolve(r.data)},r=>(f.setError(r),Promise.reject(r)))}function u(e,r){n[r]=e}function v(){n.current={_id:"",url:"",status:"",name:"",tags:[],author:"",owner:"",date:"",views:0,content:[]}}function C(e){const r={order:n.project.content.length+1,type:e.type,data:e.data,class:e.class,content:e.content};n.project.content.push(r)}t.watch(n,(e,r)=>{});const x=Object.freeze(Object.defineProperty({__proto__:null,blockAdd:C,clean:v,create:b,read:y,remove:h,set:u,state:n,update:k},Symbol.toStringTag,{value:"Module"})),N={class:"t-semi br-top-dark flex-nowrap flex-nojustify flex"},V=t.createElementVNode("span",{class:"mn-r-small mn-l-small d-block"},"·",-1),$={class:"cursor-pointer"},S=t.createElementVNode("span",{class:"mn-r-small mn-l-small d-block"},"·",-1),w={__name:"FooterBlogpost",props:["blogpost","owner","user"],setup(e){const r=e,o=t.ref(r.blogpost.numberOfReactions),s=t.ref(r.blogpost.isReacted),c=t.ref(r.blogpost.reactionId);async function l(m){if(!r.user){alert("Please login to add a reaction");return}try{const a={target:r.blogpost._id,type:"blogpost",user:r.user,class:"like"},g=await p.actions.create(a);g.reaction.class==="like"&&(o.value+=1,s.value=!0,c.value=g.reaction._id)}catch(a){console.error(a),alert("Error adding reaction. Please try again later.")}}async function i(m){if(!r.user){alert("Please login to add a reaction");return}try{const a={_id:c.value};await p.actions.delete(a),o.value-=1,s.value=!1,c.value=null}catch{alert("Error adding reaction. Please try again later.")}}return(m,a)=>(t.openBlock(),t.createElementBlock("footer",N,[t.createTextVNode(" 👁️ "+t.toDisplayString(e.blogpost.views)+" ",1),V,t.createElementVNode("div",$,[s.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:"cursor-pointer",onClick:a[0]||(a[0]=g=>l())}," 👍 "+t.toDisplayString(o.value),1)),s.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"cursor-pointer",onClick:a[1]||(a[1]=g=>i())}," 👍 "+t.toDisplayString(o.value),1)):t.createCommentVNode("",!0)]),S,t.createTextVNode(" 💬 "+t.toDisplayString(e.blogpost.numberOfComments),1)]))}},R={class:"pos-relative bg-grey radius-big"},j=["src"],I={class:"pd-t-zero pd-medium"},q={key:0,class:"cursor-pointer mn-thin flex-nowrap flex w-100"},D={key:0,class:"pd-micro t-white uppercase t-semi p-small flex-center flex pd-r-small pd-l-small mn-l-thin w-min bg-second radius-extra"},T={key:1,class:"mn-small t-transp p-big"},z={key:2,class:"mn-small h2"},L={__name:"CardBlogpost",props:["blogpost","user","type"],setup(e){const r=e,o=E.useRouter(),s=t.computed(()=>r.blogpost.content.find(l=>l.type==="ImageUpload")),c=t.computed(()=>r.blogpost.content.find(l=>l.type==="Textarea"));return(l,i)=>(t.openBlock(),t.createElementBlock("article",R,[e.user&&e.user===e.blogpost.creator.target._id?(t.openBlock(),t.createBlock(P.IconEdit,{key:0,onClick:i[0]||(i[0]=t.withModifiers(m=>l.$router.push({name:"Edit BlogPost",params:{url:e.blogpost.url}}),["stop"])),class:"z-index-2 pos-absolute pos-t-regular pos-r-regular i-regular t-transp"})):t.createCommentVNode("",!0),t.createVNode(p._sfc_main,{class:t.normalizeClass({"mn-small pd-medium":e.type!=="short","flex-child-order-last flex-child mn-l-small":e.type==="short"}),entity:e.blogpost,entityType:"blogpost",user:e.user,owner:e.blogpost.owner,creator:e.blogpost.creator,date:e.blogpost.createdAt},null,8,["class","entity","user","owner","creator","date"]),t.unref(s)&&t.unref(s).content&&e.type!=="blogpostPage"?(t.openBlock(),t.createElementBlock("img",{key:1,src:(l.FILE_SERVER_URL||"")+t.unref(s).content,alt:"Blog post image",class:"mn-medium object-fit-cover w-100 h-20r"},null,8,j)):t.createCommentVNode("",!0),t.createElementVNode("section",I,[e.type!=="blogpostPage"?(t.openBlock(),t.createElementBlock("div",q,[t.createElementVNode("h3",{onClick:i[1]||(i[1]=m=>t.unref(o).push({name:"BlogPost",params:{url:e.blogpost.url}})),class:""},t.toDisplayString(e.blogpost.name),1),e.blogpost.status==="draft"?(t.openBlock(),t.createElementBlock("div",D,t.toDisplayString(e.blogpost.status),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.unref(c)&&t.unref(c).content&&e.type!=="blogpostPage"?(t.openBlock(),t.createElementBlock("p",T,t.toDisplayString(t.unref(c).content.slice(0,120))+"... ",1)):t.createCommentVNode("",!0),e.type==="blogpostPage"?(t.openBlock(),t.createElementBlock("h3",z,t.toDisplayString(e.blogpost.name),1)):t.createCommentVNode("",!0),t.renderSlot(l.$slots,"default"),e.type!=="short"&&e.blogpost.tags.length>0?(t.openBlock(),t.createBlock(p._sfc_main$1,{key:3,chips:e.blogpost.tags},null,8,["chips"])):t.createCommentVNode("",!0)]),t.createVNode(w,{class:"pd-t-zero pd-medium",blogpost:e.blogpost,user:e.user},null,8,["blogpost","user"])]))}};exports._sfc_main=L;exports._sfc_main$1=w;exports.blogposts=x;exports.clean=v;exports.create=b;exports.read=y;exports.remove=h;exports.state=n;exports.update=k;
|
@@ -0,0 +1,246 @@
|
|
1
|
+
import { a as C } from "./index-a661083c.mjs";
|
2
|
+
import { reactive as j, watch as E, ref as w, openBlock as r, createElementBlock as c, createTextVNode as k, toDisplayString as i, createElementVNode as f, createCommentVNode as n, computed as P, createBlock as x, withModifiers as I, createVNode as $, normalizeClass as B, unref as m, renderSlot as S } from "vue";
|
3
|
+
import { s as v } from "./globals-96ba60e4.mjs";
|
4
|
+
import { a as R, _ as z, b as N } from "./Chips-a8681edd.mjs";
|
5
|
+
import { useRouter as T } from "vue-router";
|
6
|
+
import { I as V } from "./IconEdit-9edfd74d.mjs";
|
7
|
+
const b = C.create({ baseURL: process.env.API_URL, withCredentials: !0 });
|
8
|
+
b.defaults.withCredentials = !0;
|
9
|
+
const u = j({
|
10
|
+
all: [],
|
11
|
+
filter: {
|
12
|
+
// query
|
13
|
+
tags: [],
|
14
|
+
period: ""
|
15
|
+
// pagination
|
16
|
+
},
|
17
|
+
pagination: {
|
18
|
+
page: 1,
|
19
|
+
perPage: 18
|
20
|
+
},
|
21
|
+
// Sort
|
22
|
+
sort: {
|
23
|
+
current: "popularity",
|
24
|
+
ascending: !1
|
25
|
+
},
|
26
|
+
current: {
|
27
|
+
_id: "",
|
28
|
+
url: "",
|
29
|
+
status: "",
|
30
|
+
name: "",
|
31
|
+
tags: [],
|
32
|
+
owner: {},
|
33
|
+
date: "",
|
34
|
+
views: 0,
|
35
|
+
content: []
|
36
|
+
}
|
37
|
+
});
|
38
|
+
async function L(e = {}) {
|
39
|
+
e.params = e.params || {}, e.params.skip = e.skip || 0, e.params.limit = e.limit || 9, e.params.tags = e.tags || [], e.period && (e.params.period = e.period), e.url && (e.params = { url: e.url }), e.category && (e.params.category = e.category), e.owner && (e.params.owner = e.owner), e.following && (e.params.following = e.following), e.creator && (e.params.creator = e.creator), e.status && (e.params.status = e.status), e.user && (e.params.user = e.user), e.params.skip = e.skip || 0, e.params.limit = e.limit || 10;
|
40
|
+
try {
|
41
|
+
console.log("Request params:" + e.params);
|
42
|
+
const t = await b.get("/api/blog/read", { params: e.params });
|
43
|
+
return e.url ? p(t.data, "current") : p(t.data, "all"), Promise.resolve(t.data);
|
44
|
+
} catch (t) {
|
45
|
+
return v(t), Promise.reject(t);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
async function O(e) {
|
49
|
+
return b.post("/api/blog/create", e).then(
|
50
|
+
(t) => (p(t.data, "current"), Promise.resolve(t.data)),
|
51
|
+
(t) => (v(t), Promise.reject(t))
|
52
|
+
);
|
53
|
+
}
|
54
|
+
async function U(e) {
|
55
|
+
return b.post("/api/blog/update", e).then(
|
56
|
+
(t) => (p(t.data, "current"), Promise.resolve(t.data)),
|
57
|
+
(t) => (v(t), Promise.reject(t))
|
58
|
+
);
|
59
|
+
}
|
60
|
+
async function A(e) {
|
61
|
+
return await b.delete(`/api/blog/delete/${e}`).then(
|
62
|
+
(t) => {
|
63
|
+
const l = u.all.findIndex((s) => s._id === e);
|
64
|
+
return l !== -1 && u.all.splice(l, 1), Promise.resolve(t.data);
|
65
|
+
},
|
66
|
+
(t) => (v(t), Promise.reject(t))
|
67
|
+
);
|
68
|
+
}
|
69
|
+
function p(e, t) {
|
70
|
+
u[t] = e;
|
71
|
+
}
|
72
|
+
function F() {
|
73
|
+
u.current = {
|
74
|
+
_id: "",
|
75
|
+
url: "",
|
76
|
+
status: "",
|
77
|
+
name: "",
|
78
|
+
tags: [],
|
79
|
+
author: "",
|
80
|
+
owner: "",
|
81
|
+
date: "",
|
82
|
+
views: 0,
|
83
|
+
content: []
|
84
|
+
};
|
85
|
+
}
|
86
|
+
function M(e) {
|
87
|
+
const t = {
|
88
|
+
order: u.project.content.length + 1,
|
89
|
+
type: e.type,
|
90
|
+
data: e.data,
|
91
|
+
class: e.class,
|
92
|
+
content: e.content
|
93
|
+
};
|
94
|
+
u.project.content.push(t);
|
95
|
+
}
|
96
|
+
E(u, (e, t) => {
|
97
|
+
});
|
98
|
+
const oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
99
|
+
__proto__: null,
|
100
|
+
blockAdd: M,
|
101
|
+
clean: F,
|
102
|
+
create: O,
|
103
|
+
read: L,
|
104
|
+
remove: A,
|
105
|
+
set: p,
|
106
|
+
state: u,
|
107
|
+
update: U
|
108
|
+
}, Symbol.toStringTag, { value: "Module" })), q = { class: "t-semi br-top-dark flex-nowrap flex-nojustify flex" }, D = /* @__PURE__ */ f("span", { class: "mn-r-small mn-l-small d-block" }, "·", -1), G = { class: "cursor-pointer" }, H = /* @__PURE__ */ f("span", { class: "mn-r-small mn-l-small d-block" }, "·", -1), J = {
|
109
|
+
__name: "FooterBlogpost",
|
110
|
+
props: ["blogpost", "owner", "user"],
|
111
|
+
setup(e) {
|
112
|
+
const t = e, l = w(t.blogpost.numberOfReactions), s = w(t.blogpost.isReacted), d = w(t.blogpost.reactionId);
|
113
|
+
async function o(y) {
|
114
|
+
if (!t.user) {
|
115
|
+
alert("Please login to add a reaction");
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
try {
|
119
|
+
const a = {
|
120
|
+
target: t.blogpost._id,
|
121
|
+
type: "blogpost",
|
122
|
+
user: t.user,
|
123
|
+
class: "like"
|
124
|
+
}, h = await R.create(a);
|
125
|
+
h.reaction.class === "like" && (l.value += 1, s.value = !0, d.value = h.reaction._id);
|
126
|
+
} catch (a) {
|
127
|
+
console.error(a), alert("Error adding reaction. Please try again later.");
|
128
|
+
}
|
129
|
+
}
|
130
|
+
async function g(y) {
|
131
|
+
if (!t.user) {
|
132
|
+
alert("Please login to add a reaction");
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
try {
|
136
|
+
const a = { _id: d.value };
|
137
|
+
await R.delete(a), l.value -= 1, s.value = !1, d.value = null;
|
138
|
+
} catch {
|
139
|
+
alert("Error adding reaction. Please try again later.");
|
140
|
+
}
|
141
|
+
}
|
142
|
+
return (y, a) => (r(), c("footer", q, [
|
143
|
+
k(" 👁️ " + i(e.blogpost.views) + " ", 1),
|
144
|
+
D,
|
145
|
+
f("div", G, [
|
146
|
+
s.value ? n("", !0) : (r(), c("div", {
|
147
|
+
key: 0,
|
148
|
+
class: "cursor-pointer",
|
149
|
+
onClick: a[0] || (a[0] = (h) => o())
|
150
|
+
}, " 👍 " + i(l.value), 1)),
|
151
|
+
s.value ? (r(), c("div", {
|
152
|
+
key: 1,
|
153
|
+
class: "cursor-pointer",
|
154
|
+
onClick: a[1] || (a[1] = (h) => g())
|
155
|
+
}, " 👍 " + i(l.value), 1)) : n("", !0)
|
156
|
+
]),
|
157
|
+
H,
|
158
|
+
k(" 💬 " + i(e.blogpost.numberOfComments), 1)
|
159
|
+
]));
|
160
|
+
}
|
161
|
+
}, K = { class: "pos-relative bg-grey radius-big" }, Q = ["src"], W = { class: "pd-t-zero pd-medium" }, X = {
|
162
|
+
key: 0,
|
163
|
+
class: "cursor-pointer mn-thin flex-nowrap flex w-100"
|
164
|
+
}, Y = {
|
165
|
+
key: 0,
|
166
|
+
class: "pd-micro t-white uppercase t-semi p-small flex-center flex pd-r-small pd-l-small mn-l-thin w-min bg-second radius-extra"
|
167
|
+
}, Z = {
|
168
|
+
key: 1,
|
169
|
+
class: "mn-small t-transp p-big"
|
170
|
+
}, _ = {
|
171
|
+
key: 2,
|
172
|
+
class: "mn-small h2"
|
173
|
+
}, ne = {
|
174
|
+
__name: "CardBlogpost",
|
175
|
+
props: ["blogpost", "user", "type"],
|
176
|
+
setup(e) {
|
177
|
+
const t = e, l = T(), s = P(() => t.blogpost.content.find((o) => o.type === "ImageUpload")), d = P(() => t.blogpost.content.find((o) => o.type === "Textarea"));
|
178
|
+
return (o, g) => (r(), c("article", K, [
|
179
|
+
e.user && e.user === e.blogpost.creator.target._id ? (r(), x(V, {
|
180
|
+
key: 0,
|
181
|
+
onClick: g[0] || (g[0] = I((y) => o.$router.push({
|
182
|
+
name: "Edit BlogPost",
|
183
|
+
params: {
|
184
|
+
url: e.blogpost.url
|
185
|
+
}
|
186
|
+
}), ["stop"])),
|
187
|
+
class: "z-index-2 pos-absolute pos-t-regular pos-r-regular i-regular t-transp"
|
188
|
+
})) : n("", !0),
|
189
|
+
$(z, {
|
190
|
+
class: B({
|
191
|
+
"mn-small pd-medium": e.type !== "short",
|
192
|
+
"flex-child-order-last flex-child mn-l-small": e.type === "short"
|
193
|
+
}),
|
194
|
+
entity: e.blogpost,
|
195
|
+
entityType: "blogpost",
|
196
|
+
user: e.user,
|
197
|
+
owner: e.blogpost.owner,
|
198
|
+
creator: e.blogpost.creator,
|
199
|
+
date: e.blogpost.createdAt
|
200
|
+
}, null, 8, ["class", "entity", "user", "owner", "creator", "date"]),
|
201
|
+
m(s) && m(s).content && e.type !== "blogpostPage" ? (r(), c("img", {
|
202
|
+
key: 1,
|
203
|
+
src: (o.FILE_SERVER_URL || "") + m(s).content,
|
204
|
+
alt: "Blog post image",
|
205
|
+
class: "mn-medium object-fit-cover w-100 h-20r"
|
206
|
+
}, null, 8, Q)) : n("", !0),
|
207
|
+
f("section", W, [
|
208
|
+
e.type !== "blogpostPage" ? (r(), c("div", X, [
|
209
|
+
f("h3", {
|
210
|
+
onClick: g[1] || (g[1] = (y) => m(l).push({
|
211
|
+
name: "BlogPost",
|
212
|
+
params: {
|
213
|
+
url: e.blogpost.url
|
214
|
+
}
|
215
|
+
})),
|
216
|
+
class: ""
|
217
|
+
}, i(e.blogpost.name), 1),
|
218
|
+
e.blogpost.status === "draft" ? (r(), c("div", Y, i(e.blogpost.status), 1)) : n("", !0)
|
219
|
+
])) : n("", !0),
|
220
|
+
m(d) && m(d).content && e.type !== "blogpostPage" ? (r(), c("p", Z, i(m(d).content.slice(0, 120)) + "... ", 1)) : n("", !0),
|
221
|
+
e.type === "blogpostPage" ? (r(), c("h3", _, i(e.blogpost.name), 1)) : n("", !0),
|
222
|
+
S(o.$slots, "default"),
|
223
|
+
e.type !== "short" && e.blogpost.tags.length > 0 ? (r(), x(N, {
|
224
|
+
key: 3,
|
225
|
+
chips: e.blogpost.tags
|
226
|
+
}, null, 8, ["chips"])) : n("", !0)
|
227
|
+
]),
|
228
|
+
$(J, {
|
229
|
+
class: "pd-t-zero pd-medium",
|
230
|
+
blogpost: e.blogpost,
|
231
|
+
user: e.user
|
232
|
+
}, null, 8, ["blogpost", "user"])
|
233
|
+
]));
|
234
|
+
}
|
235
|
+
};
|
236
|
+
export {
|
237
|
+
ne as _,
|
238
|
+
A as a,
|
239
|
+
O as b,
|
240
|
+
F as c,
|
241
|
+
J as d,
|
242
|
+
oe as e,
|
243
|
+
L as r,
|
244
|
+
u as s,
|
245
|
+
U as u
|
246
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const e=require("vue"),k=require("vue-router"),y=require("./Dropdown-f2564c92.js");require("./Button.vue_vue_type_style_index_0_lang-0ea8fbf8.js");require("./auth-06d35b82.js");require("./memberships-393765d8.js");const p=require("./index-b41aac19.js"),u=require("./globals-928eb13c.js"),w={key:0,class:"pd-b-zero"},b={class:"w-100 flex-v-center flex-nojustify flex"},B={class:"w-100 flex-nowrap flex-v-center flex"},E=["src"],x={key:2,class:"t-semi"},$={key:1},v={key:2},C={class:"d-block mn-l-auto flex-nowrap flex flex-v-center"},V={key:0,class:"w-4r i-thin"},N={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 t-semi"},P=["src"],R={class:"bg-black pd-thin radius-small"},S=e.createElementVNode("button",{class:"w-100 bg-black br-solid br-1px br-white-transp-20 t-white button-small button"}," Report ",-1),D={__name:"CardHeader",props:["user","entity","entityType","date","dateFormatted","owner","creator","members","membersPhotos","type"],setup(t){k.useRouter();function o(s){const r=new Date,n=new Date(s),l=Math.abs(r-n),i=Math.floor(l/1e3),a=Math.floor(i/60),d=Math.floor(a/60),m=Math.floor(d/24),f=Math.floor(m/7);return f>0?`${f} week${f>1?"s":""} ago`:m>0?`${m} day${m>1?"s":""} ago`:d>0?`${d} hour${d>1?"s":""} ago`:a>0?`${a} minute${a>1?"s":""} ago`:"Just now"}return(s,r)=>{var n,l;return t.owner?(e.openBlock(),e.createElementBlock("header",w,[e.createElementVNode("div",b,[e.createElementVNode("div",B,[t.owner.target.profile.photo.length>0&&t.type!=="short"?(e.openBlock(),e.createElementBlock("img",{key:0,src:(s.FILE_SERVER_URL||"")+t.owner.target.profile.photo,class:"radius-medium mn-r-thin i-thin",onClick:r[0]||(r[0]=e.withModifiers(i=>s.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))},null,8,E)):e.createCommentVNode("",!0),!t.owner.target.profile.photo&&t.type!=="short"?(e.openBlock(),e.createBlock(y.PlaceholderUserpic,{key:1,class:"radius-medium mn-r-thin i-thin",onClick:r[1]||(r[1]=e.withModifiers(i=>s.$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",x,[e.createElementVNode("span",{onClick:r[2]||(r[2]=e.withModifiers(i=>s.$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!==((n=t.creator.target.profile)==null?void 0:n.name)?(e.openBlock(),e.createElementBlock("span",{key:0,onClick:r[3]||(r[3]=e.withModifiers(i=>s.$router.push({name:"User Profile",params:{_id:t.creator.target._id}}),["stop"]))}," · by "+e.toDisplayString((l=t.creator.target.profile)==null?void 0:l.name),1)):e.createCommentVNode("",!0),t.date?(e.openBlock(),e.createElementBlock("span",$," · "+e.toDisplayString(o(t.date)),1)):e.createCommentVNode("",!0),t.dateFormatted?(e.openBlock(),e.createElementBlock("span",v," · "+e.toDisplayString(t.dateFormatted),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",C,[t.members?(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("span",N,e.toDisplayString(t.members),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.membersPhotos.slice(0,2),(i,a)=>(e.openBlock(),e.createElementBlock("img",{key:a,src:(s.FILE_SERVER_URL||"")+i,style:e.normalizeStyle({position:"absolute",top:"0px",right:a*20+20+"%",zIndex:1-a}),class:"br-solid br-2px br-white i-thin bg-grey radius-big"},null,12,P))),128))])):e.createCommentVNode("",!0)]),t.type!=="short"&&t.user&&t.user!=t.creator.target._id?(e.openBlock(),e.createBlock(y.Dropdown,{key:3,label:"...",align:"right",class:"cursor-pointer z-index-2 pd-thin radius-extra"},{default:e.withCtx(()=>[e.createElementVNode("section",R,[t.user!==t.creator.target._id?(e.openBlock(),e.createBlock(y._sfc_main,{key:0,user:t.user,type:t.entityType,target:t.entity._id,text:"Report",class:"w-100"},{default:e.withCtx(()=>[S]),_:1},8,["user","type","target"])):e.createCommentVNode("",!0)])]),_:1},8,["label"])):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0)}}},h=p.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),c=e.reactive({reactions:[],error:null}),g={async read({user:t,type:o,target:s,role:r}){try{const n=await h.get("/api/reactions",{params:{user:t,type:o,target:s,role:r}});return c.error=null,c.reactions=n.data,Promise.resolve(n.data)}catch(n){return u.setError(n),Promise.reject(n)}},async create(t){try{const o=await h.post("/api/reactions/create",t);return c.error=null,Promise.resolve(o.data)}catch(o){return console.log(o),u.setError(o),Promise.reject(o)}},async update(t){try{const o=await h.post("/api/reactions/update",t);return c.error=null,Promise.resolve(o.data)}catch(o){return u.setError(o),Promise.reject(o)}},async delete(t){try{const o=await h.post("/api/reactions/delete",t);return c.error=null,Promise.resolve(o.data)}catch(o){return u.setError(o),Promise.reject(o)}}},M={handleReactionUpdate(t,o,s){let r;if(Array.isArray(t)?r=t.find(n=>n._id===o.target):typeof t=="object"&&t._id===o.target&&(r=t),r)if(r.hasReaction=s,s)r.reactions.push(o),r.numberOfReactions+=1;else{const n=r.reactions.findIndex(l=>l._id===o._id);n!==-1&&(r.reactions.splice(n,1),r.numberOfReactions-=1)}}};e.watch(c,t=>{});const U=Object.freeze(Object.defineProperty({__proto__:null,actions:g,mutations:M,state:c},Symbol.toStringTag,{value:"Module"})),q={class:"flex-v-center gap-thin flex"},z={class:"pd-thin radius-small t-semi bg-main"},j={key:1,class:"pd-thin radius-small t-semi bg-white"},L={__name:"Chips",props:["chips"],setup(t){return(o,s)=>(e.openBlock(),e.createElementBlock("div",q,[t.chips.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.chips,(r,n)=>(e.openBlock(),e.createElementBlock("div",z,e.toDisplayString(r.text?r.text:r),1))),256)):(e.openBlock(),e.createElementBlock("div",j,e.toDisplayString(t.chips),1))]))}};exports._sfc_main=D;exports._sfc_main$1=L;exports.actions=g;exports.reactions=U;
|
@@ -0,0 +1,213 @@
|
|
1
|
+
import { openBlock as o, createElementBlock as a, createElementVNode as d, withModifiers as g, createCommentVNode as i, createBlock as x, toDisplayString as u, Fragment as v, renderList as $, normalizeStyle as P, withCtx as k, reactive as R, watch as E } from "vue";
|
2
|
+
import { useRouter as U } from "vue-router";
|
3
|
+
import { P as z, D as C, _ as j } from "./Dropdown-ef2df9a9.mjs";
|
4
|
+
import "./Button.vue_vue_type_style_index_0_lang-4ed993c7.mjs";
|
5
|
+
import "./auth-ec618cb3.mjs";
|
6
|
+
import "./memberships-12210953.mjs";
|
7
|
+
import { a as M } from "./index-a661083c.mjs";
|
8
|
+
import { s as b } from "./globals-96ba60e4.mjs";
|
9
|
+
const L = {
|
10
|
+
key: 0,
|
11
|
+
class: "pd-b-zero"
|
12
|
+
}, O = { class: "w-100 flex-v-center flex-nojustify flex" }, S = { class: "w-100 flex-nowrap flex-v-center flex" }, D = ["src"], F = {
|
13
|
+
key: 2,
|
14
|
+
class: "t-semi"
|
15
|
+
}, I = { key: 1 }, A = { key: 2 }, T = { class: "d-block mn-l-auto flex-nowrap flex flex-v-center" }, V = {
|
16
|
+
key: 0,
|
17
|
+
class: "w-4r i-thin"
|
18
|
+
}, B = {
|
19
|
+
style: {
|
20
|
+
position: "absolute",
|
21
|
+
top: "0px",
|
22
|
+
right: "0px"
|
23
|
+
},
|
24
|
+
class: "br-solid br-2px br-white z-index-1 radius-big i-thin bg-second flex flex-center t-white p-small t-semi"
|
25
|
+
}, N = ["src"], H = { class: "bg-black pd-thin radius-small" }, J = /* @__PURE__ */ d("button", { class: "w-100 bg-black br-solid br-1px br-white-transp-20 t-white button-small button" }, " Report ", -1), oe = {
|
26
|
+
__name: "CardHeader",
|
27
|
+
props: [
|
28
|
+
"user",
|
29
|
+
"entity",
|
30
|
+
"entityType",
|
31
|
+
"date",
|
32
|
+
"dateFormatted",
|
33
|
+
"owner",
|
34
|
+
"creator",
|
35
|
+
"members",
|
36
|
+
"membersPhotos",
|
37
|
+
"type"
|
38
|
+
],
|
39
|
+
setup(e) {
|
40
|
+
U();
|
41
|
+
function r(n) {
|
42
|
+
const t = /* @__PURE__ */ new Date(), s = new Date(n), h = Math.abs(t - s), c = Math.floor(h / 1e3), l = Math.floor(c / 60), f = Math.floor(l / 60), y = Math.floor(f / 24), p = Math.floor(y / 7);
|
43
|
+
return p > 0 ? `${p} week${p > 1 ? "s" : ""} ago` : y > 0 ? `${y} day${y > 1 ? "s" : ""} ago` : f > 0 ? `${f} hour${f > 1 ? "s" : ""} ago` : l > 0 ? `${l} minute${l > 1 ? "s" : ""} ago` : "Just now";
|
44
|
+
}
|
45
|
+
return (n, t) => {
|
46
|
+
var s, h;
|
47
|
+
return e.owner ? (o(), a("header", L, [
|
48
|
+
d("div", O, [
|
49
|
+
d("div", S, [
|
50
|
+
e.owner.target.profile.photo.length > 0 && e.type !== "short" ? (o(), a("img", {
|
51
|
+
key: 0,
|
52
|
+
src: (n.FILE_SERVER_URL || "") + e.owner.target.profile.photo,
|
53
|
+
class: "radius-medium mn-r-thin i-thin",
|
54
|
+
onClick: t[0] || (t[0] = g((c) => n.$router.push({
|
55
|
+
name: e.owner.type === "user" ? "User Profile" : "Organization",
|
56
|
+
params: {
|
57
|
+
_id: e.owner.target._id
|
58
|
+
}
|
59
|
+
}), ["stop"]))
|
60
|
+
}, null, 8, D)) : i("", !0),
|
61
|
+
!e.owner.target.profile.photo && e.type !== "short" ? (o(), x(z, {
|
62
|
+
key: 1,
|
63
|
+
class: "radius-medium mn-r-thin i-thin",
|
64
|
+
onClick: t[1] || (t[1] = g((c) => n.$router.push({
|
65
|
+
name: e.owner.type === "user" ? "User Profile" : "Organization",
|
66
|
+
params: {
|
67
|
+
_id: e.owner.target._id
|
68
|
+
}
|
69
|
+
}), ["stop"]))
|
70
|
+
})) : i("", !0),
|
71
|
+
e.type !== "short" ? (o(), a("span", F, [
|
72
|
+
d("span", {
|
73
|
+
onClick: t[2] || (t[2] = g((c) => n.$router.push({
|
74
|
+
name: e.owner.type === "user" ? "User Profile" : "Organization",
|
75
|
+
params: {
|
76
|
+
_id: e.owner.target._id
|
77
|
+
}
|
78
|
+
}), ["stop"]))
|
79
|
+
}, u(e.owner.target.profile.name), 1),
|
80
|
+
!e.creator.hidden && e.owner.target.profile.name !== ((s = e.creator.target.profile) == null ? void 0 : s.name) ? (o(), a("span", {
|
81
|
+
key: 0,
|
82
|
+
onClick: t[3] || (t[3] = g((c) => n.$router.push({
|
83
|
+
name: "User Profile",
|
84
|
+
params: {
|
85
|
+
_id: e.creator.target._id
|
86
|
+
}
|
87
|
+
}), ["stop"]))
|
88
|
+
}, " · by " + u((h = e.creator.target.profile) == null ? void 0 : h.name), 1)) : i("", !0),
|
89
|
+
e.date ? (o(), a("span", I, " · " + u(r(e.date)), 1)) : i("", !0),
|
90
|
+
e.dateFormatted ? (o(), a("span", A, " · " + u(e.dateFormatted), 1)) : i("", !0)
|
91
|
+
])) : i("", !0),
|
92
|
+
d("div", T, [
|
93
|
+
e.members ? (o(), a("div", V, [
|
94
|
+
d("span", B, u(e.members), 1),
|
95
|
+
(o(!0), a(v, null, $(e.membersPhotos.slice(0, 2), (c, l) => (o(), a("img", {
|
96
|
+
key: l,
|
97
|
+
src: (n.FILE_SERVER_URL || "") + c,
|
98
|
+
style: P({
|
99
|
+
position: "absolute",
|
100
|
+
top: "0px",
|
101
|
+
right: l * 20 + 20 + "%",
|
102
|
+
zIndex: 1 - l
|
103
|
+
}),
|
104
|
+
class: "br-solid br-2px br-white i-thin bg-grey radius-big"
|
105
|
+
}, null, 12, N))), 128))
|
106
|
+
])) : i("", !0)
|
107
|
+
]),
|
108
|
+
e.type !== "short" && e.user && e.user != e.creator.target._id ? (o(), x(C, {
|
109
|
+
key: 3,
|
110
|
+
label: "...",
|
111
|
+
align: "right",
|
112
|
+
class: "cursor-pointer z-index-2 pd-thin radius-extra"
|
113
|
+
}, {
|
114
|
+
default: k(() => [
|
115
|
+
d("section", H, [
|
116
|
+
e.user !== e.creator.target._id ? (o(), x(j, {
|
117
|
+
key: 0,
|
118
|
+
user: e.user,
|
119
|
+
type: e.entityType,
|
120
|
+
target: e.entity._id,
|
121
|
+
text: "Report",
|
122
|
+
class: "w-100"
|
123
|
+
}, {
|
124
|
+
default: k(() => [
|
125
|
+
J
|
126
|
+
]),
|
127
|
+
_: 1
|
128
|
+
}, 8, ["user", "type", "target"])) : i("", !0)
|
129
|
+
])
|
130
|
+
]),
|
131
|
+
_: 1
|
132
|
+
}, 8, ["label"])) : i("", !0)
|
133
|
+
])
|
134
|
+
])
|
135
|
+
])) : i("", !0);
|
136
|
+
};
|
137
|
+
}
|
138
|
+
}, w = M.create({
|
139
|
+
baseURL: process.env.API_URL,
|
140
|
+
withCredentials: !0
|
141
|
+
}), m = R({
|
142
|
+
reactions: [],
|
143
|
+
error: null
|
144
|
+
}), q = {
|
145
|
+
async read({ user: e, type: r, target: n, role: t }) {
|
146
|
+
try {
|
147
|
+
const s = await w.get("/api/reactions", { params: { user: e, type: r, target: n, role: t } });
|
148
|
+
return m.error = null, m.reactions = s.data, Promise.resolve(s.data);
|
149
|
+
} catch (s) {
|
150
|
+
return b(s), Promise.reject(s);
|
151
|
+
}
|
152
|
+
},
|
153
|
+
async create(e) {
|
154
|
+
try {
|
155
|
+
const r = await w.post("/api/reactions/create", e);
|
156
|
+
return m.error = null, Promise.resolve(r.data);
|
157
|
+
} catch (r) {
|
158
|
+
return console.log(r), b(r), Promise.reject(r);
|
159
|
+
}
|
160
|
+
},
|
161
|
+
async update(e) {
|
162
|
+
try {
|
163
|
+
const r = await w.post("/api/reactions/update", e);
|
164
|
+
return m.error = null, Promise.resolve(r.data);
|
165
|
+
} catch (r) {
|
166
|
+
return b(r), Promise.reject(r);
|
167
|
+
}
|
168
|
+
},
|
169
|
+
async delete(e) {
|
170
|
+
try {
|
171
|
+
const r = await w.post("/api/reactions/delete", e);
|
172
|
+
return m.error = null, Promise.resolve(r.data);
|
173
|
+
} catch (r) {
|
174
|
+
return b(r), Promise.reject(r);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}, G = {
|
178
|
+
handleReactionUpdate(e, r, n) {
|
179
|
+
let t;
|
180
|
+
if (Array.isArray(e) ? t = e.find((s) => s._id === r.target) : typeof e == "object" && e._id === r.target && (t = e), t)
|
181
|
+
if (t.hasReaction = n, n)
|
182
|
+
t.reactions.push(r), t.numberOfReactions += 1;
|
183
|
+
else {
|
184
|
+
const s = t.reactions.findIndex((h) => h._id === r._id);
|
185
|
+
s !== -1 && (t.reactions.splice(s, 1), t.numberOfReactions -= 1);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
};
|
189
|
+
E(m, (e) => {
|
190
|
+
});
|
191
|
+
const ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
192
|
+
__proto__: null,
|
193
|
+
actions: q,
|
194
|
+
mutations: G,
|
195
|
+
state: m
|
196
|
+
}, Symbol.toStringTag, { value: "Module" })), K = { class: "flex-v-center gap-thin flex" }, Q = { class: "pd-thin radius-small t-semi bg-main" }, W = {
|
197
|
+
key: 1,
|
198
|
+
class: "pd-thin radius-small t-semi bg-white"
|
199
|
+
}, ae = {
|
200
|
+
__name: "Chips",
|
201
|
+
props: ["chips"],
|
202
|
+
setup(e) {
|
203
|
+
return (r, n) => (o(), a("div", K, [
|
204
|
+
e.chips.length ? (o(!0), a(v, { key: 0 }, $(e.chips, (t, s) => (o(), a("div", Q, u(t.text ? t.text : t), 1))), 256)) : (o(), a("div", W, u(e.chips), 1))
|
205
|
+
]));
|
206
|
+
}
|
207
|
+
};
|
208
|
+
export {
|
209
|
+
oe as _,
|
210
|
+
q as a,
|
211
|
+
ae as b,
|
212
|
+
ne as r
|
213
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),v=require("./CardBlogpost-ae3b4d23.js"),$=require("./auth-06d35b82.js"),D=require("vue-router"),P=require("./_plugin-vue_export-helper-f246444f.js");require("./index-b41aac19.js");require("./globals-928eb13c.js");require("vue-i18n");require("./Chips-3a07f374.js");require("./Dropdown-f2564c92.js");require("./Popup-eb11fa82.js");require("./Popup.vue_vue_type_style_index_0_lang-0ea8fbf8.js");require("./Button-7643c9aa.js");require("./Button.vue_vue_type_style_index_0_lang-0ea8fbf8.js");require("./Select-3ca5ab39.js");require("./reports-270f69df.js");require("./click-outside-0b0727d1.js");require("./memberships-393765d8.js");require("./IconEdit-c0469b45.js");var j={};(function(i){Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e=t;const h={class:"flex-nowrap flex-v-center flex pd-medium bg-white"},N={key:0,class:"t-left mn-r-small w-33"},y={class:"w-100"},k=["value","placeholder"],b=e.defineComponent({__name:"Field",props:{label:{default:"Label"},placeholder:{default:"Enter something here"},field:{default:null},validation:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(l,{emit:n}){const a=l,o=e.ref(a.field);return(m,d)=>(e.openBlock(),e.createElementBlock("div",h,[l.label?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("label",null,e.toDisplayString(l.label),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",y,[e.createElementVNode("input",{onInput:d[0]||(d[0]=g=>{var c;return o.value=n("update:modelValue",(c=g.target)==null?void 0:c.value)}),type:"text",class:"w-100",value:l.field,placeholder:l.placeholder},null,40,k)])]))}}),r={class:"input-wrapper"},f={class:"t-transp p-small"},u={key:0,class:"flex-nojustify flex-v-center flex-nowrap flex w-100"},_={key:1,class:"w-100"},B=["onClick"],V={__name:"Select",props:["obj","label","prop","value","options","content","textarea","placeholder","size"],setup(l){const n=l,a=e.ref(null),o=e.ref(!1);e.ref("Please select an item");let m=e.computed(()=>{if(n.prop[n.content]){var c=n.options.indexOf(n.prop[n.content]),p=n.options.map(s=>s);return c!=-1&&p.splice(c,1),p}else return n.options});n.prop[n.content]&&(a.value=n.prop[n.content]);function d(){o.value=!o.value}function g(c,p,s){var E=s;a.value=E,o.value=!o.value,c[p]=E}return(c,p)=>(e.openBlock(),e.createElementBlock("div",r,[e.createElementVNode("span",f,e.toDisplayString(l.label),1),e.createElementVNode("li",{onClick:p[0]||(p[0]=e.withModifiers(s=>d(),["stop"])),class:e.normalizeClass([{"input-small":l.size==="small"},"pd-small flex-center flex-nowrap flex bg-grey input-select input"])},[a.value?(e.openBlock(),e.createElementBlock("span",u,[e.createElementVNode("span",null,e.toDisplayString(a.value.name?a.value.name:a.value),1)])):(e.openBlock(),e.createElementBlock("span",_,e.toDisplayString(l.placeholder?l.placeholder:"Please select"),1))],2),o.value?(e.openBlock(),e.createElementBlock("ul",{key:0,class:e.normalizeClass([{"dropdown-small":l.size==="small"},"bg-grey dropdown-menu"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),s=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass([{"input-small":l.size==="small"},"pd-small bg-grey input-select input"])},[s?(e.openBlock(),e.createElementBlock("span",{key:0,onClick:E=>g(l.prop,l.content,s),class:"flex-nojustify flex-v-center flex-nowrap flex w-100"},[e.createElementVNode("span",null,e.toDisplayString(s.name?s.name:s),1)],8,B)):e.createCommentVNode("",!0)],2))),256))],2)):e.createCommentVNode("",!0)]))}},C=["disabled"],x={key:0},q={key:0,class:"loading"},S=e.createElementVNode("span",null,[e.createElementVNode("svg",{class:"i-default",width:"135",height:"140",viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:"#fff"},[e.createElementVNode("rect",{y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"60",width:"15",height:"140",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})])])],-1),M=[S],T={key:0,class:"h4 loading"},I=e.createElementVNode("span",{class:"t-white"},"✔",-1),L=[I],z={key:0,class:"error"},w=e.defineComponent({__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},callback:{type:Function,default:async()=>{console.log("Button callback.")}},validation:{type:Boolean,default:!1}},setup(l){const n=l,a=e.ref(null),o=e.ref(null),m=e.ref(!1),d=e.ref(!1);async function g(){a.value.style["pointer-events"]="none",o.value=null,m.value=!0;try{await n.submit(),a.value.classList.add("bg-light-blue"),a.value.classList.remove("bg-blue"),m.value=!1,d.value=!0,setTimeout(()=>n.callback(),750)}catch{a.value.classList.add("bg-light-red"),a.value.classList.remove("bg-blue"),o.value="❌",setTimeout(()=>{a.value.classList.add("bg-blue"),a.value.classList.remove("bg-light-red"),a.value.style.pointerEvents="auto",m.value=!1,d.value=!1,o.value=null},1e3)}}return(c,p)=>(e.openBlock(),e.createElementBlock("button",{onClick:g,disabled:l.validation,ref_key:"button",ref:a,class:"w-100 t-white bg-blue button"},[e.createVNode(e.Transition,{mode:"out-in",name:"fadeIn"},{default:e.withCtx(()=>[!m.value&&!o.value&&!d.value?(e.openBlock(),e.createElementBlock("span",x,[e.renderSlot(c.$slots,"default")])):e.createCommentVNode("",!0)]),_:3}),e.createVNode(e.Transition,{mode:"out-in",name:"fadeIn"},{default:e.withCtx(()=>[m.value&&!o.value?(e.openBlock(),e.createElementBlock("div",q,M)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{mode:"out-in",name:"fadeIn"},{default:e.withCtx(()=>[d.value?(e.openBlock(),e.createElementBlock("div",T,L)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{mode:"out-in",name:"fadeIn"},{default:e.withCtx(()=>[o.value?(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("span",null,e.toDisplayString(o.value),1)])):e.createCommentVNode("",!0)]),_:1})],8,C))}});var F={install:l=>{l.component("Field",b),l.component("Button",w),l.component("Select",V)}};i.Button=w,i.Field=b,i.Select=V,i.default=F})(j);const O=i=>(t.pushScopeId("data-v-faeb0fe0"),i=i(),t.popScopeId(),i),A={class:"flex-v-center flex-nowrap flex mn-medium"},R=O(()=>t.createElementVNode("h3",{class:"mn-r-medium"},"Blog",-1)),H={class:""},U={class:"flex-nowrap flex pd-t-zero pd-b-zero pd-big"},G=["onClick"],J=["onClick"],K={__name:"Community",async setup(i){let e,h;const N=D.useRouter();[e,h]=t.withAsyncContext(()=>v.read()),await e,h(),console.log(v.state),t.ref({title:"",content:"",categories:[]});const y=async r=>{window.confirm("Are you sure you want to delete this post?")&&(console.log(r),await v.remove(r))};let k=t.ref("all");const b=t.computed(()=>k.value==="all"?v.state.all:v.state.all.filter(r=>r.categories.includes(k.value)));return t.computed(()=>{for(let r of b.value)if(r.blocks&&r.blocks.length>0){const f=r.blocks.find(u=>u.type.name==="ImageUpload");if(f)return f.content}return null}),(r,f)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",A,[R,t.createElementVNode("button",{onClick:f[0]||(f[0]=u=>t.unref(N).push({name:"Create BlogPost"})),class:"t-white bg-second button-small button"},"+")]),t.createElementVNode("div",H,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(b),u=>(t.openBlock(),t.createBlock(v._sfc_main,{key:u._id,blogpost:u,owner:$.state.user._id,class:"mn-medium"},{default:t.withCtx(()=>[t.createElementVNode("div",U,[t.createElementVNode("button",{class:"mn-r-thin button-small w-100 button",onClick:_=>r.$router.push({path:"/community/posts/"+u.url+"/edit"})},"Edit",8,G),t.createElementVNode("button",{class:"button-small w-100 button",onClick:_=>y(u._id)},"Delete",8,J)])]),_:2},1032,["blogpost","owner"]))),128))])]))}},Q=P._export_sfc(K,[["__scopeId","data-v-faeb0fe0"]]);exports.default=Q;
|