@articles-media/articles-dev-box 1.0.27 → 1.0.28

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
@@ -55,6 +55,10 @@ npm run dev
55
55
  - All in one component to handle game credits UI across multiple games.
56
56
  - DarkModeHandler
57
57
  - Consumes a Zustand store, detects prefers-color-scheme, sets data-bs-theme on body element.
58
+ - ToontownModeHandler
59
+ - Handles setting zustand state from url params if toontownMode is passed.
60
+ - SocketServerUrlHandler
61
+ - Handles setting socket server state from url params if socketServerUrl is passed.
58
62
  - useUserToken
59
63
  - Hook for getting the subdomain auth token.
60
64
  - useUserDetails
@@ -4,7 +4,7 @@ import { n, t as r } from "./useAuthSiteStatus-Cj9IjMj7.js";
4
4
  import { Suspense as i, lazy as a, memo as o, useState as s } from "react";
5
5
  import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
6
6
  //#region src/components/Global/GlobalBody.jsx
7
- var d = /* @__PURE__ */ e(t(), 1), f = a(() => import("./StatusModal-BrBJnAXD.js"));
7
+ var d = /* @__PURE__ */ e(t(), 1), f = a(() => import("./StatusModal-CM9gjtT8.js"));
8
8
  function p(e) {
9
9
  let [t, a] = s(!1), { data: o, error: p, isLoading: m, mutate: h } = n({ disable: process.env.NODE_ENV !== "development" }), { data: g, error: _, isLoading: v, mutate: y } = r({ disable: process.env.NODE_ENV !== "development" });
10
10
  return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("link", {
@@ -95,33 +95,42 @@ function c({ useAudioStore: t, config: o }) {
95
95
  }
96
96
  //#endregion
97
97
  //#region src/components/Games/Settings/MultiplayerTab.jsx
98
- function l({ useStore: t }) {
99
- let n = t((e) => e.socketServerHost), o = t((e) => e.setSocketServerHost);
98
+ function l({ useStore: t, config: n }) {
99
+ let o = t((e) => e.serverUrl), s = t((e) => e.setServerUrl), c = t((e) => e.connected), l = t((e) => e.connectSocket), u = t((e) => e.disconnectSocket);
100
100
  return /* @__PURE__ */ i("div", {
101
- className: "p-2",
101
+ className: "",
102
102
  children: [
103
- /* @__PURE__ */ r(a.Label, {
103
+ /* @__PURE__ */ i(a.Label, {
104
104
  className: "mb-0",
105
- children: "Socket Server Host"
105
+ children: [/* @__PURE__ */ i("div", { children: ["Status: ", /* @__PURE__ */ r("span", {
106
+ className: `badge ${c ? "bg-success" : "bg-danger"}`,
107
+ children: c ? "Online" : "Offline"
108
+ })] }), "Socket Server Host"]
106
109
  }),
107
110
  /* @__PURE__ */ r(a.Control, {
108
111
  type: "text",
109
- value: n,
110
- onChange: (e) => o(e.target.value)
112
+ value: o,
113
+ onChange: (e) => s(e.target.value)
111
114
  }),
112
115
  /* @__PURE__ */ r(a.Label, {
113
116
  className: "mb-0",
114
117
  children: "Edit this to connect to a different multiplayer host!"
115
118
  }),
116
- /* @__PURE__ */ i("div", {
119
+ /* @__PURE__ */ r("div", {
117
120
  className: "mt-3",
118
- children: [/* @__PURE__ */ r(e, {
119
- className: "mb-1",
120
- children: "Retry"
121
- }), /* @__PURE__ */ i("div", { children: ["Status: ", /* @__PURE__ */ r("span", {
122
- className: "badge bg-danger",
123
- children: "Offline"
124
- })] })]
121
+ children: c ? /* @__PURE__ */ r(e, {
122
+ className: "",
123
+ onClick: () => {
124
+ u();
125
+ },
126
+ children: "Disconnect"
127
+ }) : /* @__PURE__ */ r(e, {
128
+ className: "",
129
+ onClick: () => {
130
+ l();
131
+ },
132
+ children: "Connect"
133
+ })
125
134
  })
126
135
  ]
127
136
  });
@@ -201,9 +210,9 @@ function f({ useStore: t, config: a, children: o }) {
201
210
  }
202
211
  //#endregion
203
212
  //#region src/components/Games/Settings/SettingsModal.jsx
204
- function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsStore: m, config: h }) {
205
- let [g, _] = t(!1), [v, y] = t(localStorage.getItem("articles_settings_tab") || "Graphics"), b = (e) => {
206
- y(e), localStorage.setItem("articles_settings_tab", e);
213
+ function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsStore: m, useSocketStore: h, config: g }) {
214
+ let [_, v] = t(!1), [y, b] = t(localStorage.getItem("articles_settings_tab") || "Graphics"), x = (e) => {
215
+ b(e), localStorage.setItem("articles_settings_tab", e);
207
216
  };
208
217
  return d((e) => e.darkMode), d((e) => e.setDarkMode), d((e) => e.arcadeMode), d((e) => e.setArcadeMode), /* @__PURE__ */ i(o, {
209
218
  className: "articles-modal",
@@ -232,37 +241,37 @@ function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsSt
232
241
  "Multiplayer",
233
242
  "Other"
234
243
  ].map((t) => /* @__PURE__ */ r(e, {
235
- active: v == t,
244
+ active: y == t,
236
245
  onClick: () => {
237
- b(t);
246
+ x(t);
238
247
  },
239
248
  children: t
240
249
  }, t))
241
250
  }),
242
251
  /* @__PURE__ */ r("hr", { className: "my-0" }),
243
252
  /* @__PURE__ */ i("div", {
244
- className: "p-2",
253
+ className: "p-3",
245
254
  children: [
246
- v == "Controls" && /* @__PURE__ */ r(u, {
255
+ y == "Controls" && /* @__PURE__ */ r(u, {
247
256
  useStore: d,
248
257
  useTouchControlsStore: m,
249
- config: h
258
+ config: g
250
259
  }),
251
- v == "Graphics" && /* @__PURE__ */ r(s, {
260
+ y == "Graphics" && /* @__PURE__ */ r(s, {
252
261
  useStore: d,
253
- config: h
262
+ config: g
254
263
  }),
255
- v == "Audio" && /* @__PURE__ */ r(c, {
264
+ y == "Audio" && /* @__PURE__ */ r(c, {
256
265
  useAudioStore: p,
257
- config: h
266
+ config: g
258
267
  }),
259
- v == "Multiplayer" && /* @__PURE__ */ r(l, {
260
- useStore: d,
261
- config: h
268
+ y == "Multiplayer" && /* @__PURE__ */ r(l, {
269
+ useStore: h,
270
+ config: g
262
271
  }),
263
- v == "Other" && /* @__PURE__ */ r(f, {
272
+ y == "Other" && /* @__PURE__ */ r(f, {
264
273
  useStore: d,
265
- config: h
274
+ config: g
266
275
  })
267
276
  ]
268
277
  })
@@ -1,2 +1,2 @@
1
- import { t as e } from "./SettingsModal-DQSSeIBg.js";
1
+ import { t as e } from "./SettingsModal-DZmAGhAO.js";
2
2
  export { e as default };
@@ -0,0 +1,14 @@
1
+ import { useEffect as e } from "react";
2
+ //#region src/components/Games/SocketServerUrlHandler.jsx
3
+ function t({ useStore: t }) {
4
+ return e(() => {
5
+ let e = t.getState()?.setSocketServerUrl, n = new URLSearchParams(window.location.search), r = n.get("socketServerUrl");
6
+ if (r) {
7
+ e(r), n.delete("socketServerUrl");
8
+ let t = window.location.pathname + (n.toString() ? `?${n.toString()}` : "") + window.location.hash;
9
+ window.history.replaceState({}, "", t);
10
+ }
11
+ }, []), null;
12
+ }
13
+ //#endregion
14
+ export { t as default };
@@ -19,7 +19,10 @@ function s({ show: s, setShow: c }) {
19
19
  className: "d-flex align-items-center mb-2",
20
20
  children: [/* @__PURE__ */ a("h5", {
21
21
  className: "mb-0 me-2",
22
- children: ["Main Site Status: ", p(m, h, g)]
22
+ children: ["Main Site Status: ", /* @__PURE__ */ i("span", {
23
+ className: `badge ${m ? "bg-success" : "bg-danger"}`,
24
+ children: p(m, h, g)
25
+ })]
23
26
  }), /* @__PURE__ */ a(e, {
24
27
  variant: "link",
25
28
  size: "sm",
@@ -37,7 +40,10 @@ function s({ show: s, setShow: c }) {
37
40
  className: "d-flex align-items-center mb-2",
38
41
  children: [/* @__PURE__ */ a("h5", {
39
42
  className: "mb-0 me-2",
40
- children: ["Auth Site Status: ", p(v, y, b)]
43
+ children: ["Auth Site Status: ", /* @__PURE__ */ i("span", {
44
+ className: `badge ${v ? "bg-success" : "bg-danger"}`,
45
+ children: p(v, y, b)
46
+ })]
41
47
  }), /* @__PURE__ */ a(e, {
42
48
  variant: "link",
43
49
  size: "sm",
@@ -0,0 +1,14 @@
1
+ import { useEffect as e } from "react";
2
+ //#region src/components/Games/ToontownModeHandler.jsx
3
+ function t({ useStore: t }) {
4
+ return e(() => {
5
+ let e = t.getState()?.setToontownMode, n = new URLSearchParams(window.location.search);
6
+ if (n.get("toontownMode")) {
7
+ e(!0), n.delete("toontownMode");
8
+ let t = window.location.pathname + (n.toString() ? `?${n.toString()}` : "") + window.location.hash;
9
+ window.history.replaceState({}, "", t);
10
+ }
11
+ }, []), null;
12
+ }
13
+ //#endregion
14
+ export { t as default };
package/dist/index.js CHANGED
@@ -6,12 +6,14 @@ import { t as i } from "./ViewUserModal-CrGeXxWG.js";
6
6
  import { t as a } from "./GameScoreboard-pTQKozrD.js";
7
7
  import o from "./GlobalHead.js";
8
8
  import s from "./GlobalBody.js";
9
- import { t as c } from "./SettingsModal-DQSSeIBg.js";
9
+ import { t as c } from "./SettingsModal-DZmAGhAO.js";
10
10
  import l from "./CreditsModal.js";
11
11
  import u from "./DarkModeHandler.js";
12
- import d from "./useUserFriends.js";
13
- import f from "./FriendsList.js";
14
- import p from "./useUserDetails.js";
15
- import m from "./useUserToken.js";
16
- import h from "./useFullscreen.js";
17
- export { r as Ad, n as ArticlesAd, l as CreditsModal, u as DarkModeHandler, f as FriendsList, a as GameScoreboard, s as GlobalBody, o as GlobalHead, e as ReturnToLauncherButton, c as SettingsModal, t as SignInButton, i as ViewUserModal, h as useFullscreen, p as useUserDetails, d as useUserFriends, m as useUserToken };
12
+ import d from "./ToontownModeHandler.js";
13
+ import f from "./SocketServerUrlHandler.js";
14
+ import p from "./useUserFriends.js";
15
+ import m from "./FriendsList.js";
16
+ import h from "./useUserDetails.js";
17
+ import g from "./useUserToken.js";
18
+ import _ from "./useFullscreen.js";
19
+ export { r as Ad, n as ArticlesAd, l as CreditsModal, u as DarkModeHandler, m as FriendsList, a as GameScoreboard, s as GlobalBody, o as GlobalHead, e as ReturnToLauncherButton, c as SettingsModal, t as SignInButton, f as SocketServerUrlHandler, d as ToontownModeHandler, i as ViewUserModal, _ as useFullscreen, h as useUserDetails, p as useUserFriends, g as useUserToken };
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.0.27",
4
+ "version": "1.0.28",
5
5
  "type": "module",
6
6
  "imports": {
7
7
  "#root/src/*": "./src/*"
@@ -28,6 +28,8 @@
28
28
  "./SettingsModal": "./dist/SettingsModal.js",
29
29
  "./CreditsModal": "./dist/CreditsModal.js",
30
30
  "./DarkModeHandler": "./dist/DarkModeHandler.js",
31
+ "./ToontownModeHandler": "./dist/ToontownModeHandler.js",
32
+ "./SocketServerUrlHandler": "./dist/SocketServerUrlHandler.js",
31
33
  "./FriendsList": "./dist/FriendsList.js",
32
34
  "./useUserDetails": "./dist/useUserDetails.js",
33
35
  "./useUserToken": "./dist/useUserToken.js",