@articles-media/articles-dev-box 1.0.12 → 1.0.14
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 -0
- package/dist/FriendsList.js +133 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +10 -8
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),x=require("./index-Ddv_TnxK.cjs"),c=require("./Button-0ZK0NKiK.cjs"),a=require("./Modal-Wmqy9fOm.cjs"),h=async s=>{if(process.env.NODE_ENV==="development")try{return(await x.axios.get("http://localhost:3001/api/user/friends",{params:{game:s.game},headers:{"x-articles-api-key":s.user_token}})).data}catch{}return x.axios.get(s.url,{params:{game:s.game},headers:{"x-articles-api-key":s.user_token}}).then(t=>t.data)},f={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},E=s=>{const{data:t,error:n,isLoading:l,isValidating:o,mutate:d}=x.useSWR(s?.user_id&&s?.user_token?{url:"https://articles.media/api/user/friends",user_token:s.user_token}:null,h,f);return{data:t,error:n,isLoading:l,isValidating:o,mutate:d}};function R({show:s,setShow:t,componentType:n,className:l,style:o={},user_id:d,user_token:m,id:p=null,allowInvite:g=!1,inviteFunction:_=null}){const{data:r,isLoading:u,mutate:j}=E({user_id:d,user_token:m});if((!n||n=="list")&&!u&&r&&r.length>0)return e.jsxRuntimeExports.jsx("ul",{className:l,style:o,children:r.map(i=>e.jsxRuntimeExports.jsxs("li",{children:[i?.populated_user?.username," - ",i?.populated_user?.display_name||"No Display Name"]},i.user_id))});if(n.toLowerCase()=="modal")return e.jsxRuntimeExports.jsxs(a.Modal,{show:s,size:"md",className:`articles-modal ${l}`,centered:!0,onHide:()=>t(!1),style:o,id:p,children:[e.jsxRuntimeExports.jsx(a.Modal.Header,{children:e.jsxRuntimeExports.jsx(a.Modal.Title,{children:"Friends"})}),e.jsxRuntimeExports.jsxs(a.Modal.Body,{children:[u&&e.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-spinner-third fa-spin fa-2x"}),e.jsxRuntimeExports.jsx("div",{children:"Loading..."})]}),!u&&r&&r.length==0&&e.jsxRuntimeExports.jsx("div",{children:"No friends to show."}),!u&&r&&r.length>0&&e.jsxRuntimeExports.jsx("ul",{children:r.map(i=>e.jsxRuntimeExports.jsxs("li",{children:[i?.populated_user?.username," - ",i?.populated_user?.display_name||"No Display Name"]},i.user_id))})]}),e.jsxRuntimeExports.jsxs(a.Modal.Footer,{className:"justify-content-between",children:[e.jsxRuntimeExports.jsx(c.ArticlesButton,{variant:"articles",onClick:()=>{j()},children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-redo"})}),e.jsxRuntimeExports.jsx(c.ArticlesButton,{variant:"articles",onClick:()=>{t(!1)},children:"Close"})]})]})}module.exports=R;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-tc70JA_2.js";
|
|
2
|
+
import { u as x, a as c } from "./index-DLYx67wi.js";
|
|
3
|
+
import { A as m } from "./Button-_Quon8UV.js";
|
|
4
|
+
import { M as n } from "./Modal-C9oYRgI1.js";
|
|
5
|
+
const g = async (s) => {
|
|
6
|
+
if (process.env.NODE_ENV === "development")
|
|
7
|
+
try {
|
|
8
|
+
return (await c.get("http://localhost:3001/api/user/friends", {
|
|
9
|
+
params: {
|
|
10
|
+
game: s.game
|
|
11
|
+
// user_token: obj.user_token
|
|
12
|
+
},
|
|
13
|
+
headers: {
|
|
14
|
+
"x-articles-api-key": s.user_token
|
|
15
|
+
}
|
|
16
|
+
})).data;
|
|
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
|
+
}, j = {
|
|
28
|
+
dedupingInterval: 1e3 * 60 * 30,
|
|
29
|
+
refreshInterval: 0,
|
|
30
|
+
revalidateOnFocus: !1,
|
|
31
|
+
revalidateIfStale: !1,
|
|
32
|
+
shouldRetryOnError: !1
|
|
33
|
+
// fallbackData: []
|
|
34
|
+
}, _ = (s) => {
|
|
35
|
+
const { data: a, error: t, isLoading: l, isValidating: d, mutate: u } = x(
|
|
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
|
+
g,
|
|
43
|
+
j
|
|
44
|
+
);
|
|
45
|
+
return {
|
|
46
|
+
data: a,
|
|
47
|
+
error: t,
|
|
48
|
+
isLoading: l,
|
|
49
|
+
isValidating: d,
|
|
50
|
+
mutate: u
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
function w({
|
|
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: v = !1,
|
|
63
|
+
inviteFunction: N = null
|
|
64
|
+
}) {
|
|
65
|
+
const {
|
|
66
|
+
data: r,
|
|
67
|
+
isLoading: o,
|
|
68
|
+
// isValidating: friendsValidating,
|
|
69
|
+
mutate: p
|
|
70
|
+
} = _({
|
|
71
|
+
user_id: u,
|
|
72
|
+
user_token: f
|
|
73
|
+
});
|
|
74
|
+
if ((!t || t == "list") && !o && r && r.length > 0)
|
|
75
|
+
return /* @__PURE__ */ e.jsx("ul", { className: l, style: d, children: r.map((i) => /* @__PURE__ */ e.jsxs("li", { children: [
|
|
76
|
+
i?.populated_user?.username,
|
|
77
|
+
" - ",
|
|
78
|
+
i?.populated_user?.display_name || "No Display Name"
|
|
79
|
+
] }, i.user_id)) });
|
|
80
|
+
if (t.toLowerCase() == "modal")
|
|
81
|
+
return /* @__PURE__ */ e.jsxs(
|
|
82
|
+
n,
|
|
83
|
+
{
|
|
84
|
+
show: s,
|
|
85
|
+
size: "md",
|
|
86
|
+
className: `articles-modal ${l}`,
|
|
87
|
+
centered: !0,
|
|
88
|
+
onHide: () => a(!1),
|
|
89
|
+
style: d,
|
|
90
|
+
id: h,
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ e.jsx(n.Header, { children: /* @__PURE__ */ e.jsx(n.Title, { children: "Friends" }) }),
|
|
93
|
+
/* @__PURE__ */ e.jsxs(n.Body, { children: [
|
|
94
|
+
o && /* @__PURE__ */ e.jsxs("div", { className: "d-flex align-items-center", children: [
|
|
95
|
+
/* @__PURE__ */ e.jsx("i", { className: "fad fa-spinner-third fa-spin fa-2x" }),
|
|
96
|
+
/* @__PURE__ */ e.jsx("div", { children: "Loading..." })
|
|
97
|
+
] }),
|
|
98
|
+
!o && r && r.length == 0 && /* @__PURE__ */ e.jsx("div", { children: "No friends to show." }),
|
|
99
|
+
!o && r && r.length > 0 && /* @__PURE__ */ e.jsx("ul", { children: r.map((i) => /* @__PURE__ */ e.jsxs("li", { children: [
|
|
100
|
+
i?.populated_user?.username,
|
|
101
|
+
" - ",
|
|
102
|
+
i?.populated_user?.display_name || "No Display Name"
|
|
103
|
+
] }, i.user_id)) })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ e.jsxs(n.Footer, { className: "justify-content-between", children: [
|
|
106
|
+
/* @__PURE__ */ e.jsx(
|
|
107
|
+
m,
|
|
108
|
+
{
|
|
109
|
+
variant: "articles",
|
|
110
|
+
onClick: () => {
|
|
111
|
+
p();
|
|
112
|
+
},
|
|
113
|
+
children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-redo" })
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ e.jsx(
|
|
117
|
+
m,
|
|
118
|
+
{
|
|
119
|
+
variant: "articles",
|
|
120
|
+
onClick: () => {
|
|
121
|
+
a(!1);
|
|
122
|
+
},
|
|
123
|
+
children: "Close"
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] })
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
w as default
|
|
133
|
+
};
|
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"),o=require("./Ad.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ReturnToLauncherButton.cjs"),r=require("./ArticlesAd.cjs"),o=require("./Ad.cjs"),s=require("./GameScoreboard.cjs"),t=require("./GlobalHead.cjs"),u=require("./GlobalBody-BQ2qC81K.cjs"),i=require("./ViewUserModal.cjs"),n=require("./FriendsList.cjs"),a=require("./useUserDetails.cjs"),l=require("./useUserToken.cjs");exports.ReturnToLauncherButton=e;exports.ArticlesAd=r;exports.Ad=o;exports.GameScoreboard=s;exports.GlobalHead=t;exports.GlobalBody=u.GlobalBody_default;exports.ViewUserModal=i;exports.FriendsList=n;exports.useUserDetails=a;exports.useUserToken=l;
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { default as r } from "./ReturnToLauncherButton.js";
|
|
2
2
|
import { default as t } from "./ArticlesAd.js";
|
|
3
3
|
import { default as s } from "./Ad.js";
|
|
4
|
-
import { default as
|
|
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
|
-
import { default as
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as A } from "./
|
|
7
|
+
import { default as n } from "./ViewUserModal.js";
|
|
8
|
+
import { default as b } from "./FriendsList.js";
|
|
9
|
+
import { default as A } from "./useUserDetails.js";
|
|
10
|
+
import { default as B } from "./useUserToken.js";
|
|
10
11
|
export {
|
|
11
12
|
s as Ad,
|
|
12
13
|
t as ArticlesAd,
|
|
13
|
-
|
|
14
|
+
b as FriendsList,
|
|
15
|
+
l as GameScoreboard,
|
|
14
16
|
x as GlobalBody,
|
|
15
17
|
m as GlobalHead,
|
|
16
18
|
r as ReturnToLauncherButton,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
n as ViewUserModal,
|
|
20
|
+
A as useUserDetails,
|
|
21
|
+
B as useUserToken
|
|
20
22
|
};
|
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.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
7
7
|
"#root/src/*": "./src/*"
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
"import": "./dist/ViewUserModal.js",
|
|
49
49
|
"require": "./dist/ViewUserModal.cjs"
|
|
50
50
|
},
|
|
51
|
+
"./FriendsList": {
|
|
52
|
+
"import": "./dist/FriendsList.js",
|
|
53
|
+
"require": "./dist/FriendsList.cjs"
|
|
54
|
+
},
|
|
51
55
|
"./useUserDetails": {
|
|
52
56
|
"import": "./dist/useUserDetails.js",
|
|
53
57
|
"require": "./dist/useUserDetails.cjs"
|