@articles-media/articles-dev-box 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FriendsList.cjs +1 -1
- package/dist/FriendsList.js +85 -98
- package/dist/index.cjs +1 -1
- package/dist/index.js +10 -8
- package/dist/useUserFriends.cjs +1 -0
- package/dist/useUserFriends.js +52 -0
- package/package.json +5 -1
package/dist/FriendsList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-nZSsnGb7.cjs"),f=require("./useUserFriends.cjs"),n=require("./Button-0ZK0NKiK.cjs"),i=require("./Modal-Wmqy9fOm.cjs");function h({show:u,setShow:x,componentType:a,className:l,style:o={},user_id:c,user_token:m,id:j=null,allowInvite:d=!1,inviteFunction:E=null,modalBackdropClassName:p=""}){const{data:e,error:N,isLoading:r,mutate:R}=f({user_id:c,user_token:m});if((!a||a=="list")&&!r&&e&&e.length>0)return s.jsxRuntimeExports.jsx("ul",{className:l,style:o,children:e.map(t=>s.jsxRuntimeExports.jsxs("li",{children:[t?.populated_user?.username," - ",t?.populated_user?.display_name||"No Display Name"]},t.user_id))});if(a.toLowerCase()=="modal")return s.jsxRuntimeExports.jsxs(i.Modal,{show:u,size:"md",className:`articles-modal ${l}`,modalBackdropClassName:p,centered:!0,onHide:()=>x(!1),style:o,id:j,children:[s.jsxRuntimeExports.jsx(i.Modal.Header,{children:s.jsxRuntimeExports.jsx(i.Modal.Title,{children:"Friends"})}),s.jsxRuntimeExports.jsxs(i.Modal.Body,{children:[r&&s.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center",children:[s.jsxRuntimeExports.jsx("i",{className:"fad fa-spinner-third fa-spin fa-2x"}),s.jsxRuntimeExports.jsx("div",{children:"Loading..."})]}),!r&&e&&e.length==0&&s.jsxRuntimeExports.jsx("div",{children:"No friends to show."}),!r&&e&&e.length>0&&s.jsxRuntimeExports.jsx("div",{children:e.map(t=>s.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center justify-content-between border p-1",children:[t?.populated_user?.username," - ",t?.populated_user?.display_name||"No Display Name",s.jsxRuntimeExports.jsxs("div",{children:[d&&s.jsxRuntimeExports.jsx(n.ArticlesButton,{variant:"articles",onClick:()=>{d(t)},children:s.jsxRuntimeExports.jsx("i",{className:"fad fa-comment-check"})}),s.jsxRuntimeExports.jsx(n.ArticlesButton,{variant:"articles",onClick:()=>{},children:s.jsxRuntimeExports.jsx("i",{className:"fad fa-info"})})]})]},t.user_id))})]}),s.jsxRuntimeExports.jsxs(i.Modal.Footer,{className:"justify-content-between",children:[s.jsxRuntimeExports.jsxs(n.ArticlesButton,{variant:"articles",onClick:()=>{R()},children:[s.jsxRuntimeExports.jsx("i",{className:"fad fa-redo me-2"}),s.jsxRuntimeExports.jsx("span",{children:"Refresh"})]}),s.jsxRuntimeExports.jsxs(n.ArticlesButton,{variant:"articles",onClick:()=>{x(!1)},children:[s.jsxRuntimeExports.jsx("i",{className:"fad fa-times me-2"}),"Close"]})]})]})}module.exports=h;
|
package/dist/FriendsList.js
CHANGED
|
@@ -1,128 +1,115 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-tc70JA_2.js";
|
|
2
|
-
import
|
|
3
|
-
import { A as
|
|
4
|
-
import { M as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} catch {
|
|
18
|
-
}
|
|
19
|
-
return c.get(s.url, {
|
|
20
|
-
params: {
|
|
21
|
-
game: s.game
|
|
22
|
-
},
|
|
23
|
-
headers: {
|
|
24
|
-
"x-articles-api-key": s.user_token
|
|
25
|
-
}
|
|
26
|
-
}).then((a) => a.data);
|
|
27
|
-
}, _ = {
|
|
28
|
-
dedupingInterval: 1e3 * 60 * 30,
|
|
29
|
-
refreshInterval: 0,
|
|
30
|
-
revalidateOnFocus: !1,
|
|
31
|
-
revalidateIfStale: !1,
|
|
32
|
-
shouldRetryOnError: !1
|
|
33
|
-
// fallbackData: []
|
|
34
|
-
}, v = (s) => {
|
|
35
|
-
const { data: a, error: t, isLoading: l, isValidating: d, mutate: u } = g(
|
|
36
|
-
s?.user_id && s?.user_token ? {
|
|
37
|
-
// url: "/api/community/games/scoreboard",
|
|
38
|
-
url: "https://articles.media/api/user/friends",
|
|
39
|
-
// game: params.game,
|
|
40
|
-
user_token: s.user_token
|
|
41
|
-
} : null,
|
|
42
|
-
j,
|
|
43
|
-
_
|
|
44
|
-
);
|
|
45
|
-
return {
|
|
46
|
-
data: a,
|
|
47
|
-
error: t,
|
|
48
|
-
isLoading: l,
|
|
49
|
-
isValidating: d,
|
|
50
|
-
mutate: u
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
function C({
|
|
54
|
-
show: s,
|
|
55
|
-
setShow: a,
|
|
56
|
-
componentType: t,
|
|
57
|
-
className: l,
|
|
58
|
-
style: d = {},
|
|
59
|
-
user_id: u,
|
|
60
|
-
user_token: f,
|
|
61
|
-
id: h = null,
|
|
62
|
-
allowInvite: N = !1,
|
|
63
|
-
inviteFunction: k = null,
|
|
64
|
-
modalBackdropClassName: p = ""
|
|
2
|
+
import p from "./useUserFriends.js";
|
|
3
|
+
import { A as l } from "./Button-_Quon8UV.js";
|
|
4
|
+
import { M as a } from "./Modal-C9oYRgI1.js";
|
|
5
|
+
function k({
|
|
6
|
+
show: m,
|
|
7
|
+
setShow: d,
|
|
8
|
+
componentType: n,
|
|
9
|
+
className: t,
|
|
10
|
+
style: c = {},
|
|
11
|
+
user_id: f,
|
|
12
|
+
user_token: x,
|
|
13
|
+
id: u = null,
|
|
14
|
+
allowInvite: o = !1,
|
|
15
|
+
inviteFunction: N = null,
|
|
16
|
+
modalBackdropClassName: j = ""
|
|
65
17
|
}) {
|
|
66
18
|
const {
|
|
67
|
-
data:
|
|
68
|
-
|
|
19
|
+
data: s,
|
|
20
|
+
error: v,
|
|
21
|
+
isLoading: r,
|
|
69
22
|
// isValidating: friendsValidating,
|
|
70
|
-
mutate:
|
|
71
|
-
} =
|
|
72
|
-
user_id:
|
|
73
|
-
user_token:
|
|
23
|
+
mutate: h
|
|
24
|
+
} = p({
|
|
25
|
+
user_id: f,
|
|
26
|
+
user_token: x
|
|
74
27
|
});
|
|
75
|
-
if ((!
|
|
76
|
-
return /* @__PURE__ */ e.jsx("ul", { className:
|
|
28
|
+
if ((!n || n == "list") && !r && s && s.length > 0)
|
|
29
|
+
return /* @__PURE__ */ e.jsx("ul", { className: t, style: c, children: s.map((i) => /* @__PURE__ */ e.jsxs("li", { children: [
|
|
77
30
|
i?.populated_user?.username,
|
|
78
31
|
" - ",
|
|
79
32
|
i?.populated_user?.display_name || "No Display Name"
|
|
80
33
|
] }, i.user_id)) });
|
|
81
|
-
if (
|
|
34
|
+
if (n.toLowerCase() == "modal")
|
|
82
35
|
return /* @__PURE__ */ e.jsxs(
|
|
83
|
-
|
|
36
|
+
a,
|
|
84
37
|
{
|
|
85
|
-
show:
|
|
38
|
+
show: m,
|
|
86
39
|
size: "md",
|
|
87
|
-
className: `articles-modal ${
|
|
88
|
-
modalBackdropClassName:
|
|
40
|
+
className: `articles-modal ${t}`,
|
|
41
|
+
modalBackdropClassName: j,
|
|
89
42
|
centered: !0,
|
|
90
|
-
onHide: () =>
|
|
91
|
-
style:
|
|
92
|
-
id:
|
|
43
|
+
onHide: () => d(!1),
|
|
44
|
+
style: c,
|
|
45
|
+
id: u,
|
|
93
46
|
children: [
|
|
94
|
-
/* @__PURE__ */ e.jsx(
|
|
95
|
-
/* @__PURE__ */ e.jsxs(
|
|
96
|
-
|
|
47
|
+
/* @__PURE__ */ e.jsx(a.Header, { children: /* @__PURE__ */ e.jsx(a.Title, { children: "Friends" }) }),
|
|
48
|
+
/* @__PURE__ */ e.jsxs(a.Body, { children: [
|
|
49
|
+
r && /* @__PURE__ */ e.jsxs("div", { className: "d-flex align-items-center", children: [
|
|
97
50
|
/* @__PURE__ */ e.jsx("i", { className: "fad fa-spinner-third fa-spin fa-2x" }),
|
|
98
51
|
/* @__PURE__ */ e.jsx("div", { children: "Loading..." })
|
|
99
52
|
] }),
|
|
100
|
-
!
|
|
101
|
-
!
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
53
|
+
!r && s && s.length == 0 && /* @__PURE__ */ e.jsx("div", { children: "No friends to show." }),
|
|
54
|
+
!r && s && s.length > 0 && /* @__PURE__ */ e.jsx("div", { children: s.map((i) => /* @__PURE__ */ e.jsxs(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: "d-flex align-items-center justify-content-between border p-1",
|
|
58
|
+
children: [
|
|
59
|
+
i?.populated_user?.username,
|
|
60
|
+
" - ",
|
|
61
|
+
i?.populated_user?.display_name || "No Display Name",
|
|
62
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
63
|
+
o && /* @__PURE__ */ e.jsx(
|
|
64
|
+
l,
|
|
65
|
+
{
|
|
66
|
+
variant: "articles",
|
|
67
|
+
onClick: () => {
|
|
68
|
+
o(i);
|
|
69
|
+
},
|
|
70
|
+
children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-comment-check" })
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ e.jsx(
|
|
74
|
+
l,
|
|
75
|
+
{
|
|
76
|
+
variant: "articles",
|
|
77
|
+
onClick: () => {
|
|
78
|
+
},
|
|
79
|
+
children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-info" })
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
] })
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
i.user_id
|
|
86
|
+
)) })
|
|
106
87
|
] }),
|
|
107
|
-
/* @__PURE__ */ e.jsxs(
|
|
108
|
-
/* @__PURE__ */ e.
|
|
109
|
-
|
|
88
|
+
/* @__PURE__ */ e.jsxs(a.Footer, { className: "justify-content-between", children: [
|
|
89
|
+
/* @__PURE__ */ e.jsxs(
|
|
90
|
+
l,
|
|
110
91
|
{
|
|
111
92
|
variant: "articles",
|
|
112
93
|
onClick: () => {
|
|
113
|
-
|
|
94
|
+
h();
|
|
114
95
|
},
|
|
115
|
-
children:
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ e.jsx("i", { className: "fad fa-redo me-2" }),
|
|
98
|
+
/* @__PURE__ */ e.jsx("span", { children: "Refresh" })
|
|
99
|
+
]
|
|
116
100
|
}
|
|
117
101
|
),
|
|
118
|
-
/* @__PURE__ */ e.
|
|
119
|
-
|
|
102
|
+
/* @__PURE__ */ e.jsxs(
|
|
103
|
+
l,
|
|
120
104
|
{
|
|
121
105
|
variant: "articles",
|
|
122
106
|
onClick: () => {
|
|
123
|
-
|
|
107
|
+
d(!1);
|
|
124
108
|
},
|
|
125
|
-
children:
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ e.jsx("i", { className: "fad fa-times me-2" }),
|
|
111
|
+
"Close"
|
|
112
|
+
]
|
|
126
113
|
}
|
|
127
114
|
)
|
|
128
115
|
] })
|
|
@@ -131,5 +118,5 @@ function C({
|
|
|
131
118
|
);
|
|
132
119
|
}
|
|
133
120
|
export {
|
|
134
|
-
|
|
121
|
+
k as default
|
|
135
122
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ReturnToLauncherButton.cjs"),r=require("./ArticlesAd.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ReturnToLauncherButton.cjs"),r=require("./ArticlesAd.cjs"),s=require("./Ad.cjs"),o=require("./GameScoreboard.cjs"),t=require("./GlobalHead.cjs"),u=require("./GlobalBody-BQ2qC81K.cjs"),i=require("./ViewUserModal.cjs"),n=require("./FriendsList.cjs"),a=require("./useUserDetails.cjs"),d=require("./useUserToken.cjs"),l=require("./useUserFriends.cjs");exports.ReturnToLauncherButton=e;exports.ArticlesAd=r;exports.Ad=s;exports.GameScoreboard=o;exports.GlobalHead=t;exports.GlobalBody=u.GlobalBody_default;exports.ViewUserModal=i;exports.FriendsList=n;exports.useUserDetails=a;exports.useUserToken=d;exports.useUserFriends=l;
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as o } from "./ReturnToLauncherButton.js";
|
|
2
2
|
import { default as t } from "./ArticlesAd.js";
|
|
3
|
-
import { default as
|
|
3
|
+
import { default as f } from "./Ad.js";
|
|
4
4
|
import { default as l } from "./GameScoreboard.js";
|
|
5
5
|
import { default as m } from "./GlobalHead.js";
|
|
6
6
|
import { G as x } from "./GlobalBody-tmIC_GWn.js";
|
|
7
7
|
import { default as n } from "./ViewUserModal.js";
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
8
|
+
import { default as U } from "./FriendsList.js";
|
|
9
|
+
import { default as c } from "./useUserDetails.js";
|
|
10
10
|
import { default as B } from "./useUserToken.js";
|
|
11
|
+
import { default as L } from "./useUserFriends.js";
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
f as Ad,
|
|
13
14
|
t as ArticlesAd,
|
|
14
|
-
|
|
15
|
+
U as FriendsList,
|
|
15
16
|
l as GameScoreboard,
|
|
16
17
|
x as GlobalBody,
|
|
17
18
|
m as GlobalHead,
|
|
18
|
-
|
|
19
|
+
o as ReturnToLauncherButton,
|
|
19
20
|
n as ViewUserModal,
|
|
20
|
-
|
|
21
|
+
c as useUserDetails,
|
|
22
|
+
L as useUserFriends,
|
|
21
23
|
B as useUserToken
|
|
22
24
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./index-Ddv_TnxK.cjs"),u=async e=>{if(process.env.NODE_ENV==="development")try{return(await s.axios.get("http://localhost:3001/api/user/friends",{params:{game:e.game},headers:{"x-articles-api-key":e.user_token}})).data}catch{}return s.axios.get(e.url,{params:{game:e.game},headers:{"x-articles-api-key":e.user_token}}).then(r=>r.data)},o={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},l=e=>{const{data:r,error:t,isLoading:a,isValidating:n,mutate:i}=s.useSWR(e?.user_id&&e?.user_token?{url:"https://articles.media/api/user/friends",user_token:e.user_token}:null,u,o);return{data:r,error:t,isLoading:a,isValidating:n,mutate:i}};module.exports=l;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { u, a } from "./index-DLYx67wi.js";
|
|
2
|
+
const l = async (e) => {
|
|
3
|
+
if (process.env.NODE_ENV === "development")
|
|
4
|
+
try {
|
|
5
|
+
return (await a.get("http://localhost:3001/api/user/friends", {
|
|
6
|
+
params: {
|
|
7
|
+
game: e.game
|
|
8
|
+
// user_token: obj.user_token
|
|
9
|
+
},
|
|
10
|
+
headers: {
|
|
11
|
+
"x-articles-api-key": e.user_token
|
|
12
|
+
}
|
|
13
|
+
})).data;
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
return a.get(e.url, {
|
|
17
|
+
params: {
|
|
18
|
+
game: e.game
|
|
19
|
+
},
|
|
20
|
+
headers: {
|
|
21
|
+
"x-articles-api-key": e.user_token
|
|
22
|
+
}
|
|
23
|
+
}).then((r) => r.data);
|
|
24
|
+
}, o = {
|
|
25
|
+
dedupingInterval: 1e3 * 60 * 30,
|
|
26
|
+
refreshInterval: 0,
|
|
27
|
+
revalidateOnFocus: !1,
|
|
28
|
+
revalidateIfStale: !1,
|
|
29
|
+
shouldRetryOnError: !1
|
|
30
|
+
// fallbackData: []
|
|
31
|
+
}, c = (e) => {
|
|
32
|
+
const { data: r, error: t, isLoading: s, isValidating: n, mutate: i } = u(
|
|
33
|
+
e?.user_id && e?.user_token ? {
|
|
34
|
+
// url: "/api/community/games/scoreboard",
|
|
35
|
+
url: "https://articles.media/api/user/friends",
|
|
36
|
+
// game: params.game,
|
|
37
|
+
user_token: e.user_token
|
|
38
|
+
} : null,
|
|
39
|
+
l,
|
|
40
|
+
o
|
|
41
|
+
);
|
|
42
|
+
return {
|
|
43
|
+
data: r,
|
|
44
|
+
error: t,
|
|
45
|
+
isLoading: s,
|
|
46
|
+
isValidating: n,
|
|
47
|
+
mutate: i
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
c as default
|
|
52
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@articles-media/articles-dev-box",
|
|
3
3
|
"description": "Shared code, functions, and components for different Articles Media projects.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.16",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
7
7
|
"#root/src/*": "./src/*"
|
|
@@ -60,6 +60,10 @@
|
|
|
60
60
|
"import": "./dist/useUserToken.js",
|
|
61
61
|
"require": "./dist/useUserToken.cjs"
|
|
62
62
|
},
|
|
63
|
+
"./useUserFriends": {
|
|
64
|
+
"import": "./dist/useUserFriends.js",
|
|
65
|
+
"require": "./dist/useUserFriends.cjs"
|
|
66
|
+
},
|
|
63
67
|
"./dist/style.css": "./dist/articles-dev-box.css",
|
|
64
68
|
"./dist/articles-dev-box.css": "./dist/articles-dev-box.css"
|
|
65
69
|
},
|