@articles-media/articles-dev-box 1.0.15 → 1.0.17

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 (39) hide show
  1. package/README.md +4 -0
  2. package/dist/Ad.cjs +1 -1
  3. package/dist/Ad.js +2 -2
  4. package/dist/{AdConfirmExitModal-CKkMAvBK.js → AdConfirmExitModal-Bhz-lt9w.js} +1 -1
  5. package/dist/{AdConfirmExitModal-CcSxmXKT.cjs → AdConfirmExitModal-N3Lvhb4y.cjs} +1 -1
  6. package/dist/{AdDetailsModal-k840vrS2.cjs → AdDetailsModal-BMj8DjV0.cjs} +1 -1
  7. package/dist/{AdDetailsModal-Bp5hZm9N.js → AdDetailsModal-DXvfmyKK.js} +1 -1
  8. package/dist/DarkModeHandler.cjs +1 -0
  9. package/dist/DarkModeHandler.js +17 -0
  10. package/dist/ElementChildren-DN3RWY2E.js +51 -0
  11. package/dist/ElementChildren-eAwIENLl.cjs +1 -0
  12. package/dist/FriendsList.cjs +1 -1
  13. package/dist/FriendsList.js +85 -98
  14. package/dist/GameScoreboard.cjs +1 -1
  15. package/dist/GameScoreboard.js +2 -2
  16. package/dist/{GlobalBody-tmIC_GWn.js → GlobalBody-BrrtfBBs.js} +2 -2
  17. package/dist/{GlobalBody-BQ2qC81K.cjs → GlobalBody-weON_TbJ.cjs} +1 -1
  18. package/dist/GlobalBody.cjs +1 -1
  19. package/dist/GlobalBody.js +1 -1
  20. package/dist/{Modal-Wmqy9fOm.cjs → Modal-Bdhkgkwr.cjs} +2 -2
  21. package/dist/{Modal-C9oYRgI1.js → Modal-nux8R77F.js} +320 -306
  22. package/dist/SettingsModal.cjs +1 -0
  23. package/dist/SettingsModal.js +658 -0
  24. package/dist/{StatusModal-CAVxWCUq.js → StatusModal-B086BgSW.js} +2 -2
  25. package/dist/{StatusModal-BlwaI-2B.cjs → StatusModal-CzPyqQQA.cjs} +1 -1
  26. package/dist/ViewUserModal.cjs +1 -1
  27. package/dist/ViewUserModal.js +465 -505
  28. package/dist/{index-DLYx67wi.js → index-C8MeSLnR.js} +935 -825
  29. package/dist/index-DWV8myok.cjs +6 -0
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.js +19 -13
  32. package/dist/useUserDetails.cjs +1 -1
  33. package/dist/useUserDetails.js +1 -1
  34. package/dist/useUserFriends.cjs +1 -0
  35. package/dist/useUserFriends.js +52 -0
  36. package/dist/useUserToken.cjs +1 -1
  37. package/dist/useUserToken.js +1 -1
  38. package/package.json +13 -1
  39. package/dist/index-Ddv_TnxK.cjs +0 -6
package/README.md CHANGED
@@ -47,6 +47,10 @@ npm run dev
47
47
  - Easy way to add future logic and components to all projects with ease. For now handling the font awesome script. Also shows connection status to required servers in development. Will ping the main and auth server as they are needed for some dev-box features.
48
48
  - ViewUserModal
49
49
  - View user profile data and recent activity.
50
+ - SettingsModal
51
+ - All in one component to handle game settings UI across multiple games.
52
+ - DarkModeHandler
53
+ - Consumes a Zustand store, detects prefers-color-scheme, sets data-bs-theme on body element.
50
54
  - useUserToken
51
55
  - Hook for getting the subdomain auth token.
52
56
  - useUserDetails
package/dist/Ad.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),c=require("react"),v=require("./numberWithCommas-CRgrb58X.cjs"),R=require("./index-Ddv_TnxK.cjs"),Z=require("./Button-0ZK0NKiK.cjs"),ee=require("./index-BlP2-uOi.cjs");function se(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:()=>s[i]})}}return t.default=s,Object.freeze(t)}const A=se(c);var C=new Map,M=new WeakMap,W=0,te;function ne(s){return s?(M.has(s)||(W+=1,M.set(s,W.toString())),M.get(s)):"0"}function re(s){return Object.keys(s).sort().filter(t=>s[t]!==void 0).map(t=>`${t}_${t==="root"?ne(s.root):s[t]}`).toString()}function ie(s){const t=re(s);let i=C.get(t);if(!i){const r=new Map;let l;const u=new IntersectionObserver(x=>{x.forEach(o=>{var p;const N=o.isIntersecting&&l.some(j=>o.intersectionRatio>=j);s.trackVisibility&&typeof o.isVisible>"u"&&(o.isVisible=N),(p=r.get(o.target))==null||p.forEach(j=>{j(N,o)})})},s);l=u.thresholds||(Array.isArray(s.threshold)?s.threshold:[s.threshold||0]),i={id:t,observer:u,elements:r},C.set(t,i)}return i}function oe(s,t,i={},r=te){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const p=s.getBoundingClientRect();return t(r,{isIntersecting:r,target:s,intersectionRatio:typeof i.threshold=="number"?i.threshold:0,time:0,boundingClientRect:p,intersectionRect:p,rootBounds:p}),()=>{}}const{id:l,observer:u,elements:x}=ie(i),o=x.get(s)||[];return x.has(s)||x.set(s,o),o.push(t),u.observe(s),function(){o.splice(o.indexOf(t),1),o.length===0&&(x.delete(s),u.unobserve(s)),x.size===0&&(u.disconnect(),C.delete(l))}}function ae({threshold:s,delay:t,trackVisibility:i,rootMargin:r,root:l,triggerOnce:u,skip:x,initialInView:o,fallbackInView:p,onChange:N}={}){var j;const[_,b]=A.useState(null),n=A.useRef(N),a=A.useRef(o),[k,D]=A.useState({inView:!!o,entry:void 0});n.current=N,A.useEffect(()=>{if(a.current===void 0&&(a.current=o),x||!_)return;let g;return g=oe(_,(f,E)=>{const P=a.current;a.current=f,!(P===void 0&&!f)&&(D({inView:f,entry:E}),n.current&&n.current(f,E),E.isIntersecting&&u&&g&&(g(),g=void 0))},{root:l,rootMargin:r,threshold:s,trackVisibility:i,delay:t},p),()=>{g&&g()}},[Array.isArray(s)?s.toString():s,_,l,r,u,x,i,p,t]);const y=(j=k.entry)==null?void 0:j.target,S=A.useRef(void 0);!_&&y&&!u&&!x&&S.current!==y&&(S.current=y,D({inView:!!o,entry:void 0}),a.current=o);const m=[b,k.inView,k.entry];return m.ref=m[0],m.inView=m[1],m.entry=m[2],m}const ce=async s=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get(`http://localhost:3001/api/ads/${s.ad_id}`,{params:{ad_id:s.ad_id,user_ad_token:s.user_ad_token}})).data.result}catch{}return R.axios.get(s.url,{params:{ad_id:s.ad_id}}).then(t=>t.data.result)},le=60,de={dedupingInterval:1e3*60*le},ue=(s,t)=>{const{data:i,error:r,isLoading:l,mutate:u}=R.useSWR(s?{url:`https://articles.media/api/ads/${s}`,ad_id:s,user_ad_token:t}:null,ce,de);return{data:i,error:r,isLoading:l,mutate:u}};function xe(s){return t=>{const r=(s?Math[s]:Math.trunc)(t);return r===0?0:r}}function me(s,t){return+v.toDate(s)-+v.toDate(t)}function z(s,t,i){const r=me(s,t)/v.millisecondsInMinute;return xe(i?.roundingMethod)(r)}function U(s){return Math.trunc(s*v.millisecondsInMinute)}const pe=async s=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get("http://localhost:3001/api/ads",{params:{}})).data}catch{}return R.axios.get(s.url,{params:{}}).then(t=>t.data)},X=60,je={dedupingInterval:U(X),focusThrottleInterval:U(X)},fe=s=>{const{data:t,error:i,isLoading:r,mutate:l}=R.useSWR(s?.loading||s?.disabled?null:{url:"https://articles.media/api/ads"},pe,je);return{data:t,error:i,isLoading:r,mutate:l}},he=c.lazy(()=>Promise.resolve().then(()=>require("./AdDetailsModal-k840vrS2.cjs"))),ve=c.lazy(()=>Promise.resolve().then(()=>require("./AdConfirmExitModal-CcSxmXKT.cjs")));function ge(s,t){return Math.floor(Math.random()*(t-s+1))+s}function Ee(s){let{previewMode:t,darkMode:i,user_ad_token:r,userDetails:l,userDetailsLoading:u,prepend:x,append:o}=s;const p=!1,N=[],[j,_]=c.useState(null),{data:b}=fe({loading:u,disabled:l?.articles_membership?.status=="Active"}),{data:n}=ue(j,r);let a=s.previewData||{};const[k,D]=c.useState(null),[y,S]=c.useState(null),[m,g]=c.useState(null),[f,E]=c.useState(0),[P,K]=c.useState(!1),[$,L]=c.useState(!1),[F,O]=c.useState(!1),[Ne,be]=c.useState(new Date),[V,G]=c.useState([]);c.useEffect(()=>{b&&b?.length>0&&!j&&(console.log("Ad Mounted or reduxAds changed"),_(s.ad_id||b[ge(0,b?.length-1)]?._id))},[b]),c.useEffect(()=>{},[n]),c.useEffect(()=>{n?.populated_promos&&f>=0&&g(n?.populated_promos[f])},[f,n]);function H(){L(!$)}const{ref:J,inView:w}=ae({threshold:0,triggerOnce:!0});function T(d){if(t&&console.log("Preventing this event from being logged as this ad is being shown in preview mode."),V.find(h=>h==d)){console.log("Already logged this event");return}R.axios.get("/api/ads/event",{params:{ad_id:n?._id,event:d}}).then(function(h){G([...V,d]),console.log(h.data)}).catch(function(h){console.log(h)})}c.useEffect(()=>{if(!t&&(console.log("inView",w),w&&j)){let d=[{ad_id:j,date:new Date().toString()},...N.filter(h=>{if(console.log(z(new Date,new Date(h.date))),z(new Date,new Date(h.date))>5){console.log("adsViewed - Remove Old Ad View Object");return}else return console.log("adsViewed - Keep Ad View Object"),h})];console.log("unexpiredRecentViews",d)}},[w,j]);const[q,Q]=c.useState(null),[Y,I]=c.useState(!1);function B(){I(!0),console.log("logAdAvoided called",r),R.axios.get(process.env.NODE_ENV==="development"?"http://localhost:3001/api/user/advertising/avoided":"https://articles.media/api/user/advertising/avoided",{params:{user_id:l?._id},headers:{"x-articles-api-key":r}}).then(function(d){I(!1),Q(d.data.avoided_count),console.log(d.data)}).catch(function(d){console.log(d),I(!1)})}return c.useEffect(()=>{t||(console.log("inView",w),l?.articles_membership?.status=="Active"&&w&&B())},[w,l]),u?null:e.jsxRuntimeExports.jsxs("div",{ref:J,className:ee.classNames("ad-wrap",{"active-member":l?.articles_membership?.status=="Active"}),style:{"--articles-ad-background-color":a.background_color||n?.background_color,"--articles-ad-font-color":a.font_color||n?.font_color,"--articles-ad-border-color":a.border_color||n?.border_color},children:[$&&e.jsxRuntimeExports.jsx(he,{setModalShow:L,ad:n,previewData:a}),F&&e.jsxRuntimeExports.jsx(ve,{setModalShow:O,ad:n,previewData:a}),x&&e.jsxRuntimeExports.jsx("div",{className:"prepend-container",children:x}),e.jsxRuntimeExports.jsxs("div",{className:"ad",children:[l?.articles_membership?.status!=="Active"&&e.jsxRuntimeExports.jsxs("div",{className:"main-panel",children:[e.jsxRuntimeExports.jsx("div",{className:"ad-warning flex-header",children:e.jsxRuntimeExports.jsxs("div",{className:"",children:[n?.city&&"Local"," Advertisement"]})}),e.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[e.jsxRuntimeExports.jsx("div",{className:"logo",children:(a.logo?.location||n?.logo?.location)&&e.jsxRuntimeExports.jsx("img",{src:a?.logo?.key?`${process.env.NEXT_PUBLIC_CDN}${a?.logo?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.logo?.key}`,alt:""})}),e.jsxRuntimeExports.jsx("div",{className:"icon d-none",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-mug-hot"})}),e.jsxRuntimeExports.jsx("img",{className:"photo",src:a?.background?.key?`${process.env.NEXT_PUBLIC_CDN}${a.background?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.background?.key}`,alt:""})]}),e.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"detail-title",children:[e.jsxRuntimeExports.jsx("div",{className:"detail",children:e.jsxRuntimeExports.jsx("span",{className:"h4",children:a?.business||n?.business})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-column d-none",children:[e.jsxRuntimeExports.jsxs("div",{className:"detail",children:[e.jsxRuntimeExports.jsx("span",{className:"icon",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-search-location"})}),e.jsxRuntimeExports.jsxs("span",{children:[n?.city,", ",n?.state]})]}),e.jsxRuntimeExports.jsxs("div",{className:"detail",children:[e.jsxRuntimeExports.jsx("span",{className:"icon",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-clock me-2"})}),e.jsxRuntimeExports.jsx("span",{children:"6:30AM–8PM"})]})]})]}),n?.city&&e.jsxRuntimeExports.jsx("div",{className:"details mb-3 d-none"}),e.jsxRuntimeExports.jsx("div",{className:"short-description",children:a?.description||n?.description})]})]}),p?.roles?.isDev&&n?.populated_promos?.length>0&&e.jsxRuntimeExports.jsxs("div",{children:[m&&e.jsxRuntimeExports.jsx("div",{className:"promos-wrap",children:m&&e.jsxRuntimeExports.jsxs("div",{className:"promo-wrap d-flex justify-content-between align-items-center mx-2 p-1 px-2 border border-2 border-light mb-0",children:[e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsx("div",{children:m.title}),e.jsxRuntimeExports.jsx("div",{className:"small",children:e.jsxRuntimeExports.jsx("div",{className:"small",children:m.details})})]}),e.jsxRuntimeExports.jsx(Z.ArticlesButton,{className:"px-3",small:!0,onClick:()=>{console.log("Load Save Modal"),K(!0)},children:"Save"})]},m._id)}),e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"px-2",children:[n?.populated_promos?.length," Promos Active"]}),e.jsxRuntimeExports.jsxs("div",{className:"controls",children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-left",type:"button",onClick:()=>{f==0?E(n?.populated_promos?.length-1):E(d=>d-1)}}),n?.populated_promos?.map((d,h)=>e.jsxRuntimeExports.jsx("i",{className:`fa-square ${h==f?"fad":"fas"}`},d._id)),e.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-right",type:"button",onClick:()=>{f==n?.populated_promos?.length-1?E(0):E(d=>d+1)}})]})]})]}),e.jsxRuntimeExports.jsx("hr",{style:{borderColor:"white"},className:"mt-auto mb-0"}),e.jsxRuntimeExports.jsxs("div",{className:"action-wrap d-flex justify-content-lg-between px-3 py-2",children:[e.jsxRuntimeExports.jsx("div",{onClick:()=>{H(),T("Details")},className:"action flex-grow-1 flex-shrink-0",children:"Details"}),e.jsxRuntimeExports.jsx("span",{className:"px-4"}),e.jsxRuntimeExports.jsx("a",{className:"action flex-grow-1 flex-shrink-0",href:n?.website,target:"_blank",rel:"noreferrer",onClick:d=>{d.preventDefault(),O(!0),T("Confirm Exit Modal Opened")},children:e.jsxRuntimeExports.jsx("div",{children:"Website"})})]})]}),l?.articles_membership?.status=="Active"&&e.jsxRuntimeExports.jsx("div",{className:"main-panel",children:e.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[e.jsxRuntimeExports.jsx("div",{className:"logo"}),e.jsxRuntimeExports.jsxs("div",{className:"splash",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-broadcast-tower"}),e.jsxRuntimeExports.jsxs("div",{className:"text",children:[e.jsxRuntimeExports.jsx("div",{className:"count",children:Y?e.jsxRuntimeExports.jsx("i",{className:"fas fa-spinner fa-spin me-0"}):q?v.numberWithCommas(q):0}),e.jsxRuntimeExports.jsx("div",{className:"label",children:"ads avoided."})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"member-since",children:["Member since: ",e.jsxRuntimeExports.jsx(v.ArticlesDate,{format:"PP",date:l?.articles_membership?.membership_started})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[e.jsxRuntimeExports.jsx("div",{className:"detail-title",children:e.jsxRuntimeExports.jsx("div",{className:"detail",children:e.jsxRuntimeExports.jsx("span",{className:"h4",children:"Thanks for the support!"})})}),e.jsxRuntimeExports.jsxs("div",{className:"short-description",children:[e.jsxRuntimeExports.jsx("div",{className:"mb-2",children:"Without support from users like you, we wouldn't be here."}),e.jsxRuntimeExports.jsxs("div",{className:"links-list",children:[e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/messages",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-comments-alt"}),"0 unread messages."]}),e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/settings/notifications",onClick:()=>{B()},children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-bell"}),"0 notifications."]}),e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/settings/account",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-cog"}),"Manage account settings."]})]})]})]})]})})]}),o&&e.jsxRuntimeExports.jsx("div",{className:"append-container",children:o}),!t&&e.jsxRuntimeExports.jsx("div",{className:"advertise-with-us p-1",style:{backgroundColor:a.background_color||n?.background_color,color:a.font_color||n?.font_color,borderColor:a.border_color||n?.border_color},children:e.jsxRuntimeExports.jsxs(v.Link,{className:"small d-block w-100 text-center",href:"https://articles.media/advertising",newPage:!0,children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-share me-1"}),"Advertise with Articles Media!"]})})]})}const Re=c.memo(Ee);module.exports=Re;
1
+ "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),c=require("react"),v=require("./numberWithCommas-CRgrb58X.cjs"),R=require("./index-DWV8myok.cjs"),Z=require("./Button-0ZK0NKiK.cjs"),ee=require("./index-BlP2-uOi.cjs");function se(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:()=>s[i]})}}return t.default=s,Object.freeze(t)}const A=se(c);var C=new Map,M=new WeakMap,W=0,te;function ne(s){return s?(M.has(s)||(W+=1,M.set(s,W.toString())),M.get(s)):"0"}function re(s){return Object.keys(s).sort().filter(t=>s[t]!==void 0).map(t=>`${t}_${t==="root"?ne(s.root):s[t]}`).toString()}function ie(s){const t=re(s);let i=C.get(t);if(!i){const r=new Map;let l;const u=new IntersectionObserver(x=>{x.forEach(o=>{var p;const N=o.isIntersecting&&l.some(j=>o.intersectionRatio>=j);s.trackVisibility&&typeof o.isVisible>"u"&&(o.isVisible=N),(p=r.get(o.target))==null||p.forEach(j=>{j(N,o)})})},s);l=u.thresholds||(Array.isArray(s.threshold)?s.threshold:[s.threshold||0]),i={id:t,observer:u,elements:r},C.set(t,i)}return i}function oe(s,t,i={},r=te){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const p=s.getBoundingClientRect();return t(r,{isIntersecting:r,target:s,intersectionRatio:typeof i.threshold=="number"?i.threshold:0,time:0,boundingClientRect:p,intersectionRect:p,rootBounds:p}),()=>{}}const{id:l,observer:u,elements:x}=ie(i),o=x.get(s)||[];return x.has(s)||x.set(s,o),o.push(t),u.observe(s),function(){o.splice(o.indexOf(t),1),o.length===0&&(x.delete(s),u.unobserve(s)),x.size===0&&(u.disconnect(),C.delete(l))}}function ae({threshold:s,delay:t,trackVisibility:i,rootMargin:r,root:l,triggerOnce:u,skip:x,initialInView:o,fallbackInView:p,onChange:N}={}){var j;const[_,b]=A.useState(null),n=A.useRef(N),a=A.useRef(o),[k,D]=A.useState({inView:!!o,entry:void 0});n.current=N,A.useEffect(()=>{if(a.current===void 0&&(a.current=o),x||!_)return;let g;return g=oe(_,(f,E)=>{const P=a.current;a.current=f,!(P===void 0&&!f)&&(D({inView:f,entry:E}),n.current&&n.current(f,E),E.isIntersecting&&u&&g&&(g(),g=void 0))},{root:l,rootMargin:r,threshold:s,trackVisibility:i,delay:t},p),()=>{g&&g()}},[Array.isArray(s)?s.toString():s,_,l,r,u,x,i,p,t]);const y=(j=k.entry)==null?void 0:j.target,S=A.useRef(void 0);!_&&y&&!u&&!x&&S.current!==y&&(S.current=y,D({inView:!!o,entry:void 0}),a.current=o);const m=[b,k.inView,k.entry];return m.ref=m[0],m.inView=m[1],m.entry=m[2],m}const ce=async s=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get(`http://localhost:3001/api/ads/${s.ad_id}`,{params:{ad_id:s.ad_id,user_ad_token:s.user_ad_token}})).data.result}catch{}return R.axios.get(s.url,{params:{ad_id:s.ad_id}}).then(t=>t.data.result)},le=60,de={dedupingInterval:1e3*60*le},ue=(s,t)=>{const{data:i,error:r,isLoading:l,mutate:u}=R.useSWR(s?{url:`https://articles.media/api/ads/${s}`,ad_id:s,user_ad_token:t}:null,ce,de);return{data:i,error:r,isLoading:l,mutate:u}};function xe(s){return t=>{const r=(s?Math[s]:Math.trunc)(t);return r===0?0:r}}function me(s,t){return+v.toDate(s)-+v.toDate(t)}function z(s,t,i){const r=me(s,t)/v.millisecondsInMinute;return xe(i?.roundingMethod)(r)}function U(s){return Math.trunc(s*v.millisecondsInMinute)}const pe=async s=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get("http://localhost:3001/api/ads",{params:{}})).data}catch{}return R.axios.get(s.url,{params:{}}).then(t=>t.data)},X=60,je={dedupingInterval:U(X),focusThrottleInterval:U(X)},fe=s=>{const{data:t,error:i,isLoading:r,mutate:l}=R.useSWR(s?.loading||s?.disabled?null:{url:"https://articles.media/api/ads"},pe,je);return{data:t,error:i,isLoading:r,mutate:l}},he=c.lazy(()=>Promise.resolve().then(()=>require("./AdDetailsModal-BMj8DjV0.cjs"))),ve=c.lazy(()=>Promise.resolve().then(()=>require("./AdConfirmExitModal-N3Lvhb4y.cjs")));function ge(s,t){return Math.floor(Math.random()*(t-s+1))+s}function Ee(s){let{previewMode:t,darkMode:i,user_ad_token:r,userDetails:l,userDetailsLoading:u,prepend:x,append:o}=s;const p=!1,N=[],[j,_]=c.useState(null),{data:b}=fe({loading:u,disabled:l?.articles_membership?.status=="Active"}),{data:n}=ue(j,r);let a=s.previewData||{};const[k,D]=c.useState(null),[y,S]=c.useState(null),[m,g]=c.useState(null),[f,E]=c.useState(0),[P,K]=c.useState(!1),[$,L]=c.useState(!1),[F,O]=c.useState(!1),[Ne,be]=c.useState(new Date),[V,G]=c.useState([]);c.useEffect(()=>{b&&b?.length>0&&!j&&(console.log("Ad Mounted or reduxAds changed"),_(s.ad_id||b[ge(0,b?.length-1)]?._id))},[b]),c.useEffect(()=>{},[n]),c.useEffect(()=>{n?.populated_promos&&f>=0&&g(n?.populated_promos[f])},[f,n]);function H(){L(!$)}const{ref:J,inView:w}=ae({threshold:0,triggerOnce:!0});function T(d){if(t&&console.log("Preventing this event from being logged as this ad is being shown in preview mode."),V.find(h=>h==d)){console.log("Already logged this event");return}R.axios.get("/api/ads/event",{params:{ad_id:n?._id,event:d}}).then(function(h){G([...V,d]),console.log(h.data)}).catch(function(h){console.log(h)})}c.useEffect(()=>{if(!t&&(console.log("inView",w),w&&j)){let d=[{ad_id:j,date:new Date().toString()},...N.filter(h=>{if(console.log(z(new Date,new Date(h.date))),z(new Date,new Date(h.date))>5){console.log("adsViewed - Remove Old Ad View Object");return}else return console.log("adsViewed - Keep Ad View Object"),h})];console.log("unexpiredRecentViews",d)}},[w,j]);const[q,Q]=c.useState(null),[Y,I]=c.useState(!1);function B(){I(!0),console.log("logAdAvoided called",r),R.axios.get(process.env.NODE_ENV==="development"?"http://localhost:3001/api/user/advertising/avoided":"https://articles.media/api/user/advertising/avoided",{params:{user_id:l?._id},headers:{"x-articles-api-key":r}}).then(function(d){I(!1),Q(d.data.avoided_count),console.log(d.data)}).catch(function(d){console.log(d),I(!1)})}return c.useEffect(()=>{t||(console.log("inView",w),l?.articles_membership?.status=="Active"&&w&&B())},[w,l]),u?null:e.jsxRuntimeExports.jsxs("div",{ref:J,className:ee.classNames("ad-wrap",{"active-member":l?.articles_membership?.status=="Active"}),style:{"--articles-ad-background-color":a.background_color||n?.background_color,"--articles-ad-font-color":a.font_color||n?.font_color,"--articles-ad-border-color":a.border_color||n?.border_color},children:[$&&e.jsxRuntimeExports.jsx(he,{setModalShow:L,ad:n,previewData:a}),F&&e.jsxRuntimeExports.jsx(ve,{setModalShow:O,ad:n,previewData:a}),x&&e.jsxRuntimeExports.jsx("div",{className:"prepend-container",children:x}),e.jsxRuntimeExports.jsxs("div",{className:"ad",children:[l?.articles_membership?.status!=="Active"&&e.jsxRuntimeExports.jsxs("div",{className:"main-panel",children:[e.jsxRuntimeExports.jsx("div",{className:"ad-warning flex-header",children:e.jsxRuntimeExports.jsxs("div",{className:"",children:[n?.city&&"Local"," Advertisement"]})}),e.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[e.jsxRuntimeExports.jsx("div",{className:"logo",children:(a.logo?.location||n?.logo?.location)&&e.jsxRuntimeExports.jsx("img",{src:a?.logo?.key?`${process.env.NEXT_PUBLIC_CDN}${a?.logo?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.logo?.key}`,alt:""})}),e.jsxRuntimeExports.jsx("div",{className:"icon d-none",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-mug-hot"})}),e.jsxRuntimeExports.jsx("img",{className:"photo",src:a?.background?.key?`${process.env.NEXT_PUBLIC_CDN}${a.background?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.background?.key}`,alt:""})]}),e.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"detail-title",children:[e.jsxRuntimeExports.jsx("div",{className:"detail",children:e.jsxRuntimeExports.jsx("span",{className:"h4",children:a?.business||n?.business})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-column d-none",children:[e.jsxRuntimeExports.jsxs("div",{className:"detail",children:[e.jsxRuntimeExports.jsx("span",{className:"icon",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-search-location"})}),e.jsxRuntimeExports.jsxs("span",{children:[n?.city,", ",n?.state]})]}),e.jsxRuntimeExports.jsxs("div",{className:"detail",children:[e.jsxRuntimeExports.jsx("span",{className:"icon",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-clock me-2"})}),e.jsxRuntimeExports.jsx("span",{children:"6:30AM–8PM"})]})]})]}),n?.city&&e.jsxRuntimeExports.jsx("div",{className:"details mb-3 d-none"}),e.jsxRuntimeExports.jsx("div",{className:"short-description",children:a?.description||n?.description})]})]}),p?.roles?.isDev&&n?.populated_promos?.length>0&&e.jsxRuntimeExports.jsxs("div",{children:[m&&e.jsxRuntimeExports.jsx("div",{className:"promos-wrap",children:m&&e.jsxRuntimeExports.jsxs("div",{className:"promo-wrap d-flex justify-content-between align-items-center mx-2 p-1 px-2 border border-2 border-light mb-0",children:[e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsx("div",{children:m.title}),e.jsxRuntimeExports.jsx("div",{className:"small",children:e.jsxRuntimeExports.jsx("div",{className:"small",children:m.details})})]}),e.jsxRuntimeExports.jsx(Z.ArticlesButton,{className:"px-3",small:!0,onClick:()=>{console.log("Load Save Modal"),K(!0)},children:"Save"})]},m._id)}),e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"px-2",children:[n?.populated_promos?.length," Promos Active"]}),e.jsxRuntimeExports.jsxs("div",{className:"controls",children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-left",type:"button",onClick:()=>{f==0?E(n?.populated_promos?.length-1):E(d=>d-1)}}),n?.populated_promos?.map((d,h)=>e.jsxRuntimeExports.jsx("i",{className:`fa-square ${h==f?"fad":"fas"}`},d._id)),e.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-right",type:"button",onClick:()=>{f==n?.populated_promos?.length-1?E(0):E(d=>d+1)}})]})]})]}),e.jsxRuntimeExports.jsx("hr",{style:{borderColor:"white"},className:"mt-auto mb-0"}),e.jsxRuntimeExports.jsxs("div",{className:"action-wrap d-flex justify-content-lg-between px-3 py-2",children:[e.jsxRuntimeExports.jsx("div",{onClick:()=>{H(),T("Details")},className:"action flex-grow-1 flex-shrink-0",children:"Details"}),e.jsxRuntimeExports.jsx("span",{className:"px-4"}),e.jsxRuntimeExports.jsx("a",{className:"action flex-grow-1 flex-shrink-0",href:n?.website,target:"_blank",rel:"noreferrer",onClick:d=>{d.preventDefault(),O(!0),T("Confirm Exit Modal Opened")},children:e.jsxRuntimeExports.jsx("div",{children:"Website"})})]})]}),l?.articles_membership?.status=="Active"&&e.jsxRuntimeExports.jsx("div",{className:"main-panel",children:e.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[e.jsxRuntimeExports.jsx("div",{className:"logo"}),e.jsxRuntimeExports.jsxs("div",{className:"splash",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-broadcast-tower"}),e.jsxRuntimeExports.jsxs("div",{className:"text",children:[e.jsxRuntimeExports.jsx("div",{className:"count",children:Y?e.jsxRuntimeExports.jsx("i",{className:"fas fa-spinner fa-spin me-0"}):q?v.numberWithCommas(q):0}),e.jsxRuntimeExports.jsx("div",{className:"label",children:"ads avoided."})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"member-since",children:["Member since: ",e.jsxRuntimeExports.jsx(v.ArticlesDate,{format:"PP",date:l?.articles_membership?.membership_started})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[e.jsxRuntimeExports.jsx("div",{className:"detail-title",children:e.jsxRuntimeExports.jsx("div",{className:"detail",children:e.jsxRuntimeExports.jsx("span",{className:"h4",children:"Thanks for the support!"})})}),e.jsxRuntimeExports.jsxs("div",{className:"short-description",children:[e.jsxRuntimeExports.jsx("div",{className:"mb-2",children:"Without support from users like you, we wouldn't be here."}),e.jsxRuntimeExports.jsxs("div",{className:"links-list",children:[e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/messages",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-comments-alt"}),"0 unread messages."]}),e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/settings/notifications",onClick:()=>{B()},children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-bell"}),"0 notifications."]}),e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/settings/account",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-cog"}),"Manage account settings."]})]})]})]})]})})]}),o&&e.jsxRuntimeExports.jsx("div",{className:"append-container",children:o}),!t&&e.jsxRuntimeExports.jsx("div",{className:"advertise-with-us p-1",style:{backgroundColor:a.background_color||n?.background_color,color:a.font_color||n?.font_color,borderColor:a.border_color||n?.border_color},children:e.jsxRuntimeExports.jsxs(v.Link,{className:"small d-block w-100 text-center",href:"https://articles.media/advertising",newPage:!0,children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-share me-1"}),"Advertise with Articles Media!"]})})]})}const Re=c.memo(Ee);module.exports=Re;
package/dist/Ad.js CHANGED
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-tc70JA_2.js";
2
2
  import * as A from "react";
3
3
  import { lazy as G, memo as re, useState as p, useEffect as y } from "react";
4
4
  import { t as X, m as H, n as ne, A as ie, L as E } from "./numberWithCommas-DnAkiOFL.js";
5
- import { u as J, a as k } from "./index-DLYx67wi.js";
5
+ import { u as J, a as k } from "./index-C8MeSLnR.js";
6
6
  import { A as oe } from "./Button-_Quon8UV.js";
7
7
  import { c as le } from "./index-YnD2EP-S.js";
8
8
  var S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap(), z = 0, de;
@@ -210,7 +210,7 @@ const be = async (s) => {
210
210
  isLoading: r,
211
211
  mutate: o
212
212
  };
213
- }, Ae = G(() => import("./AdDetailsModal-Bp5hZm9N.js")), ke = G(() => import("./AdConfirmExitModal-CKkMAvBK.js"));
213
+ }, Ae = G(() => import("./AdDetailsModal-DXvfmyKK.js")), ke = G(() => import("./AdConfirmExitModal-Bhz-lt9w.js"));
214
214
  function ye(s, t) {
215
215
  return Math.floor(Math.random() * (t - s + 1)) + s;
216
216
  }
@@ -1,7 +1,7 @@
1
1
  import { j as e } from "./jsx-runtime-tc70JA_2.js";
2
2
  import { useEffect as l } from "react";
3
3
  import { L as n } from "./numberWithCommas-DnAkiOFL.js";
4
- import { M as s } from "./Modal-C9oYRgI1.js";
4
+ import { M as s } from "./Modal-nux8R77F.js";
5
5
  import { A as i } from "./Button-_Quon8UV.js";
6
6
  function x(t) {
7
7
  let { setModalShow: r, ad: o, previewData: d } = t;
@@ -1 +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;
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-Bdhkgkwr.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;
@@ -1 +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;
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-Bdhkgkwr.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;
@@ -1,7 +1,7 @@
1
1
  import { j as s } from "./jsx-runtime-tc70JA_2.js";
2
2
  import { useEffect as t } from "react";
3
3
  import { L as n } from "./numberWithCommas-DnAkiOFL.js";
4
- import { M as i } from "./Modal-C9oYRgI1.js";
4
+ import { M as i } from "./Modal-nux8R77F.js";
5
5
  import { A as l } from "./Button-_Quon8UV.js";
6
6
  function b(d) {
7
7
  let { setModalShow: r, ad: e, previewData: c } = d;
@@ -0,0 +1 @@
1
+ "use strict";const a=require("./jsx-runtime-nZSsnGb7.cjs"),d=require("react");function n({useStore:t}){const r=t(e=>e.darkMode),s=t(e=>e._hasHydrated);return d.useEffect(()=>{if(s){if(r==null){const e=window.matchMedia("(prefers-color-scheme: dark)").matches;t.getState().setDarkMode(!!e)}r?document.body.setAttribute("data-bs-theme","dark"):document.body.setAttribute("data-bs-theme","light")}},[r,s]),a.jsxRuntimeExports.jsx(a.jsxRuntimeExports.Fragment,{})}module.exports=n;
@@ -0,0 +1,17 @@
1
+ import { j as d } from "./jsx-runtime-tc70JA_2.js";
2
+ import { useEffect as s } from "react";
3
+ function m({ useStore: t }) {
4
+ const r = t((e) => e.darkMode), a = t((e) => e._hasHydrated);
5
+ return s(() => {
6
+ if (a) {
7
+ if (r == null) {
8
+ const e = window.matchMedia("(prefers-color-scheme: dark)").matches;
9
+ t.getState().setDarkMode(!!e);
10
+ }
11
+ r ? document.body.setAttribute("data-bs-theme", "dark") : document.body.setAttribute("data-bs-theme", "light");
12
+ }
13
+ }, [r, a]), /* @__PURE__ */ d.jsx(d.Fragment, {});
14
+ }
15
+ export {
16
+ m as default
17
+ };
@@ -0,0 +1,51 @@
1
+ import { g as l } from "./index-YnD2EP-S.js";
2
+ import * as s from "react";
3
+ var f, m;
4
+ function p() {
5
+ if (m) return f;
6
+ m = 1;
7
+ var o = process.env.NODE_ENV !== "production", a = function() {
8
+ };
9
+ if (o) {
10
+ var t = function(u, n) {
11
+ var e = arguments.length;
12
+ n = new Array(e > 1 ? e - 1 : 0);
13
+ for (var r = 1; r < e; r++)
14
+ n[r - 1] = arguments[r];
15
+ var c = 0, g = "Warning: " + u.replace(/%s/g, function() {
16
+ return n[c++];
17
+ });
18
+ typeof console < "u" && console.error(g);
19
+ try {
20
+ throw new Error(g);
21
+ } catch {
22
+ }
23
+ };
24
+ a = function(i, u, n) {
25
+ var e = arguments.length;
26
+ n = new Array(e > 2 ? e - 2 : 0);
27
+ for (var r = 2; r < e; r++)
28
+ n[r - 2] = arguments[r];
29
+ if (u === void 0)
30
+ throw new Error(
31
+ "`warning(condition, format, ...args)` requires a warning message argument"
32
+ );
33
+ i || t.apply(null, [u].concat(n));
34
+ };
35
+ }
36
+ return f = a, f;
37
+ }
38
+ var v = p();
39
+ const E = /* @__PURE__ */ l(v);
40
+ function h(o, a) {
41
+ let t = 0;
42
+ return s.Children.map(o, (i) => /* @__PURE__ */ s.isValidElement(i) ? a(i, t++) : i);
43
+ }
44
+ function x(o, a) {
45
+ return s.Children.toArray(o).some((t) => /* @__PURE__ */ s.isValidElement(t) && t.type === a);
46
+ }
47
+ export {
48
+ x as h,
49
+ h as m,
50
+ E as w
51
+ };
@@ -0,0 +1 @@
1
+ "use strict";const p=require("./index-BlP2-uOi.cjs"),d=require("react");function m(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,t.get?t:{enumerable:!0,get:()=>n[r]})}}return e.default=n,Object.freeze(e)}const c=m(d);var s,l;function v(){if(l)return s;l=1;var n=process.env.NODE_ENV!=="production",e=function(){};if(n){var r=function(u,i){var o=arguments.length;i=new Array(o>1?o-1:0);for(var a=1;a<o;a++)i[a-1]=arguments[a];var g=0,f="Warning: "+u.replace(/%s/g,function(){return i[g++]});typeof console<"u"&&console.error(f);try{throw new Error(f)}catch{}};e=function(t,u,i){var o=arguments.length;i=new Array(o>2?o-2:0);for(var a=2;a<o;a++)i[a-2]=arguments[a];if(u===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");t||r.apply(null,[u].concat(i))}}return s=e,s}var w=v();const h=p.getDefaultExportFromCjs(w);function E(n,e){let r=0;return c.Children.map(n,t=>c.isValidElement(t)?e(t,r++):t)}function _(n,e){return c.Children.toArray(n).some(r=>c.isValidElement(r)&&r.type===e)}exports.hasChildOfType=_;exports.map=E;exports.warning=h;
@@ -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"),f=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)},E={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},R=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,f,E);return{data:t,error:n,isLoading:l,isValidating:o,mutate:d}};function g({show:s,setShow:t,componentType:n,className:l,style:o={},user_id:d,user_token:m,id:p=null,allowInvite:_=!1,inviteFunction:v=null,modalBackdropClassName:j=""}){const{data:r,isLoading:u,mutate:h}=R({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}`,modalBackdropClassName:j,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:()=>{h()},children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-redo"})}),e.jsxRuntimeExports.jsx(c.ArticlesButton,{variant:"articles",onClick:()=>{t(!1)},children:"Close"})]})]})}module.exports=g;
1
+ "use strict";const s=require("./jsx-runtime-nZSsnGb7.cjs"),f=require("./useUserFriends.cjs"),n=require("./Button-0ZK0NKiK.cjs"),i=require("./Modal-Bdhkgkwr.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,128 +1,115 @@
1
1
  import { j as e } from "./jsx-runtime-tc70JA_2.js";
2
- import { u as g, 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 j = 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
- }, _ = {
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-nux8R77F.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: r,
68
- isLoading: o,
19
+ data: s,
20
+ error: v,
21
+ isLoading: r,
69
22
  // isValidating: friendsValidating,
70
- mutate: x
71
- } = v({
72
- user_id: u,
73
- user_token: f
23
+ mutate: h
24
+ } = p({
25
+ user_id: f,
26
+ user_token: x
74
27
  });
75
- if ((!t || t == "list") && !o && r && r.length > 0)
76
- 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: [
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 (t.toLowerCase() == "modal")
34
+ if (n.toLowerCase() == "modal")
82
35
  return /* @__PURE__ */ e.jsxs(
83
- n,
36
+ a,
84
37
  {
85
- show: s,
38
+ show: m,
86
39
  size: "md",
87
- className: `articles-modal ${l}`,
88
- modalBackdropClassName: p,
40
+ className: `articles-modal ${t}`,
41
+ modalBackdropClassName: j,
89
42
  centered: !0,
90
- onHide: () => a(!1),
91
- style: d,
92
- id: h,
43
+ onHide: () => d(!1),
44
+ style: c,
45
+ id: u,
93
46
  children: [
94
- /* @__PURE__ */ e.jsx(n.Header, { children: /* @__PURE__ */ e.jsx(n.Title, { children: "Friends" }) }),
95
- /* @__PURE__ */ e.jsxs(n.Body, { children: [
96
- 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: [
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
- !o && r && r.length == 0 && /* @__PURE__ */ e.jsx("div", { children: "No friends to show." }),
101
- !o && r && r.length > 0 && /* @__PURE__ */ e.jsx("ul", { children: r.map((i) => /* @__PURE__ */ e.jsxs("li", { children: [
102
- i?.populated_user?.username,
103
- " - ",
104
- i?.populated_user?.display_name || "No Display Name"
105
- ] }, 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
+ )) })
106
87
  ] }),
107
- /* @__PURE__ */ e.jsxs(n.Footer, { className: "justify-content-between", children: [
108
- /* @__PURE__ */ e.jsx(
109
- m,
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
- x();
94
+ h();
114
95
  },
115
- 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
+ ]
116
100
  }
117
101
  ),
118
- /* @__PURE__ */ e.jsx(
119
- m,
102
+ /* @__PURE__ */ e.jsxs(
103
+ l,
120
104
  {
121
105
  variant: "articles",
122
106
  onClick: () => {
123
- a(!1);
107
+ d(!1);
124
108
  },
125
- children: "Close"
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
- C as default
121
+ k as default
135
122
  };
@@ -1 +1 @@
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
+ "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),l=require("react"),i=require("./Modal-Bdhkgkwr.cjs"),E=require("./ViewUserModal.cjs"),m=require("./Button-0ZK0NKiK.cjs"),d=require("./index-DWV8myok.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
2
  import { useState as f, useEffect as x } from "react";
3
- import { M as i } from "./Modal-C9oYRgI1.js";
3
+ import { M as i } from "./Modal-nux8R77F.js";
4
4
  import N from "./ViewUserModal.js";
5
5
  import { A as o } from "./Button-_Quon8UV.js";
6
- import { u as v, a as j } from "./index-DLYx67wi.js";
6
+ import { u as v, a as j } from "./index-C8MeSLnR.js";
7
7
  function y({
8
8
  setChecked: s,
9
9
  checked: a,
@@ -1,5 +1,5 @@
1
1
  import { j as e } from "./jsx-runtime-tc70JA_2.js";
2
- import { u as r, a as l } from "./index-DLYx67wi.js";
2
+ import { u as r, a as l } from "./index-C8MeSLnR.js";
3
3
  import { c as i } from "./index-YnD2EP-S.js";
4
4
  import { lazy as c, memo as d, useState as u, Suspense as m } from "react";
5
5
  const p = (s) => l.get(s).then((t) => t.data), f = (s) => {
@@ -36,7 +36,7 @@ const p = (s) => l.get(s).then((t) => t.data), f = (s) => {
36
36
  isLoading: o,
37
37
  mutate: n
38
38
  };
39
- }, x = c(() => import("./StatusModal-CAVxWCUq.js"));
39
+ }, x = c(() => import("./StatusModal-B086BgSW.js"));
40
40
  function g(s) {
41
41
  const [t, a] = u(!1), {
42
42
  data: o
@@ -1,4 +1,4 @@
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:`
1
+ "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),l=require("./index-DWV8myok.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-CzPyqQQA.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
2
  @keyframes grow-shrink {
3
3
  0% { transform: translateY(-50px); }
4
4
  50% { transform: translateY(0px); }
@@ -1 +1 @@
1
- "use strict";require("./jsx-runtime-nZSsnGb7.cjs");const e=require("./GlobalBody-BQ2qC81K.cjs");require("./index-BlP2-uOi.cjs");require("react");module.exports=e.GlobalBody_default;
1
+ "use strict";require("./jsx-runtime-nZSsnGb7.cjs");const e=require("./GlobalBody-weON_TbJ.cjs");require("./index-BlP2-uOi.cjs");require("react");module.exports=e.GlobalBody_default;
@@ -1,5 +1,5 @@
1
1
  import "./jsx-runtime-tc70JA_2.js";
2
- import { G as i } from "./GlobalBody-tmIC_GWn.js";
2
+ import { G as i } from "./GlobalBody-BrrtfBBs.js";
3
3
  import "./index-YnD2EP-S.js";
4
4
  import "react";
5
5
  export {