@articles-media/articles-dev-box 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,3 +35,8 @@ npm link @articles-media/articles-dev-box
35
35
  ⏹️ Remove Bootstrap reliance
36
36
  ⏹️ Look into npm package yalc
37
37
  ⏹️ Automatic GitHub Action for NPM
38
+
39
+
40
+ # TODO
41
+ - Bundle SCSS on a component level instead of a project level.
42
+ - Verify I am exporting components the most efficient way.
package/dist/Ad.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";const s=require("./jsx-runtime-Blz-RjDE.cjs"),d=require("react"),R=require("./index-CqsCVLvJ.cjs"),X=require("./Button-CZyAJPvK.cjs");function F(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const N=F(d);var C=new Map,A=new WeakMap,O=0,z;function K(e){return e?(A.has(e)||(O+=1,A.set(e,O.toString())),A.get(e)):"0"}function G(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?K(e.root):e[t]}`).toString()}function H(e){const t=G(e);let o=C.get(t);if(!o){const r=new Map;let l;const i=new IntersectionObserver(c=>{c.forEach(a=>{var x;const E=a.isIntersecting&&l.some(h=>a.intersectionRatio>=h);e.trackVisibility&&typeof a.isVisible>"u"&&(a.isVisible=E),(x=r.get(a.target))==null||x.forEach(h=>{h(E,a)})})},e);l=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),o={id:t,observer:i,elements:r},C.set(t,o)}return o}function J(e,t,o={},r=z){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const x=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:typeof o.threshold=="number"?o.threshold:0,time:0,boundingClientRect:x,intersectionRect:x,rootBounds:x}),()=>{}}const{id:l,observer:i,elements:c}=H(o),a=c.get(e)||[];return c.has(e)||c.set(e,a),a.push(t),i.observe(e),function(){a.splice(a.indexOf(t),1),a.length===0&&(c.delete(e),i.unobserve(e)),c.size===0&&(i.disconnect(),C.delete(l))}}function Q({threshold:e,delay:t,trackVisibility:o,rootMargin:r,root:l,triggerOnce:i,skip:c,initialInView:a,fallbackInView:x,onChange:E}={}){var h;const[w,g]=N.useState(null),_=N.useRef(E),u=N.useRef(a),[j,I]=N.useState({inView:!!a,entry:void 0});_.current=E,N.useEffect(()=>{if(u.current===void 0&&(u.current=a),c||!w)return;let v;return v=J(w,(D,b)=>{const M=u.current;u.current=D,!(M===void 0&&!D)&&(I({inView:D,entry:b}),_.current&&_.current(D,b),b.isIntersecting&&i&&v&&(v(),v=void 0))},{root:l,rootMargin:r,threshold:e,trackVisibility:o,delay:t},x),()=>{v&&v()}},[Array.isArray(e)?e.toString():e,w,l,r,i,c,o,x,t]);const y=(h=j.entry)==null?void 0:h.target,S=N.useRef(void 0);!w&&y&&!i&&!c&&S.current!==y&&(S.current=y,I({inView:!!a,entry:void 0}),u.current=a);const f=[g,j.inView,j.entry];return f.ref=f[0],f.inView=f[1],f.entry=f[2],f}const Y=async e=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get(`http://localhost:3001/api/ads/${e.ad_id}`,{params:{ad_id:e.ad_id}})).data.result}catch{}return R.axios.get(e.url,{params:{ad_id:e.ad_id}}).then(t=>t.data.result)},Z=60,ee={dedupingInterval:1e3*60*Z},se=e=>{const{data:t,error:o,isLoading:r,mutate:l}=R.useSWR(e?{url:`https://articles.media/api/ads/${e}`,ad_id:e}:null,Y,ee);return{data:t,error:o,isLoading:r,mutate:l}},q=6e4,P=Symbol.for("constructDateFrom");function te(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&P in e?e[P](t):e instanceof Date?new e.constructor(t):new Date(t)}function T(e,t){return te(e,e)}function re(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function ne(e,t){return+T(e)-+T(t)}function V(e,t,o){const r=ne(e,t)/q;return re(o?.roundingMethod)(r)}function L(e){return Math.trunc(e*q)}const oe=async e=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get("http://localhost:3001/api/ads",{params:{}})).data}catch{}return R.axios.get(e.url,{params:{}}).then(t=>t.data)},B=60,ie={dedupingInterval:L(B),focusThrottleInterval:L(B)},ae=e=>{const{data:t,error:o,isLoading:r,mutate:l}=R.useSWR({url:"https://articles.media/api/ads"},oe,ie);return{data:t,error:o,isLoading:r,mutate:l}};function ce(e,t){return Math.floor(Math.random()*(t-e+1))+e}function le(e){const o=[],{data:r}=ae();let{previewMode:l}=e,i=e.previewData||{};const[c,a]=d.useState(null),[x,E]=d.useState(null),[h,w]=d.useState(null),[g,_]=d.useState(null),[u,j]=d.useState(0),[I,y]=d.useState(!1),[S,f]=d.useState(!1),[v,D]=d.useState(new Date),[b,M]=d.useState([]),{data:n}=se(c);d.useEffect(()=>{r&&r?.length>0&&!c&&(console.log("Ad Mounted or reduxAds changed"),a(e.ad_id||r[ce(0,r?.length-1)]?._id))},[r]),d.useEffect(()=>{},[n]),d.useEffect(()=>{n?.populated_promos&&u>=0&&_(n?.populated_promos[u])},[u,n]);function W(){f(!S)}const{ref:U,inView:k}=Q({threshold:0,triggerOnce:!0});function $(m){if(l&&console.log("Preventing this event from being logged as this ad is being shown in preview mode."),b.find(p=>p==m)){console.log("Already logged this event");return}R.axios.get("/api/ads/event",{params:{ad_id:n?._id,event:m}}).then(function(p){M([...b,m]),console.log(p.data)}).catch(function(p){console.log(p)})}return d.useEffect(()=>{if(!l&&(console.log("inView",k),k&&c)){let m=[{ad_id:c,date:new Date().toString()},...o.filter(p=>{if(console.log(V(new Date,new Date(p.date))),V(new Date,new Date(p.date))>5){console.log("adsViewed - Remove Old Ad View Object");return}else return console.log("adsViewed - Keep Ad View Object"),p})];console.log("unexpiredRecentViews",m)}},[k,c]),s.jsxRuntimeExports.jsxs("div",{ref:U,className:"ad-wrap",style:{"--articles-ad-background-color":i.background_color||n?.background_color,"--articles-ad-font-color":i.font_color||n?.font_color,"--articles-ad-border-color":i.border_color||n?.border_color},children:[s.jsxRuntimeExports.jsx("div",{className:"ad",children:s.jsxRuntimeExports.jsxs("div",{className:"main-panel",children:[s.jsxRuntimeExports.jsx("div",{className:"ad-warning flex-header",children:s.jsxRuntimeExports.jsxs("div",{className:"",children:[n?.city&&"Local"," Advertisement"]})}),s.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[s.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[s.jsxRuntimeExports.jsx("div",{className:"logo",children:(i.logo?.location||n?.logo?.location)&&s.jsxRuntimeExports.jsx("img",{src:i?.logo?.key?`${process.env.NEXT_PUBLIC_CDN}${i?.logo?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.logo?.key}`,alt:""})}),s.jsxRuntimeExports.jsx("div",{className:"icon d-none",children:s.jsxRuntimeExports.jsx("i",{className:"fas fa-mug-hot"})}),s.jsxRuntimeExports.jsx("img",{className:"photo",src:i?.background?.key?`${process.env.NEXT_PUBLIC_CDN}${i.background?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.background?.key}`,alt:""})]}),s.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[s.jsxRuntimeExports.jsxs("div",{className:"detail-title",children:[s.jsxRuntimeExports.jsx("div",{className:"detail",children:s.jsxRuntimeExports.jsx("span",{className:"h4",children:i?.business||n?.business})}),s.jsxRuntimeExports.jsxs("div",{className:"flex flex-column d-none",children:[s.jsxRuntimeExports.jsxs("div",{className:"detail",children:[s.jsxRuntimeExports.jsx("span",{className:"icon",children:s.jsxRuntimeExports.jsx("i",{className:"fas fa-search-location"})}),s.jsxRuntimeExports.jsxs("span",{children:[n?.city,", ",n?.state]})]}),s.jsxRuntimeExports.jsxs("div",{className:"detail",children:[s.jsxRuntimeExports.jsx("span",{className:"icon",children:s.jsxRuntimeExports.jsx("i",{className:"fas fa-clock me-2"})}),s.jsxRuntimeExports.jsx("span",{children:"6:30AM–8PM"})]})]})]}),n?.city&&s.jsxRuntimeExports.jsx("div",{className:"details mb-3 d-none"}),s.jsxRuntimeExports.jsx("div",{className:"short-description",children:i?.description||n?.description})]})]}),(!1)?.roles?.isDev&&n?.populated_promos?.length>0&&s.jsxRuntimeExports.jsxs("div",{children:[g&&s.jsxRuntimeExports.jsx("div",{className:"promos-wrap",children:g&&s.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:[s.jsxRuntimeExports.jsxs("div",{className:"",children:[s.jsxRuntimeExports.jsx("div",{children:g.title}),s.jsxRuntimeExports.jsx("div",{className:"small",children:s.jsxRuntimeExports.jsx("div",{className:"small",children:g.details})})]}),s.jsxRuntimeExports.jsx(X.ArticlesButton,{className:"px-3",small:!0,onClick:()=>{console.log("Load Save Modal"),y(!0)},children:"Save"})]},g._id)}),s.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between",children:[s.jsxRuntimeExports.jsxs("div",{className:"px-2",children:[n?.populated_promos?.length," Promos Active"]}),s.jsxRuntimeExports.jsxs("div",{className:"controls",children:[s.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-left",type:"button",onClick:()=>{u==0?j(n?.populated_promos?.length-1):j(m=>m-1)}}),n?.populated_promos?.map((m,p)=>s.jsxRuntimeExports.jsx("i",{className:`fa-square ${p==u?"fad":"fas"}`},m._id)),s.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-right",type:"button",onClick:()=>{u==n?.populated_promos?.length-1?j(0):j(m=>m+1)}})]})]})]}),s.jsxRuntimeExports.jsx("hr",{style:{borderColor:"white"},className:"mt-auto mb-0"}),s.jsxRuntimeExports.jsxs("div",{className:"action-wrap d-flex justify-content-lg-between px-3 py-2",children:[s.jsxRuntimeExports.jsx("div",{onClick:()=>{W(),$("Details")},className:"action flex-grow-1 flex-shrink-0",children:"Details"}),s.jsxRuntimeExports.jsx("span",{className:"px-4"}),s.jsxRuntimeExports.jsx("a",{className:"action flex-grow-1 flex-shrink-0",href:n?.website,target:"_blank",rel:"noreferrer",onClick:()=>$("Website"),children:s.jsxRuntimeExports.jsx("div",{children:"Website"})})]})]})}),!l&&s.jsxRuntimeExports.jsx("div",{className:"advertise-with-us p-1",style:{backgroundColor:i.background_color||n?.background_color,color:i.font_color||n?.font_color,borderColor:i.border_color||n?.border_color},children:s.jsxRuntimeExports.jsxs("div",{className:"small d-block w-100 text-center",children:[s.jsxRuntimeExports.jsx("i",{className:"fas fa-share me-1"}),"Advertise with Articles Media!"]})})]})}const de=d.memo(le);module.exports=de;
package/dist/Ad.js ADDED
@@ -0,0 +1,461 @@
1
+ import { j as s } from "./jsx-runtime-tc70JA_2.js";
2
+ import * as w from "react";
3
+ import { memo as z, useState as p, useEffect as M } from "react";
4
+ import { u as W, a as I } from "./index-CsgQIn35.js";
5
+ import { A as K } from "./Button-g7fiSVpz.js";
6
+ var $ = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new WeakMap(), P = 0, G;
7
+ function H(e) {
8
+ return e ? (k.has(e) || (P += 1, k.set(e, P.toString())), k.get(e)) : "0";
9
+ }
10
+ function J(e) {
11
+ return Object.keys(e).sort().filter(
12
+ (t) => e[t] !== void 0
13
+ ).map((t) => `${t}_${t === "root" ? H(e.root) : e[t]}`).toString();
14
+ }
15
+ function Q(e) {
16
+ const t = J(e);
17
+ let a = $.get(t);
18
+ if (!a) {
19
+ const n = /* @__PURE__ */ new Map();
20
+ let l;
21
+ const o = new IntersectionObserver((c) => {
22
+ c.forEach((i) => {
23
+ var u;
24
+ const N = i.isIntersecting && l.some((v) => i.intersectionRatio >= v);
25
+ e.trackVisibility && typeof i.isVisible > "u" && (i.isVisible = N), (u = n.get(i.target)) == null || u.forEach((v) => {
26
+ v(N, i);
27
+ });
28
+ });
29
+ }, e);
30
+ l = o.thresholds || (Array.isArray(e.threshold) ? e.threshold : [e.threshold || 0]), a = {
31
+ id: t,
32
+ observer: o,
33
+ elements: n
34
+ }, $.set(t, a);
35
+ }
36
+ return a;
37
+ }
38
+ function Y(e, t, a = {}, n = G) {
39
+ if (typeof window.IntersectionObserver > "u" && n !== void 0) {
40
+ const u = e.getBoundingClientRect();
41
+ return t(n, {
42
+ isIntersecting: n,
43
+ target: e,
44
+ intersectionRatio: typeof a.threshold == "number" ? a.threshold : 0,
45
+ time: 0,
46
+ boundingClientRect: u,
47
+ intersectionRect: u,
48
+ rootBounds: u
49
+ }), () => {
50
+ };
51
+ }
52
+ const { id: l, observer: o, elements: c } = Q(a), i = c.get(e) || [];
53
+ return c.has(e) || c.set(e, i), i.push(t), o.observe(e), function() {
54
+ i.splice(i.indexOf(t), 1), i.length === 0 && (c.delete(e), o.unobserve(e)), c.size === 0 && (o.disconnect(), $.delete(l));
55
+ };
56
+ }
57
+ function Z({
58
+ threshold: e,
59
+ delay: t,
60
+ trackVisibility: a,
61
+ rootMargin: n,
62
+ root: l,
63
+ triggerOnce: o,
64
+ skip: c,
65
+ initialInView: i,
66
+ fallbackInView: u,
67
+ onChange: N
68
+ } = {}) {
69
+ var v;
70
+ const [_, x] = w.useState(null), y = w.useRef(N), d = w.useRef(i), [g, E] = w.useState({
71
+ inView: !!i,
72
+ entry: void 0
73
+ });
74
+ y.current = N, w.useEffect(
75
+ () => {
76
+ if (d.current === void 0 && (d.current = i), c || !_) return;
77
+ let j;
78
+ return j = Y(
79
+ _,
80
+ (A, b) => {
81
+ const C = d.current;
82
+ d.current = A, !(C === void 0 && !A) && (E({
83
+ inView: A,
84
+ entry: b
85
+ }), y.current && y.current(A, b), b.isIntersecting && o && j && (j(), j = void 0));
86
+ },
87
+ {
88
+ root: l,
89
+ rootMargin: n,
90
+ threshold: e,
91
+ // @ts-expect-error
92
+ trackVisibility: a,
93
+ delay: t
94
+ },
95
+ u
96
+ ), () => {
97
+ j && j();
98
+ };
99
+ },
100
+ // We break the rule here, because we aren't including the actual `threshold` variable
101
+ // eslint-disable-next-line react-hooks/exhaustive-deps
102
+ [
103
+ // If the threshold is an array, convert it to a string, so it won't change between renders.
104
+ Array.isArray(e) ? e.toString() : e,
105
+ _,
106
+ l,
107
+ n,
108
+ o,
109
+ c,
110
+ a,
111
+ u,
112
+ t
113
+ ]
114
+ );
115
+ const D = (v = g.entry) == null ? void 0 : v.target, R = w.useRef(void 0);
116
+ !_ && D && !o && !c && R.current !== D && (R.current = D, E({
117
+ inView: !!i,
118
+ entry: void 0
119
+ }), d.current = i);
120
+ const h = [x, g.inView, g.entry];
121
+ return h.ref = h[0], h.inView = h[1], h.entry = h[2], h;
122
+ }
123
+ const ee = async (e) => {
124
+ if (process.env.NODE_ENV === "development")
125
+ try {
126
+ return (await I.get(`http://localhost:3001/api/ads/${e.ad_id}`, {
127
+ params: {
128
+ ad_id: e.ad_id
129
+ }
130
+ })).data.result;
131
+ } catch {
132
+ }
133
+ return I.get(e.url, {
134
+ params: {
135
+ ad_id: e.ad_id
136
+ }
137
+ }).then((t) => t.data.result);
138
+ }, se = 60, te = {
139
+ dedupingInterval: 1e3 * 60 * se
140
+ // keepPreviousData: true,
141
+ // fallbackData: []
142
+ }, re = (e) => {
143
+ const { data: t, error: a, isLoading: n, mutate: l } = W(
144
+ e ? {
145
+ url: `https://articles.media/api/ads/${e}`,
146
+ ad_id: e
147
+ } : null,
148
+ ee,
149
+ te
150
+ );
151
+ return {
152
+ data: t,
153
+ error: a,
154
+ isLoading: n,
155
+ mutate: l
156
+ };
157
+ }, X = 6e4, T = /* @__PURE__ */ Symbol.for("constructDateFrom");
158
+ function ne(e, t) {
159
+ return typeof e == "function" ? e(t) : e && typeof e == "object" && T in e ? e[T](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
160
+ }
161
+ function L(e, t) {
162
+ return ne(e, e);
163
+ }
164
+ function oe(e) {
165
+ return (t) => {
166
+ const n = (e ? Math[e] : Math.trunc)(t);
167
+ return n === 0 ? 0 : n;
168
+ };
169
+ }
170
+ function ae(e, t) {
171
+ return +L(e) - +L(t);
172
+ }
173
+ function O(e, t, a) {
174
+ const n = ae(e, t) / X;
175
+ return oe(a?.roundingMethod)(n);
176
+ }
177
+ function B(e) {
178
+ return Math.trunc(e * X);
179
+ }
180
+ const ie = async (e) => {
181
+ if (process.env.NODE_ENV === "development")
182
+ try {
183
+ return (await I.get("http://localhost:3001/api/ads", {
184
+ params: {
185
+ // ad_id: data.ad_id
186
+ }
187
+ })).data;
188
+ } catch {
189
+ }
190
+ return I.get(e.url, {
191
+ params: {
192
+ // ad_id: data.ad_id
193
+ }
194
+ }).then((t) => t.data);
195
+ }, U = 60, ce = {
196
+ dedupingInterval: B(U),
197
+ focusThrottleInterval: B(U)
198
+ // keepPreviousData: true,
199
+ // fallbackData: []
200
+ }, le = (e) => {
201
+ const { data: t, error: a, isLoading: n, mutate: l } = W(
202
+ {
203
+ url: "https://articles.media/api/ads"
204
+ // ad_id
205
+ },
206
+ ie,
207
+ ce
208
+ );
209
+ return {
210
+ data: t,
211
+ error: a,
212
+ isLoading: n,
213
+ mutate: l
214
+ };
215
+ };
216
+ function de(e, t) {
217
+ return Math.floor(Math.random() * (t - e + 1)) + e;
218
+ }
219
+ function ue(e) {
220
+ const a = [], {
221
+ data: n
222
+ } = le();
223
+ let { previewMode: l } = e, o = e.previewData || {};
224
+ const [c, i] = p(null), [u, N] = p(null), [v, _] = p(null), [x, y] = p(null), [d, g] = p(0), [E, D] = p(!1), [R, h] = p(!1), [j, A] = p(/* @__PURE__ */ new Date()), [b, C] = p([]), { data: r } = re(c);
225
+ M(() => {
226
+ n && n?.length > 0 && !c && (console.log("Ad Mounted or reduxAds changed"), i(e.ad_id || n[de(0, n?.length - 1)]?._id));
227
+ }, [n]), M(() => {
228
+ }, [r]), M(() => {
229
+ r?.populated_promos && d >= 0 && y(r?.populated_promos[d]);
230
+ }, [d, r]);
231
+ function F() {
232
+ h(!R);
233
+ }
234
+ const { ref: q, inView: S } = Z({
235
+ /* Optional options */
236
+ threshold: 0,
237
+ triggerOnce: !0
238
+ });
239
+ function V(f) {
240
+ if (l && console.log("Preventing this event from being logged as this ad is being shown in preview mode."), b.find((m) => m == f)) {
241
+ console.log("Already logged this event");
242
+ return;
243
+ }
244
+ I.get("/api/ads/event", {
245
+ params: {
246
+ ad_id: r?._id,
247
+ event: f
248
+ }
249
+ }).then(function(m) {
250
+ C([...b, f]), console.log(m.data);
251
+ }).catch(function(m) {
252
+ console.log(m);
253
+ });
254
+ }
255
+ return M(() => {
256
+ if (!l && (console.log("inView", S), S && c)) {
257
+ let f = [
258
+ {
259
+ ad_id: c,
260
+ date: (/* @__PURE__ */ new Date()).toString()
261
+ },
262
+ ...a.filter((m) => {
263
+ if (console.log(
264
+ O(/* @__PURE__ */ new Date(), new Date(m.date))
265
+ ), O(/* @__PURE__ */ new Date(), new Date(m.date)) > 5) {
266
+ console.log("adsViewed - Remove Old Ad View Object");
267
+ return;
268
+ } else
269
+ return console.log("adsViewed - Keep Ad View Object"), m;
270
+ })
271
+ ];
272
+ console.log("unexpiredRecentViews", f);
273
+ }
274
+ }, [S, c]), /* @__PURE__ */ s.jsxs(
275
+ "div",
276
+ {
277
+ ref: q,
278
+ className: "ad-wrap",
279
+ style: {
280
+ "--articles-ad-background-color": o.background_color || r?.background_color,
281
+ "--articles-ad-font-color": o.font_color || r?.font_color,
282
+ "--articles-ad-border-color": o.border_color || r?.border_color
283
+ },
284
+ children: [
285
+ /* @__PURE__ */ s.jsx(
286
+ "div",
287
+ {
288
+ className: "ad",
289
+ children: /* @__PURE__ */ s.jsxs(
290
+ "div",
291
+ {
292
+ className: "main-panel",
293
+ children: [
294
+ /* @__PURE__ */ s.jsx("div", { className: "ad-warning flex-header", children: /* @__PURE__ */ s.jsxs("div", { className: "", children: [
295
+ r?.city && "Local",
296
+ " Advertisement"
297
+ ] }) }),
298
+ /* @__PURE__ */ s.jsxs("div", { className: "content-wrap", children: [
299
+ /* @__PURE__ */ s.jsxs("div", { className: "photo-banner", children: [
300
+ /* @__PURE__ */ s.jsx("div", { className: "logo", children: (o.logo?.location || r?.logo?.location) && /* @__PURE__ */ s.jsx(
301
+ "img",
302
+ {
303
+ src: o?.logo?.key ? `${process.env.NEXT_PUBLIC_CDN}${o?.logo?.key}` : `${process.env.NEXT_PUBLIC_CDN}${r?.logo?.key}`,
304
+ alt: ""
305
+ }
306
+ ) }),
307
+ /* @__PURE__ */ s.jsx("div", { className: "icon d-none", children: /* @__PURE__ */ s.jsx("i", { className: "fas fa-mug-hot" }) }),
308
+ /* @__PURE__ */ s.jsx(
309
+ "img",
310
+ {
311
+ className: "photo",
312
+ src: o?.background?.key ? `${process.env.NEXT_PUBLIC_CDN}${o.background?.key}` : `${process.env.NEXT_PUBLIC_CDN}${r?.background?.key}`,
313
+ alt: ""
314
+ }
315
+ )
316
+ ] }),
317
+ /* @__PURE__ */ s.jsxs("div", { className: "details-wrap", children: [
318
+ /* @__PURE__ */ s.jsxs("div", { className: "detail-title", children: [
319
+ /* @__PURE__ */ s.jsx("div", { className: "detail", children: /* @__PURE__ */ s.jsx("span", { className: "h4", children: o?.business || r?.business }) }),
320
+ /* @__PURE__ */ s.jsxs("div", { className: "flex flex-column d-none", children: [
321
+ /* @__PURE__ */ s.jsxs("div", { className: "detail", children: [
322
+ /* @__PURE__ */ s.jsx("span", { className: "icon", children: /* @__PURE__ */ s.jsx("i", { className: "fas fa-search-location" }) }),
323
+ /* @__PURE__ */ s.jsxs("span", { children: [
324
+ r?.city,
325
+ ", ",
326
+ r?.state
327
+ ] })
328
+ ] }),
329
+ /* @__PURE__ */ s.jsxs("div", { className: "detail", children: [
330
+ /* @__PURE__ */ s.jsx("span", { className: "icon", children: /* @__PURE__ */ s.jsx("i", { className: "fas fa-clock me-2" }) }),
331
+ /* @__PURE__ */ s.jsx("span", { children: "6:30AM–8PM" })
332
+ ] })
333
+ ] })
334
+ ] }),
335
+ r?.city && /* @__PURE__ */ s.jsx("div", { className: "details mb-3 d-none" }),
336
+ /* @__PURE__ */ s.jsx("div", { className: "short-description", children: o?.description || r?.description })
337
+ ] })
338
+ ] }),
339
+ (!1)?.roles?.isDev && r?.populated_promos?.length > 0 && /* @__PURE__ */ s.jsxs("div", { children: [
340
+ x && /* @__PURE__ */ s.jsx("div", { className: "promos-wrap", children: x && /* @__PURE__ */ s.jsxs(
341
+ "div",
342
+ {
343
+ className: "promo-wrap d-flex justify-content-between align-items-center mx-2 p-1 px-2 border border-2 border-light mb-0",
344
+ children: [
345
+ /* @__PURE__ */ s.jsxs("div", { className: "", children: [
346
+ /* @__PURE__ */ s.jsx("div", { children: x.title }),
347
+ /* @__PURE__ */ s.jsx("div", { className: "small", children: /* @__PURE__ */ s.jsx("div", { className: "small", children: x.details }) })
348
+ ] }),
349
+ /* @__PURE__ */ s.jsx(
350
+ K,
351
+ {
352
+ className: "px-3",
353
+ small: !0,
354
+ onClick: () => {
355
+ console.log("Load Save Modal"), D(!0);
356
+ },
357
+ children: "Save"
358
+ }
359
+ )
360
+ ]
361
+ },
362
+ x._id
363
+ ) }),
364
+ /* @__PURE__ */ s.jsxs("div", { className: "d-flex justify-content-between", children: [
365
+ /* @__PURE__ */ s.jsxs("div", { className: "px-2", children: [
366
+ r?.populated_promos?.length,
367
+ " Promos Active"
368
+ ] }),
369
+ /* @__PURE__ */ s.jsxs("div", { className: "controls", children: [
370
+ /* @__PURE__ */ s.jsx(
371
+ "i",
372
+ {
373
+ className: "fad fa-arrow-circle-left",
374
+ type: "button",
375
+ onClick: () => {
376
+ d == 0 ? g(r?.populated_promos?.length - 1) : g((f) => f - 1);
377
+ }
378
+ }
379
+ ),
380
+ r?.populated_promos?.map(
381
+ (f, m) => /* @__PURE__ */ s.jsx(
382
+ "i",
383
+ {
384
+ className: `fa-square ${m == d ? "fad" : "fas"}`
385
+ },
386
+ f._id
387
+ )
388
+ ),
389
+ /* @__PURE__ */ s.jsx(
390
+ "i",
391
+ {
392
+ className: "fad fa-arrow-circle-right",
393
+ type: "button",
394
+ onClick: () => {
395
+ d == r?.populated_promos?.length - 1 ? g(0) : g((f) => f + 1);
396
+ }
397
+ }
398
+ )
399
+ ] })
400
+ ] })
401
+ ] }),
402
+ /* @__PURE__ */ s.jsx("hr", { style: { borderColor: "white" }, className: "mt-auto mb-0" }),
403
+ /* @__PURE__ */ s.jsxs("div", { className: "action-wrap d-flex justify-content-lg-between px-3 py-2", children: [
404
+ /* @__PURE__ */ s.jsx(
405
+ "div",
406
+ {
407
+ onClick: () => {
408
+ F(), V("Details");
409
+ },
410
+ className: "action flex-grow-1 flex-shrink-0",
411
+ children: "Details"
412
+ }
413
+ ),
414
+ /* @__PURE__ */ s.jsx("span", { className: "px-4" }),
415
+ /* @__PURE__ */ s.jsx(
416
+ "a",
417
+ {
418
+ className: "action flex-grow-1 flex-shrink-0",
419
+ href: r?.website,
420
+ target: "_blank",
421
+ rel: "noreferrer",
422
+ onClick: () => V("Website"),
423
+ children: /* @__PURE__ */ s.jsx("div", { children: "Website" })
424
+ }
425
+ )
426
+ ] })
427
+ ]
428
+ }
429
+ )
430
+ }
431
+ ),
432
+ !l && /* @__PURE__ */ s.jsx(
433
+ "div",
434
+ {
435
+ className: "advertise-with-us p-1",
436
+ style: {
437
+ // ...(props.previewData ? props.previewData.background_color : ad?.background_color),
438
+ backgroundColor: o.background_color || r?.background_color,
439
+ color: o.font_color || r?.font_color,
440
+ borderColor: o.border_color || r?.border_color
441
+ },
442
+ children: /* @__PURE__ */ s.jsxs(
443
+ "div",
444
+ {
445
+ className: "small d-block w-100 text-center",
446
+ children: [
447
+ /* @__PURE__ */ s.jsx("i", { className: "fas fa-share me-1" }),
448
+ "Advertise with Articles Media!"
449
+ ]
450
+ }
451
+ )
452
+ }
453
+ )
454
+ ]
455
+ }
456
+ );
457
+ }
458
+ const ge = z(ue);
459
+ export {
460
+ ge as default
461
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("./jsx-runtime-Blz-RjDE.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 x=require("./jsx-runtime-Blz-RjDE.cjs"),N=require("react");function S(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var u={exports:{}};var l;function w(){return l||(l=1,(function(n){(function(){var a={}.hasOwnProperty;function r(){for(var t="",e=0;e<arguments.length;e++){var s=arguments[e];s&&(t=i(t,o(s)))}return t}function o(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return r.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var s in t)a.call(t,s)&&t[s]&&(e=i(e,s));return e}function i(t,e){return e?t?t+" "+e:t+e:t}n.exports?(r.default=r,n.exports=r):window.classNames=r})()})(u)),u.exports}var A=w();const O=S(A),f=N.forwardRef((n,a)=>{const{size:r,variant:o,style:i,small:t,large:e,onClick:s,className:c,disabled:p,active:m,type:d,onMouseDown:b,onMouseUp:y,onMouseLeave:v,onTouchStart:h,onTouchEnd:j,...R}=n;return x.jsxRuntimeExports.jsx("button",{ref:a,...d&&{type:"submit"},disabled:p,style:i,onMouseDown:b,onMouseUp:y,onMouseLeave:v,onTouchStart:h,onTouchEnd:j,className:O(`btn ${o?`btn-${o}`:"btn-articles"}`,{[c]:c,"btn-lg":e,"btn-sm":t,active:m,[`btn-${r}`]:r}),onClick:s,children:n.children})});f.displayName="ArticlesButton";exports.ArticlesButton=f;
@@ -0,0 +1,91 @@
1
+ import { j } from "./jsx-runtime-tc70JA_2.js";
2
+ import { forwardRef as x } from "react";
3
+ function N(n) {
4
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
5
+ }
6
+ var u = { exports: {} };
7
+ var l;
8
+ function S() {
9
+ return l || (l = 1, (function(n) {
10
+ (function() {
11
+ var i = {}.hasOwnProperty;
12
+ function r() {
13
+ for (var t = "", e = 0; e < arguments.length; e++) {
14
+ var s = arguments[e];
15
+ s && (t = a(t, o(s)));
16
+ }
17
+ return t;
18
+ }
19
+ function o(t) {
20
+ if (typeof t == "string" || typeof t == "number")
21
+ return t;
22
+ if (typeof t != "object")
23
+ return "";
24
+ if (Array.isArray(t))
25
+ return r.apply(null, t);
26
+ if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
27
+ return t.toString();
28
+ var e = "";
29
+ for (var s in t)
30
+ i.call(t, s) && t[s] && (e = a(e, s));
31
+ return e;
32
+ }
33
+ function a(t, e) {
34
+ return e ? t ? t + " " + e : t + e : t;
35
+ }
36
+ n.exports ? (r.default = r, n.exports = r) : window.classNames = r;
37
+ })();
38
+ })(u)), u.exports;
39
+ }
40
+ var w = S();
41
+ const A = /* @__PURE__ */ N(w), O = x((n, i) => {
42
+ const {
43
+ size: r,
44
+ variant: o,
45
+ style: a,
46
+ // Can just use small instead of size="sm"
47
+ small: t,
48
+ large: e,
49
+ onClick: s,
50
+ className: c,
51
+ disabled: f,
52
+ active: p,
53
+ type: m,
54
+ onMouseDown: d,
55
+ onMouseUp: b,
56
+ onMouseLeave: y,
57
+ onTouchStart: v,
58
+ onTouchEnd: h,
59
+ ...E
60
+ } = n;
61
+ return /* @__PURE__ */ j.jsx(
62
+ "button",
63
+ {
64
+ ref: i,
65
+ ...m && { type: "submit" },
66
+ disabled: f,
67
+ style: a,
68
+ onMouseDown: d,
69
+ onMouseUp: b,
70
+ onMouseLeave: y,
71
+ onTouchStart: v,
72
+ onTouchEnd: h,
73
+ className: A(
74
+ `btn ${o ? `btn-${o}` : "btn-articles"}`,
75
+ {
76
+ [c]: c,
77
+ "btn-lg": e,
78
+ "btn-sm": t,
79
+ active: p,
80
+ [`btn-${r}`]: r
81
+ }
82
+ ),
83
+ onClick: s,
84
+ children: n.children
85
+ }
86
+ );
87
+ });
88
+ O.displayName = "ArticlesButton";
89
+ export {
90
+ O as A
91
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./jsx-runtime-Blz-RjDE.cjs"),r=require("react"),d=require("./Button-CZyAJPvK.cjs"),l=require("./index-CqsCVLvJ.cjs"),j=async s=>{if(process.env.NODE_ENV==="development")try{return(await l.axios.get("http://localhost:3001/api/community/games/scoreboard",{params:{game:s.game}})).data}catch{}return l.axios.get(s.url,{params:{game:s.game}}).then(t=>t.data)},p={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},h=s=>{const{data:t,error:i,isLoading:c,isValidating:n,mutate:o}=l.useSWR(s?.game?{url:"https://articles.media/api/community/games/scoreboard",game:s.game}:null,j,p);return{data:t,error:i,isLoading:c,isValidating:n,mutate:o}};function f({game:s,reloadScoreboard:t,setReloadScoreboard:i}){const[c,n]=r.useState(!1),[o,E]=r.useState(!1),{data:m,mutate:x}=h({game:s});return r.useEffect(()=>{},[]),r.useEffect(()=>{t&&(i(!1),x())},[t]),e.jsxRuntimeExports.jsx("div",{className:"scoreboard",children: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(d.ArticlesButton,{onClick:()=>{x()},small:!0,children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-redo me-0"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"card-body p-0",children:[(m?.length||0)==0&&e.jsxRuntimeExports.jsx("div",{className:"small p-2",children:"No scores yet"}),m?.map((a,u)=>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:u+1}),e.jsxRuntimeExports.jsx("div",{className:"lh-sm"})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("h5",{className:"mb-0",children:a.score||a.total})})]}),a.last_play&&a.public_last_play&&e.jsxRuntimeExports.jsxs("small",{className:"mt-1",style:{fontSize:"0.75rem"},children:["Played: ",format(new Date(a.last_play),"MM/d/yy hh:mmaa")]})]},a._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(d.ArticlesButton,{small:!0,onClick:()=>{n(!0)},children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-cog me-0"})})]})]})})}module.exports=f;