@articles-media/articles-dev-box 1.0.14 → 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.
@@ -1 +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;
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;
@@ -1,126 +1,115 @@
1
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
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 = ""
64
17
  }) {
65
18
  const {
66
- data: r,
67
- isLoading: o,
19
+ data: s,
20
+ error: v,
21
+ isLoading: r,
68
22
  // isValidating: friendsValidating,
69
- mutate: p
70
- } = _({
71
- user_id: u,
72
- user_token: f
23
+ mutate: h
24
+ } = p({
25
+ user_id: f,
26
+ user_token: x
73
27
  });
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: [
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: [
76
30
  i?.populated_user?.username,
77
31
  " - ",
78
32
  i?.populated_user?.display_name || "No Display Name"
79
33
  ] }, i.user_id)) });
80
- if (t.toLowerCase() == "modal")
34
+ if (n.toLowerCase() == "modal")
81
35
  return /* @__PURE__ */ e.jsxs(
82
- n,
36
+ a,
83
37
  {
84
- show: s,
38
+ show: m,
85
39
  size: "md",
86
- className: `articles-modal ${l}`,
40
+ className: `articles-modal ${t}`,
41
+ modalBackdropClassName: j,
87
42
  centered: !0,
88
- onHide: () => a(!1),
89
- style: d,
90
- id: h,
43
+ onHide: () => d(!1),
44
+ style: c,
45
+ id: u,
91
46
  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: [
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: [
95
50
  /* @__PURE__ */ e.jsx("i", { className: "fad fa-spinner-third fa-spin fa-2x" }),
96
51
  /* @__PURE__ */ e.jsx("div", { children: "Loading..." })
97
52
  ] }),
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)) })
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
+ )) })
104
87
  ] }),
105
- /* @__PURE__ */ e.jsxs(n.Footer, { className: "justify-content-between", children: [
106
- /* @__PURE__ */ e.jsx(
107
- m,
88
+ /* @__PURE__ */ e.jsxs(a.Footer, { className: "justify-content-between", children: [
89
+ /* @__PURE__ */ e.jsxs(
90
+ l,
108
91
  {
109
92
  variant: "articles",
110
93
  onClick: () => {
111
- p();
94
+ h();
112
95
  },
113
- children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-redo" })
96
+ children: [
97
+ /* @__PURE__ */ e.jsx("i", { className: "fad fa-redo me-2" }),
98
+ /* @__PURE__ */ e.jsx("span", { children: "Refresh" })
99
+ ]
114
100
  }
115
101
  ),
116
- /* @__PURE__ */ e.jsx(
117
- m,
102
+ /* @__PURE__ */ e.jsxs(
103
+ l,
118
104
  {
119
105
  variant: "articles",
120
106
  onClick: () => {
121
- a(!1);
107
+ d(!1);
122
108
  },
123
- children: "Close"
109
+ children: [
110
+ /* @__PURE__ */ e.jsx("i", { className: "fad fa-times me-2" }),
111
+ "Close"
112
+ ]
124
113
  }
125
114
  )
126
115
  ] })
@@ -129,5 +118,5 @@ function w({
129
118
  );
130
119
  }
131
120
  export {
132
- w as default
121
+ k as default
133
122
  };
@@ -1 +1 @@
1
- "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),c=require("react"),l=require("./Modal-Wmqy9fOm.cjs"),h=require("./ViewUserModal.cjs"),x=require("./Button-0ZK0NKiK.cjs"),m=require("./index-Ddv_TnxK.cjs");function f({setChecked:s,checked:t,readOnly:a}){return e.jsxRuntimeExports.jsxs("label",{className:`articles-switch mb-0 ${t&&"checked"}`,children:[e.jsxRuntimeExports.jsx("input",{type:"checkbox",readOnly:!!a,checked:t,onChange:()=>{}}),e.jsxRuntimeExports.jsx("span",{onClick:i=>{if(s){s(!t);return}else{i.preventDefault();return}},className:"slider"})]})}const E=async s=>{if(process.env.NODE_ENV==="development")try{return(await m.axios.get("http://localhost:3001/api/community/games/scoreboard",{params:{game:s.game}})).data}catch{}return m.axios.get(s.url,{params:{game:s.game}}).then(t=>t.data)},R={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},b=s=>{const{data:t,error:a,isLoading:i,isValidating:n,mutate:o}=m.useSWR(s?.game?{url:"https://articles.media/api/community/games/scoreboard",game:s.game}:null,E,R);return{data:t,error:a,isLoading:i,isValidating:n,mutate:o}};function y({game:s,reloadScoreboard:t,setReloadScoreboard:a}){const[i,n]=c.useState(!1),[o,j]=c.useState(!1),{data:d,mutate:u}=b({game:s});return c.useEffect(()=>{},[]),c.useEffect(()=>{t&&(a(!1),u())},[t]),e.jsxRuntimeExports.jsxs("div",{className:"scoreboard",children:[e.jsxRuntimeExports.jsxs(l.Modal,{show:i,size:"md",className:"articles-modal",centered:!0,onHide:()=>n(!1),children:[e.jsxRuntimeExports.jsx(l.Modal.Header,{children:e.jsxRuntimeExports.jsx(l.Modal.Title,{children:"Scoreboard Settings"})}),e.jsxRuntimeExports.jsx(l.Modal.Body,{children:e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between align-items-center",onClick:()=>j(!o),children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-trophy-alt"}),e.jsxRuntimeExports.jsx("span",{children:"Join Scoreboard?"})]}),e.jsxRuntimeExports.jsx(f,{checked:o})]})}),e.jsxRuntimeExports.jsx(l.Modal.Footer,{className:"justify-content-between",children:e.jsxRuntimeExports.jsx(x.ArticlesButton,{variant:"articles",onClick:()=>{n(!1)},children:"Close"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"card card-articles card-sm mb-3 mb-lg-0",children:[e.jsxRuntimeExports.jsxs("div",{className:"card-header d-flex justify-content-between align-items-center",children:[e.jsxRuntimeExports.jsxs("span",{children:[s," Scoreboard"]}),e.jsxRuntimeExports.jsx(x.ArticlesButton,{onClick:()=>{u()},small:!0,children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-redo me-0"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"card-body p-0",children:[(d?.length||0)==0&&e.jsxRuntimeExports.jsx("div",{className:"small p-2",children:"No scores yet"}),d?.map((r,p)=>e.jsxRuntimeExports.jsxs("div",{className:"result d-flex flex-column justify-content-between border-bottom p-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between lh-sm",children:[e.jsxRuntimeExports.jsxs("div",{className:"d-flex",children:[e.jsxRuntimeExports.jsx("h5",{className:"mb-0 me-3",children:p+1}),e.jsxRuntimeExports.jsx("div",{className:"lh-sm",children:e.jsxRuntimeExports.jsx(h,{populated_user:r.populated_user,user_id:r.user_id})})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("h5",{className:"mb-0",children:r.score||r.total})})]}),r.last_play&&r.public_last_play&&e.jsxRuntimeExports.jsxs("small",{className:"mt-1",style:{fontSize:"0.75rem"},children:["Played: ",format(new Date(r.last_play),"MM/d/yy hh:mmaa")]})]},r._id))]}),e.jsxRuntimeExports.jsxs("div",{className:"card-footer d-flex justify-content-between align-items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"small",children:"Play to get on the board!"}),e.jsxRuntimeExports.jsx(x.ArticlesButton,{small:!0,onClick:()=>{n(!0)},children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-cog me-0"})})]})]})]})}module.exports=y;
1
+ "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),l=require("react"),i=require("./Modal-Wmqy9fOm.cjs"),E=require("./ViewUserModal.cjs"),m=require("./Button-0ZK0NKiK.cjs"),d=require("./index-Ddv_TnxK.cjs");function R({setChecked:s,checked:t,readOnly:a}){return e.jsxRuntimeExports.jsxs("label",{className:`articles-switch mb-0 ${t&&"checked"}`,children:[e.jsxRuntimeExports.jsx("input",{type:"checkbox",readOnly:!!a,checked:t,onChange:()=>{}}),e.jsxRuntimeExports.jsx("span",{onClick:n=>{if(s){s(!t);return}else{n.preventDefault();return}},className:"slider"})]})}const b=async s=>{if(process.env.NODE_ENV==="development")try{return(await d.axios.get("http://localhost:3001/api/community/games/scoreboard",{params:{game:s.game}})).data}catch{}return d.axios.get(s.url,{params:{game:s.game}}).then(t=>t.data)},N={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},v=s=>{const{data:t,error:a,isLoading:n,isValidating:o,mutate:c}=d.useSWR(s?.game?{url:"https://articles.media/api/community/games/scoreboard",game:s.game}:null,b,N);return{data:t,error:a,isLoading:n,isValidating:o,mutate:c}};function y({game:s,reloadScoreboard:t,setReloadScoreboard:a,prepend:n,append:o}){const[c,x]=l.useState(!1),[u,h]=l.useState(!1),{data:j,mutate:p}=v({game:s});return l.useEffect(()=>{},[]),l.useEffect(()=>{t&&(a(!1),p())},[t]),e.jsxRuntimeExports.jsxs("div",{className:"scoreboard",children:[e.jsxRuntimeExports.jsxs(i.Modal,{show:c,size:"md",className:"articles-modal",centered:!0,onHide:()=>x(!1),children:[e.jsxRuntimeExports.jsx(i.Modal.Header,{children:e.jsxRuntimeExports.jsx(i.Modal.Title,{children:"Scoreboard Settings"})}),e.jsxRuntimeExports.jsx(i.Modal.Body,{children:e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between align-items-center",onClick:()=>h(!u),children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-trophy-alt"}),e.jsxRuntimeExports.jsx("span",{children:"Join Scoreboard?"})]}),e.jsxRuntimeExports.jsx(R,{checked:u})]})}),e.jsxRuntimeExports.jsx(i.Modal.Footer,{className:"justify-content-between",children:e.jsxRuntimeExports.jsx(m.ArticlesButton,{variant:"articles",onClick:()=>{x(!1)},children:"Close"})})]}),e.jsxRuntimeExports.jsx("div",{className:"prepend-container",children:n}),e.jsxRuntimeExports.jsxs("div",{className:"card card-articles card-sm mb-3 mb-lg-0",children:[e.jsxRuntimeExports.jsxs("div",{className:"card-header d-flex justify-content-between align-items-center",children:[e.jsxRuntimeExports.jsxs("span",{children:[s," Scoreboard"]}),e.jsxRuntimeExports.jsx(m.ArticlesButton,{onClick:()=>{p()},small:!0,children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-redo me-0"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"card-body p-0",children:[(j?.length||0)==0&&e.jsxRuntimeExports.jsx("div",{className:"small p-2",children:"No scores yet"}),j?.map((r,f)=>e.jsxRuntimeExports.jsxs("div",{className:"result d-flex flex-column justify-content-between border-bottom p-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between lh-sm",children:[e.jsxRuntimeExports.jsxs("div",{className:"d-flex",children:[e.jsxRuntimeExports.jsx("h5",{className:"mb-0 me-3",children:f+1}),e.jsxRuntimeExports.jsx("div",{className:"lh-sm",children:e.jsxRuntimeExports.jsx(E,{populated_user:r.populated_user,user_id:r.user_id})})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("h5",{className:"mb-0",children:r.score||r.total})})]}),r.last_play&&r.public_last_play&&e.jsxRuntimeExports.jsxs("small",{className:"mt-1",style:{fontSize:"0.75rem"},children:["Played: ",format(new Date(r.last_play),"MM/d/yy hh:mmaa")]})]},r._id))]}),e.jsxRuntimeExports.jsxs("div",{className:"card-footer d-flex justify-content-between align-items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"small",children:"Play to get on the board!"}),e.jsxRuntimeExports.jsx(m.ArticlesButton,{small:!0,onClick:()=>{x(!0)},children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-cog me-0"})})]})]}),e.jsxRuntimeExports.jsx("div",{className:"append-container",children:o})]})}module.exports=y;
@@ -1,9 +1,9 @@
1
1
  import { j as e } from "./jsx-runtime-tc70JA_2.js";
2
- import { useState as h, useEffect as u } from "react";
3
- import { M as n } from "./Modal-C9oYRgI1.js";
4
- import p from "./ViewUserModal.js";
2
+ import { useState as f, useEffect as x } from "react";
3
+ import { M as i } from "./Modal-C9oYRgI1.js";
4
+ import N from "./ViewUserModal.js";
5
5
  import { A as o } from "./Button-_Quon8UV.js";
6
- import { u as b, a as f } from "./index-DLYx67wi.js";
6
+ import { u as v, a as j } from "./index-DLYx67wi.js";
7
7
  function y({
8
8
  setChecked: s,
9
9
  checked: a,
@@ -37,64 +37,70 @@ function y({
37
37
  )
38
38
  ] });
39
39
  }
40
- const N = async (s) => {
40
+ const g = async (s) => {
41
41
  if (process.env.NODE_ENV === "development")
42
42
  try {
43
- return (await f.get("http://localhost:3001/api/community/games/scoreboard", {
43
+ return (await j.get("http://localhost:3001/api/community/games/scoreboard", {
44
44
  params: {
45
45
  game: s.game
46
46
  }
47
47
  })).data;
48
48
  } catch {
49
49
  }
50
- return f.get(s.url, {
50
+ return j.get(s.url, {
51
51
  params: {
52
52
  game: s.game
53
53
  }
54
54
  }).then((a) => a.data);
55
- }, g = {
55
+ }, w = {
56
56
  dedupingInterval: 1e3 * 60 * 30,
57
57
  refreshInterval: 0,
58
58
  revalidateOnFocus: !1,
59
59
  revalidateIfStale: !1,
60
60
  shouldRetryOnError: !1
61
61
  // fallbackData: []
62
- }, v = (s) => {
63
- const { data: a, error: r, isLoading: l, isValidating: i, mutate: c } = b(
62
+ }, S = (s) => {
63
+ const { data: a, error: r, isLoading: l, isValidating: n, mutate: c } = v(
64
64
  s?.game ? {
65
65
  // url: "/api/community/games/scoreboard",
66
66
  url: "https://articles.media/api/community/games/scoreboard",
67
67
  game: s.game
68
68
  } : null,
69
- N,
70
- g
69
+ g,
70
+ w
71
71
  );
72
72
  return {
73
73
  data: a,
74
74
  error: r,
75
75
  isLoading: l,
76
- isValidating: i,
76
+ isValidating: n,
77
77
  mutate: c
78
78
  };
79
79
  };
80
- function E({ game: s, reloadScoreboard: a, setReloadScoreboard: r }) {
81
- const [l, i] = h(!1), [c, x] = h(!1), {
82
- data: d,
83
- mutate: m
84
- } = v({
80
+ function V({
81
+ game: s,
82
+ reloadScoreboard: a,
83
+ setReloadScoreboard: r,
84
+ prepend: l,
85
+ append: n
86
+ }) {
87
+ const [c, d] = f(!1), [m, p] = f(!1), {
88
+ data: h,
89
+ mutate: u
90
+ } = S({
85
91
  game: s
86
92
  });
87
- return u(() => {
88
- }, []), u(() => {
89
- a && (r(!1), m());
93
+ return x(() => {
94
+ }, []), x(() => {
95
+ a && (r(!1), u());
90
96
  }, [a]), /* @__PURE__ */ e.jsxs("div", { className: "scoreboard", children: [
91
- /* @__PURE__ */ e.jsxs(n, { show: l, size: "md", className: "articles-modal", centered: !0, onHide: () => i(!1), children: [
92
- /* @__PURE__ */ e.jsx(n.Header, { children: /* @__PURE__ */ e.jsx(n.Title, { children: "Scoreboard Settings" }) }),
93
- /* @__PURE__ */ e.jsx(n.Body, { children: /* @__PURE__ */ e.jsxs(
97
+ /* @__PURE__ */ e.jsxs(i, { show: c, size: "md", className: "articles-modal", centered: !0, onHide: () => d(!1), children: [
98
+ /* @__PURE__ */ e.jsx(i.Header, { children: /* @__PURE__ */ e.jsx(i.Title, { children: "Scoreboard Settings" }) }),
99
+ /* @__PURE__ */ e.jsx(i.Body, { children: /* @__PURE__ */ e.jsxs(
94
100
  "div",
95
101
  {
96
102
  className: "d-flex justify-content-between align-items-center",
97
- onClick: () => x(!c),
103
+ onClick: () => p(!m),
98
104
  children: [
99
105
  /* @__PURE__ */ e.jsxs("div", { children: [
100
106
  /* @__PURE__ */ e.jsx("i", { className: "fas fa-trophy-alt" }),
@@ -103,23 +109,24 @@ function E({ game: s, reloadScoreboard: a, setReloadScoreboard: r }) {
103
109
  /* @__PURE__ */ e.jsx(
104
110
  y,
105
111
  {
106
- checked: c
112
+ checked: m
107
113
  }
108
114
  )
109
115
  ]
110
116
  }
111
117
  ) }),
112
- /* @__PURE__ */ e.jsx(n.Footer, { className: "justify-content-between", children: /* @__PURE__ */ e.jsx(
118
+ /* @__PURE__ */ e.jsx(i.Footer, { className: "justify-content-between", children: /* @__PURE__ */ e.jsx(
113
119
  o,
114
120
  {
115
121
  variant: "articles",
116
122
  onClick: () => {
117
- i(!1);
123
+ d(!1);
118
124
  },
119
125
  children: "Close"
120
126
  }
121
127
  ) })
122
128
  ] }),
129
+ /* @__PURE__ */ e.jsx("div", { className: "prepend-container", children: l }),
123
130
  /* @__PURE__ */ e.jsxs("div", { className: "card card-articles card-sm mb-3 mb-lg-0", children: [
124
131
  /* @__PURE__ */ e.jsxs("div", { className: "card-header d-flex justify-content-between align-items-center", children: [
125
132
  /* @__PURE__ */ e.jsxs("span", { children: [
@@ -130,7 +137,7 @@ function E({ game: s, reloadScoreboard: a, setReloadScoreboard: r }) {
130
137
  o,
131
138
  {
132
139
  onClick: () => {
133
- m();
140
+ u();
134
141
  },
135
142
  small: !0,
136
143
  children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-redo me-0" })
@@ -138,14 +145,14 @@ function E({ game: s, reloadScoreboard: a, setReloadScoreboard: r }) {
138
145
  )
139
146
  ] }),
140
147
  /* @__PURE__ */ e.jsxs("div", { className: "card-body p-0", children: [
141
- (d?.length || 0) == 0 && /* @__PURE__ */ e.jsx("div", { className: "small p-2", children: "No scores yet" }),
142
- d?.map(
143
- (t, j) => /* @__PURE__ */ e.jsxs("div", { className: "result d-flex flex-column justify-content-between border-bottom p-2", children: [
148
+ (h?.length || 0) == 0 && /* @__PURE__ */ e.jsx("div", { className: "small p-2", children: "No scores yet" }),
149
+ h?.map(
150
+ (t, b) => /* @__PURE__ */ e.jsxs("div", { className: "result d-flex flex-column justify-content-between border-bottom p-2", children: [
144
151
  /* @__PURE__ */ e.jsxs("div", { className: "d-flex justify-content-between lh-sm", children: [
145
152
  /* @__PURE__ */ e.jsxs("div", { className: "d-flex", children: [
146
- /* @__PURE__ */ e.jsx("h5", { className: "mb-0 me-3", children: j + 1 }),
153
+ /* @__PURE__ */ e.jsx("h5", { className: "mb-0 me-3", children: b + 1 }),
147
154
  /* @__PURE__ */ e.jsx("div", { className: "lh-sm", children: /* @__PURE__ */ e.jsx(
148
- p,
155
+ N,
149
156
  {
150
157
  populated_user: t.populated_user,
151
158
  user_id: t.user_id
@@ -168,15 +175,16 @@ function E({ game: s, reloadScoreboard: a, setReloadScoreboard: r }) {
168
175
  {
169
176
  small: !0,
170
177
  onClick: () => {
171
- i(!0);
178
+ d(!0);
172
179
  },
173
180
  children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-cog me-0" })
174
181
  }
175
182
  )
176
183
  ] })
177
- ] })
184
+ ] }),
185
+ /* @__PURE__ */ e.jsx("div", { className: "append-container", children: n })
178
186
  ] });
179
187
  }
180
188
  export {
181
- E as default
189
+ V as default
182
190
  };
@@ -1 +1 @@
1
- "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),s=require("./Button-0ZK0NKiK.cjs"),r=require("react");function u(){const[a,n]=r.useState(!1);if(r.useEffect(()=>{n(!0)},[]),!a)return null;const i=new URLSearchParams(window.location.search),o=Object.fromEntries(i);let{launcher_mode:t}=o;return t=t==="1",t?e.jsxRuntimeExports.jsxs(s.ArticlesButton,{className:"w-100",small:!0,style:{zIndex:10,position:"relative"},onClick:()=>{window.location.href="https://games.articles.media"},children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-gamepad"}),"Return to Games"]}):e.jsxRuntimeExports.jsxs(s.ArticlesButton,{className:"w-100",small:!0,style:{zIndex:10,position:"relative"},onClick:()=>{window.location.href="https://games.articles.media"},children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-gamepad"}),"View our other games"]})}module.exports=u;
1
+ "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),a=require("./Button-0ZK0NKiK.cjs"),n=require("react");function l({className:s,id:r}){const[o,i]=n.useState(!1);if(n.useEffect(()=>{i(!0)},[]),!o)return null;const u=new URLSearchParams(window.location.search),c=Object.fromEntries(u);let{launcher_mode:t}=c;return t=t==="1",t?e.jsxRuntimeExports.jsxs(a.ArticlesButton,{className:`${s} w-100`,id:r,small:!0,style:{zIndex:10,position:"relative"},onClick:()=>{window.location.href="https://games.articles.media"},children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-gamepad"}),"Return to Games"]}):e.jsxRuntimeExports.jsxs(a.ArticlesButton,{className:`${s} w-100`,small:!0,id:r,style:{zIndex:10,position:"relative"},onClick:()=>{window.location.href="https://games.articles.media"},children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-gamepad"}),"View our other games"]})}module.exports=l;
@@ -1,18 +1,22 @@
1
1
  import { j as e } from "./jsx-runtime-tc70JA_2.js";
2
- import { A as s } from "./Button-_Quon8UV.js";
3
- import { useState as i, useEffect as l } from "react";
4
- function f() {
5
- const [a, r] = i(!1);
6
- if (l(() => {
7
- r(!0);
8
- }, []), !a)
2
+ import { A as r } from "./Button-_Quon8UV.js";
3
+ import { useState as m, useEffect as c } from "react";
4
+ function p({
5
+ className: s,
6
+ id: a
7
+ }) {
8
+ const [o, n] = m(!1);
9
+ if (c(() => {
10
+ n(!0);
11
+ }, []), !o)
9
12
  return null;
10
- const o = new URLSearchParams(window.location.search), n = Object.fromEntries(o);
11
- let { launcher_mode: t } = n;
13
+ const i = new URLSearchParams(window.location.search), l = Object.fromEntries(i);
14
+ let { launcher_mode: t } = l;
12
15
  return t = t === "1", t ? /* @__PURE__ */ e.jsxs(
13
- s,
16
+ r,
14
17
  {
15
- className: "w-100",
18
+ className: `${s} w-100`,
19
+ id: a,
16
20
  small: !0,
17
21
  style: {
18
22
  zIndex: 10,
@@ -27,10 +31,11 @@ function f() {
27
31
  ]
28
32
  }
29
33
  ) : /* @__PURE__ */ e.jsxs(
30
- s,
34
+ r,
31
35
  {
32
- className: "w-100",
36
+ className: `${s} w-100`,
33
37
  small: !0,
38
+ id: a,
34
39
  style: {
35
40
  zIndex: 10,
36
41
  position: "relative"
@@ -46,5 +51,5 @@ function f() {
46
51
  );
47
52
  }
48
53
  export {
49
- f as default
54
+ p as default
50
55
  };
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"),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;
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 r } from "./ReturnToLauncherButton.js";
1
+ import { default as o } from "./ReturnToLauncherButton.js";
2
2
  import { default as t } from "./ArticlesAd.js";
3
- import { default as s } from "./Ad.js";
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 b } from "./FriendsList.js";
9
- import { default as A } from "./useUserDetails.js";
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
- s as Ad,
13
+ f as Ad,
13
14
  t as ArticlesAd,
14
- b as FriendsList,
15
+ U as FriendsList,
15
16
  l as GameScoreboard,
16
17
  x as GlobalBody,
17
18
  m as GlobalHead,
18
- r as ReturnToLauncherButton,
19
+ o as ReturnToLauncherButton,
19
20
  n as ViewUserModal,
20
- A as useUserDetails,
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.14",
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
  },