@articles-media/articles-dev-box 1.0.42 → 1.1.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.
- package/README.md +8 -0
- package/dist/GameMenuPrimaryButtonGroup.js +7 -0
- package/dist/GlobalClientModals.js +57 -0
- package/dist/InfoModal.js +58 -0
- package/dist/PageTemplateLandingPage.js +195 -0
- package/dist/ReturnToLauncherButton.js +1 -1
- package/dist/{SettingsModal-B7EJA7mn.js → SettingsModal-BKcxlAg_.js} +10 -2
- package/dist/SettingsModal.js +1 -1
- package/dist/defaultGameNextConfig.js +25 -0
- package/dist/defaultGameThemeConfig.js +11 -0
- package/dist/generateRandomNickname.js +78 -0
- package/dist/index.js +7 -2
- package/dist/typicalZustandStoreStateSlice.js +6 -0
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -91,6 +91,14 @@ For newly developed components I sometimes find myself trying to remember what r
|
|
|
91
91
|
- getSignOutRedirectUrl - Catching Game
|
|
92
92
|
- GameMenuPrimaryButtonGroup - Catching Game and Move Match
|
|
93
93
|
- NicknameInput - Catching Game
|
|
94
|
+
- InfoModal - USA Tycoon
|
|
95
|
+
- GlobalClientModals - USA Tycoon
|
|
96
|
+
- generateRandomNickname - USA Tycoon
|
|
97
|
+
- defaultGameNextConfig - USA Tycoon
|
|
98
|
+
- defaultGameThemeConfig - USA Tycoon
|
|
99
|
+
- useModalNavigation - USA Tycoon
|
|
100
|
+
- gameLandingPageTemplate - USA Tycoon
|
|
101
|
+
- gamePageTemplate - USA Tycoon
|
|
94
102
|
|
|
95
103
|
# Roadmap
|
|
96
104
|
⏹️ Remove Bootstrap reliance?
|
|
@@ -2,6 +2,13 @@ import { t as ArticlesButton } from "./Button-DvEZjsVV.js";
|
|
|
2
2
|
import useFullscreen from "./useFullscreen.js";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/Games/GameMenuPrimaryButtonGroup.jsx
|
|
5
|
+
/**
|
|
6
|
+
* @param {Object} props
|
|
7
|
+
* @param {function} props.useStore Zustand store hook
|
|
8
|
+
* @param {('Landing'|'GameMenu')} props.type Only "Landing" or "GameMenu" allowed
|
|
9
|
+
* @param {string} [props.owner] Optional GitHub owner
|
|
10
|
+
* @param {string} [props.repo] Optional GitHub repo
|
|
11
|
+
*/
|
|
5
12
|
function PrimaryButtonGroup({ useStore, type, owner, repo }) {
|
|
6
13
|
if (!useStore) return null;
|
|
7
14
|
const { isFullscreen, requestFullscreen, exitFullscreen } = useFullscreen();
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import useUserDetails from "./useUserDetails.js";
|
|
3
|
+
import useUserToken from "./useUserToken.js";
|
|
4
|
+
import { lazy } from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Global/GlobalClientModals.jsx
|
|
7
|
+
var InfoModal = lazy(() => import("./InfoModal.js"));
|
|
8
|
+
var CreditsModal = lazy(() => import("./CreditsModal.js"));
|
|
9
|
+
var FriendsList = lazy(() => import("./FriendsList.js"));
|
|
10
|
+
var SettingsModal = lazy(() => import("./SettingsModal.js"));
|
|
11
|
+
function GlobalClientModals({ useStore, useAudioStore, useTouchControlsStore, useSocketStore, packageInfo, settingsModalConfig, infoModalConfig }) {
|
|
12
|
+
const showInfoModal = useStore((state) => state.showInfoModal);
|
|
13
|
+
const setShowInfoModal = useStore((state) => state.setShowInfoModal);
|
|
14
|
+
const showSettingsModal = useStore((state) => state.showSettingsModal);
|
|
15
|
+
const setShowSettingsModal = useStore((state) => state.setShowSettingsModal);
|
|
16
|
+
const showCreditsModal = useStore((state) => state.showCreditsModal);
|
|
17
|
+
const setShowCreditsModal = useStore((state) => state.setShowCreditsModal);
|
|
18
|
+
const showFriendsModal = useStore((state) => state.showFriendsModal);
|
|
19
|
+
const setShowFriendsModal = useStore((state) => state.setShowFriendsModal);
|
|
20
|
+
const { data: userToken, error: userTokenError, isLoading: userTokenLoading, mutate: userTokenMutate } = useUserToken(process.env.NEXT_PUBLIC_GAME_PORT);
|
|
21
|
+
const { data: userDetails, error: userDetailsError, isLoading: userDetailsLoading, mutate: userDetailsMutate } = useUserDetails({ token: userToken });
|
|
22
|
+
if (!settingsModalConfig) {
|
|
23
|
+
console.error("GlobalClientModals: settingsModalConfig is not provided!");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
+
showInfoModal && /* @__PURE__ */ jsx(InfoModal, {
|
|
28
|
+
show: showInfoModal,
|
|
29
|
+
setShow: setShowInfoModal,
|
|
30
|
+
useStore,
|
|
31
|
+
packageInfo,
|
|
32
|
+
infoModalConfig
|
|
33
|
+
}),
|
|
34
|
+
showSettingsModal && /* @__PURE__ */ jsx(SettingsModal, {
|
|
35
|
+
show: showSettingsModal,
|
|
36
|
+
setShow: setShowSettingsModal,
|
|
37
|
+
store: useStore,
|
|
38
|
+
useAudioStore,
|
|
39
|
+
useTouchControlsStore,
|
|
40
|
+
useSocketStore,
|
|
41
|
+
config: settingsModalConfig
|
|
42
|
+
}),
|
|
43
|
+
showCreditsModal && /* @__PURE__ */ jsx(CreditsModal, {
|
|
44
|
+
show: showCreditsModal,
|
|
45
|
+
setShow: setShowCreditsModal
|
|
46
|
+
}),
|
|
47
|
+
showFriendsModal && /* @__PURE__ */ jsx(FriendsList, {
|
|
48
|
+
componentType: "modal",
|
|
49
|
+
show: showFriendsModal,
|
|
50
|
+
setShow: setShowFriendsModal,
|
|
51
|
+
user_id: userDetails ? userDetails.user_id : null,
|
|
52
|
+
user_token: userToken ? userToken : null
|
|
53
|
+
})
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { GlobalClientModals as default };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { t as ArticlesButton } from "./Button-DvEZjsVV.js";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Modal } from "react-bootstrap";
|
|
5
|
+
//#region src/components/Games/InfoModal.jsx
|
|
6
|
+
function InfoModal({ show, setShow, useStore, packageInfo, infoModalConfig }) {
|
|
7
|
+
const [showModal, setShowModal] = useState(true);
|
|
8
|
+
const darkMode = useStore((state) => state.darkMode);
|
|
9
|
+
useRef([]);
|
|
10
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Modal, {
|
|
11
|
+
className: "articles-modal games-info-modal",
|
|
12
|
+
size: "md",
|
|
13
|
+
show: showModal,
|
|
14
|
+
centered: true,
|
|
15
|
+
scrollable: true,
|
|
16
|
+
onExited: () => {
|
|
17
|
+
setShow(false);
|
|
18
|
+
},
|
|
19
|
+
onHide: () => {
|
|
20
|
+
setShowModal(false);
|
|
21
|
+
},
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ jsx(Modal.Header, {
|
|
24
|
+
closeButton: true,
|
|
25
|
+
children: /* @__PURE__ */ jsxs(Modal.Title, { children: [process.env.NEXT_PUBLIC_GAME_NAME, " Info"] })
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ jsxs(Modal.Body, {
|
|
28
|
+
className: "flex-column p-0",
|
|
29
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
30
|
+
className: "ratio ratio-16x9",
|
|
31
|
+
children: darkMode ? /* @__PURE__ */ jsx("img", { src: infoModalConfig?.previewImage }) : /* @__PURE__ */ jsx("img", { src: infoModalConfig?.previewImage })
|
|
32
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
33
|
+
className: "p-3",
|
|
34
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: "",
|
|
36
|
+
children: packageInfo?.description
|
|
37
|
+
})
|
|
38
|
+
})]
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ jsxs(Modal.Footer, {
|
|
41
|
+
className: "justify-content-between",
|
|
42
|
+
children: [/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
className: "version small",
|
|
44
|
+
children: ["Version: ", packageInfo?.version]
|
|
45
|
+
}) }), /* @__PURE__ */ jsx(ArticlesButton, {
|
|
46
|
+
variant: "outline-dark",
|
|
47
|
+
onClick: () => {
|
|
48
|
+
setShow(false);
|
|
49
|
+
},
|
|
50
|
+
className: "d-flex align-items-center",
|
|
51
|
+
children: "Close"
|
|
52
|
+
})]
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}) });
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { InfoModal as default };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as ArticlesButton } from "./Button-DvEZjsVV.js";
|
|
3
|
+
import useUserDetails from "./useUserDetails.js";
|
|
4
|
+
import useUserToken from "./useUserToken.js";
|
|
5
|
+
import PrimaryButtonGroup from "./GameMenuPrimaryButtonGroup.js";
|
|
6
|
+
import NicknameInput from "./NicknameInput.js";
|
|
7
|
+
import { lazy } from "react";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/Games/PageTemplates/PageTemplateLandingPage.jsx
|
|
10
|
+
var SessionButton = lazy(() => import("./SessionButton.js"));
|
|
11
|
+
var ReturnToLauncherButton = lazy(() => import("./ReturnToLauncherButton.js"));
|
|
12
|
+
var GameScoreboard = lazy(() => import("./GameScoreboard.js"));
|
|
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 }) {
|
|
15
|
+
const { data: userToken, error: userTokenError, isLoading: userTokenLoading, mutate: userTokenMutate } = useUserToken(process.env.NEXT_PUBLIC_GAME_PORT);
|
|
16
|
+
const { data: userDetails, error: userDetailsError, isLoading: userDetailsLoading, mutate: userDetailsMutate } = useUserDetails({ token: userToken });
|
|
17
|
+
const darkMode = useStore((state) => state.darkMode);
|
|
18
|
+
const lobbyDetails = useStore((state) => state.lobbyDetails);
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: "landing-page",
|
|
21
|
+
children: [
|
|
22
|
+
AdditionalContent,
|
|
23
|
+
/* @__PURE__ */ jsx("div", {
|
|
24
|
+
className: "background-wrap",
|
|
25
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
26
|
+
src: backgroundImage,
|
|
27
|
+
alt: "",
|
|
28
|
+
width: "100%",
|
|
29
|
+
height: "100%",
|
|
30
|
+
style: {
|
|
31
|
+
objectFit: "cover",
|
|
32
|
+
objectPosition: "bottom"
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsxs("div", {
|
|
37
|
+
className: "container d-flex flex-column-reverse flex-lg-row justify-content-center align-items-center py-3",
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsxs("div", {
|
|
40
|
+
className: "",
|
|
41
|
+
style: { "width": maxInnerWidth },
|
|
42
|
+
children: [
|
|
43
|
+
PreHeroContent,
|
|
44
|
+
!disableHero && /* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: "landing-hero text-center mb-2",
|
|
46
|
+
children: [/* @__PURE__ */ jsx("img", {
|
|
47
|
+
src: logoImage,
|
|
48
|
+
alt: "",
|
|
49
|
+
width: "200",
|
|
50
|
+
height: "auto",
|
|
51
|
+
style: {
|
|
52
|
+
objectFit: "cover",
|
|
53
|
+
objectPosition: "bottom"
|
|
54
|
+
}
|
|
55
|
+
}), /* @__PURE__ */ jsx("h1", {
|
|
56
|
+
className: `text-center mb-0 ${brandingTextClass}`,
|
|
57
|
+
children: process.env.NEXT_PUBLIC_GAME_NAME
|
|
58
|
+
})]
|
|
59
|
+
}),
|
|
60
|
+
PostHeroContent,
|
|
61
|
+
/* @__PURE__ */ jsxs("div", {
|
|
62
|
+
className: "card card-articles mb-3",
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx("div", {
|
|
65
|
+
className: "card-header",
|
|
66
|
+
children: /* @__PURE__ */ jsx(NicknameInput, { useStore })
|
|
67
|
+
}),
|
|
68
|
+
CardBodyOverride ? /* @__PURE__ */ jsx(CardBodyOverride, {}) : /* @__PURE__ */ jsxs("div", {
|
|
69
|
+
className: "card-body",
|
|
70
|
+
children: [singlePlayerConfig && /* @__PURE__ */ jsx(Link, {
|
|
71
|
+
href: "/play",
|
|
72
|
+
style: { textDecoration: "none" },
|
|
73
|
+
children: /* @__PURE__ */ jsxs(ArticlesButton, {
|
|
74
|
+
variant: "",
|
|
75
|
+
className: "d-flex justify-content-center align-items-center mb-3 w-100",
|
|
76
|
+
onClick: () => {},
|
|
77
|
+
children: [/* @__PURE__ */ jsx("i", { className: "fad fa-play me-2" }), "Single Player"]
|
|
78
|
+
})
|
|
79
|
+
}), multiplayerConfig && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
80
|
+
className: "fw-bold mb-1 small text-center",
|
|
81
|
+
children: [
|
|
82
|
+
lobbyDetails?.players.length || 0,
|
|
83
|
+
" player",
|
|
84
|
+
lobbyDetails?.players.length !== 1 && "s",
|
|
85
|
+
" in the lobby."
|
|
86
|
+
]
|
|
87
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: "servers",
|
|
89
|
+
children: Array.from({ length: multiplayerConfig?.defaultServers }).map((_, id) => {
|
|
90
|
+
let lobbyLookup = lobbyDetails?.games?.find((lobby) => parseInt(lobby.server_id) == id);
|
|
91
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
92
|
+
className: "server",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: "d-flex justify-content-between align-items-center w-100 mb-2",
|
|
96
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
97
|
+
className: "mb-0",
|
|
98
|
+
style: { fontSize: "0.9rem" },
|
|
99
|
+
children: /* @__PURE__ */ jsxs("b", { children: ["Server ", id] })
|
|
100
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
101
|
+
className: "mb-0",
|
|
102
|
+
children: [lobbyLookup?.players?.length || 0, "/4"]
|
|
103
|
+
})]
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: "d-flex justify-content-around w-100 mb-1",
|
|
107
|
+
children: [
|
|
108
|
+
1,
|
|
109
|
+
2,
|
|
110
|
+
3,
|
|
111
|
+
4
|
|
112
|
+
].map((player_count) => {
|
|
113
|
+
let playerLookup = false;
|
|
114
|
+
if (lobbyLookup?.players?.length >= player_count) playerLookup = true;
|
|
115
|
+
return /* @__PURE__ */ jsx("div", {
|
|
116
|
+
className: "icon",
|
|
117
|
+
style: {
|
|
118
|
+
width: "20px",
|
|
119
|
+
height: "20px",
|
|
120
|
+
...playerLookup ? { backgroundColor: "black" } : { backgroundColor: "gray" },
|
|
121
|
+
border: "1px solid black"
|
|
122
|
+
}
|
|
123
|
+
}, player_count);
|
|
124
|
+
})
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ jsx(Link, {
|
|
127
|
+
className: ``,
|
|
128
|
+
href: {
|
|
129
|
+
pathname: `/play`,
|
|
130
|
+
query: { server: id }
|
|
131
|
+
},
|
|
132
|
+
style: { ...multiplayerConfig?.comingSoon ? { pointerEvents: "none" } : {} },
|
|
133
|
+
children: /* @__PURE__ */ jsx(ArticlesButton, {
|
|
134
|
+
small: true,
|
|
135
|
+
className: "px-3",
|
|
136
|
+
disabled: multiplayerConfig?.comingSoon,
|
|
137
|
+
children: multiplayerConfig?.comingSoon ? "Coming Soon" : "Join Game"
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
}, id);
|
|
142
|
+
})
|
|
143
|
+
})] })]
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ jsx("div", {
|
|
146
|
+
className: "card-footer d-flex flex-wrap justify-content-center",
|
|
147
|
+
children: /* @__PURE__ */ jsx(PrimaryButtonGroup, {
|
|
148
|
+
useStore,
|
|
149
|
+
type: "Landing"
|
|
150
|
+
})
|
|
151
|
+
})
|
|
152
|
+
]
|
|
153
|
+
}),
|
|
154
|
+
PostCardContent,
|
|
155
|
+
/* @__PURE__ */ jsxs("div", {
|
|
156
|
+
className: "extras",
|
|
157
|
+
children: [/* @__PURE__ */ jsx(SessionButton, {
|
|
158
|
+
port: process.env.NEXT_PUBLIC_GAME_PORT,
|
|
159
|
+
friendsButton: true
|
|
160
|
+
}), /* @__PURE__ */ jsx(ReturnToLauncherButton, {})]
|
|
161
|
+
}),
|
|
162
|
+
PostExtrasContent
|
|
163
|
+
]
|
|
164
|
+
}),
|
|
165
|
+
!disableGameScoreboard && /* @__PURE__ */ jsx(GameScoreboard, {
|
|
166
|
+
game: process.env.NEXT_PUBLIC_GAME_NAME,
|
|
167
|
+
style: "Default",
|
|
168
|
+
darkMode: darkMode ? true : false,
|
|
169
|
+
prepend: RotatingMascot && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
|
|
170
|
+
style: {
|
|
171
|
+
width: "100%",
|
|
172
|
+
height: "200px",
|
|
173
|
+
display: "flex",
|
|
174
|
+
justifyContent: "center",
|
|
175
|
+
alignItems: "center"
|
|
176
|
+
},
|
|
177
|
+
children: /* @__PURE__ */ jsx(RotatingMascot, {})
|
|
178
|
+
}) })
|
|
179
|
+
}),
|
|
180
|
+
!disableAd && /* @__PURE__ */ jsx(Ad, {
|
|
181
|
+
style: "Default",
|
|
182
|
+
section: "Games",
|
|
183
|
+
section_id: process.env.NEXT_PUBLIC_GAME_NAME,
|
|
184
|
+
darkMode: darkMode ? true : false,
|
|
185
|
+
user_ad_token: userToken,
|
|
186
|
+
userDetails,
|
|
187
|
+
userDetailsLoading
|
|
188
|
+
})
|
|
189
|
+
]
|
|
190
|
+
})
|
|
191
|
+
]
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { PageTemplateLandingPage as default };
|
|
@@ -9,7 +9,7 @@ function ReturnToLauncherButton({ className, id }) {
|
|
|
9
9
|
setIsMounted(true);
|
|
10
10
|
}, []);
|
|
11
11
|
if (!isMounted) return null;
|
|
12
|
-
const urlParams = new
|
|
12
|
+
const urlParams = new URL(window.location.href).searchParams;
|
|
13
13
|
let { launcher_mode } = Object.fromEntries(urlParams);
|
|
14
14
|
launcher_mode = launcher_mode === "1" ? true : false;
|
|
15
15
|
if (!launcher_mode) return /* @__PURE__ */ jsxs(ArticlesButton, {
|
|
@@ -235,8 +235,9 @@ function OtherTab({ useStore, config }) {
|
|
|
235
235
|
var package_default = {
|
|
236
236
|
name: "@articles-media/articles-dev-box",
|
|
237
237
|
description: "Shared code, functions, and components for different Articles Media projects.",
|
|
238
|
-
version: "1.
|
|
238
|
+
version: "1.1.1",
|
|
239
239
|
type: "module",
|
|
240
|
+
sideEffects: false,
|
|
240
241
|
imports: { "#root/src/*": "./src/*" },
|
|
241
242
|
main: "./dist/index.js",
|
|
242
243
|
module: "./dist/index.js",
|
|
@@ -253,14 +254,17 @@ var package_default = {
|
|
|
253
254
|
"./NicknameInput": "./dist/NicknameInput.js",
|
|
254
255
|
"./ArticlesAd": "./dist/ArticlesAd.js",
|
|
255
256
|
"./GameScoreboard": "./dist/GameScoreboard.js",
|
|
257
|
+
"./PageTemplateLandingPage": "./dist/PageTemplateLandingPage.js",
|
|
256
258
|
"./ReturnToLauncherButton": "./dist/ReturnToLauncherButton.js",
|
|
257
259
|
"./SignInButton": "./dist/SignInButton.js",
|
|
258
260
|
"./SessionButton": "./dist/SessionButton.js",
|
|
259
261
|
"./GlobalHead": "./dist/GlobalHead.js",
|
|
260
262
|
"./GlobalBody": "./dist/GlobalBody.js",
|
|
263
|
+
"./GlobalClientModals": "./dist/GlobalClientModals.js",
|
|
261
264
|
"./ViewUserModal": "./dist/ViewUserModal.js",
|
|
262
265
|
"./SettingsModal": "./dist/SettingsModal.js",
|
|
263
266
|
"./CreditsModal": "./dist/CreditsModal.js",
|
|
267
|
+
"./InfoModal": "./dist/InfoModal.js",
|
|
264
268
|
"./DarkModeHandler": "./dist/DarkModeHandler.js",
|
|
265
269
|
"./ToontownModeHandler": "./dist/ToontownModeHandler.js",
|
|
266
270
|
"./SocketServerUrlHandler": "./dist/SocketServerUrlHandler.js",
|
|
@@ -272,7 +276,10 @@ var package_default = {
|
|
|
272
276
|
"./useFullscreen": "./dist/useFullscreen.js",
|
|
273
277
|
"./typicalZustandStoreExcludes": "./dist/typicalZustandStoreExcludes.js",
|
|
274
278
|
"./typicalZustandStoreStateSlice": "./dist/typicalZustandStoreStateSlice.js",
|
|
279
|
+
"./defaultGameNextConfig": "./dist/defaultGameNextConfig.js",
|
|
280
|
+
"./defaultGameThemeConfig": "./dist/defaultGameThemeConfig.js",
|
|
275
281
|
"./getSignOutRedirectUrl": "./dist/getSignOutRedirectUrl.js",
|
|
282
|
+
"./generateRandomNickname": "./dist/generateRandomNickname.js",
|
|
276
283
|
"./dist/style.css": "./dist/articles-dev-box.css",
|
|
277
284
|
"./dist/articles-dev-box.css": "./dist/articles-dev-box.css"
|
|
278
285
|
},
|
|
@@ -343,6 +350,7 @@ function SettingsModal({ show, setShow, store, useAudioStore, useTouchControlsSt
|
|
|
343
350
|
setShow(false);
|
|
344
351
|
},
|
|
345
352
|
children: store && /* @__PURE__ */ jsx(ModalContent, {
|
|
353
|
+
setShow,
|
|
346
354
|
useStore: store,
|
|
347
355
|
useAudioStore,
|
|
348
356
|
useTouchControlsStore,
|
|
@@ -351,7 +359,7 @@ function SettingsModal({ show, setShow, store, useAudioStore, useTouchControlsSt
|
|
|
351
359
|
})
|
|
352
360
|
});
|
|
353
361
|
}
|
|
354
|
-
function ModalContent({ useStore, useAudioStore, useTouchControlsStore, useSocketStore, config }) {
|
|
362
|
+
function ModalContent({ setShow, useStore, useAudioStore, useTouchControlsStore, useSocketStore, config }) {
|
|
355
363
|
const [tab, setTab] = useState(localStorage.getItem("articles_settings_tab") || "Graphics");
|
|
356
364
|
const handleTabChange = (newTab) => {
|
|
357
365
|
setTab(newTab);
|
package/dist/SettingsModal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SettingsModal } from "./SettingsModal-
|
|
1
|
+
import { t as SettingsModal } from "./SettingsModal-BKcxlAg_.js";
|
|
2
2
|
export { SettingsModal as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/constants/defaultGameNextConfig.js
|
|
2
|
+
var defaultGameNextConfig = {
|
|
3
|
+
poweredByHeader: false,
|
|
4
|
+
reactCompiler: true,
|
|
5
|
+
images: { remotePatterns: [{
|
|
6
|
+
protocol: "https",
|
|
7
|
+
hostname: "cdn.articles.media",
|
|
8
|
+
port: ""
|
|
9
|
+
}, {
|
|
10
|
+
protocol: "https",
|
|
11
|
+
hostname: "articles-website.s3.amazonaws.com",
|
|
12
|
+
port: ""
|
|
13
|
+
}] },
|
|
14
|
+
async headers() {
|
|
15
|
+
return [{
|
|
16
|
+
source: "/(.*)",
|
|
17
|
+
headers: [{
|
|
18
|
+
key: "X-Frame-Options",
|
|
19
|
+
value: "SAMEORIGIN"
|
|
20
|
+
}]
|
|
21
|
+
}];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { defaultGameNextConfig as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/constants/defaultGameThemeConfig.js
|
|
2
|
+
var getTheme = (createTheme) => createTheme({
|
|
3
|
+
cssVariables: true,
|
|
4
|
+
palette: { mode: "dark" },
|
|
5
|
+
components: { MuiAlert: { styleOverrides: { root: { variants: [{
|
|
6
|
+
props: { severity: "info" },
|
|
7
|
+
style: { backgroundColor: "#60a5fa" }
|
|
8
|
+
}] } } } }
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { getTheme as default };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/util/generateRandomNickname.js
|
|
2
|
+
var defaultAdjectives = [
|
|
3
|
+
"Swift",
|
|
4
|
+
"Clever",
|
|
5
|
+
"Bright",
|
|
6
|
+
"Bold",
|
|
7
|
+
"Calm",
|
|
8
|
+
"Quick",
|
|
9
|
+
"Smart",
|
|
10
|
+
"Witty",
|
|
11
|
+
"Sharp",
|
|
12
|
+
"Kind",
|
|
13
|
+
"Cool",
|
|
14
|
+
"Vast",
|
|
15
|
+
"Fair",
|
|
16
|
+
"Brave",
|
|
17
|
+
"Keen",
|
|
18
|
+
"Grand",
|
|
19
|
+
"Pure",
|
|
20
|
+
"Rich",
|
|
21
|
+
"Smooth",
|
|
22
|
+
"Strong",
|
|
23
|
+
"Sunny",
|
|
24
|
+
"Wild",
|
|
25
|
+
"Wise",
|
|
26
|
+
"Zero",
|
|
27
|
+
"Great",
|
|
28
|
+
"Elite",
|
|
29
|
+
"Prime",
|
|
30
|
+
"Solid",
|
|
31
|
+
"Global",
|
|
32
|
+
"Unique"
|
|
33
|
+
];
|
|
34
|
+
var defaultNouns = [
|
|
35
|
+
"Fox",
|
|
36
|
+
"Wolf",
|
|
37
|
+
"Bear",
|
|
38
|
+
"Eagle",
|
|
39
|
+
"Hawk",
|
|
40
|
+
"Lion",
|
|
41
|
+
"Tiger",
|
|
42
|
+
"Shark",
|
|
43
|
+
"Owl",
|
|
44
|
+
"Deer",
|
|
45
|
+
"Falcon",
|
|
46
|
+
"Raven",
|
|
47
|
+
"Panda",
|
|
48
|
+
"Koala",
|
|
49
|
+
"Otter",
|
|
50
|
+
"Lynx",
|
|
51
|
+
"River",
|
|
52
|
+
"Star",
|
|
53
|
+
"Sky",
|
|
54
|
+
"Mountain",
|
|
55
|
+
"Cloud",
|
|
56
|
+
"Ocean",
|
|
57
|
+
"Forest",
|
|
58
|
+
"Storm",
|
|
59
|
+
"Peak",
|
|
60
|
+
"Valley",
|
|
61
|
+
"Desert",
|
|
62
|
+
"Island",
|
|
63
|
+
"Bridge"
|
|
64
|
+
];
|
|
65
|
+
/**
|
|
66
|
+
* Generates a random pattern/solving-themed nickname.
|
|
67
|
+
* @returns {string} A random nickname like "CleverSolver42" or "SwiftMatcher7".
|
|
68
|
+
*/
|
|
69
|
+
var generateRandomNickname = (config) => {
|
|
70
|
+
const { type, parts } = config || {};
|
|
71
|
+
if (type == "Basic") {
|
|
72
|
+
const adjectives = parts[0] || defaultAdjectives;
|
|
73
|
+
const nouns = parts[1] || defaultNouns;
|
|
74
|
+
return `${(adjectives || defaultAdjectives)[Math.floor(Math.random() * (adjectives || defaultAdjectives).length)]}${(nouns || defaultNouns)[Math.floor(Math.random() * (nouns || defaultNouns).length)]}${Math.floor(Math.random() * 100)}`;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
export { generateRandomNickname as default };
|
package/dist/index.js
CHANGED
|
@@ -13,15 +13,20 @@ import useFullscreen from "./useFullscreen.js";
|
|
|
13
13
|
import PrimaryButtonGroup from "./GameMenuPrimaryButtonGroup.js";
|
|
14
14
|
import NicknameInput from "./NicknameInput.js";
|
|
15
15
|
import { t as GameScoreboard } from "./GameScoreboard-CYuTBE_E.js";
|
|
16
|
+
import PageTemplateLandingPage from "./PageTemplateLandingPage.js";
|
|
16
17
|
import GlobalHead from "./GlobalHead.js";
|
|
17
18
|
import GlobalBody_default from "./GlobalBody.js";
|
|
18
|
-
import { t as SettingsModal } from "./SettingsModal-
|
|
19
|
+
import { t as SettingsModal } from "./SettingsModal-BKcxlAg_.js";
|
|
19
20
|
import CreditsModal from "./CreditsModal.js";
|
|
21
|
+
import InfoModal from "./InfoModal.js";
|
|
20
22
|
import DarkModeHandler from "./DarkModeHandler.js";
|
|
21
23
|
import ToontownModeHandler from "./ToontownModeHandler.js";
|
|
22
24
|
import SocketServerUrlHandler from "./SocketServerUrlHandler.js";
|
|
23
25
|
import HasNoMouseHandler from "./HasNoMouseHandler.js";
|
|
24
26
|
import typicalZustandStoreExcludes from "./typicalZustandStoreExcludes.js";
|
|
25
27
|
import typicalZustandStoreStateSlice from "./typicalZustandStoreStateSlice.js";
|
|
28
|
+
import defaultGameNextConfig from "./defaultGameNextConfig.js";
|
|
29
|
+
import getTheme from "./defaultGameThemeConfig.js";
|
|
26
30
|
import getSignOutRedirectUrl from "./getSignOutRedirectUrl.js";
|
|
27
|
-
|
|
31
|
+
import generateRandomNickname from "./generateRandomNickname.js";
|
|
32
|
+
export { Ad_default as Ad, ArticlesAd, CreditsModal, DarkModeHandler, FriendsList, GameMenu, PrimaryButtonGroup as GameMenuPrimaryButtonGroup, GameScoreboard, GlobalBody_default as GlobalBody, GlobalHead, HasNoMouseHandler, InfoModal, NicknameInput, PageTemplateLandingPage, ReturnToLauncherButton, SessionButton, SettingsModal, SignInButton, SocketServerUrlHandler, ToontownModeHandler, ViewUserModal, defaultGameNextConfig, getTheme as defaultGameThemeConfig, generateRandomNickname, getSignOutRedirectUrl, typicalZustandStoreExcludes, typicalZustandStoreStateSlice, useFullscreen, useUserDetails, useUserFriends, useUserToken };
|
|
@@ -22,6 +22,9 @@ var typicalZustandStoreStateSlice = (set, get, generateRandomNickname) => ({
|
|
|
22
22
|
set((prev) => ({ nicknameKeyboard: newValue }));
|
|
23
23
|
},
|
|
24
24
|
debug: false,
|
|
25
|
+
toggleDebug: () => {
|
|
26
|
+
set((prev) => ({ debug: !prev.debug }));
|
|
27
|
+
},
|
|
25
28
|
setDebug: (newValue) => {
|
|
26
29
|
set((prev) => ({ debug: newValue }));
|
|
27
30
|
},
|
|
@@ -43,6 +46,9 @@ var typicalZustandStoreStateSlice = (set, get, generateRandomNickname) => ({
|
|
|
43
46
|
set((prev) => ({ sidebar: newValue }));
|
|
44
47
|
},
|
|
45
48
|
showMenu: false,
|
|
49
|
+
toggleShowMenu: () => {
|
|
50
|
+
set((prev) => ({ showMenu: !prev.showMenu }));
|
|
51
|
+
},
|
|
46
52
|
setShowMenu: (value) => set({ showMenu: value }),
|
|
47
53
|
showSettingsModal: false,
|
|
48
54
|
setShowSettingsModal: (newValue) => {
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
6
7
|
"imports": {
|
|
7
8
|
"#root/src/*": "./src/*"
|
|
8
9
|
},
|
|
@@ -23,14 +24,17 @@
|
|
|
23
24
|
"./NicknameInput": "./dist/NicknameInput.js",
|
|
24
25
|
"./ArticlesAd": "./dist/ArticlesAd.js",
|
|
25
26
|
"./GameScoreboard": "./dist/GameScoreboard.js",
|
|
27
|
+
"./PageTemplateLandingPage": "./dist/PageTemplateLandingPage.js",
|
|
26
28
|
"./ReturnToLauncherButton": "./dist/ReturnToLauncherButton.js",
|
|
27
29
|
"./SignInButton": "./dist/SignInButton.js",
|
|
28
30
|
"./SessionButton": "./dist/SessionButton.js",
|
|
29
31
|
"./GlobalHead": "./dist/GlobalHead.js",
|
|
30
32
|
"./GlobalBody": "./dist/GlobalBody.js",
|
|
33
|
+
"./GlobalClientModals": "./dist/GlobalClientModals.js",
|
|
31
34
|
"./ViewUserModal": "./dist/ViewUserModal.js",
|
|
32
35
|
"./SettingsModal": "./dist/SettingsModal.js",
|
|
33
36
|
"./CreditsModal": "./dist/CreditsModal.js",
|
|
37
|
+
"./InfoModal": "./dist/InfoModal.js",
|
|
34
38
|
"./DarkModeHandler": "./dist/DarkModeHandler.js",
|
|
35
39
|
"./ToontownModeHandler": "./dist/ToontownModeHandler.js",
|
|
36
40
|
"./SocketServerUrlHandler": "./dist/SocketServerUrlHandler.js",
|
|
@@ -42,7 +46,10 @@
|
|
|
42
46
|
"./useFullscreen": "./dist/useFullscreen.js",
|
|
43
47
|
"./typicalZustandStoreExcludes": "./dist/typicalZustandStoreExcludes.js",
|
|
44
48
|
"./typicalZustandStoreStateSlice": "./dist/typicalZustandStoreStateSlice.js",
|
|
49
|
+
"./defaultGameNextConfig": "./dist/defaultGameNextConfig.js",
|
|
50
|
+
"./defaultGameThemeConfig": "./dist/defaultGameThemeConfig.js",
|
|
45
51
|
"./getSignOutRedirectUrl": "./dist/getSignOutRedirectUrl.js",
|
|
52
|
+
"./generateRandomNickname": "./dist/generateRandomNickname.js",
|
|
46
53
|
"./dist/style.css": "./dist/articles-dev-box.css",
|
|
47
54
|
"./dist/articles-dev-box.css": "./dist/articles-dev-box.css"
|
|
48
55
|
},
|