@articles-media/articles-dev-box 1.3.0 → 1.3.2
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 +1 -1
- package/dist/{GameScoreboard-CYuTBE_E.js → GameScoreboard-BvE_sIDW.js} +49 -30
- package/dist/GameScoreboard.js +1 -1
- package/dist/InfoModal.js +6 -3
- package/dist/PageTemplateLandingPage.js +5 -4
- package/dist/{SettingsModal-DIMbVw4n.js → SettingsModal-Cg15aSoE.js} +1 -1
- package/dist/SettingsModal.js +1 -1
- package/dist/index.js +2 -2
- package/dist/typicalZustandStoreStateSlice.js +3 -1
- package/dist/useUserToken.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Shared code, functions, and components that are commonly used across Articles Media projects.
|
|
6
6
|
|
|
7
7
|
# Warning
|
|
8
|
-
|
|
8
|
+
A lot of this package is expected to be consumed in a Articles Media related React ecosystem. See Package Exports section for more details.
|
|
9
9
|
|
|
10
10
|
## Getting Started
|
|
11
11
|
|
|
@@ -60,11 +60,11 @@ var useGameScoreboard = (params) => {
|
|
|
60
60
|
};
|
|
61
61
|
//#endregion
|
|
62
62
|
//#region src/components/Games/GameScoreboard.jsx
|
|
63
|
-
function GameScoreboard({ game, metric, reloadScoreboard, setReloadScoreboard, prepend, append }) {
|
|
63
|
+
function GameScoreboard({ game, metric, metrics, reloadScoreboard, setReloadScoreboard, prepend, append, append_score_text = "" }) {
|
|
64
64
|
const [showSettings, setShowSettings] = useState(false);
|
|
65
65
|
const [visible, setVisible] = useState(false);
|
|
66
|
+
const [activeMetric, setActiveMetric] = useState(false);
|
|
66
67
|
const { data: scoreboard, isLoading: scoreboardIsLoading, mutate: scoreboardMutate } = useGameScoreboard({ game });
|
|
67
|
-
useEffect(() => {}, []);
|
|
68
68
|
useEffect(() => {
|
|
69
69
|
if (reloadScoreboard) {
|
|
70
70
|
setReloadScoreboard(false);
|
|
@@ -118,35 +118,54 @@ function GameScoreboard({ game, metric, reloadScoreboard, setReloadScoreboard, p
|
|
|
118
118
|
}),
|
|
119
119
|
/* @__PURE__ */ jsxs("div", {
|
|
120
120
|
className: "card-body p-0",
|
|
121
|
-
children: [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
children: [
|
|
122
|
+
metrics?.length > 1 && /* @__PURE__ */ jsx("div", {
|
|
123
|
+
className: "metrics d-flex border-bottom p-2",
|
|
124
|
+
children: metrics.map((m, i) => /* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: "metric badge bg-black text-white me-2",
|
|
126
|
+
onClick: () => setActiveMetric(m?.label),
|
|
127
|
+
style: {
|
|
128
|
+
opacity: activeMetric == m?.label ? 1 : .5,
|
|
129
|
+
cursor: "pointer"
|
|
130
|
+
},
|
|
131
|
+
children: m?.label
|
|
132
|
+
}, i))
|
|
133
|
+
}),
|
|
134
|
+
scoreboardIsLoading && /* @__PURE__ */ jsxs("div", {
|
|
135
|
+
className: "d-flex align-items-center p-2",
|
|
136
|
+
children: [/* @__PURE__ */ jsx("i", { className: "fad fa-spinner-third fa-spin fa-2x me-2" }), /* @__PURE__ */ jsx("div", { children: "Loading..." })]
|
|
137
|
+
}),
|
|
138
|
+
(scoreboard?.length || 0) == 0 && !scoreboardIsLoading && /* @__PURE__ */ jsx("div", {
|
|
139
|
+
className: "small p-2",
|
|
140
|
+
children: "No scores yet"
|
|
141
|
+
}),
|
|
142
|
+
scoreboard?.length > 0 && scoreboard?.map((doc, i) => /* @__PURE__ */ jsxs("div", {
|
|
143
|
+
className: "result d-flex flex-column justify-content-between border-bottom p-2",
|
|
128
144
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
129
|
-
className: "d-flex",
|
|
130
|
-
children: [/* @__PURE__ */
|
|
131
|
-
className: "
|
|
132
|
-
children:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
children:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
className: "d-flex justify-content-between lh-sm",
|
|
146
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
147
|
+
className: "d-flex",
|
|
148
|
+
children: [/* @__PURE__ */ jsx("h5", {
|
|
149
|
+
className: "mb-0 me-3",
|
|
150
|
+
children: i + 1
|
|
151
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
152
|
+
className: "lh-sm",
|
|
153
|
+
children: /* @__PURE__ */ jsx(ViewUserModal, {
|
|
154
|
+
populated_user: doc.populated_user,
|
|
155
|
+
user_id: doc.user_id
|
|
156
|
+
})
|
|
157
|
+
})]
|
|
158
|
+
}), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("h5", {
|
|
159
|
+
className: "mb-0",
|
|
160
|
+
children: [doc.score || doc.total, append_score_text]
|
|
161
|
+
}) })]
|
|
162
|
+
}), doc.last_play && doc.public_last_play && /* @__PURE__ */ jsxs("small", {
|
|
163
|
+
className: "mt-1",
|
|
164
|
+
style: { fontSize: "0.75rem" },
|
|
165
|
+
children: ["Played: ", format(new Date(doc.last_play), "MM/d/yy hh:mmaa")]
|
|
166
|
+
})]
|
|
167
|
+
}, doc._id))
|
|
168
|
+
]
|
|
150
169
|
}),
|
|
151
170
|
/* @__PURE__ */ jsxs("div", {
|
|
152
171
|
className: "card-footer d-flex justify-content-between align-items-center",
|
package/dist/GameScoreboard.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as GameScoreboard } from "./GameScoreboard-
|
|
1
|
+
import { t as GameScoreboard } from "./GameScoreboard-BvE_sIDW.js";
|
|
2
2
|
export { GameScoreboard as default };
|
package/dist/InfoModal.js
CHANGED
|
@@ -29,12 +29,15 @@ function InfoModal({ show, setShow, useStore, packageInfo, infoModalConfig }) {
|
|
|
29
29
|
children: [/* @__PURE__ */ jsx("div", {
|
|
30
30
|
className: "ratio ratio-16x9",
|
|
31
31
|
children: darkMode ? /* @__PURE__ */ jsx("img", { src: infoModalConfig?.previewImage }) : /* @__PURE__ */ jsx("img", { src: infoModalConfig?.previewImage })
|
|
32
|
-
}), /* @__PURE__ */
|
|
32
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
33
33
|
className: "p-3",
|
|
34
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
34
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
35
35
|
className: "",
|
|
36
36
|
children: packageInfo?.description
|
|
37
|
-
})
|
|
37
|
+
}), infoModalConfig?.appendContent && /* @__PURE__ */ jsx("div", {
|
|
38
|
+
className: "mt-2",
|
|
39
|
+
children: infoModalConfig.appendContent
|
|
40
|
+
})]
|
|
38
41
|
})]
|
|
39
42
|
}),
|
|
40
43
|
/* @__PURE__ */ jsxs(Modal.Footer, {
|
|
@@ -11,7 +11,7 @@ var SessionButton = lazy(() => import("./SessionButton.js"));
|
|
|
11
11
|
var ReturnToLauncherButton = lazy(() => import("./ReturnToLauncherButton.js"));
|
|
12
12
|
var GameScoreboard = lazy(() => import("./GameScoreboard.js"));
|
|
13
13
|
var Ad = lazy(() => import("./Ad.js"));
|
|
14
|
-
function PageTemplateLandingPage({ useStore, useSocketStore, RotatingMascot, Link, logoImage, backgroundImage, CardBodyOverride, singlePlayerConfig, multiplayerConfig, brandingTextClass, disableHero, disableAd, disableGameScoreboard, maxInnerWidth = "20rem", AdditionalContent = null, PostCardContent = null, PostExtrasContent = null, PreHeroContent = null, PostHeroContent = null, NicknameInputConfig = null, CardOverride = null, LandingBackgroundAnimation = null }) {
|
|
14
|
+
function PageTemplateLandingPage({ useStore, useSocketStore, RotatingMascot, Link, logoImage, backgroundImage, CardBodyOverride, singlePlayerConfig, multiplayerConfig, brandingTextClass, disableHero, heroOverride, disableAd, disableGameScoreboard, gameScoreboardConfig, maxInnerWidth = "20rem", AdditionalContent = null, PostCardContent = null, PostExtrasContent = null, PreHeroContent = null, PostHeroContent = null, NicknameInputConfig = null, CardOverride = null, LandingBackgroundAnimation = null }) {
|
|
15
15
|
const { data: userToken, error: userTokenError, isLoading: userTokenLoading, mutate: userTokenMutate } = useUserToken(process.env.NEXT_PUBLIC_GAME_PORT);
|
|
16
16
|
const { data: userDetails, error: userDetailsError, isLoading: userDetailsLoading, mutate: userDetailsMutate } = useUserDetails({ token: userToken });
|
|
17
17
|
const darkMode = useStore((state) => state.darkMode);
|
|
@@ -42,7 +42,7 @@ function PageTemplateLandingPage({ useStore, useSocketStore, RotatingMascot, Lin
|
|
|
42
42
|
style: { "width": maxInnerWidth },
|
|
43
43
|
children: [
|
|
44
44
|
PreHeroContent && PreHeroContent,
|
|
45
|
-
!disableHero && /* @__PURE__ */ jsxs("div", {
|
|
45
|
+
heroOverride ? heroOverride : !disableHero && /* @__PURE__ */ jsxs("div", {
|
|
46
46
|
className: "landing-hero text-center mb-2",
|
|
47
47
|
children: [/* @__PURE__ */ jsx("img", {
|
|
48
48
|
src: logoImage,
|
|
@@ -157,7 +157,7 @@ function PageTemplateLandingPage({ useStore, useSocketStore, RotatingMascot, Lin
|
|
|
157
157
|
]
|
|
158
158
|
}),
|
|
159
159
|
PostCardContent && PostCardContent,
|
|
160
|
-
/* @__PURE__ */ jsxs("div", {
|
|
160
|
+
process.env.NEXT_PUBLIC_ENABLE_ARTICLES !== "false" && /* @__PURE__ */ jsxs("div", {
|
|
161
161
|
className: "extras",
|
|
162
162
|
children: [/* @__PURE__ */ jsx(SessionButton, {
|
|
163
163
|
port: process.env.NEXT_PUBLIC_GAME_PORT,
|
|
@@ -180,7 +180,8 @@ function PageTemplateLandingPage({ useStore, useSocketStore, RotatingMascot, Lin
|
|
|
180
180
|
alignItems: "center"
|
|
181
181
|
},
|
|
182
182
|
children: /* @__PURE__ */ jsx(RotatingMascot, {})
|
|
183
|
-
}) })
|
|
183
|
+
}) }),
|
|
184
|
+
...gameScoreboardConfig
|
|
184
185
|
}),
|
|
185
186
|
!disableAd && /* @__PURE__ */ jsx(Ad, {
|
|
186
187
|
style: "Default",
|
|
@@ -246,7 +246,7 @@ function OtherTab({ useStore, config }) {
|
|
|
246
246
|
var package_default = {
|
|
247
247
|
name: "@articles-media/articles-dev-box",
|
|
248
248
|
description: "Shared code, functions, and components for different Articles Media projects.",
|
|
249
|
-
version: "1.3.
|
|
249
|
+
version: "1.3.2",
|
|
250
250
|
type: "module",
|
|
251
251
|
sideEffects: false,
|
|
252
252
|
imports: { "#root/src/*": "./src/*" },
|
package/dist/SettingsModal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SettingsModal } from "./SettingsModal-
|
|
1
|
+
import { t as SettingsModal } from "./SettingsModal-Cg15aSoE.js";
|
|
2
2
|
export { SettingsModal as default };
|
package/dist/index.js
CHANGED
|
@@ -12,11 +12,11 @@ import { t as GameMenu } from "./GameMenu-CBn1r9Cq.js";
|
|
|
12
12
|
import useFullscreen from "./useFullscreen.js";
|
|
13
13
|
import PrimaryButtonGroup from "./GameMenuPrimaryButtonGroup.js";
|
|
14
14
|
import NicknameInput from "./NicknameInput.js";
|
|
15
|
-
import { t as GameScoreboard } from "./GameScoreboard-
|
|
15
|
+
import { t as GameScoreboard } from "./GameScoreboard-BvE_sIDW.js";
|
|
16
16
|
import PageTemplateLandingPage from "./PageTemplateLandingPage.js";
|
|
17
17
|
import GlobalHead from "./GlobalHead.js";
|
|
18
18
|
import GlobalBody_default from "./GlobalBody.js";
|
|
19
|
-
import { t as SettingsModal } from "./SettingsModal-
|
|
19
|
+
import { t as SettingsModal } from "./SettingsModal-Cg15aSoE.js";
|
|
20
20
|
import CreditsModal from "./CreditsModal.js";
|
|
21
21
|
import InfoModal from "./InfoModal.js";
|
|
22
22
|
import DarkModeHandler from "./DarkModeHandler.js";
|
|
@@ -101,7 +101,9 @@ var typicalZustandStoreStateSlice = (set, get, generateRandomNickname) => ({
|
|
|
101
101
|
hasNoMouse: null,
|
|
102
102
|
setHasNoMouse: (value) => set({ hasNoMouse: value }),
|
|
103
103
|
isTouchCapable: null,
|
|
104
|
-
setIsTouchCapable: (value) => set({ isTouchCapable: value })
|
|
104
|
+
setIsTouchCapable: (value) => set({ isTouchCapable: value }),
|
|
105
|
+
modelSource: process.env.NEXT_PUBLIC_MODEL_SOURCE || "Local",
|
|
106
|
+
setModelSource: (value) => set({ modelSource: value })
|
|
105
107
|
});
|
|
106
108
|
//#endregion
|
|
107
109
|
export { typicalZustandStoreStateSlice as default };
|
package/dist/useUserToken.js
CHANGED
|
@@ -5,7 +5,7 @@ var fetcher = (url) => fetch(url).then((res) => {
|
|
|
5
5
|
return res.json();
|
|
6
6
|
});
|
|
7
7
|
var useUserToken = (port) => {
|
|
8
|
-
const { data, error, isLoading, mutate } = useSWR(process.env.NODE_ENV === "development" ? `http://localhost:${port}/api/token` : "/api/token", fetcher, {
|
|
8
|
+
const { data, error, isLoading, mutate } = useSWR(process.env.NEXT_PUBLIC_ENABLE_ARTICLES !== "false" ? process.env.NODE_ENV === "development" ? `http://localhost:${port}/api/token` : "/api/token" : false, fetcher, {
|
|
9
9
|
revalidateOnFocus: false,
|
|
10
10
|
revalidateOnReconnect: false,
|
|
11
11
|
shouldRetryOnError: false,
|
package/package.json
CHANGED