dirk-cfx-react 1.1.89 → 1.1.90

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.
@@ -1343,11 +1343,35 @@ function reportMissingLocale(key) {
1343
1343
  fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
1344
1344
  });
1345
1345
  }
1346
+ var PACKAGE_DEFAULTS = {
1347
+ "OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant.",
1348
+ "cfgpanel_discard": "Discard",
1349
+ "cfgpanel_manual_edit": "Manual Edit",
1350
+ "cfgpanel_reset_defaults": "Reset Defaults",
1351
+ "cfgpanel_version": "Version",
1352
+ "cfgpanel_back_title": "Back to script list",
1353
+ "cfgpanel_undo": "Undo",
1354
+ "cfgpanel_redo": "Redo",
1355
+ "cfgpanel_save": "Save",
1356
+ "cfgpanel_saving": "Saving...",
1357
+ "cfgpanel_history": "History",
1358
+ "cfgpanel_reset_title": "Reset to Defaults",
1359
+ "cfgpanel_reset_desc": "This will permanently reset ALL config back to the defaults. Every value you have configured will be overwritten. This cannot be undone.",
1360
+ "cfgpanel_reset_confirm": "Reset Config",
1361
+ "cfgpanel_discard_title": "Discard Unsaved Changes?",
1362
+ "cfgpanel_discard_desc_back": "You have unsaved changes. Going back now will discard them.",
1363
+ "cfgpanel_discard_desc_close": "You have unsaved changes. Closing now will discard them.",
1364
+ "cfgpanel_discard_confirm_back": "Go Back Without Saving",
1365
+ "cfgpanel_discard_confirm_close": "Close Without Saving",
1366
+ "cfgpanel_json_title": "Config JSON",
1367
+ "cfgpanel_cancel": "Cancel",
1368
+ "cfgpanel_apply": "Apply",
1369
+ "cfgpanel_history_title": "Config History",
1370
+ "cfgpanel_close": "Close"
1371
+ };
1346
1372
  var localeStore = create((set, get) => {
1347
1373
  return {
1348
- locales: {
1349
- "OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant."
1350
- },
1374
+ locales: { ...PACKAGE_DEFAULTS },
1351
1375
  locale: (key, ...args) => {
1352
1376
  const exists = get().locales[key];
1353
1377
  if (!exists) reportMissingLocale(key);
@@ -1361,7 +1385,7 @@ var localeStore = create((set, get) => {
1361
1385
  });
1362
1386
  var locale = localeStore.getState().locale;
1363
1387
  registerInitialFetch("GET_LOCALES", void 0).then((data) => {
1364
- localeStore.setState({ locales: data });
1388
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...data } });
1365
1389
  }).catch(() => {
1366
1390
  });
1367
1391
  if (typeof window !== "undefined") {
@@ -1370,7 +1394,7 @@ if (typeof window !== "undefined") {
1370
1394
  if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
1371
1395
  if (!msg.data || typeof msg.data !== "object") return;
1372
1396
  if (Object.keys(msg.data).length === 0) return;
1373
- localeStore.setState({ locales: msg.data });
1397
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...msg.data } });
1374
1398
  });
1375
1399
  }
1376
1400
 
@@ -3899,7 +3923,7 @@ function ConfigJsonModal({
3899
3923
  setError(e.message);
3900
3924
  }
3901
3925
  };
3902
- return /* @__PURE__ */ jsxs(Modal, { title: "Config JSON", icon: Code2, iconColor: color, onClose, width: "60vh", maxHeight: "80vh", zIndex: 200, children: [
3926
+ return /* @__PURE__ */ jsxs(Modal, { title: locale("cfgpanel_json_title"), icon: Code2, iconColor: color, onClose, width: "60vh", maxHeight: "80vh", zIndex: 200, children: [
3903
3927
  /* @__PURE__ */ jsxs(Box, { flex: 1, p: "0.8vh", style: { overflowY: "auto" }, children: [
3904
3928
  /* @__PURE__ */ jsx(
3905
3929
  JsonInput,
@@ -3927,7 +3951,7 @@ function ConfigJsonModal({
3927
3951
  style: { background: "transparent", border: `0.1vh solid ${theme.colors.dark[6]}`, borderRadius: theme.radius.xs, padding: `${theme.spacing.xxs} ${theme.spacing.xs}`, cursor: "pointer", display: "flex", alignItems: "center", gap: theme.spacing.xxs },
3928
3952
  children: [
3929
3953
  /* @__PURE__ */ jsx(X, { color: "rgba(255,255,255,0.4)" }),
3930
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: "Cancel" })
3954
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: locale("cfgpanel_cancel") })
3931
3955
  ]
3932
3956
  }
3933
3957
  ),
@@ -3940,7 +3964,7 @@ function ConfigJsonModal({
3940
3964
  style: { background: alpha(color, 0.14), border: `0.1vh solid ${alpha(color, 0.4)}`, borderRadius: theme.radius.xs, padding: `${theme.spacing.xxs} ${theme.spacing.xs}`, cursor: "pointer", display: "flex", alignItems: "center", gap: theme.spacing.xxs },
3941
3965
  children: [
3942
3966
  /* @__PURE__ */ jsx(Check, { color }),
3943
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: color, children: "Apply" })
3967
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: color, children: locale("cfgpanel_apply") })
3944
3968
  ]
3945
3969
  }
3946
3970
  )
@@ -4081,7 +4105,7 @@ function ConfigHistoryModal({
4081
4105
  historyQuery.fetchNextPage();
4082
4106
  }
4083
4107
  };
4084
- return /* @__PURE__ */ jsxs(Modal, { title: "Config History", icon: History, iconColor: color, onClose, width: "88vh", maxHeight: "82vh", zIndex: 260, children: [
4108
+ return /* @__PURE__ */ jsxs(Modal, { title: locale("cfgpanel_history_title"), icon: History, iconColor: color, onClose, width: "88vh", maxHeight: "82vh", zIndex: 260, children: [
4085
4109
  /* @__PURE__ */ jsxs(Flex, { direction: "column", style: { flex: 1, minHeight: 0 }, children: [
4086
4110
  /* @__PURE__ */ jsxs(Flex, { gap: "xs", p: "sm", style: { borderBottom: `0.1vh solid ${alpha(theme.colors.dark[7], 0.8)}` }, children: [
4087
4111
  /* @__PURE__ */ jsx(TextInput, { leftSection: /* @__PURE__ */ jsx(Search, { size: "1.4vh" }), placeholder: "Search path/admin/value", value: queryInput, onChange: (e) => setQueryInput(e.currentTarget.value), size: "xs", style: { flex: 1 } }),
@@ -4124,7 +4148,7 @@ function ConfigHistoryModal({
4124
4148
  style: { background: "transparent", border: `0.1vh solid ${theme.colors.dark[6]}`, borderRadius: theme.radius.xs, padding: `${theme.spacing.xxs} ${theme.spacing.xs}`, cursor: "pointer", display: "flex", alignItems: "center", gap: theme.spacing.xxs },
4125
4149
  children: [
4126
4150
  /* @__PURE__ */ jsx(X, { color: "rgba(255,255,255,0.4)", size: "1.5vh" }),
4127
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: "Close" })
4151
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: locale("cfgpanel_close") })
4128
4152
  ]
4129
4153
  }
4130
4154
  ) })
@@ -4184,9 +4208,9 @@ function ConfigPanelInner({
4184
4208
  /* @__PURE__ */ jsx(AnimatePresence, { children: resetOpen && /* @__PURE__ */ jsx(
4185
4209
  ConfirmModal,
4186
4210
  {
4187
- title: "Reset to Defaults",
4188
- description: "This will permanently reset ALL config back to the defaults. Every value you have configured will be overwritten. This cannot be undone.",
4189
- confirmLabel: "Reset Config",
4211
+ title: locale("cfgpanel_reset_title"),
4212
+ description: locale("cfgpanel_reset_desc"),
4213
+ confirmLabel: locale("cfgpanel_reset_confirm"),
4190
4214
  confirmText: resetConfirmText,
4191
4215
  onConfirm: async () => {
4192
4216
  setResetOpen(false);
@@ -4218,9 +4242,9 @@ function ConfigPanelInner({
4218
4242
  /* @__PURE__ */ jsx(AnimatePresence, { children: pendingAction !== null && /* @__PURE__ */ jsx(
4219
4243
  ConfirmModal,
4220
4244
  {
4221
- title: "Discard Unsaved Changes?",
4222
- description: pendingAction === "back" ? "You have unsaved changes. Going back now will discard them." : "You have unsaved changes. Closing now will discard them.",
4223
- confirmLabel: pendingAction === "back" ? "Go Back Without Saving" : "Close Without Saving",
4245
+ title: locale("cfgpanel_discard_title"),
4246
+ description: pendingAction === "back" ? locale("cfgpanel_discard_desc_back") : locale("cfgpanel_discard_desc_close"),
4247
+ confirmLabel: pendingAction === "back" ? locale("cfgpanel_discard_confirm_back") : locale("cfgpanel_discard_confirm_close"),
4224
4248
  onConfirm: () => {
4225
4249
  const action = pendingAction;
4226
4250
  setPendingAction(null);
@@ -4258,7 +4282,7 @@ function ConfigPanelInner({
4258
4282
  /* @__PURE__ */ jsx(
4259
4283
  motion.button,
4260
4284
  {
4261
- title: "Back to script list",
4285
+ title: locale("cfgpanel_back_title"),
4262
4286
  onClick: handleBack,
4263
4287
  whileHover: { background: alpha(color, 0.16), borderColor: alpha(color, 0.45) },
4264
4288
  whileTap: { scale: 0.95 },
@@ -4286,7 +4310,7 @@ function ConfigPanelInner({
4286
4310
  /* @__PURE__ */ jsx(
4287
4311
  motion.button,
4288
4312
  {
4289
- title: "Undo",
4313
+ title: locale("cfgpanel_undo"),
4290
4314
  onClick: () => form.canBack && form.back(),
4291
4315
  disabled: !form.canBack,
4292
4316
  whileHover: form.canBack ? { background: "rgba(255,255,255,0.07)" } : void 0,
@@ -4298,7 +4322,7 @@ function ConfigPanelInner({
4298
4322
  /* @__PURE__ */ jsx(
4299
4323
  motion.button,
4300
4324
  {
4301
- title: "Redo",
4325
+ title: locale("cfgpanel_redo"),
4302
4326
  onClick: () => form.canForward && form.forward(),
4303
4327
  disabled: !form.canForward,
4304
4328
  whileHover: form.canForward ? { background: "rgba(255,255,255,0.07)" } : void 0,
@@ -4310,7 +4334,7 @@ function ConfigPanelInner({
4310
4334
  /* @__PURE__ */ jsx(
4311
4335
  motion.button,
4312
4336
  {
4313
- title: isSaving ? "Saving..." : isDirty ? `Save (${changedCount})` : "Save",
4337
+ title: isSaving ? locale("cfgpanel_saving") : isDirty ? `${locale("cfgpanel_save")} (${changedCount})` : locale("cfgpanel_save"),
4314
4338
  onClick: () => isDirty && !isSaving && form.submit(),
4315
4339
  disabled: !isDirty || isSaving,
4316
4340
  whileHover: isDirty && !isSaving ? { background: alpha(color, 0.25), borderColor: alpha(color, 0.5) } : void 0,
@@ -4322,7 +4346,7 @@ function ConfigPanelInner({
4322
4346
  /* @__PURE__ */ jsx(
4323
4347
  motion.button,
4324
4348
  {
4325
- title: "History",
4349
+ title: locale("cfgpanel_history"),
4326
4350
  onClick: () => setHistoryOpen(true),
4327
4351
  whileHover: { background: alpha("#22d3ee", 0.16), borderColor: alpha("#22d3ee", 0.5) },
4328
4352
  whileTap: { scale: 0.97 },
@@ -4343,7 +4367,7 @@ function ConfigPanelInner({
4343
4367
  style: { width: "100%", background: "transparent", border: `0.1vh solid ${isDirty ? alpha("#f97316", 0.35) : alpha(theme.colors.dark[5], 0.3)}`, borderRadius: theme.radius.xs, padding: "0.65vh 0.8vh", cursor: isDirty ? "pointer" : "default", display: "flex", alignItems: "center", gap: "0.55vh", opacity: isDirty ? 1 : 0.35, transition: "opacity 0.2s" },
4344
4368
  children: [
4345
4369
  /* @__PURE__ */ jsx(XCircle, { color: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", size: "1.6vh" }),
4346
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", children: "Discard" })
4370
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", children: locale("cfgpanel_discard") })
4347
4371
  ]
4348
4372
  }
4349
4373
  ),
@@ -4357,7 +4381,7 @@ function ConfigPanelInner({
4357
4381
  style: { width: "100%", background: alpha(color, 0.07), border: `0.1vh solid ${alpha(color, 0.28)}`, borderRadius: theme.radius.xs, padding: "0.65vh 0.8vh", cursor: "pointer", display: "flex", alignItems: "center", gap: "0.55vh" },
4358
4382
  children: [
4359
4383
  /* @__PURE__ */ jsx(Code2, { color, size: "1.6vh" }),
4360
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: "Manual Edit" })
4384
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: locale("cfgpanel_manual_edit") })
4361
4385
  ]
4362
4386
  }
4363
4387
  ),
@@ -4370,12 +4394,13 @@ function ConfigPanelInner({
4370
4394
  style: { width: "100%", background: alpha("#ef4444", 0.07), border: `0.1vh solid ${alpha("#ef4444", 0.25)}`, borderRadius: theme.radius.xs, padding: "0.65vh 0.8vh", cursor: "pointer", display: "flex", alignItems: "center", gap: "0.55vh" },
4371
4395
  children: [
4372
4396
  /* @__PURE__ */ jsx(RotateCcw, { color: "#ef4444", size: "1.6vh" }),
4373
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: "#ef4444", children: "Reset Defaults" })
4397
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: "#ef4444", children: locale("cfgpanel_reset_defaults") })
4374
4398
  ]
4375
4399
  }
4376
4400
  ),
4377
4401
  version && /* @__PURE__ */ jsxs(Text, { size: "0.95vh", c: "dimmed", ta: "center", style: { letterSpacing: "0.04em", opacity: 0.8 }, children: [
4378
- "Version ",
4402
+ locale("cfgpanel_version"),
4403
+ " ",
4379
4404
  version
4380
4405
  ] })
4381
4406
  ] })