@articles-media/articles-dev-box 1.0.13 → 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.
Files changed (44) hide show
  1. package/dist/Ad.cjs +1 -0
  2. package/dist/Ad.js +600 -0
  3. package/dist/AdConfirmExitModal-CKkMAvBK.js +72 -0
  4. package/dist/AdConfirmExitModal-CcSxmXKT.cjs +1 -0
  5. package/dist/AdDetailsModal-Bp5hZm9N.js +83 -0
  6. package/dist/AdDetailsModal-k840vrS2.cjs +1 -0
  7. package/dist/ArticlesAd.cjs +1 -0
  8. package/dist/ArticlesAd.js +16 -0
  9. package/dist/Button-0ZK0NKiK.cjs +1 -0
  10. package/dist/Button-_Quon8UV.js +54 -0
  11. package/dist/FriendsList.cjs +1 -0
  12. package/dist/FriendsList.js +133 -0
  13. package/dist/GameScoreboard.cjs +1 -0
  14. package/dist/GameScoreboard.js +182 -0
  15. package/dist/GlobalBody-BQ2qC81K.cjs +33 -0
  16. package/dist/GlobalBody-tmIC_GWn.js +123 -0
  17. package/dist/GlobalBody.cjs +1 -0
  18. package/dist/GlobalBody.js +7 -0
  19. package/dist/GlobalHead.cjs +1 -0
  20. package/dist/GlobalHead.js +13 -0
  21. package/dist/Modal-C9oYRgI1.js +2073 -0
  22. package/dist/Modal-Wmqy9fOm.cjs +2 -0
  23. package/dist/ReturnToLauncherButton.cjs +1 -0
  24. package/dist/ReturnToLauncherButton.js +50 -0
  25. package/dist/StatusModal-BlwaI-2B.cjs +1 -0
  26. package/dist/StatusModal-CAVxWCUq.js +71 -0
  27. package/dist/ViewUserModal.cjs +1 -0
  28. package/dist/ViewUserModal.js +3189 -0
  29. package/dist/articles-dev-box.css +1 -0
  30. package/dist/index-BlP2-uOi.cjs +1 -0
  31. package/dist/index-DLYx67wi.js +2394 -0
  32. package/dist/index-Ddv_TnxK.cjs +6 -0
  33. package/dist/index-YnD2EP-S.js +43 -0
  34. package/dist/index.cjs +1 -0
  35. package/dist/index.js +22 -0
  36. package/dist/jsx-runtime-nZSsnGb7.cjs +6 -0
  37. package/dist/jsx-runtime-tc70JA_2.js +264 -0
  38. package/dist/numberWithCommas-CRgrb58X.cjs +1 -0
  39. package/dist/numberWithCommas-DnAkiOFL.js +1256 -0
  40. package/dist/useUserDetails.cjs +1 -0
  41. package/dist/useUserDetails.js +33 -0
  42. package/dist/useUserToken.cjs +1 -0
  43. package/dist/useUserToken.js +22 -0
  44. package/package.json +1 -1
@@ -0,0 +1,72 @@
1
+ import { j as e } from "./jsx-runtime-tc70JA_2.js";
2
+ import { useEffect as l } from "react";
3
+ import { L as n } from "./numberWithCommas-DnAkiOFL.js";
4
+ import { M as s } from "./Modal-C9oYRgI1.js";
5
+ import { A as i } from "./Button-_Quon8UV.js";
6
+ function x(t) {
7
+ let { setModalShow: r, ad: o, previewData: d } = t;
8
+ l(() => {
9
+ console.log("Mounted");
10
+ }, []);
11
+ const a = () => {
12
+ r(!1);
13
+ };
14
+ return /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs(
15
+ s,
16
+ {
17
+ show: !0,
18
+ backdropClassName: "ad-details-modal-backdrop",
19
+ className: "articles-modal",
20
+ centered: !0,
21
+ onHide: a,
22
+ size: "md",
23
+ children: [
24
+ /* @__PURE__ */ e.jsx(s.Header, { className: "align-items-center", closeButton: !0, children: /* @__PURE__ */ e.jsx(s.Title, { children: "Confirm Exit" }) }),
25
+ /* @__PURE__ */ e.jsxs(
26
+ s.Body,
27
+ {
28
+ className: "",
29
+ children: [
30
+ /* @__PURE__ */ e.jsx("div", { className: "ratio ratio-16x9 bg-black mb-2" }),
31
+ /* @__PURE__ */ e.jsx("p", { className: "mb-1", children: "This advertiser has been approved and verified to display ads but always be cautious when interacting with ads. Any offsite interactions are at your own risk and should be approached with caution. We can not be held responsible for any issues that may arise." })
32
+ ]
33
+ }
34
+ ),
35
+ /* @__PURE__ */ e.jsxs(s.Footer, { className: "d-flex justify-content-between", children: [
36
+ /* @__PURE__ */ e.jsxs(
37
+ i,
38
+ {
39
+ variant: "articles",
40
+ onClick: a,
41
+ children: [
42
+ /* @__PURE__ */ e.jsx("i", { className: "fad fa-times" }),
43
+ "Close"
44
+ ]
45
+ }
46
+ ),
47
+ /* @__PURE__ */ e.jsx(
48
+ n,
49
+ {
50
+ href: o?.website,
51
+ newPage: !0,
52
+ children: /* @__PURE__ */ e.jsxs(
53
+ i,
54
+ {
55
+ variant: "articles",
56
+ onClick: a,
57
+ children: [
58
+ /* @__PURE__ */ e.jsx("i", { className: "fad fa-link" }),
59
+ "Proceed"
60
+ ]
61
+ }
62
+ )
63
+ }
64
+ )
65
+ ] })
66
+ ]
67
+ }
68
+ ) });
69
+ }
70
+ export {
71
+ x as default
72
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-nZSsnGb7.cjs"),n=require("react"),l=require("./numberWithCommas-CRgrb58X.cjs"),s=require("./Modal-Wmqy9fOm.cjs"),i=require("./Button-0ZK0NKiK.cjs");function d(a){let{setModalShow:r,ad:o,previewData:c}=a;n.useEffect(()=>{console.log("Mounted")},[]);const t=()=>{r(!1)};return e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs(s.Modal,{show:!0,backdropClassName:"ad-details-modal-backdrop",className:"articles-modal",centered:!0,onHide:t,size:"md",children:[e.jsxRuntimeExports.jsx(s.Modal.Header,{className:"align-items-center",closeButton:!0,children:e.jsxRuntimeExports.jsx(s.Modal.Title,{children:"Confirm Exit"})}),e.jsxRuntimeExports.jsxs(s.Modal.Body,{className:"",children:[e.jsxRuntimeExports.jsx("div",{className:"ratio ratio-16x9 bg-black mb-2"}),e.jsxRuntimeExports.jsx("p",{className:"mb-1",children:"This advertiser has been approved and verified to display ads but always be cautious when interacting with ads. Any offsite interactions are at your own risk and should be approached with caution. We can not be held responsible for any issues that may arise."})]}),e.jsxRuntimeExports.jsxs(s.Modal.Footer,{className:"d-flex justify-content-between",children:[e.jsxRuntimeExports.jsxs(i.ArticlesButton,{variant:"articles",onClick:t,children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-times"}),"Close"]}),e.jsxRuntimeExports.jsx(l.Link,{href:o?.website,newPage:!0,children:e.jsxRuntimeExports.jsxs(i.ArticlesButton,{variant:"articles",onClick:t,children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-link"}),"Proceed"]})})]})]})})}exports.default=d;
@@ -0,0 +1,83 @@
1
+ import { j as s } from "./jsx-runtime-tc70JA_2.js";
2
+ import { useEffect as t } from "react";
3
+ import { L as n } from "./numberWithCommas-DnAkiOFL.js";
4
+ import { M as i } from "./Modal-C9oYRgI1.js";
5
+ import { A as l } from "./Button-_Quon8UV.js";
6
+ function b(d) {
7
+ let { setModalShow: r, ad: e, previewData: c } = d;
8
+ t(() => {
9
+ console.log("Mounted");
10
+ }, []);
11
+ const a = () => {
12
+ r(!1);
13
+ };
14
+ return /* @__PURE__ */ s.jsx("div", { children: /* @__PURE__ */ s.jsxs(
15
+ i,
16
+ {
17
+ show: !0,
18
+ backdropClassName: "ad-details-modal-backdrop",
19
+ className: "articles-modal",
20
+ centered: !0,
21
+ onHide: a,
22
+ size: "md",
23
+ children: [
24
+ /* @__PURE__ */ s.jsx(i.Header, { className: "align-items-center", closeButton: !0, children: /* @__PURE__ */ s.jsx(i.Title, { children: "Ad Details" }) }),
25
+ /* @__PURE__ */ s.jsxs(
26
+ i.Body,
27
+ {
28
+ className: "",
29
+ children: [
30
+ /* @__PURE__ */ s.jsxs("p", { className: "mb-1", children: [
31
+ "Advertiser: ",
32
+ /* @__PURE__ */ s.jsx("b", { children: e?.business })
33
+ ] }),
34
+ /* @__PURE__ */ s.jsxs("p", { className: "mb-0", children: [
35
+ "Ad ID: ",
36
+ /* @__PURE__ */ s.jsx("b", { children: c?._id || e._id })
37
+ ] }),
38
+ /* @__PURE__ */ s.jsx("hr", {}),
39
+ /* @__PURE__ */ s.jsx("div", { className: "mb-1", children: "This ad is being shown to you for the following reasons" }),
40
+ e.city ? /* @__PURE__ */ s.jsxs("div", { children: [
41
+ /* @__PURE__ */ s.jsx("div", { className: "h4 mb-1", children: e.business }),
42
+ /* @__PURE__ */ s.jsx("div", { children: "Is advertising to all zip codes within a" }),
43
+ /* @__PURE__ */ s.jsx("span", { children: /* @__PURE__ */ s.jsx("div", { className: "badge bg-black shadow-articles", children: "15 Mile Radius" }) }),
44
+ /* @__PURE__ */ s.jsx("div", { children: "of it's business" }),
45
+ /* @__PURE__ */ s.jsx("hr", { className: "border w-50 border-white" }),
46
+ /* @__PURE__ */ s.jsxs("div", { className: "d-flex align-items-center", children: [
47
+ /* @__PURE__ */ s.jsx("div", { children: "Your Zip code" }),
48
+ /* @__PURE__ */ s.jsx("div", { className: "badge bg-black shadow-articles ms-2", children: "00000" }),
49
+ /* @__PURE__ */ s.jsx("div", { className: "ms-2", children: "is" }),
50
+ /* @__PURE__ */ s.jsx("div", { className: "badge bg-black shadow-articles ms-2", children: "4.2 miles away" })
51
+ ] })
52
+ ] }) : /* @__PURE__ */ s.jsxs("div", { children: [
53
+ /* @__PURE__ */ s.jsx("div", { className: "h4 mb-1", children: e.business }),
54
+ /* @__PURE__ */ s.jsx("div", { children: "Is advertising to all users" })
55
+ ] }),
56
+ /* @__PURE__ */ s.jsx("div", { className: "grow" }),
57
+ /* @__PURE__ */ s.jsx("hr", { className: "w-100" }),
58
+ /* @__PURE__ */ s.jsx("div", { className: "reason lh-sm mb-2", children: "Ads we display to you will always be transparent as to why you are seeing them." }),
59
+ /* @__PURE__ */ s.jsx(n, { href: "https://articles.media/settings/account", newPage: !0, className: "", children: /* @__PURE__ */ s.jsx(
60
+ l,
61
+ {
62
+ small: !0,
63
+ children: "Settings"
64
+ }
65
+ ) })
66
+ ]
67
+ }
68
+ ),
69
+ /* @__PURE__ */ s.jsx(i.Footer, { className: "d-flex justify-content-center", children: /* @__PURE__ */ s.jsx(
70
+ l,
71
+ {
72
+ variant: "articles",
73
+ onClick: a,
74
+ children: "Close"
75
+ }
76
+ ) })
77
+ ]
78
+ }
79
+ ) });
80
+ }
81
+ export {
82
+ b as default
83
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-nZSsnGb7.cjs"),o=require("react"),x=require("./numberWithCommas-CRgrb58X.cjs"),t=require("./Modal-Wmqy9fOm.cjs"),r=require("./Button-0ZK0NKiK.cjs");function d(n){let{setModalShow:a,ad:e,previewData:l}=n;o.useEffect(()=>{console.log("Mounted")},[]);const i=()=>{a(!1)};return s.jsxRuntimeExports.jsx("div",{children:s.jsxRuntimeExports.jsxs(t.Modal,{show:!0,backdropClassName:"ad-details-modal-backdrop",className:"articles-modal",centered:!0,onHide:i,size:"md",children:[s.jsxRuntimeExports.jsx(t.Modal.Header,{className:"align-items-center",closeButton:!0,children:s.jsxRuntimeExports.jsx(t.Modal.Title,{children:"Ad Details"})}),s.jsxRuntimeExports.jsxs(t.Modal.Body,{className:"",children:[s.jsxRuntimeExports.jsxs("p",{className:"mb-1",children:["Advertiser: ",s.jsxRuntimeExports.jsx("b",{children:e?.business})]}),s.jsxRuntimeExports.jsxs("p",{className:"mb-0",children:["Ad ID: ",s.jsxRuntimeExports.jsx("b",{children:l?._id||e._id})]}),s.jsxRuntimeExports.jsx("hr",{}),s.jsxRuntimeExports.jsx("div",{className:"mb-1",children:"This ad is being shown to you for the following reasons"}),e.city?s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:"h4 mb-1",children:e.business}),s.jsxRuntimeExports.jsx("div",{children:"Is advertising to all zip codes within a"}),s.jsxRuntimeExports.jsx("span",{children:s.jsxRuntimeExports.jsx("div",{className:"badge bg-black shadow-articles",children:"15 Mile Radius"})}),s.jsxRuntimeExports.jsx("div",{children:"of it's business"}),s.jsxRuntimeExports.jsx("hr",{className:"border w-50 border-white"}),s.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center",children:[s.jsxRuntimeExports.jsx("div",{children:"Your Zip code"}),s.jsxRuntimeExports.jsx("div",{className:"badge bg-black shadow-articles ms-2",children:"00000"}),s.jsxRuntimeExports.jsx("div",{className:"ms-2",children:"is"}),s.jsxRuntimeExports.jsx("div",{className:"badge bg-black shadow-articles ms-2",children:"4.2 miles away"})]})]}):s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:"h4 mb-1",children:e.business}),s.jsxRuntimeExports.jsx("div",{children:"Is advertising to all users"})]}),s.jsxRuntimeExports.jsx("div",{className:"grow"}),s.jsxRuntimeExports.jsx("hr",{className:"w-100"}),s.jsxRuntimeExports.jsx("div",{className:"reason lh-sm mb-2",children:"Ads we display to you will always be transparent as to why you are seeing them."}),s.jsxRuntimeExports.jsx(x.Link,{href:"https://articles.media/settings/account",newPage:!0,className:"",children:s.jsxRuntimeExports.jsx(r.ArticlesButton,{small:!0,children:"Settings"})})]}),s.jsxRuntimeExports.jsx(t.Modal.Footer,{className:"d-flex justify-content-center",children:s.jsxRuntimeExports.jsx(r.ArticlesButton,{variant:"articles",onClick:i,children:"Close"})})]})})}exports.default=d;
@@ -0,0 +1 @@
1
+ "use strict";const t=require("./jsx-runtime-nZSsnGb7.cjs"),s=require("react");function c({darkMode:r}){return s.useEffect(()=>{},[]),s.useEffect(()=>{const e=document.createElement("script");return e.src="https://accounts.articles.media/js/ad.js",e.async=!0,document.body.appendChild(e),()=>{document.body.removeChild(e)}},[]),t.jsxRuntimeExports.jsx("div",{className:"",children:t.jsxRuntimeExports.jsx("div",{className:"articles-media-ad"})})}module.exports=c;
@@ -0,0 +1,16 @@
1
+ import { j as t } from "./jsx-runtime-tc70JA_2.js";
2
+ import { useEffect as s } from "react";
3
+ function a({
4
+ darkMode: r
5
+ }) {
6
+ return s(() => {
7
+ }, []), s(() => {
8
+ const e = document.createElement("script");
9
+ return e.src = "https://accounts.articles.media/js/ad.js", e.async = !0, document.body.appendChild(e), () => {
10
+ document.body.removeChild(e);
11
+ };
12
+ }, []), /* @__PURE__ */ t.jsx("div", { className: "", children: /* @__PURE__ */ t.jsx("div", { className: "articles-media-ad" }) });
13
+ }
14
+ export {
15
+ a as default
16
+ };
@@ -0,0 +1 @@
1
+ "use strict";const N=require("./jsx-runtime-nZSsnGb7.cjs"),R=require("react"),j=require("./index-BlP2-uOi.cjs"),o=R.forwardRef((t,c)=>{const{size:e,variant:s,style:i,small:r,large:a,onClick:l,className:n,disabled:u,active:b,type:m,onMouseDown:d,onMouseUp:x,onMouseLeave:h,onTouchStart:v,onTouchEnd:y,...p}=t;return N.jsxRuntimeExports.jsx("button",{ref:c,...m&&{type:"submit"},disabled:u,style:i,onMouseDown:d,onMouseUp:x,onMouseLeave:h,onTouchStart:v,onTouchEnd:y,className:j.classNames(`btn ${s?`btn-${s}`:"btn-articles"}`,{[n]:n,"btn-lg":a,"btn-sm":r,active:b,[`btn-${e}`]:e}),onClick:l,children:t.children})});o.displayName="ArticlesButton";exports.ArticlesButton=o;
@@ -0,0 +1,54 @@
1
+ import { j as v } from "./jsx-runtime-tc70JA_2.js";
2
+ import { forwardRef as x } from "react";
3
+ import { c as y } from "./index-YnD2EP-S.js";
4
+ const N = x((t, n) => {
5
+ const {
6
+ size: s,
7
+ variant: e,
8
+ style: a,
9
+ // Can just use small instead of size="sm"
10
+ small: r,
11
+ large: i,
12
+ onClick: c,
13
+ className: o,
14
+ disabled: l,
15
+ active: m,
16
+ type: u,
17
+ onMouseDown: b,
18
+ onMouseUp: d,
19
+ onMouseLeave: p,
20
+ onTouchStart: f,
21
+ onTouchEnd: h,
22
+ ...j
23
+ } = t;
24
+ return /* @__PURE__ */ v.jsx(
25
+ "button",
26
+ {
27
+ ref: n,
28
+ ...u && { type: "submit" },
29
+ disabled: l,
30
+ style: a,
31
+ onMouseDown: b,
32
+ onMouseUp: d,
33
+ onMouseLeave: p,
34
+ onTouchStart: f,
35
+ onTouchEnd: h,
36
+ className: y(
37
+ `btn ${e ? `btn-${e}` : "btn-articles"}`,
38
+ {
39
+ [o]: o,
40
+ "btn-lg": i,
41
+ "btn-sm": r,
42
+ active: m,
43
+ [`btn-${s}`]: s
44
+ }
45
+ ),
46
+ onClick: c,
47
+ children: t.children
48
+ }
49
+ );
50
+ });
51
+ N.displayName = "ArticlesButton";
52
+ export {
53
+ N as A
54
+ };
@@ -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
+ };
@@ -0,0 +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;
@@ -0,0 +1,182 @@
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";
5
+ import { A as o } from "./Button-_Quon8UV.js";
6
+ import { u as b, a as f } from "./index-DLYx67wi.js";
7
+ function y({
8
+ setChecked: s,
9
+ checked: a,
10
+ readOnly: r
11
+ }) {
12
+ return /* @__PURE__ */ e.jsxs("label", { className: `articles-switch mb-0 ${a && "checked"}`, children: [
13
+ /* @__PURE__ */ e.jsx(
14
+ "input",
15
+ {
16
+ type: "checkbox",
17
+ readOnly: !!r,
18
+ checked: a,
19
+ onChange: () => {
20
+ }
21
+ }
22
+ ),
23
+ /* @__PURE__ */ e.jsx(
24
+ "span",
25
+ {
26
+ onClick: (l) => {
27
+ if (s) {
28
+ s(!a);
29
+ return;
30
+ } else {
31
+ l.preventDefault();
32
+ return;
33
+ }
34
+ },
35
+ className: "slider"
36
+ }
37
+ )
38
+ ] });
39
+ }
40
+ const N = async (s) => {
41
+ if (process.env.NODE_ENV === "development")
42
+ try {
43
+ return (await f.get("http://localhost:3001/api/community/games/scoreboard", {
44
+ params: {
45
+ game: s.game
46
+ }
47
+ })).data;
48
+ } catch {
49
+ }
50
+ return f.get(s.url, {
51
+ params: {
52
+ game: s.game
53
+ }
54
+ }).then((a) => a.data);
55
+ }, g = {
56
+ dedupingInterval: 1e3 * 60 * 30,
57
+ refreshInterval: 0,
58
+ revalidateOnFocus: !1,
59
+ revalidateIfStale: !1,
60
+ shouldRetryOnError: !1
61
+ // fallbackData: []
62
+ }, v = (s) => {
63
+ const { data: a, error: r, isLoading: l, isValidating: i, mutate: c } = b(
64
+ s?.game ? {
65
+ // url: "/api/community/games/scoreboard",
66
+ url: "https://articles.media/api/community/games/scoreboard",
67
+ game: s.game
68
+ } : null,
69
+ N,
70
+ g
71
+ );
72
+ return {
73
+ data: a,
74
+ error: r,
75
+ isLoading: l,
76
+ isValidating: i,
77
+ mutate: c
78
+ };
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({
85
+ game: s
86
+ });
87
+ return u(() => {
88
+ }, []), u(() => {
89
+ a && (r(!1), m());
90
+ }, [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(
94
+ "div",
95
+ {
96
+ className: "d-flex justify-content-between align-items-center",
97
+ onClick: () => x(!c),
98
+ children: [
99
+ /* @__PURE__ */ e.jsxs("div", { children: [
100
+ /* @__PURE__ */ e.jsx("i", { className: "fas fa-trophy-alt" }),
101
+ /* @__PURE__ */ e.jsx("span", { children: "Join Scoreboard?" })
102
+ ] }),
103
+ /* @__PURE__ */ e.jsx(
104
+ y,
105
+ {
106
+ checked: c
107
+ }
108
+ )
109
+ ]
110
+ }
111
+ ) }),
112
+ /* @__PURE__ */ e.jsx(n.Footer, { className: "justify-content-between", children: /* @__PURE__ */ e.jsx(
113
+ o,
114
+ {
115
+ variant: "articles",
116
+ onClick: () => {
117
+ i(!1);
118
+ },
119
+ children: "Close"
120
+ }
121
+ ) })
122
+ ] }),
123
+ /* @__PURE__ */ e.jsxs("div", { className: "card card-articles card-sm mb-3 mb-lg-0", children: [
124
+ /* @__PURE__ */ e.jsxs("div", { className: "card-header d-flex justify-content-between align-items-center", children: [
125
+ /* @__PURE__ */ e.jsxs("span", { children: [
126
+ s,
127
+ " Scoreboard"
128
+ ] }),
129
+ /* @__PURE__ */ e.jsx(
130
+ o,
131
+ {
132
+ onClick: () => {
133
+ m();
134
+ },
135
+ small: !0,
136
+ children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-redo me-0" })
137
+ }
138
+ )
139
+ ] }),
140
+ /* @__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: [
144
+ /* @__PURE__ */ e.jsxs("div", { className: "d-flex justify-content-between lh-sm", children: [
145
+ /* @__PURE__ */ e.jsxs("div", { className: "d-flex", children: [
146
+ /* @__PURE__ */ e.jsx("h5", { className: "mb-0 me-3", children: j + 1 }),
147
+ /* @__PURE__ */ e.jsx("div", { className: "lh-sm", children: /* @__PURE__ */ e.jsx(
148
+ p,
149
+ {
150
+ populated_user: t.populated_user,
151
+ user_id: t.user_id
152
+ }
153
+ ) })
154
+ ] }),
155
+ /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx("h5", { className: "mb-0", children: t.score || t.total }) })
156
+ ] }),
157
+ t.last_play && t.public_last_play && /* @__PURE__ */ e.jsxs("small", { className: "mt-1", style: { fontSize: "0.75rem" }, children: [
158
+ "Played: ",
159
+ format(new Date(t.last_play), "MM/d/yy hh:mmaa")
160
+ ] })
161
+ ] }, t._id)
162
+ )
163
+ ] }),
164
+ /* @__PURE__ */ e.jsxs("div", { className: "card-footer d-flex justify-content-between align-items-center", children: [
165
+ /* @__PURE__ */ e.jsx("div", { className: "small", children: "Play to get on the board!" }),
166
+ /* @__PURE__ */ e.jsx(
167
+ o,
168
+ {
169
+ small: !0,
170
+ onClick: () => {
171
+ i(!0);
172
+ },
173
+ children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-cog me-0" })
174
+ }
175
+ )
176
+ ] })
177
+ ] })
178
+ ] });
179
+ }
180
+ export {
181
+ E as default
182
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),l=require("./index-Ddv_TnxK.cjs"),u=require("./index-BlP2-uOi.cjs"),r=require("react"),d=s=>l.axios.get(s).then(t=>t.data),i=s=>{const{data:t,error:n,isLoading:a,mutate:o}=l.useSWR(process.env.NODE_ENV==="development"&&!s?.disable?"http://localhost:3001/api/config":null,d,{revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1});return{data:t,error:n,isLoading:a,mutate:o}},m=s=>l.axios.get(s).then(t=>t.data),c=s=>{const{data:t,error:n,isLoading:a,mutate:o}=l.useSWR(process.env.NODE_ENV==="development"&&!s?.disable?"http://localhost:3012/api/status":null,m,{revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1});return{data:t,error:n,isLoading:a,mutate:o}},p=r.lazy(()=>Promise.resolve().then(()=>require("./StatusModal-BlwaI-2B.cjs")));function x(s){const[t,n]=r.useState(!1),{data:a}=i({disable:process.env.NODE_ENV!=="development"}),{data:o}=c({disable:process.env.NODE_ENV!=="development"});return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("link",{rel:"stylesheet",href:"https://cdn.articles.media/fonts/fontawesome/css/all.min.css"}),process.env.NODE_ENV==="development"&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("style",{children:`
2
+ @keyframes grow-shrink {
3
+ 0% { transform: translateY(-50px); }
4
+ 50% { transform: translateY(0px); }
5
+ 100% { transform: translateY(-50px); }
6
+ }
7
+ .articles-global-body {
8
+ transform: translateY(-40px);
9
+ z-index: 1055!important;
10
+ position: absolute;
11
+ top: 0;
12
+ left: 0;
13
+ display: flex;
14
+ justify-content: center;
15
+ align-items: center;
16
+ width: 50px;
17
+ height: 50px;
18
+ margin: 0;
19
+ padding: 0;
20
+ background-color: yellow;
21
+ color: #FFFFFF;
22
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
23
+ animation: grow-shrink 2s ease-in;
24
+ border: 4px solid red;
25
+ cursor: pointer;
26
+ }
27
+ .articles-global-body.main-connected {
28
+ background-color: green;
29
+ }
30
+ .articles-global-body.auth-connected {
31
+ border-color: blue;
32
+ }
33
+ `}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{n(!0)},className:u.classNames("articles-global-body",{"main-connected":a,"auth-connected":o}),children:e.jsxRuntimeExports.jsx("div",{className:"content",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-thumbs-up"})})}),t&&e.jsxRuntimeExports.jsx(r.Suspense,{children:e.jsxRuntimeExports.jsx(p,{show:t,setShow:n})})]})]})}const h=r.memo(x);exports.GlobalBody_default=h;exports.useAuthSiteStatus=c;exports.useMainSiteStatus=i;