@articles-media/articles-dev-box 1.3.4 → 1.3.5

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.
@@ -9,9 +9,10 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  * @param {string} [props.owner] Optional GitHub owner
10
10
  * @param {string} [props.repo] Optional GitHub repo
11
11
  */
12
- function PrimaryButtonGroup({ useStore, type, owner, repo, LeaveGameOverride, SidebarOverride, SettingsOverride, InfoOverride, CreditsOverride, GithubOverride, FullscreenOverride }) {
12
+ function PrimaryButtonGroup({ useStore, type, owner, repo, LeaveGameOverride, SidebarOverride, SettingsOverride, InfoOverride, CreditsOverride, GithubOverride, FullscreenOverride, useRouter = null }) {
13
13
  if (!useStore) return null;
14
14
  const { isFullscreen, requestFullscreen, exitFullscreen } = useFullscreen();
15
+ const router = useRouter ? useRouter() : null;
15
16
  const setShowSettingsModal = useStore((state) => state.setShowSettingsModal);
16
17
  const toggleDarkMode = useStore((state) => state.toggleDarkMode);
17
18
  const darkMode = useStore((state) => state.darkMode);
@@ -19,6 +20,7 @@ function PrimaryButtonGroup({ useStore, type, owner, repo, LeaveGameOverride, Si
19
20
  const setShowCreditsModal = useStore((state) => state.setShowCreditsModal);
20
21
  const sidebar = useStore((state) => state.sidebar);
21
22
  const setSidebar = useStore((state) => state.setSidebar);
23
+ if (!router && type === "GameMenu") console.warn("GameMenuPrimaryButtonGroup: useRouter is needed for GameMenu type to avoid full reload navigation. Please provide a router instance from your framework (e.g. Next.js useRouter) as a prop.");
22
24
  switch (type) {
23
25
  case "Landing": return /* @__PURE__ */ jsxs(Fragment, { children: [
24
26
  SettingsOverride ? SettingsOverride : /* @__PURE__ */ jsxs("div", {
@@ -72,6 +74,13 @@ function PrimaryButtonGroup({ useStore, type, owner, repo, LeaveGameOverride, Si
72
74
  LeaveGameOverride ? LeaveGameOverride : /* @__PURE__ */ jsx("a", {
73
75
  href: "/",
74
76
  className: "w-50",
77
+ onClick: (e) => {
78
+ if (router) {
79
+ e.preventDefault();
80
+ router.push("/");
81
+ return;
82
+ }
83
+ },
75
84
  children: /* @__PURE__ */ jsxs(ArticlesButton, {
76
85
  className: "w-100",
77
86
  small: true,
@@ -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, CardBodyAppendContent, CardBodyPrependContent, 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 }) {
14
+ function PageTemplateLandingPage({ useStore, useSocketStore, RotatingMascot, Link, logoImage, backgroundImage, CardBodyOverride, CardBodyAppendContent, CardBodyPrependContent, 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, useRouter = 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);
@@ -148,7 +148,8 @@ function PageTemplateLandingPage({ useStore, useSocketStore, RotatingMascot, Lin
148
148
  className: "card-footer d-flex flex-wrap justify-content-center",
149
149
  children: /* @__PURE__ */ jsx(PrimaryButtonGroup, {
150
150
  useStore,
151
- type: "Landing"
151
+ type: "Landing",
152
+ useRouter
152
153
  })
153
154
  })
154
155
  ]
@@ -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.4",
249
+ version: "1.3.5",
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-BgIeffY6.js";
1
+ import { t as SettingsModal } from "./SettingsModal-DfrM7Ai1.js";
2
2
  export { SettingsModal as default };
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ 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-BgIeffY6.js";
19
+ import { t as SettingsModal } from "./SettingsModal-DfrM7Ai1.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.4",
4
+ "version": "1.3.5",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "imports": {