dirk-cfx-react 1.1.41 → 1.1.43

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/dist/index.js CHANGED
@@ -2,16 +2,16 @@ import React3, { createContext, useEffect, useRef, useState, useContext, useLayo
2
2
  import { create, useStore, createStore } from 'zustand';
3
3
  import axios from 'axios';
4
4
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
- import { Flex, Text, Image as Image$1, createTheme, Box, Code, useMantineTheme, alpha, Progress, RingProgress, Button, MantineProvider, BackgroundImage } from '@mantine/core';
6
- import { jsxs, jsx } from 'react/jsx-runtime';
5
+ import { Flex, Text, Image as Image$1, createTheme, Box, Stack, Title as Title$1, Code, useMantineTheme, alpha, Progress, RingProgress, Button, MantineProvider, BackgroundImage } from '@mantine/core';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
7
  import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
8
8
  import clickSoundUrl from './click_sound-PNCRRTM4.mp3';
9
9
  import hoverSoundUrl from './hover_sound-NBUA222C.mp3';
10
10
  import { useClickOutside } from '@mantine/hooks';
11
11
  import '@mantine/core/styles.css';
12
12
  import '@mantine/notifications/styles.css';
13
- import './styles/notify.css';
14
13
  import './styles/fonts.css';
14
+ import './styles/notify.css';
15
15
  import './styles/scrollBar.css';
16
16
  import './styles/tornEdge.css';
17
17
  import { library } from '@fortawesome/fontawesome-svg-core';
@@ -238,15 +238,6 @@ var useSettings = create(() => ({
238
238
  "#0b33ff"
239
239
  ]
240
240
  }));
241
- registerInitialFetch("GET_SETTINGS", void 0).then((data) => {
242
- if (!data) {
243
- console.warn("No settings data received from GET_SETTINGS fetch.");
244
- return;
245
- }
246
- useSettings.setState({
247
- ...data
248
- });
249
- });
250
241
 
251
242
  // src/utils/fetchNui.ts
252
243
  async function fetchNui(eventName, data, mockData) {
@@ -2469,23 +2460,56 @@ function mergeMantineThemeSafe(base, custom, override) {
2469
2460
  var DirkErrorBoundary = class extends React3.Component {
2470
2461
  constructor() {
2471
2462
  super(...arguments);
2472
- __publicField(this, "state", { error: null });
2463
+ __publicField(this, "state", { error: null, stack: void 0 });
2473
2464
  }
2474
2465
  static getDerivedStateFromError(error2) {
2475
2466
  return { error: error2 };
2476
2467
  }
2477
2468
  componentDidCatch(error2, info) {
2478
2469
  console.group("\u{1F525} Dirk UI Crash");
2479
- console.error(error2);
2480
- console.error(info.componentStack);
2470
+ console.error("Error:", error2);
2471
+ console.error("Component Stack:", info.componentStack);
2481
2472
  console.groupEnd();
2482
2473
  }
2483
2474
  render() {
2484
2475
  if (!this.state.error) return this.props.children;
2485
- return /* @__PURE__ */ jsxs(Box, { p: "md", bg: "dark.8", children: [
2486
- /* @__PURE__ */ jsx(Text, { c: "red", fw: 600, children: "UI crashed" }),
2487
- /* @__PURE__ */ jsx(Code, { block: true, mt: "sm", children: this.state.error.message })
2488
- ] });
2476
+ return /* @__PURE__ */ jsx(
2477
+ Box,
2478
+ {
2479
+ style: {
2480
+ position: "fixed",
2481
+ inset: 0,
2482
+ width: "100vw",
2483
+ height: "100vh",
2484
+ background: "rgba(10, 10, 12, 0.92)",
2485
+ display: "flex",
2486
+ alignItems: "center",
2487
+ justifyContent: "center",
2488
+ padding: "2rem",
2489
+ zIndex: 999999
2490
+ },
2491
+ children: /* @__PURE__ */ jsx(
2492
+ Box,
2493
+ {
2494
+ maw: 900,
2495
+ w: "100%",
2496
+ p: "lg",
2497
+ style: {
2498
+ background: "rgba(20,20,24,0.75)",
2499
+ border: "1px solid rgba(255,255,255,0.08)",
2500
+ borderRadius: "10px",
2501
+ boxShadow: "0 10px 40px rgba(0,0,0,0.6)"
2502
+ },
2503
+ children: /* @__PURE__ */ jsxs(Stack, { gap: "sm", children: [
2504
+ /* @__PURE__ */ jsx(Title$1, { order: 2, c: "red.5", children: "Dirk UI Crash" }),
2505
+ /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "sm", children: "The interface encountered a fatal error and stopped rendering." }),
2506
+ /* @__PURE__ */ jsx(Code, { block: true, style: { maxHeight: 150, overflow: "auto" }, children: this.state.error?.message }),
2507
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "Check console for full stack trace" })
2508
+ ] })
2509
+ }
2510
+ )
2511
+ }
2512
+ );
2489
2513
  }
2490
2514
  };
2491
2515
  library.add(fas, far, fab);
@@ -2501,6 +2525,17 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
2501
2525
  overideResourceName
2502
2526
  });
2503
2527
  }, [overideResourceName]);
2528
+ useEffect(() => {
2529
+ fetchNui("NUI_READY").catch(() => {
2530
+ });
2531
+ fetchNui("GET_SETTINGS").then((data) => {
2532
+ useSettings.setState({
2533
+ ...data
2534
+ });
2535
+ }).catch((err) => {
2536
+ console.error("Failed to fetch initial settings within dirk-cfx-react:", err);
2537
+ });
2538
+ }, []);
2504
2539
  const mergedTheme = useMemo(
2505
2540
  () => mergeMantineThemeSafe(
2506
2541
  { ...theme_default, primaryColor, primaryShade },