@articles-media/articles-dev-box 1.3.0 → 1.3.1

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.
@@ -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: [(scoreboard?.length || 0) == 0 && /* @__PURE__ */ jsx("div", {
122
- className: "small p-2",
123
- children: "No scores yet"
124
- }), scoreboard?.length > 0 && scoreboard?.map((doc, i) => /* @__PURE__ */ jsxs("div", {
125
- className: "result d-flex flex-column justify-content-between border-bottom p-2",
126
- children: [/* @__PURE__ */ jsxs("div", {
127
- className: "d-flex justify-content-between lh-sm",
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__ */ jsx("h5", {
131
- className: "mb-0 me-3",
132
- children: i + 1
133
- }), /* @__PURE__ */ jsx("div", {
134
- className: "lh-sm",
135
- children: /* @__PURE__ */ jsx(ViewUserModal, {
136
- populated_user: doc.populated_user,
137
- user_id: doc.user_id
138
- })
139
- })]
140
- }), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h5", {
141
- className: "mb-0",
142
- children: doc.score || doc.total
143
- }) })]
144
- }), doc.last_play && doc.public_last_play && /* @__PURE__ */ jsxs("small", {
145
- className: "mt-1",
146
- style: { fontSize: "0.75rem" },
147
- children: ["Played: ", format(new Date(doc.last_play), "MM/d/yy hh:mmaa")]
148
- })]
149
- }, doc._id))]
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",
@@ -1,2 +1,2 @@
1
- import { t as GameScoreboard } from "./GameScoreboard-CYuTBE_E.js";
1
+ import { t as GameScoreboard } from "./GameScoreboard-BvE_sIDW.js";
2
2
  export { GameScoreboard as 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.0",
249
+ version: "1.3.1",
250
250
  type: "module",
251
251
  sideEffects: false,
252
252
  imports: { "#root/src/*": "./src/*" },
@@ -1,2 +1,2 @@
1
- import { t as SettingsModal } from "./SettingsModal-DIMbVw4n.js";
1
+ import { t as SettingsModal } from "./SettingsModal-BguWq4Q_.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-CYuTBE_E.js";
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-DIMbVw4n.js";
19
+ import { t as SettingsModal } from "./SettingsModal-BguWq4Q_.js";
20
20
  import CreditsModal from "./CreditsModal.js";
21
21
  import InfoModal from "./InfoModal.js";
22
22
  import DarkModeHandler from "./DarkModeHandler.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@articles-media/articles-dev-box",
3
3
  "description": "Shared code, functions, and components for different Articles Media projects.",
4
- "version": "1.3.0",
4
+ "version": "1.3.1",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "imports": {