@valbuild/ui 0.28.0 → 0.30.0

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.
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Val</title>
7
7
 
8
- <script type="module" crossorigin src="/api/val/static/assets/index-513f7a9c.js"></script>
9
- <link rel="stylesheet" href="/api/val/static/assets/index-18cfa26c.css">
8
+ <script type="module" crossorigin src="/api/val/static/assets/index-9616f8c2.js"></script>
9
+ <link rel="stylesheet" href="/api/val/static/assets/index-8e61e324.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
@@ -634,6 +634,12 @@ body {
634
634
  .-left-2 {
635
635
  left: -0.5rem;
636
636
  }
637
+ .-right-\[10px\] {
638
+ right: -10px;
639
+ }
640
+ .-top-\[10px\] {
641
+ top: -10px;
642
+ }
637
643
  .-top-\[4px\] {
638
644
  top: -4px;
639
645
  }
@@ -1072,6 +1078,10 @@ body {
1072
1078
  .gap-\[36px\] {
1073
1079
  gap: 36px;
1074
1080
  }
1081
+ .gap-x-2 {
1082
+ -moz-column-gap: 0.5rem;
1083
+ column-gap: 0.5rem;
1084
+ }
1075
1085
  .gap-x-3 {
1076
1086
  -moz-column-gap: 0.75rem;
1077
1087
  column-gap: 0.75rem;
@@ -33725,6 +33725,42 @@ var ValApi = /* @__PURE__ */ function() {
33725
33725
  value: function getEditUrl() {
33726
33726
  return "".concat(this.host, "/static/edit");
33727
33727
  }
33728
+ }, {
33729
+ key: "getLoginUrl",
33730
+ value: function getLoginUrl(redirectTo) {
33731
+ return "".concat(this.host, "/authorize?redirect_to=").concat(encodeURIComponent(redirectTo));
33732
+ }
33733
+ }, {
33734
+ key: "getPatches",
33735
+ value: function() {
33736
+ var _getPatches = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(_ref) {
33737
+ var patchIds, headers, patchIdsParam;
33738
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
33739
+ while (1)
33740
+ switch (_context.prev = _context.next) {
33741
+ case 0:
33742
+ patchIds = _ref.patchIds, headers = _ref.headers;
33743
+ patchIdsParam = patchIds ? "?".concat(patchIds.map(function(id) {
33744
+ return "".concat(id, "=").concat(encodeURIComponent(id));
33745
+ }).join("&")) : "";
33746
+ return _context.abrupt("return", fetch("".concat(this.host, "/patches/~").concat(patchIdsParam), {
33747
+ headers: headers || {
33748
+ "Content-Type": "application/json"
33749
+ }
33750
+ }).then(function(res) {
33751
+ return parse$1(res);
33752
+ }));
33753
+ case 3:
33754
+ case "end":
33755
+ return _context.stop();
33756
+ }
33757
+ }, _callee, this);
33758
+ }));
33759
+ function getPatches(_x) {
33760
+ return _getPatches.apply(this, arguments);
33761
+ }
33762
+ return getPatches;
33763
+ }()
33728
33764
  }, {
33729
33765
  key: "postPatches",
33730
33766
  value: function postPatches(moduleId, patches, headers) {
@@ -33747,8 +33783,8 @@ var ValApi = /* @__PURE__ */ function() {
33747
33783
  }
33748
33784
  }, {
33749
33785
  key: "getModules",
33750
- value: function getModules(_ref) {
33751
- var _ref$patch = _ref.patch, patch = _ref$patch === void 0 ? false : _ref$patch, _ref$includeSchema = _ref.includeSchema, includeSchema = _ref$includeSchema === void 0 ? false : _ref$includeSchema, _ref$includeSource = _ref.includeSource, includeSource = _ref$includeSource === void 0 ? false : _ref$includeSource, _ref$treePath = _ref.treePath, treePath = _ref$treePath === void 0 ? "/" : _ref$treePath, headers = _ref.headers;
33786
+ value: function getModules(_ref2) {
33787
+ var _ref2$patch = _ref2.patch, patch = _ref2$patch === void 0 ? false : _ref2$patch, _ref2$includeSchema = _ref2.includeSchema, includeSchema = _ref2$includeSchema === void 0 ? false : _ref2$includeSchema, _ref2$includeSource = _ref2.includeSource, includeSource = _ref2$includeSource === void 0 ? false : _ref2$includeSource, _ref2$treePath = _ref2.treePath, treePath = _ref2$treePath === void 0 ? "/" : _ref2$treePath, headers = _ref2.headers;
33752
33788
  var params = new URLSearchParams();
33753
33789
  params.set("patch", patch.toString());
33754
33790
  params.set("schema", includeSchema.toString());
@@ -33762,52 +33798,52 @@ var ValApi = /* @__PURE__ */ function() {
33762
33798
  }]);
33763
33799
  return ValApi2;
33764
33800
  }();
33765
- function parse$1(_x) {
33801
+ function parse$1(_x2) {
33766
33802
  return _parse.apply(this, arguments);
33767
33803
  }
33768
33804
  function _parse() {
33769
- _parse = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(res) {
33770
- return _regeneratorRuntime().wrap(function _callee$(_context) {
33805
+ _parse = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(res) {
33806
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
33771
33807
  while (1)
33772
- switch (_context.prev = _context.next) {
33808
+ switch (_context2.prev = _context2.next) {
33773
33809
  case 0:
33774
- _context.prev = 0;
33810
+ _context2.prev = 0;
33775
33811
  if (!res.ok) {
33776
- _context.next = 9;
33812
+ _context2.next = 9;
33777
33813
  break;
33778
33814
  }
33779
- _context.t0 = result;
33780
- _context.next = 5;
33815
+ _context2.t0 = result;
33816
+ _context2.next = 5;
33781
33817
  return res.json();
33782
33818
  case 5:
33783
- _context.t1 = _context.sent;
33784
- return _context.abrupt("return", _context.t0.ok.call(_context.t0, _context.t1));
33819
+ _context2.t1 = _context2.sent;
33820
+ return _context2.abrupt("return", _context2.t0.ok.call(_context2.t0, _context2.t1));
33785
33821
  case 9:
33786
- _context.t2 = result;
33787
- _context.t3 = res.status;
33788
- _context.next = 13;
33822
+ _context2.t2 = result;
33823
+ _context2.t3 = res.status;
33824
+ _context2.next = 13;
33789
33825
  return res.text();
33790
33826
  case 13:
33791
- _context.t4 = _context.sent;
33792
- _context.t5 = {
33793
- statusCode: _context.t3,
33794
- message: _context.t4
33827
+ _context2.t4 = _context2.sent;
33828
+ _context2.t5 = {
33829
+ statusCode: _context2.t3,
33830
+ message: _context2.t4
33795
33831
  };
33796
- return _context.abrupt("return", _context.t2.err.call(_context.t2, _context.t5));
33832
+ return _context2.abrupt("return", _context2.t2.err.call(_context2.t2, _context2.t5));
33797
33833
  case 16:
33798
- _context.next = 21;
33834
+ _context2.next = 21;
33799
33835
  break;
33800
33836
  case 18:
33801
- _context.prev = 18;
33802
- _context.t6 = _context["catch"](0);
33803
- return _context.abrupt("return", err({
33804
- message: _context.t6 instanceof Error ? _context.t6.message : "Unknown error"
33837
+ _context2.prev = 18;
33838
+ _context2.t6 = _context2["catch"](0);
33839
+ return _context2.abrupt("return", err({
33840
+ message: _context2.t6 instanceof Error ? _context2.t6.message : "Unknown error"
33805
33841
  }));
33806
33842
  case 21:
33807
33843
  case "end":
33808
- return _context.stop();
33844
+ return _context2.stop();
33809
33845
  }
33810
- }, _callee, null, [[0, 18]]);
33846
+ }, _callee2, null, [[0, 18]]);
33811
33847
  }));
33812
33848
  return _parse.apply(this, arguments);
33813
33849
  }
@@ -61058,6 +61094,11 @@ const ChevronDown = createLucideIcon("ChevronDown", [
61058
61094
  const ChevronLeft = createLucideIcon("ChevronLeft", [
61059
61095
  ["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
61060
61096
  ]);
61097
+ const LogIn = createLucideIcon("LogIn", [
61098
+ ["path", { d: "M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4", key: "u53s6r" }],
61099
+ ["polyline", { points: "10 17 15 12 10 7", key: "1ail0h" }],
61100
+ ["line", { x1: "15", x2: "3", y1: "12", y2: "12", key: "v6grx8" }]
61101
+ ]);
61061
61102
  const Maximize = createLucideIcon("Maximize", [
61062
61103
  ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
61063
61104
  ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
@@ -61084,6 +61125,10 @@ const Power = createLucideIcon("Power", [
61084
61125
  ["path", { d: "M12 2v10", key: "mnfbl" }],
61085
61126
  ["path", { d: "M18.4 6.6a9 9 0 1 1-12.77.04", key: "obofu9" }]
61086
61127
  ]);
61128
+ const Send = createLucideIcon("Send", [
61129
+ ["path", { d: "m22 2-7 20-4-9-9-4Z", key: "1q3vgg" }],
61130
+ ["path", { d: "M22 2 11 13", key: "nzbqef" }]
61131
+ ]);
61087
61132
  const Sun = createLucideIcon("Sun", [
61088
61133
  ["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
61089
61134
  ["path", { d: "M12 2v2", key: "tus03m" }],
@@ -61102,8 +61147,30 @@ const X = createLucideIcon("X", [
61102
61147
  const className = "p-1 border rounded-full shadow border-accent";
61103
61148
  const PREV_URL_KEY = "valbuild:urlBeforeNavigation";
61104
61149
  function ValMenu({ api }) {
61105
- const { theme: theme2, setTheme, editMode, setEditMode } = useValOverlayContext();
61106
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center justify-center w-full h-full px-1 py-2 border-2 rounded-full gap-x-3 text-primary bg-background border-fill", children: [
61150
+ const { theme: theme2, setTheme, editMode, setEditMode, session } = useValOverlayContext();
61151
+ if (session.status === "success" && session.data === "not-authenticated") {
61152
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row items-center justify-center w-full h-full font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className, href: api.getLoginUrl(window.location.href), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center px-2 gap-x-2", children: [
61153
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Login" }),
61154
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LogIn, { size: 18 })
61155
+ ] }) }) });
61156
+ }
61157
+ const [patchCount, setPatchCount] = reactExports.useState();
61158
+ reactExports.useEffect(() => {
61159
+ if (session.status === "success" && session.data !== "not-authenticated") {
61160
+ api.getPatches({}).then((patchRes) => {
61161
+ if (result.isOk(patchRes)) {
61162
+ let patchCount2 = 0;
61163
+ for (const moduleId in patchRes.value) {
61164
+ patchCount2 += patchRes.value[moduleId].length;
61165
+ }
61166
+ setPatchCount(patchCount2);
61167
+ } else {
61168
+ console.error("Could not load patches", patchRes.error);
61169
+ }
61170
+ });
61171
+ }
61172
+ }, [session]);
61173
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuContainer, { children: [
61107
61174
  /* @__PURE__ */ jsxRuntimeExports.jsx(
61108
61175
  MenuButton,
61109
61176
  {
@@ -61142,9 +61209,25 @@ function ValMenu({ api }) {
61142
61209
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-[24px] w-[24px] flex justify-center items-center", children: editMode === "full" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Minimize, { size: 15 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Maximize, { size: 15 }) })
61143
61210
  }
61144
61211
  ),
61212
+ patchCount && /* @__PURE__ */ jsxRuntimeExports.jsx(
61213
+ MenuButton,
61214
+ {
61215
+ onClick: () => {
61216
+ },
61217
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative h-[24px] w-[24px] flex justify-center items-center", children: [
61218
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute -right-[10px] -top-[10px] border border-border rounded-full px-1 font-sans text-xs bg-card text-accent", children: patchCount }),
61219
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Send, { size: 18 })
61220
+ ] })
61221
+ }
61222
+ ),
61145
61223
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className, href: api.getDisableUrl(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-[24px] w-[24px] flex justify-center items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Power, { size: 18 }) }) })
61146
61224
  ] });
61147
61225
  }
61226
+ function MenuContainer({
61227
+ children
61228
+ }) {
61229
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row items-center justify-center w-full h-full px-2 py-2 font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill", children });
61230
+ }
61148
61231
  function MenuButton({
61149
61232
  active,
61150
61233
  onClick,
@@ -33724,6 +33724,42 @@ var ValApi = /* @__PURE__ */ function() {
33724
33724
  value: function getEditUrl() {
33725
33725
  return "".concat(this.host, "/static/edit");
33726
33726
  }
33727
+ }, {
33728
+ key: "getLoginUrl",
33729
+ value: function getLoginUrl(redirectTo) {
33730
+ return "".concat(this.host, "/authorize?redirect_to=").concat(encodeURIComponent(redirectTo));
33731
+ }
33732
+ }, {
33733
+ key: "getPatches",
33734
+ value: function() {
33735
+ var _getPatches = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(_ref) {
33736
+ var patchIds, headers, patchIdsParam;
33737
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
33738
+ while (1)
33739
+ switch (_context.prev = _context.next) {
33740
+ case 0:
33741
+ patchIds = _ref.patchIds, headers = _ref.headers;
33742
+ patchIdsParam = patchIds ? "?".concat(patchIds.map(function(id) {
33743
+ return "".concat(id, "=").concat(encodeURIComponent(id));
33744
+ }).join("&")) : "";
33745
+ return _context.abrupt("return", fetch("".concat(this.host, "/patches/~").concat(patchIdsParam), {
33746
+ headers: headers || {
33747
+ "Content-Type": "application/json"
33748
+ }
33749
+ }).then(function(res) {
33750
+ return parse$1(res);
33751
+ }));
33752
+ case 3:
33753
+ case "end":
33754
+ return _context.stop();
33755
+ }
33756
+ }, _callee, this);
33757
+ }));
33758
+ function getPatches(_x) {
33759
+ return _getPatches.apply(this, arguments);
33760
+ }
33761
+ return getPatches;
33762
+ }()
33727
33763
  }, {
33728
33764
  key: "postPatches",
33729
33765
  value: function postPatches(moduleId, patches, headers) {
@@ -33746,8 +33782,8 @@ var ValApi = /* @__PURE__ */ function() {
33746
33782
  }
33747
33783
  }, {
33748
33784
  key: "getModules",
33749
- value: function getModules(_ref) {
33750
- var _ref$patch = _ref.patch, patch = _ref$patch === void 0 ? false : _ref$patch, _ref$includeSchema = _ref.includeSchema, includeSchema = _ref$includeSchema === void 0 ? false : _ref$includeSchema, _ref$includeSource = _ref.includeSource, includeSource = _ref$includeSource === void 0 ? false : _ref$includeSource, _ref$treePath = _ref.treePath, treePath = _ref$treePath === void 0 ? "/" : _ref$treePath, headers = _ref.headers;
33785
+ value: function getModules(_ref2) {
33786
+ var _ref2$patch = _ref2.patch, patch = _ref2$patch === void 0 ? false : _ref2$patch, _ref2$includeSchema = _ref2.includeSchema, includeSchema = _ref2$includeSchema === void 0 ? false : _ref2$includeSchema, _ref2$includeSource = _ref2.includeSource, includeSource = _ref2$includeSource === void 0 ? false : _ref2$includeSource, _ref2$treePath = _ref2.treePath, treePath = _ref2$treePath === void 0 ? "/" : _ref2$treePath, headers = _ref2.headers;
33751
33787
  var params = new URLSearchParams();
33752
33788
  params.set("patch", patch.toString());
33753
33789
  params.set("schema", includeSchema.toString());
@@ -33761,52 +33797,52 @@ var ValApi = /* @__PURE__ */ function() {
33761
33797
  }]);
33762
33798
  return ValApi2;
33763
33799
  }();
33764
- function parse$1(_x) {
33800
+ function parse$1(_x2) {
33765
33801
  return _parse.apply(this, arguments);
33766
33802
  }
33767
33803
  function _parse() {
33768
- _parse = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(res) {
33769
- return _regeneratorRuntime().wrap(function _callee$(_context) {
33804
+ _parse = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(res) {
33805
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
33770
33806
  while (1)
33771
- switch (_context.prev = _context.next) {
33807
+ switch (_context2.prev = _context2.next) {
33772
33808
  case 0:
33773
- _context.prev = 0;
33809
+ _context2.prev = 0;
33774
33810
  if (!res.ok) {
33775
- _context.next = 9;
33811
+ _context2.next = 9;
33776
33812
  break;
33777
33813
  }
33778
- _context.t0 = result;
33779
- _context.next = 5;
33814
+ _context2.t0 = result;
33815
+ _context2.next = 5;
33780
33816
  return res.json();
33781
33817
  case 5:
33782
- _context.t1 = _context.sent;
33783
- return _context.abrupt("return", _context.t0.ok.call(_context.t0, _context.t1));
33818
+ _context2.t1 = _context2.sent;
33819
+ return _context2.abrupt("return", _context2.t0.ok.call(_context2.t0, _context2.t1));
33784
33820
  case 9:
33785
- _context.t2 = result;
33786
- _context.t3 = res.status;
33787
- _context.next = 13;
33821
+ _context2.t2 = result;
33822
+ _context2.t3 = res.status;
33823
+ _context2.next = 13;
33788
33824
  return res.text();
33789
33825
  case 13:
33790
- _context.t4 = _context.sent;
33791
- _context.t5 = {
33792
- statusCode: _context.t3,
33793
- message: _context.t4
33826
+ _context2.t4 = _context2.sent;
33827
+ _context2.t5 = {
33828
+ statusCode: _context2.t3,
33829
+ message: _context2.t4
33794
33830
  };
33795
- return _context.abrupt("return", _context.t2.err.call(_context.t2, _context.t5));
33831
+ return _context2.abrupt("return", _context2.t2.err.call(_context2.t2, _context2.t5));
33796
33832
  case 16:
33797
- _context.next = 21;
33833
+ _context2.next = 21;
33798
33834
  break;
33799
33835
  case 18:
33800
- _context.prev = 18;
33801
- _context.t6 = _context["catch"](0);
33802
- return _context.abrupt("return", err({
33803
- message: _context.t6 instanceof Error ? _context.t6.message : "Unknown error"
33836
+ _context2.prev = 18;
33837
+ _context2.t6 = _context2["catch"](0);
33838
+ return _context2.abrupt("return", err({
33839
+ message: _context2.t6 instanceof Error ? _context2.t6.message : "Unknown error"
33804
33840
  }));
33805
33841
  case 21:
33806
33842
  case "end":
33807
- return _context.stop();
33843
+ return _context2.stop();
33808
33844
  }
33809
- }, _callee, null, [[0, 18]]);
33845
+ }, _callee2, null, [[0, 18]]);
33810
33846
  }));
33811
33847
  return _parse.apply(this, arguments);
33812
33848
  }
@@ -61057,6 +61093,11 @@ const ChevronDown = createLucideIcon("ChevronDown", [
61057
61093
  const ChevronLeft = createLucideIcon("ChevronLeft", [
61058
61094
  ["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
61059
61095
  ]);
61096
+ const LogIn = createLucideIcon("LogIn", [
61097
+ ["path", { d: "M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4", key: "u53s6r" }],
61098
+ ["polyline", { points: "10 17 15 12 10 7", key: "1ail0h" }],
61099
+ ["line", { x1: "15", x2: "3", y1: "12", y2: "12", key: "v6grx8" }]
61100
+ ]);
61060
61101
  const Maximize = createLucideIcon("Maximize", [
61061
61102
  ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
61062
61103
  ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
@@ -61083,6 +61124,10 @@ const Power = createLucideIcon("Power", [
61083
61124
  ["path", { d: "M12 2v10", key: "mnfbl" }],
61084
61125
  ["path", { d: "M18.4 6.6a9 9 0 1 1-12.77.04", key: "obofu9" }]
61085
61126
  ]);
61127
+ const Send = createLucideIcon("Send", [
61128
+ ["path", { d: "m22 2-7 20-4-9-9-4Z", key: "1q3vgg" }],
61129
+ ["path", { d: "M22 2 11 13", key: "nzbqef" }]
61130
+ ]);
61086
61131
  const Sun = createLucideIcon("Sun", [
61087
61132
  ["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
61088
61133
  ["path", { d: "M12 2v2", key: "tus03m" }],
@@ -61101,8 +61146,30 @@ const X = createLucideIcon("X", [
61101
61146
  const className = "p-1 border rounded-full shadow border-accent";
61102
61147
  const PREV_URL_KEY = "valbuild:urlBeforeNavigation";
61103
61148
  function ValMenu({ api }) {
61104
- const { theme: theme2, setTheme, editMode, setEditMode } = useValOverlayContext();
61105
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center justify-center w-full h-full px-1 py-2 border-2 rounded-full gap-x-3 text-primary bg-background border-fill", children: [
61149
+ const { theme: theme2, setTheme, editMode, setEditMode, session } = useValOverlayContext();
61150
+ if (session.status === "success" && session.data === "not-authenticated") {
61151
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row items-center justify-center w-full h-full font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className, href: api.getLoginUrl(window.location.href), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center px-2 gap-x-2", children: [
61152
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Login" }),
61153
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LogIn, { size: 18 })
61154
+ ] }) }) });
61155
+ }
61156
+ const [patchCount, setPatchCount] = reactExports.useState();
61157
+ reactExports.useEffect(() => {
61158
+ if (session.status === "success" && session.data !== "not-authenticated") {
61159
+ api.getPatches({}).then((patchRes) => {
61160
+ if (result.isOk(patchRes)) {
61161
+ let patchCount2 = 0;
61162
+ for (const moduleId in patchRes.value) {
61163
+ patchCount2 += patchRes.value[moduleId].length;
61164
+ }
61165
+ setPatchCount(patchCount2);
61166
+ } else {
61167
+ console.error("Could not load patches", patchRes.error);
61168
+ }
61169
+ });
61170
+ }
61171
+ }, [session]);
61172
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuContainer, { children: [
61106
61173
  /* @__PURE__ */ jsxRuntimeExports.jsx(
61107
61174
  MenuButton,
61108
61175
  {
@@ -61141,9 +61208,25 @@ function ValMenu({ api }) {
61141
61208
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-[24px] w-[24px] flex justify-center items-center", children: editMode === "full" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Minimize, { size: 15 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Maximize, { size: 15 }) })
61142
61209
  }
61143
61210
  ),
61211
+ patchCount && /* @__PURE__ */ jsxRuntimeExports.jsx(
61212
+ MenuButton,
61213
+ {
61214
+ onClick: () => {
61215
+ },
61216
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative h-[24px] w-[24px] flex justify-center items-center", children: [
61217
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute -right-[10px] -top-[10px] border border-border rounded-full px-1 font-sans text-xs bg-card text-accent", children: patchCount }),
61218
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Send, { size: 18 })
61219
+ ] })
61220
+ }
61221
+ ),
61144
61222
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className, href: api.getDisableUrl(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-[24px] w-[24px] flex justify-center items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Power, { size: 18 }) }) })
61145
61223
  ] });
61146
61224
  }
61225
+ function MenuContainer({
61226
+ children
61227
+ }) {
61228
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row items-center justify-center w-full h-full px-2 py-2 font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill", children });
61229
+ }
61147
61230
  function MenuButton({
61148
61231
  active,
61149
61232
  onClick,