@seliseblocks/genesis-os 4.3.1 → 4.3.3

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.
Files changed (38) hide show
  1. package/dist/{chunk-X35MVDEU.js → chunk-ASLTNGXQ.js} +879 -382
  2. package/dist/chunk-ASLTNGXQ.js.map +1 -0
  3. package/dist/chunk-FQ2QETFA.cjs +4 -0
  4. package/dist/{chunk-OSAQRM46.cjs.map → chunk-FQ2QETFA.cjs.map} +1 -1
  5. package/dist/{chunk-6TMMJJRJ.cjs → chunk-GZSVB47D.cjs} +38 -2
  6. package/dist/{chunk-6TMMJJRJ.cjs.map → chunk-GZSVB47D.cjs.map} +1 -1
  7. package/dist/{chunk-LONMDMML.js → chunk-QMVZVNIZ.js} +39 -4
  8. package/dist/chunk-QMVZVNIZ.js.map +1 -0
  9. package/dist/{chunk-V4GJPS3E.cjs → chunk-SG3SZ45K.cjs} +905 -407
  10. package/dist/chunk-SG3SZ45K.cjs.map +1 -0
  11. package/dist/chunk-T3FFMBIJ.js +3 -0
  12. package/dist/{chunk-OGSC2U3E.js.map → chunk-T3FFMBIJ.js.map} +1 -1
  13. package/dist/components/index.cjs +344 -340
  14. package/dist/components/index.d.cts +13 -2
  15. package/dist/components/index.d.ts +13 -2
  16. package/dist/components/index.js +3 -3
  17. package/dist/hooks/index.cjs +44 -40
  18. package/dist/hooks/index.d.cts +20 -1
  19. package/dist/hooks/index.d.ts +20 -1
  20. package/dist/hooks/index.js +1 -1
  21. package/dist/index.cjs +399 -391
  22. package/dist/index.d.cts +3 -2
  23. package/dist/index.d.ts +3 -2
  24. package/dist/index.js +3 -3
  25. package/dist/layouts/index.cjs +10 -10
  26. package/dist/layouts/index.js +3 -3
  27. package/dist/models/index.cjs +1 -1
  28. package/dist/models/index.d.cts +10 -0
  29. package/dist/models/index.d.ts +10 -0
  30. package/dist/models/index.js +1 -1
  31. package/dist/pages/index.cjs +8 -8
  32. package/dist/pages/index.js +3 -3
  33. package/package.json +1 -1
  34. package/dist/chunk-LONMDMML.js.map +0 -1
  35. package/dist/chunk-OGSC2U3E.js +0 -3
  36. package/dist/chunk-OSAQRM46.cjs +0 -4
  37. package/dist/chunk-V4GJPS3E.cjs.map +0 -1
  38. package/dist/chunk-X35MVDEU.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkXJ6DPUCV_cjs = require('./chunk-XJ6DPUCV.cjs');
4
- var chunk6TMMJJRJ_cjs = require('./chunk-6TMMJJRJ.cjs');
4
+ var chunkGZSVB47D_cjs = require('./chunk-GZSVB47D.cjs');
5
5
  var chunkVTOD5ZQU_cjs = require('./chunk-VTOD5ZQU.cjs');
6
6
  var chunkZVGCCTNK_cjs = require('./chunk-ZVGCCTNK.cjs');
7
7
  var chunkQ7Y32IBM_cjs = require('./chunk-Q7Y32IBM.cjs');
@@ -1525,7 +1525,7 @@ function RightSidePanelProvider({
1525
1525
  const close = React8__namespace.useCallback(() => {
1526
1526
  setOpen(false);
1527
1527
  }, [setOpen]);
1528
- chunk6TMMJJRJ_cjs.useKeyboardShortcut(shortcut, toggle);
1528
+ chunkGZSVB47D_cjs.useKeyboardShortcut(shortcut, toggle);
1529
1529
  React8__namespace.useEffect(() => {
1530
1530
  if (!syncHash || isControlled || typeof window === "undefined") return;
1531
1531
  const handleHashChange = () => {
@@ -3501,7 +3501,7 @@ function MultiSelect({
3501
3501
  onChange,
3502
3502
  value: selectedValues
3503
3503
  }) {
3504
- const [buttonRef, popoverWidth] = chunk6TMMJJRJ_cjs.usePopoverWidth();
3504
+ const [buttonRef, popoverWidth] = chunkGZSVB47D_cjs.usePopoverWidth();
3505
3505
  const onSelectHandler = (value) => {
3506
3506
  const nextValues = selectedValues.includes(value) ? selectedValues.filter((item) => item !== value) : [...selectedValues, value];
3507
3507
  onChange(nextValues);
@@ -6690,7 +6690,7 @@ function useAppRedirectUrls({
6690
6690
  const controller = new AbortController();
6691
6691
  const { signal } = controller;
6692
6692
  stableApps.forEach((app) => {
6693
- chunk6TMMJJRJ_cjs.initiateService.fetchRedirectUrl({
6693
+ chunkGZSVB47D_cjs.initiateService.fetchRedirectUrl({
6694
6694
  clientId: chunkX4YCRWXO_cjs.getRuntimeEnv(app.clientId),
6695
6695
  redirectUri: chunkX4YCRWXO_cjs.getRuntimeEnv(app.redirectUri),
6696
6696
  forwardedTo: resolveRef.current(app)
@@ -6716,7 +6716,7 @@ function useAppRedirectUrls({
6716
6716
  }
6717
6717
  var AppSwitcher = ({ forwardedTo }) => {
6718
6718
  const [open, setOpen] = React8.useState(false);
6719
- const config = chunk6TMMJJRJ_cjs.useBlocksAppConfigStore((state) => state.getConfig());
6719
+ const config = chunkGZSVB47D_cjs.useBlocksAppConfigStore((state) => state.getConfig());
6720
6720
  const filteredApps = React8.useMemo(
6721
6721
  () => filteredAppSwitcherData.filter((app) => app.id !== config.name),
6722
6722
  [config.name]
@@ -6743,32 +6743,82 @@ var AppSwitcher = ({ forwardedTo }) => {
6743
6743
  )
6744
6744
  ] });
6745
6745
  };
6746
- var OPTIONS = [
6747
- { value: "system", Icon: lucideReact.Monitor, label: "Auto" },
6748
- { value: "light", Icon: lucideReact.Sun, label: "Light" },
6749
- { value: "dark", Icon: lucideReact.Moon, label: "Dark" }
6750
- ];
6751
- function ThemeSwitcher() {
6752
- const { theme, setTheme } = chunk6TMMJJRJ_cjs.useTheme();
6753
- return /* @__PURE__ */ jsxRuntime.jsx(
6754
- Tabs,
6755
- {
6756
- value: theme,
6757
- onValueChange: (value) => setTheme(value),
6758
- children: /* @__PURE__ */ jsxRuntime.jsx(TabsList, { className: "h-auto gap-0.5 rounded-md !bg-transparent p-0.5", children: OPTIONS.map(({ value, Icon: Icon2, label }) => /* @__PURE__ */ jsxRuntime.jsxs(
6759
- TabsTrigger,
6746
+ var OPTIONS = {
6747
+ system: { Icon: lucideReact.Monitor, label: "Auto" },
6748
+ light: { Icon: lucideReact.Sun, label: "Light" },
6749
+ dark: { Icon: lucideReact.Moon, label: "Dark" }
6750
+ };
6751
+ var OPTION_ORDER = ["system", "light", "dark"];
6752
+ var TRIGGER_BASE_CLASSES = "relative z-50 inline-flex h-9 items-center justify-center gap-2 px-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";
6753
+ var TRIGGER_DEFAULT_TYPOGRAPHY_CLASSES = "text-sm font-medium text-muted-foreground hover:text-foreground";
6754
+ function ThemeSwitcher({
6755
+ className,
6756
+ showChevron = true
6757
+ } = {}) {
6758
+ const { theme, setTheme } = chunkGZSVB47D_cjs.useTheme();
6759
+ const { Icon: ThemeIcon, label: themeLabel } = OPTIONS[theme];
6760
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
6761
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
6762
+ "button",
6763
+ {
6764
+ type: "button",
6765
+ "aria-label": "Change theme",
6766
+ className: chunkYAF2X7W5_cjs.cn(
6767
+ TRIGGER_BASE_CLASSES,
6768
+ className ?? TRIGGER_DEFAULT_TYPOGRAPHY_CLASSES
6769
+ ),
6770
+ children: [
6771
+ /* @__PURE__ */ jsxRuntime.jsx(ThemeIcon, { className: "h-4 w-4", "aria-hidden": true }),
6772
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: themeLabel }),
6773
+ showChevron && /* @__PURE__ */ jsxRuntime.jsx(
6774
+ lucideReact.ChevronDown,
6775
+ {
6776
+ className: "h-3.5 w-3.5 text-muted-foreground",
6777
+ "aria-hidden": true
6778
+ }
6779
+ )
6780
+ ]
6781
+ }
6782
+ ) }),
6783
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "end", className: "min-w-40", children: [
6784
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { className: "px-2 py-1.5 text-xs font-medium text-muted-foreground", children: "Appearance" }),
6785
+ /* @__PURE__ */ jsxRuntime.jsx(
6786
+ DropdownMenuRadioGroup,
6760
6787
  {
6761
- value,
6762
- className: "group h-auto rounded-sm px-2 py-1 text-xs font-medium data-[state=active]:bg-[hsl(var(--primary)/0.1)] data-[state=active]:text-[hsl(var(--primary))] data-[state=inactive]:text-[hsl(var(--muted-foreground)/0.9)] data-[state=active]:shadow-sm data-[state=inactive]:hover:text-[hsl(var(--foreground)/0.9)]",
6763
- children: [
6764
- /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 13, "aria-hidden": true }),
6765
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1.5 hidden group-data-[state=active]:inline", children: label })
6766
- ]
6767
- },
6768
- value
6769
- )) })
6770
- }
6771
- );
6788
+ value: theme,
6789
+ onValueChange: (value) => setTheme(value),
6790
+ children: OPTION_ORDER.map((value) => {
6791
+ const { Icon: Icon2, label } = OPTIONS[value];
6792
+ const isActive = value === theme;
6793
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6794
+ DropdownMenuRadioItem,
6795
+ {
6796
+ value,
6797
+ className: chunkYAF2X7W5_cjs.cn(
6798
+ "gap-2 border border-transparent py-2 hover:border-input",
6799
+ isActive && "text-primary"
6800
+ ),
6801
+ children: [
6802
+ /* @__PURE__ */ jsxRuntime.jsx(
6803
+ Icon2,
6804
+ {
6805
+ className: chunkYAF2X7W5_cjs.cn(
6806
+ "h-4 w-4",
6807
+ isActive ? "text-foreground" : "text-muted-foreground"
6808
+ ),
6809
+ "aria-hidden": true
6810
+ }
6811
+ ),
6812
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkYAF2X7W5_cjs.cn(isActive && "text-foreground font-medium"), children: label })
6813
+ ]
6814
+ },
6815
+ value
6816
+ );
6817
+ })
6818
+ }
6819
+ )
6820
+ ] })
6821
+ ] });
6772
6822
  }
6773
6823
 
6774
6824
  // src/services/user.service.ts
@@ -6816,14 +6866,14 @@ function UserAvatar({ size = "sm" }) {
6816
6866
  );
6817
6867
  }
6818
6868
  function UserDropdownMenu() {
6819
- const { name } = chunk6TMMJJRJ_cjs.useBlocksAppConfigStore((state) => state.config);
6869
+ const { name } = chunkGZSVB47D_cjs.useBlocksAppConfigStore((state) => state.config);
6820
6870
  const { data: data2 } = useGetUserInfo();
6821
6871
  const userData = data2?.data;
6822
- const { isPending, mutateAsync } = chunk6TMMJJRJ_cjs.useLogout();
6872
+ const { isPending, mutateAsync } = chunkGZSVB47D_cjs.useLogout();
6823
6873
  const { resetProjectStore } = chunkVAKGHXK6_cjs.useProjectStore();
6824
6874
  const { setUnAuthenticated, clearTokens } = chunkVAKGHXK6_cjs.useAuthStore();
6825
6875
  const { resetSelectedLanguages } = chunk3VNGGYRG_cjs.useLanguageViewStore();
6826
- const { data: myOrgsData, isLoading: isOrgsLoading } = chunk6TMMJJRJ_cjs.useGetMyOrganizations();
6876
+ const { data: myOrgsData, isLoading: isOrgsLoading } = chunkGZSVB47D_cjs.useGetMyOrganizations();
6827
6877
  const fullName = [userData?.firstName, userData?.lastName].filter(Boolean).join(" ") || "\u2014";
6828
6878
  const email = userData?.email || "";
6829
6879
  const roles = Object.values(userData?.roles || {}).flat();
@@ -6953,7 +7003,7 @@ var languages = [
6953
7003
  { key: "fr", title: "French" }
6954
7004
  ];
6955
7005
  function LanguageSelector() {
6956
- const { changeLanguage, language } = chunk6TMMJJRJ_cjs.useLanguageSwitcher();
7006
+ const { changeLanguage, language } = chunkGZSVB47D_cjs.useLanguageSwitcher();
6957
7007
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
6958
7008
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
6959
7009
  "button",
@@ -7043,7 +7093,7 @@ var notificationListenerService = new NotificationListenerService();
7043
7093
 
7044
7094
  // src/components/common/notification/use-notification-socket.ts
7045
7095
  function useNotificationSocket() {
7046
- const { data: configData } = chunk6TMMJJRJ_cjs.useGetBlocksNotificationConfig(0, 100);
7096
+ const { data: configData } = chunkGZSVB47D_cjs.useGetBlocksNotificationConfig(0, 100);
7047
7097
  const queryClient = reactQuery.useQueryClient();
7048
7098
  notificationListenerService.connect();
7049
7099
  React8.useEffect(() => {
@@ -7058,7 +7108,7 @@ function useNotificationSocket() {
7058
7108
  notificationListenerService.connection.on(
7059
7109
  config.notifyMethod,
7060
7110
  (message) => {
7061
- chunk6TMMJJRJ_cjs.notificationService.getNotificationConfig(config, message);
7111
+ chunkGZSVB47D_cjs.notificationService.getNotificationConfig(config, message);
7062
7112
  try {
7063
7113
  const notice = typeof message === "string" ? JSON.parse(message) : message;
7064
7114
  const denom = JSON.parse(
@@ -7082,12 +7132,12 @@ function useNotificationFeed(open) {
7082
7132
  const [notifications, setNotifications] = React8.useState([]);
7083
7133
  const [hasMore, setHasMore] = React8.useState(true);
7084
7134
  const listRef = React8.useRef(null);
7085
- const { data: data2, isLoading, isFetching } = chunk6TMMJJRJ_cjs.useGetNotifications(
7135
+ const { data: data2, isLoading, isFetching } = chunkGZSVB47D_cjs.useGetNotifications(
7086
7136
  pageNumber,
7087
7137
  PAGE_SIZE
7088
7138
  );
7089
- const markAsRead = chunk6TMMJJRJ_cjs.useMarkAsRead();
7090
- const markAllAsRead = chunk6TMMJJRJ_cjs.useMarkAllAsRead();
7139
+ const markAsRead = chunkGZSVB47D_cjs.useMarkAsRead();
7140
+ const markAllAsRead = chunkGZSVB47D_cjs.useMarkAllAsRead();
7091
7141
  React8.useEffect(() => {
7092
7142
  if (!data2?.notifications) return;
7093
7143
  setNotifications((prev) => {
@@ -7321,7 +7371,7 @@ function ConsoleHeader() {
7321
7371
  window.addEventListener("scroll", handleScroll);
7322
7372
  return () => window.removeEventListener("scroll", handleScroll);
7323
7373
  }, []);
7324
- const { appLightLogo, appDarkLogo } = chunk6TMMJJRJ_cjs.useLogo();
7374
+ const { appLightLogo, appDarkLogo } = chunkGZSVB47D_cjs.useLogo();
7325
7375
  return /* @__PURE__ */ jsxRuntime.jsx(
7326
7376
  "div",
7327
7377
  {
@@ -7788,7 +7838,7 @@ var LoginHeader = ({
7788
7838
  }) => {
7789
7839
  const {
7790
7840
  config: { appLogoUrl }
7791
- } = chunk6TMMJJRJ_cjs.useBlocksAppConfigStore((state) => state);
7841
+ } = chunkGZSVB47D_cjs.useBlocksAppConfigStore((state) => state);
7792
7842
  const resolveLogo = (variant) => {
7793
7843
  if (!appLogoUrl) return void 0;
7794
7844
  if (typeof appLogoUrl === "string") return appLogoUrl;
@@ -7829,7 +7879,13 @@ var LoginHeader = ({
7829
7879
  children: "GitHub"
7830
7880
  }
7831
7881
  ),
7832
- /* @__PURE__ */ jsxRuntime.jsx(ThemeSwitcher, {})
7882
+ /* @__PURE__ */ jsxRuntime.jsx(
7883
+ ThemeSwitcher,
7884
+ {
7885
+ className: "nav-link inline-flex items-center gap-1.5",
7886
+ showChevron: false
7887
+ }
7888
+ )
7833
7889
  ] })
7834
7890
  ] });
7835
7891
  };
@@ -8152,6 +8208,24 @@ var blocksLoginStyles = `
8152
8208
  .blocksLogin-page .cta-docs svg { transition: transform 0.25s var(--ease-out-expo); }
8153
8209
  .blocksLogin-page .cta-docs:hover svg { transform: translateX(4px); }
8154
8210
 
8211
+ .blocksLogin-page .cta-signup {
8212
+ margin-top: 18px;
8213
+ font-size: 0.82rem;
8214
+ line-height: 1.5;
8215
+ color: var(--muted);
8216
+ opacity: 0;
8217
+ transform: translateY(12px);
8218
+ animation: blocksLogin-fadeUp 0.7s var(--ease-out-expo) 1.45s forwards;
8219
+ }
8220
+ .blocksLogin-page .cta-signup-link {
8221
+ display: inline-flex; align-items: center; gap: 6px;
8222
+ color: var(--accent2); text-decoration: none; font-weight: 600;
8223
+ transition: gap 0.25s var(--ease-out-expo), text-shadow 0.25s ease;
8224
+ }
8225
+ .blocksLogin-page .cta-signup-link:hover { gap: 10px; text-shadow: 0 0 10px var(--accent2-glow); }
8226
+ .blocksLogin-page .cta-signup-link svg { transition: transform 0.25s var(--ease-out-expo); }
8227
+ .blocksLogin-page .cta-signup-link:hover svg { transform: translateX(3px); }
8228
+
8155
8229
  .blocksLogin-page .col-right {
8156
8230
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
8157
8231
  opacity: 0; transform: translateX(20px);
@@ -8310,6 +8384,7 @@ var blocksLoginStyles = `
8310
8384
  .blocksLogin-page .features { gap: 8px; }
8311
8385
  .blocksLogin-page .feature-pill { padding: 5px 10px; font-size: 0.58rem; }
8312
8386
  .blocksLogin-page .cta-row { gap: 18px; }
8387
+ .blocksLogin-page .cta-signup { font-size: 0.78rem; }
8313
8388
  }
8314
8389
 
8315
8390
  @media (prefers-reduced-motion: reduce) {
@@ -8704,6 +8779,7 @@ var BlocksLoginPage = ({
8704
8779
  loginLabel = "Log in to your account",
8705
8780
  docsUrl = "https://docs.seliseblocks.com/",
8706
8781
  footerLink = { label: "Visit Blocks", url: "https://seliseblocks.com" },
8782
+ signUpUrl,
8707
8783
  carouselItems
8708
8784
  }) => {
8709
8785
  const canvasRef = React8.useRef(null);
@@ -8876,6 +8952,25 @@ var BlocksLoginPage = ({
8876
8952
  ]
8877
8953
  }
8878
8954
  )
8955
+ ] }),
8956
+ signUpUrl && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "cta-signup", children: [
8957
+ "Not a member?",
8958
+ " ",
8959
+ /* @__PURE__ */ jsxRuntime.jsxs("a", { href: signUpUrl, className: "cta-signup-link", children: [
8960
+ "Sign up",
8961
+ /* @__PURE__ */ jsxRuntime.jsx(
8962
+ "svg",
8963
+ {
8964
+ width: "11",
8965
+ height: "11",
8966
+ viewBox: "0 0 24 24",
8967
+ fill: "none",
8968
+ stroke: "currentColor",
8969
+ strokeWidth: "2.5",
8970
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14M12 5l7 7-7 7" })
8971
+ }
8972
+ )
8973
+ ] })
8879
8974
  ] })
8880
8975
  ] }),
8881
8976
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-right", children: [
@@ -8992,14 +9087,16 @@ var BlocksLoginPage = ({
8992
9087
  ] });
8993
9088
  };
8994
9089
  var LoginPage = () => {
8995
- const config = chunk6TMMJJRJ_cjs.useBlocksAppConfigStore((state) => state.getConfig());
8996
- const { start, isLoading } = chunk6TMMJJRJ_cjs.useLogin();
9090
+ const config = chunkGZSVB47D_cjs.useBlocksAppConfigStore((state) => state.getConfig());
9091
+ const { start, isLoading } = chunkGZSVB47D_cjs.useLogin();
9092
+ const { signUpUrl } = chunkGZSVB47D_cjs.useSignUpAffordance();
8997
9093
  return /* @__PURE__ */ jsxRuntime.jsx(
8998
9094
  BlocksLoginPage,
8999
9095
  {
9000
9096
  name: config.name,
9001
9097
  onLogin: start,
9002
9098
  isLoading,
9099
+ signUpUrl,
9003
9100
  carouselItems: BLOCKS_PRODUCTS
9004
9101
  }
9005
9102
  );
@@ -9075,10 +9172,10 @@ var DefaultDoc = () => {
9075
9172
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-5 md:grid-cols-2 lg:grid-cols-3", children: data.map((item) => /* @__PURE__ */ jsxRuntime.jsx(DocCard, { ...item }, item.url)) });
9076
9173
  };
9077
9174
  function useCreateProjectRedirect() {
9078
- const { name } = chunk6TMMJJRJ_cjs.useBlocksAppConfigStore((state) => state.config);
9175
+ const { name } = chunkGZSVB47D_cjs.useBlocksAppConfigStore((state) => state.config);
9079
9176
  const navigate = reactRouter.useNavigate();
9080
9177
  const osApp = filteredAppSwitcherData.find((app) => app.id === "blocks-os");
9081
- const { isFetching, isReady, redirect } = chunk6TMMJJRJ_cjs.usePrefetchRedirect({
9178
+ const { isFetching, isReady, redirect } = chunkGZSVB47D_cjs.usePrefetchRedirect({
9082
9179
  clientId: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.clientId) : "",
9083
9180
  redirectUri: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.redirectUri) : "",
9084
9181
  forwardedTo: "/app/create-project",
@@ -9170,10 +9267,10 @@ function useProjectOverviewRedirect({
9170
9267
  tenantGroupId
9171
9268
  }) {
9172
9269
  const navigate = reactRouter.useNavigate();
9173
- const { name } = chunk6TMMJJRJ_cjs.useBlocksAppConfigStore((state) => state.config);
9270
+ const { name } = chunkGZSVB47D_cjs.useBlocksAppConfigStore((state) => state.config);
9174
9271
  const osApp = filteredAppSwitcherData.find((app) => app.id === "blocks-os");
9175
9272
  const redirectedRoute = `/app/project/${tenantGroupId}/environments`;
9176
- const { isFetching, isReady, redirect } = chunk6TMMJJRJ_cjs.usePrefetchRedirect({
9273
+ const { isFetching, isReady, redirect } = chunkGZSVB47D_cjs.usePrefetchRedirect({
9177
9274
  clientId: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.clientId) : "",
9178
9275
  redirectUri: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.redirectUri) : "",
9179
9276
  forwardedTo: redirectedRoute,
@@ -9193,52 +9290,141 @@ function useProjectOverviewRedirect({
9193
9290
  isFetching
9194
9291
  };
9195
9292
  }
9196
- var INLINE_LIMIT = 3;
9197
- var ProjectCard = ({
9293
+ var getActionLabels = (canOpen, isShared) => {
9294
+ if (canOpen) {
9295
+ return isShared ? { accessibleLabel: "Open shared project", tooltipLabel: "Open Project" } : {
9296
+ accessibleLabel: "Configure project",
9297
+ tooltipLabel: "Configure Project"
9298
+ };
9299
+ }
9300
+ return {
9301
+ accessibleLabel: "Project access unavailable",
9302
+ tooltipLabel: "Project access unavailable"
9303
+ };
9304
+ };
9305
+ var ProjectActionButton = ({
9198
9306
  project,
9199
- projects,
9200
9307
  isShared,
9201
9308
  canOpen = true
9202
9309
  }) => {
9203
- const navigate = reactRouter.useNavigate();
9204
- const { setTenantGroup, setSelectedProject } = chunkVAKGHXK6_cjs.useProjectStore();
9310
+ const { setTenantGroup } = chunkVAKGHXK6_cjs.useProjectStore();
9205
9311
  const { handleClick, isDisabled, isFetching } = useProjectOverviewRedirect({
9206
9312
  tenantGroupId: project.tenantGroupId
9207
9313
  });
9208
- const onConfigureClick = () => {
9314
+ const isActionDisabled = !canOpen || isDisabled || isFetching;
9315
+ const { accessibleLabel, tooltipLabel } = getActionLabels(canOpen, isShared);
9316
+ const onClick = () => {
9209
9317
  setTenantGroup(project.tenantGroupId);
9210
9318
  handleClick();
9211
9319
  };
9212
- const onEnvBadgeClick = async (e, envProject) => {
9213
- e.stopPropagation();
9320
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
9321
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
9322
+ Button,
9323
+ {
9324
+ size: "icon",
9325
+ "data-testid": isShared ? "project-card-open-shared" : "project-card-configure",
9326
+ variant: "ghost",
9327
+ className: "text-primary hover:bg-primary/10 h-8 w-8 shrink-0 transition-colors",
9328
+ disabled: isActionDisabled,
9329
+ onClick,
9330
+ "aria-label": accessibleLabel,
9331
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings2, { size: 16 })
9332
+ }
9333
+ ) }),
9334
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: tooltipLabel })
9335
+ ] });
9336
+ };
9337
+
9338
+ // src/pages/console/project-list-utils.ts
9339
+ var canOpenProject = (group) => !group.isShared || !group.accessPolicies || group.accessPolicies.length > 0;
9340
+ var getProjectGroupName = (group) => group.projects[0]?.name ?? "";
9341
+ var getLatestProjectUpdate = (group) => group.projects.reduce((latest, project) => {
9342
+ const timestamp = Date.parse(project.lastUpdatedDate);
9343
+ return Number.isFinite(timestamp) ? Math.max(latest, timestamp) : latest;
9344
+ }, 0);
9345
+ var getEnvironmentLabel = (environment) => environmentOptions.find((option) => option.value === environment)?.label ?? environment;
9346
+ var INLINE_LIMIT = 3;
9347
+ var ProjectEnvironments = ({ projects }) => {
9348
+ const navigate = reactRouter.useNavigate();
9349
+ const { setTenantGroup, setSelectedProject } = chunkVAKGHXK6_cjs.useProjectStore();
9350
+ const onEnvironmentClick = async (event, project) => {
9351
+ event.stopPropagation();
9214
9352
  try {
9215
- setTenantGroup(envProject.tenantGroupId);
9216
- setSelectedProject(envProject);
9217
- navigate(`/app/${envProject.itemId}/dashboard`);
9218
- } catch (err) {
9219
- console.error("Failed to switch environment", err);
9353
+ setTenantGroup(project.tenantGroupId);
9354
+ setSelectedProject(project);
9355
+ navigate(`/app/${project.itemId}/dashboard`);
9356
+ } catch (error) {
9357
+ console.error("Failed to switch environment", error);
9220
9358
  }
9221
9359
  };
9222
- const renderEnvChip = (envProject) => {
9223
- const label = environmentOptions.find(
9224
- (o) => o.value === envProject.environment
9225
- )?.label;
9226
- return /* @__PURE__ */ jsxRuntime.jsxs(
9227
- "button",
9228
- {
9229
- onClick: (e) => onEnvBadgeClick(e, envProject),
9230
- className: "group/chip border-primary bg-primary text-primary-foreground hover:text-primary inline-flex cursor-pointer items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium transition-all duration-150 hover:border-blocks-primary-50 hover:bg-blocks-primary-25 active:scale-95",
9231
- children: [
9232
- label,
9233
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-3 w-3 transition-all duration-150 group-hover/chip:translate-x-0.5" })
9234
- ]
9235
- },
9236
- envProject.environment
9237
- );
9238
- };
9360
+ const renderEnvironmentChip = (project) => /* @__PURE__ */ jsxRuntime.jsxs(
9361
+ "button",
9362
+ {
9363
+ type: "button",
9364
+ onClick: (event) => onEnvironmentClick(event, project),
9365
+ className: "group/chip border-primary bg-primary text-primary-foreground hover:text-primary inline-flex cursor-pointer items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium transition-all duration-150 hover:border-blocks-primary-50 hover:bg-blocks-primary-25 active:scale-95",
9366
+ children: [
9367
+ getEnvironmentLabel(project.environment),
9368
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-3 w-3 transition-all duration-150 group-hover/chip:translate-x-0.5" })
9369
+ ]
9370
+ },
9371
+ project.environment
9372
+ );
9373
+ if (projects.length === 0) {
9374
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "border-border/60 bg-muted/40 text-muted-foreground inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs", children: "No environments" });
9375
+ }
9239
9376
  const hasOverflow = projects.length > INLINE_LIMIT;
9240
9377
  const visibleProjects = hasOverflow ? projects.slice(0, INLINE_LIMIT) : projects;
9241
9378
  const overflowCount = projects.length - INLINE_LIMIT;
9379
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [
9380
+ visibleProjects.map(renderEnvironmentChip),
9381
+ hasOverflow && /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9382
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9383
+ "button",
9384
+ {
9385
+ type: "button",
9386
+ onClick: (event) => event.stopPropagation(),
9387
+ className: "border-border/60 bg-muted/40 text-muted-foreground hover:bg-muted hover:text-foreground inline-flex cursor-pointer items-center rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors",
9388
+ children: [
9389
+ "+",
9390
+ overflowCount,
9391
+ " more"
9392
+ ]
9393
+ }
9394
+ ) }),
9395
+ /* @__PURE__ */ jsxRuntime.jsxs(
9396
+ PopoverContent,
9397
+ {
9398
+ className: "w-52 p-1.5",
9399
+ align: "start",
9400
+ onClick: (event) => event.stopPropagation(),
9401
+ children: [
9402
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-2 pb-1.5 pt-1 text-[10px] font-semibold uppercase tracking-wider", children: "All environments" }),
9403
+ projects.map((project) => /* @__PURE__ */ jsxRuntime.jsxs(
9404
+ "button",
9405
+ {
9406
+ type: "button",
9407
+ onClick: (event) => onEnvironmentClick(event, project),
9408
+ className: "group/item hover:bg-accent flex w-full items-center justify-between rounded-md px-2 py-1.5 text-sm transition-colors",
9409
+ children: [
9410
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: getEnvironmentLabel(project.environment) }),
9411
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "text-muted-foreground group-hover/item:text-foreground h-3.5 w-3.5 transition-transform duration-150 group-hover/item:translate-x-0.5" })
9412
+ ]
9413
+ },
9414
+ project.environment
9415
+ ))
9416
+ ]
9417
+ }
9418
+ )
9419
+ ] })
9420
+ ] });
9421
+ };
9422
+ var ProjectCard = ({
9423
+ project,
9424
+ projects,
9425
+ isShared,
9426
+ canOpen = true
9427
+ }) => {
9242
9428
  return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "border-border/60 bg-card hover:border-primary/30 group flex h-40 flex-col overflow-hidden rounded-xl border p-4 shadow-sm transition-all duration-200 hover:shadow-md", children: [
9243
9429
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-start justify-between gap-2", children: [
9244
9430
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "line-clamp-3 break-all text-base font-semibold leading-snug", children: project.name }) }),
@@ -9258,151 +9444,640 @@ var ProjectCard = ({
9258
9444
  ]
9259
9445
  }
9260
9446
  ),
9261
- canOpen && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
9262
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
9263
- Button,
9264
- {
9265
- size: "icon",
9266
- "data-testid": "project-card-open-shared",
9267
- variant: "ghost",
9268
- className: "text-primary hover:bg-primary/10 h-8 w-8 shrink-0 transition-colors",
9269
- disabled: isDisabled || isFetching,
9270
- onClick: onConfigureClick,
9271
- "aria-label": "Open shared project",
9272
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings2, { size: 16 })
9273
- }
9274
- ) }),
9275
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Open Project" })
9276
- ] })
9277
- ] }),
9278
- whenFalse: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
9279
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
9280
- Button,
9447
+ /* @__PURE__ */ jsxRuntime.jsx(
9448
+ ProjectActionButton,
9281
9449
  {
9282
- size: "icon",
9283
- "data-testid": "project-card-configure",
9284
- variant: "ghost",
9285
- className: "text-primary hover:bg-primary/10 h-8 w-8 shrink-0 transition-colors",
9286
- disabled: isDisabled || isFetching,
9287
- onClick: onConfigureClick,
9288
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings2, { size: 16 })
9450
+ project,
9451
+ isShared: true,
9452
+ canOpen
9289
9453
  }
9290
- ) }),
9291
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Configure Project" })
9292
- ] })
9454
+ )
9455
+ ] }),
9456
+ whenFalse: /* @__PURE__ */ jsxRuntime.jsx(ProjectActionButton, { project, isShared: false })
9293
9457
  }
9294
9458
  ) })
9295
9459
  ] }),
9296
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-auto", children: projects.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "border-border/60 bg-muted/40 text-muted-foreground inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs", children: "No environments" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [
9297
- visibleProjects.map((p) => renderEnvChip(p)),
9298
- hasOverflow && /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9299
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9300
- "button",
9301
- {
9302
- onClick: (e) => e.stopPropagation(),
9303
- className: "border-border/60 bg-muted/40 text-muted-foreground hover:bg-muted hover:text-foreground inline-flex cursor-pointer items-center rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors",
9304
- children: [
9305
- "+",
9306
- overflowCount,
9307
- " more"
9308
- ]
9309
- }
9310
- ) }),
9311
- /* @__PURE__ */ jsxRuntime.jsxs(
9312
- PopoverContent,
9313
- {
9314
- className: "w-52 p-1.5",
9315
- align: "start",
9316
- onClick: (e) => e.stopPropagation(),
9317
- children: [
9318
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-2 pb-1.5 pt-1 text-[10px] font-semibold uppercase tracking-wider", children: "All environments" }),
9319
- projects.map((p) => {
9320
- const opt = environmentOptions.find(
9321
- (o) => o.value === p.environment
9322
- );
9323
- return /* @__PURE__ */ jsxRuntime.jsxs(
9324
- "button",
9325
- {
9326
- onClick: (e) => onEnvBadgeClick(e, p),
9327
- className: "group/item hover:bg-accent flex w-full items-center justify-between rounded-md px-2 py-1.5 text-sm transition-colors",
9328
- children: [
9329
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: opt?.label ?? p.environment }),
9330
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "text-muted-foreground group-hover/item:text-foreground h-3.5 w-3.5 transition-transform duration-150 group-hover/item:translate-x-0.5" })
9331
- ]
9332
- },
9333
- p.environment
9334
- );
9335
- })
9336
- ]
9337
- }
9338
- )
9339
- ] })
9340
- ] }) })
9460
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-auto", children: /* @__PURE__ */ jsxRuntime.jsx(ProjectEnvironments, { projects }) })
9341
9461
  ] });
9342
9462
  };
9343
- var cardVariants = {
9344
- hidden: { opacity: 0, y: 20, scale: 0.97 },
9345
- visible: (i) => ({
9346
- opacity: 1,
9347
- y: 0,
9348
- scale: 1,
9349
- transition: {
9350
- delay: i * 0.06,
9351
- duration: 0.4,
9352
- ease: [0.22, 1, 0.36, 1]
9353
- }
9354
- })
9463
+ var getLastUpdatedLabel = (group) => {
9464
+ const timestamp = getLatestProjectUpdate(group);
9465
+ return timestamp === 0 ? "Unknown" : dateFns.formatDistanceToNow(timestamp, { addSuffix: true });
9355
9466
  };
9356
- var canOpenProject = (group) => !group.isShared || !group.accessPolicies || group.accessPolicies.length > 0;
9357
- var SelfProjectLoading = () => {
9358
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-4", children: ["sk-1", "sk-2", "sk-3", "sk-4", "sk-5", "sk-6", "sk-7", "sk-8"].map(
9359
- (itemKey) => /* @__PURE__ */ jsxRuntime.jsx(ProjectCardLoadingSkeleton, {}, itemKey)
9467
+ var getLastUpdatedCellLabel = (group) => {
9468
+ const timestamp = getLatestProjectUpdate(group);
9469
+ return timestamp === 0 ? "Not updated yet" : `Updated ${dateFns.formatDistanceToNow(timestamp, { addSuffix: true })}`;
9470
+ };
9471
+ var CARD_RADIUS = "0.75rem";
9472
+ var ROW_SPACING = "0 0.5rem";
9473
+ var cardCorners = {
9474
+ left: {
9475
+ borderTopLeftRadius: CARD_RADIUS,
9476
+ borderBottomLeftRadius: CARD_RADIUS
9477
+ },
9478
+ right: {
9479
+ borderTopRightRadius: CARD_RADIUS,
9480
+ borderBottomRightRadius: CARD_RADIUS
9481
+ }
9482
+ };
9483
+ var SharedStatus = ({ isShared }) => isShared ? /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "outline", className: "flex w-fit items-center gap-1", children: [
9484
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UsersRound, { size: 16 }),
9485
+ "Shared"
9486
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2014" });
9487
+ var AddProjectListAction = ({ mobile = false }) => {
9488
+ const { handleClick, isDisabled, isFetching } = useCreateProjectRedirect();
9489
+ const action = /* @__PURE__ */ jsxRuntime.jsxs(
9490
+ Button,
9491
+ {
9492
+ type: "button",
9493
+ variant: "ghost",
9494
+ className: "text-primary w-full justify-start gap-2",
9495
+ disabled: isDisabled || isFetching,
9496
+ onClick: handleClick,
9497
+ children: [
9498
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }),
9499
+ "Add Project"
9500
+ ]
9501
+ }
9502
+ );
9503
+ if (mobile) {
9504
+ return /* @__PURE__ */ jsxRuntime.jsx(
9505
+ Card,
9506
+ {
9507
+ "data-testid": "add-project-list-row",
9508
+ className: "border-primary/30 rounded-xl border border-dashed p-2",
9509
+ children: action
9510
+ }
9511
+ );
9512
+ }
9513
+ return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "data-testid": "add-project-list-row", className: "border-0", children: /* @__PURE__ */ jsxRuntime.jsx(
9514
+ TableCell,
9515
+ {
9516
+ colSpan: 5,
9517
+ className: "border-primary/30 border border-dashed bg-transparent p-2",
9518
+ style: { borderRadius: CARD_RADIUS },
9519
+ children: action
9520
+ }
9360
9521
  ) });
9361
9522
  };
9362
- var SelfProject = ({ canCreateProject = false }) => {
9363
- const { data: data2, isLoading, isFetching } = chunkUVMFL4UV_cjs.useGetProjects({ enabled: true });
9364
- if (isLoading || isFetching) return /* @__PURE__ */ jsxRuntime.jsx(SelfProjectLoading, {});
9365
- const projectGroups = data2 || [];
9366
- if (!projectGroups.length && canCreateProject)
9367
- return /* @__PURE__ */ jsxRuntime.jsx(ConsoleCreateProject, {});
9368
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "flex flex-col gap-4", children: [
9369
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
9370
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
9371
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "shrink-0 text-base font-semibold text-[hsl(var(--high-emphasis))]", children: "Your Blocks Projects" }),
9372
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary/10 text-primary rounded-full px-2 py-0.5 text-xs font-semibold", children: projectGroups.length })
9373
- ] }),
9374
- canCreateProject && projectGroups.length > 9 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-sm text-[hsl(var(--medium-emphasis))]", children: "Please delete an existing project to create a new one." })
9375
- ] }),
9376
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-4", children: [
9377
- projectGroups.length < 10 && /* @__PURE__ */ jsxRuntime.jsx(
9378
- framerMotion.motion.div,
9379
- {
9380
- variants: cardVariants,
9381
- custom: 0,
9382
- initial: "hidden",
9383
- animate: "visible",
9384
- children: /* @__PURE__ */ jsxRuntime.jsx(AddProjectCard, {})
9385
- }
9386
- ),
9387
- projectGroups.map((project, i) => /* @__PURE__ */ jsxRuntime.jsx(
9388
- framerMotion.motion.div,
9389
- {
9390
- variants: cardVariants,
9391
- custom: projectGroups.length < 10 ? i + 1 : i,
9392
- initial: "hidden",
9393
- animate: "visible",
9394
- children: project.projects[0] && /* @__PURE__ */ jsxRuntime.jsx(
9395
- ProjectCard,
9523
+ var ProjectMobileList = ({
9524
+ projectGroups,
9525
+ showAddProject
9526
+ }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-3", "data-testid": "project-list-mobile", children: [
9527
+ showAddProject && /* @__PURE__ */ jsxRuntime.jsx(AddProjectListAction, { mobile: true }),
9528
+ projectGroups.map((group) => {
9529
+ const project = group.projects[0];
9530
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9531
+ Card,
9532
+ {
9533
+ "data-testid": "project-list-row",
9534
+ className: "border-border/60 space-y-3 rounded-xl border p-4 shadow-sm",
9535
+ children: [
9536
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
9537
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-2", children: [
9538
+ /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "break-all text-base", children: getProjectGroupName(group) || "Unnamed project" }),
9539
+ /* @__PURE__ */ jsxRuntime.jsx(SharedStatus, { isShared: group.isShared })
9540
+ ] }),
9541
+ project && /* @__PURE__ */ jsxRuntime.jsx(
9542
+ ProjectActionButton,
9543
+ {
9544
+ project,
9545
+ isShared: group.isShared,
9546
+ canOpen: canOpenProject(group)
9547
+ }
9548
+ )
9549
+ ] }),
9550
+ /* @__PURE__ */ jsxRuntime.jsx(ProjectEnvironments, { projects: group.projects }),
9551
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground text-xs", children: [
9552
+ "Last updated ",
9553
+ getLastUpdatedLabel(group)
9554
+ ] })
9555
+ ]
9556
+ },
9557
+ group.tenantGroupId
9558
+ );
9559
+ })
9560
+ ] });
9561
+ var ProjectList = ({
9562
+ projectGroups,
9563
+ showAddProject
9564
+ }) => {
9565
+ const isMobile = chunkQ7Y32IBM_cjs.useIsMobile();
9566
+ if (isMobile) {
9567
+ return /* @__PURE__ */ jsxRuntime.jsx(
9568
+ ProjectMobileList,
9569
+ {
9570
+ projectGroups,
9571
+ showAddProject
9572
+ }
9573
+ );
9574
+ }
9575
+ return /* @__PURE__ */ jsxRuntime.jsx(
9576
+ Table,
9577
+ {
9578
+ "data-testid": "project-list-table",
9579
+ style: { borderCollapse: "separate", borderSpacing: ROW_SPACING },
9580
+ children: /* @__PURE__ */ jsxRuntime.jsxs(TableBody, { children: [
9581
+ showAddProject && /* @__PURE__ */ jsxRuntime.jsx(AddProjectListAction, {}),
9582
+ projectGroups.map((group) => {
9583
+ const project = group.projects[0];
9584
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9585
+ TableRow,
9396
9586
  {
9397
- project: project.projects[0],
9398
- projects: project.projects,
9399
- isShared: project.isShared,
9587
+ "data-testid": "project-list-row",
9588
+ className: "border-0",
9589
+ children: [
9590
+ /* @__PURE__ */ jsxRuntime.jsx(
9591
+ TableCell,
9592
+ {
9593
+ className: "bg-card max-w-64 break-all py-2 font-medium",
9594
+ style: cardCorners.left,
9595
+ children: getProjectGroupName(group) || "Unnamed project"
9596
+ }
9597
+ ),
9598
+ /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "bg-card py-2", children: /* @__PURE__ */ jsxRuntime.jsx(ProjectEnvironments, { projects: group.projects }) }),
9599
+ /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "bg-card py-2", children: /* @__PURE__ */ jsxRuntime.jsx(SharedStatus, { isShared: group.isShared }) }),
9600
+ /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "bg-card whitespace-nowrap py-2 text-muted-foreground", children: getLastUpdatedCellLabel(group) }),
9601
+ /* @__PURE__ */ jsxRuntime.jsx(
9602
+ TableCell,
9603
+ {
9604
+ className: "bg-card py-2 text-right",
9605
+ style: cardCorners.right,
9606
+ children: project && /* @__PURE__ */ jsxRuntime.jsx(
9607
+ ProjectActionButton,
9608
+ {
9609
+ project,
9610
+ isShared: group.isShared,
9611
+ canOpen: canOpenProject(group)
9612
+ }
9613
+ )
9614
+ }
9615
+ )
9616
+ ]
9617
+ },
9618
+ group.tenantGroupId
9619
+ );
9620
+ })
9621
+ ] })
9622
+ }
9623
+ );
9624
+ };
9625
+ function MultiSelect2({
9626
+ label,
9627
+ options,
9628
+ onChange,
9629
+ value: selectedValues
9630
+ }) {
9631
+ const [buttonRef, popoverWidth] = chunkGZSVB47D_cjs.usePopoverWidth();
9632
+ const onSelectHandler = (value) => {
9633
+ const nextValues = selectedValues.includes(value) ? selectedValues.filter((item) => item !== value) : [...selectedValues, value];
9634
+ onChange(nextValues);
9635
+ };
9636
+ const onResetHandler = () => {
9637
+ onChange([]);
9638
+ };
9639
+ const isMobile = chunkQ7Y32IBM_cjs.useIsMobile();
9640
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9641
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
9642
+ Button,
9643
+ {
9644
+ ref: buttonRef,
9645
+ variant: "outline",
9646
+ size: "sm",
9647
+ className: "h-8 rounded-md border-dashed",
9648
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [
9649
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
9650
+ /* @__PURE__ */ jsxRuntime.jsx(reactIcons.PlusCircledIcon, { className: "mr-2 h-4 w-4" }),
9651
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: label }),
9652
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sm:hidden", children: label?.split(" ")[0] })
9653
+ ] }),
9654
+ selectedValues?.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9655
+ /* @__PURE__ */ jsxRuntime.jsx(
9656
+ Separator,
9657
+ {
9658
+ orientation: "vertical",
9659
+ className: "hidden h-4 sm:mx-2 sm:block"
9660
+ }
9661
+ ),
9662
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex space-x-1", children: selectedValues.length > 2 ? /* @__PURE__ */ jsxRuntime.jsxs(
9663
+ Badge,
9664
+ {
9665
+ variant: "outline",
9666
+ className: "rounded-sm px-1 font-normal",
9667
+ children: [
9668
+ selectedValues.length,
9669
+ " selected"
9670
+ ]
9671
+ }
9672
+ ) : options.filter((option) => selectedValues.includes(option.value)).map((option) => /* @__PURE__ */ jsxRuntime.jsx(
9673
+ Badge,
9674
+ {
9675
+ variant: "outline",
9676
+ className: "rounded-sm px-1 font-normal",
9677
+ children: option.label
9678
+ },
9679
+ option.value
9680
+ )) })
9681
+ ] })
9682
+ ] })
9683
+ }
9684
+ ) }),
9685
+ /* @__PURE__ */ jsxRuntime.jsx(
9686
+ PopoverContent,
9687
+ {
9688
+ className: "w-auto p-0 sm:w-full",
9689
+ align: "start",
9690
+ style: isMobile ? { width: popoverWidth ? `${popoverWidth}px` : "auto" } : void 0,
9691
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Command, { children: [
9692
+ /* @__PURE__ */ jsxRuntime.jsx(CommandInput, { placeholder: label }),
9693
+ /* @__PURE__ */ jsxRuntime.jsxs(CommandList, { children: [
9694
+ /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: "No results found." }),
9695
+ /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: options.map((option) => {
9696
+ const isSelected = selectedValues.includes(option.value);
9697
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9698
+ CommandItem,
9699
+ {
9700
+ onSelect: () => onSelectHandler(option.value),
9701
+ children: [
9702
+ /* @__PURE__ */ jsxRuntime.jsx(
9703
+ "div",
9704
+ {
9705
+ className: chunkYAF2X7W5_cjs.cn(
9706
+ "mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
9707
+ isSelected ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"
9708
+ ),
9709
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.CheckIcon, { className: chunkYAF2X7W5_cjs.cn("h-4 w-4") })
9710
+ }
9711
+ ),
9712
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label })
9713
+ ]
9714
+ },
9715
+ option.value
9716
+ );
9717
+ }) }),
9718
+ selectedValues.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9719
+ /* @__PURE__ */ jsxRuntime.jsx(CommandSeparator, {}),
9720
+ /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(
9721
+ CommandItem,
9722
+ {
9723
+ onSelect: () => onResetHandler(),
9724
+ className: "justify-center text-center",
9725
+ children: "Clear"
9726
+ }
9727
+ ) })
9728
+ ] })
9729
+ ] })
9730
+ ] })
9731
+ }
9732
+ )
9733
+ ] });
9734
+ }
9735
+ var ResetButton = ({ onClick }) => {
9736
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9737
+ Button,
9738
+ {
9739
+ type: "button",
9740
+ variant: "outline",
9741
+ onClick,
9742
+ className: "h-8 rounded-md px-2 lg:px-3",
9743
+ children: [
9744
+ "Reset",
9745
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "ml-2 h-4 w-4" })
9746
+ ]
9747
+ }
9748
+ );
9749
+ };
9750
+ var SearchInput = ({
9751
+ onChange,
9752
+ placeholder = "Search...",
9753
+ value,
9754
+ className = ""
9755
+ }) => {
9756
+ const [state, setState] = React8.useState(value);
9757
+ const inputRef = React8.useRef(null);
9758
+ React8.useEffect(() => {
9759
+ setState(value);
9760
+ }, [value]);
9761
+ const debounced = React8.useRef(
9762
+ chunkVTOD5ZQU_cjs.debounce((val) => {
9763
+ onChange(val);
9764
+ }, 300)
9765
+ ).current;
9766
+ React8.useEffect(() => {
9767
+ return () => {
9768
+ debounced.cancel();
9769
+ };
9770
+ }, [debounced]);
9771
+ const handleChange = (event) => {
9772
+ event.stopPropagation();
9773
+ setState(event.target.value);
9774
+ debounced(event.target.value);
9775
+ };
9776
+ const handleClear = (e) => {
9777
+ e.stopPropagation();
9778
+ setState("");
9779
+ onChange("");
9780
+ };
9781
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md border bg-background flex items-center px-2", children: [
9782
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 text-muted-foreground" }),
9783
+ /* @__PURE__ */ jsxRuntime.jsx(
9784
+ Input,
9785
+ {
9786
+ ref: inputRef,
9787
+ placeholder,
9788
+ value: state,
9789
+ onChange: handleChange,
9790
+ className: chunkYAF2X7W5_cjs.cn(
9791
+ "h-8 w-52 border-none p-0 focus-visible:ring-0 focus-visible:ring-offset-0",
9792
+ className
9793
+ )
9794
+ }
9795
+ ),
9796
+ /* @__PURE__ */ jsxRuntime.jsx(
9797
+ Button,
9798
+ {
9799
+ variant: "ghost",
9800
+ size: "xs",
9801
+ className: chunkYAF2X7W5_cjs.cn(
9802
+ "h-full p-1 pr-0 hover:bg-transparent",
9803
+ !value && "invisible"
9804
+ ),
9805
+ onClick: handleClear,
9806
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4 text-muted-foreground" })
9807
+ }
9808
+ )
9809
+ ] });
9810
+ };
9811
+ var ProjectToolbar = ({
9812
+ availableEnvironmentOptions,
9813
+ environmentFilter,
9814
+ onEnvironmentFilterChange,
9815
+ onReset,
9816
+ onSearchTextChange,
9817
+ onViewModeChange,
9818
+ searchText,
9819
+ viewMode
9820
+ }) => {
9821
+ const hasActiveFilters = searchText.trim().length > 0 || environmentFilter.length > 0;
9822
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9823
+ "div",
9824
+ {
9825
+ className: "flex flex-wrap items-center justify-between gap-3",
9826
+ "aria-label": "Project filters and view",
9827
+ children: [
9828
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
9829
+ /* @__PURE__ */ jsxRuntime.jsx(
9830
+ SearchInput,
9831
+ {
9832
+ value: searchText,
9833
+ onChange: onSearchTextChange,
9834
+ placeholder: "Search projects..."
9835
+ }
9836
+ ),
9837
+ /* @__PURE__ */ jsxRuntime.jsx(
9838
+ MultiSelect2,
9839
+ {
9840
+ label: "Environment",
9841
+ options: availableEnvironmentOptions,
9842
+ value: environmentFilter,
9843
+ onChange: onEnvironmentFilterChange
9844
+ }
9845
+ ),
9846
+ hasActiveFilters && /* @__PURE__ */ jsxRuntime.jsx(ResetButton, { onClick: onReset })
9847
+ ] }),
9848
+ /* @__PURE__ */ jsxRuntime.jsxs(
9849
+ ToggleGroup,
9850
+ {
9851
+ type: "single",
9852
+ variant: "outline",
9853
+ size: "sm",
9854
+ value: viewMode,
9855
+ onValueChange: (value) => {
9856
+ if (value === "grid" || value === "list") onViewModeChange(value);
9857
+ },
9858
+ "aria-label": "Project view",
9859
+ className: "h-8 rounded-md border bg-background p-0.5",
9860
+ children: [
9861
+ /* @__PURE__ */ jsxRuntime.jsx(
9862
+ ToggleGroupItem,
9863
+ {
9864
+ value: "grid",
9865
+ "aria-label": "Grid view",
9866
+ className: "h-7 w-7 min-w-0 border-0 px-0",
9867
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutGrid, { className: "h-4 w-4" })
9868
+ }
9869
+ ),
9870
+ /* @__PURE__ */ jsxRuntime.jsx(
9871
+ ToggleGroupItem,
9872
+ {
9873
+ value: "list",
9874
+ "aria-label": "List view",
9875
+ className: "h-7 w-7 min-w-0 border-0 px-0",
9876
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "h-4 w-4" })
9877
+ }
9878
+ )
9879
+ ]
9880
+ }
9881
+ )
9882
+ ]
9883
+ }
9884
+ );
9885
+ };
9886
+ var DEFAULT_SORT = {
9887
+ property: "lastUpdatedDate",
9888
+ isDescending: true
9889
+ };
9890
+ var projectViewStorage = chunkVTOD5ZQU_cjs.createStorage("local", { prefix: "console" });
9891
+ var VIEW_MODE_KEY = "projectsViewMode";
9892
+ var readViewMode = () => {
9893
+ const storedValue = projectViewStorage.get(VIEW_MODE_KEY);
9894
+ return storedValue === "list" || storedValue === "grid" ? storedValue : "grid";
9895
+ };
9896
+ var SEARCH_OPTIONS = {
9897
+ keys: ["representativeName"],
9898
+ threshold: 0.3
9899
+ };
9900
+ var useProjectListState = (projectGroups) => {
9901
+ const [viewMode, setViewMode] = React8.useState(readViewMode);
9902
+ const [searchText, setSearchText] = React8.useState("");
9903
+ const [environmentFilter, setEnvironmentFilter] = React8.useState([]);
9904
+ const [sort, setSort] = React8.useState(DEFAULT_SORT);
9905
+ const searchableGroups = React8.useMemo(
9906
+ () => projectGroups.map((group) => ({
9907
+ group,
9908
+ representativeName: getProjectGroupName(group)
9909
+ })),
9910
+ [projectGroups]
9911
+ );
9912
+ const searchedGroups = chunkGZSVB47D_cjs.useDebouncedFuseFilter(
9913
+ searchableGroups,
9914
+ searchText,
9915
+ SEARCH_OPTIONS
9916
+ );
9917
+ const visibleProjectGroups = React8.useMemo(() => {
9918
+ const filteredGroups = searchedGroups.map(({ group }) => group).filter(
9919
+ (group) => environmentFilter.length === 0 || group.projects.some(
9920
+ (project) => environmentFilter.includes(project.environment)
9921
+ )
9922
+ );
9923
+ return filteredGroups.toSorted((left, right) => {
9924
+ const comparison = sort.property === "name" ? getProjectGroupName(left).localeCompare(getProjectGroupName(right)) : getLatestProjectUpdate(left) - getLatestProjectUpdate(right);
9925
+ return sort.isDescending ? -comparison : comparison;
9926
+ });
9927
+ }, [environmentFilter, searchedGroups, sort]);
9928
+ const availableEnvironmentOptions = React8.useMemo(() => {
9929
+ const presentValues = new Set(
9930
+ projectGroups.flatMap(
9931
+ (group) => group.projects.map((project) => project.environment).filter((environment) => environment.length > 0)
9932
+ )
9933
+ );
9934
+ const knownOptions = environmentOptions.filter((option) => presentValues.delete(option.value)).map(({ label, value }) => ({ label, value }));
9935
+ const unknownOptions = [...presentValues].sort((left, right) => left.localeCompare(right)).map((value) => ({ label: value, value }));
9936
+ return [...knownOptions, ...unknownOptions];
9937
+ }, [projectGroups]);
9938
+ const persistViewMode = React8.useCallback((nextViewMode) => {
9939
+ setViewMode(nextViewMode);
9940
+ projectViewStorage.set(VIEW_MODE_KEY, nextViewMode);
9941
+ }, []);
9942
+ const resetFilters = React8.useCallback(() => {
9943
+ setSearchText("");
9944
+ setEnvironmentFilter([]);
9945
+ }, []);
9946
+ return {
9947
+ availableEnvironmentOptions,
9948
+ environmentFilter,
9949
+ resetFilters,
9950
+ searchText,
9951
+ setEnvironmentFilter,
9952
+ setSearchText,
9953
+ setSort,
9954
+ setViewMode: persistViewMode,
9955
+ sort,
9956
+ viewMode,
9957
+ visibleProjectGroups
9958
+ };
9959
+ };
9960
+ var cardVariants = {
9961
+ hidden: { opacity: 0, y: 20, scale: 0.97 },
9962
+ visible: (i) => ({
9963
+ opacity: 1,
9964
+ y: 0,
9965
+ scale: 1,
9966
+ transition: {
9967
+ delay: i * 0.06,
9968
+ duration: 0.4,
9969
+ ease: [0.22, 1, 0.36, 1]
9970
+ }
9971
+ })
9972
+ };
9973
+ var SelfProjectLoading = ({ viewMode }) => {
9974
+ if (viewMode === "list") {
9975
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: ["sk-1", "sk-2", "sk-3", "sk-4", "sk-5"].map((itemKey) => /* @__PURE__ */ jsxRuntime.jsx(ProjectListRowLoadingSkeleton, {}, itemKey)) });
9976
+ }
9977
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-4", children: ["sk-1", "sk-2", "sk-3", "sk-4", "sk-5", "sk-6", "sk-7", "sk-8"].map(
9978
+ (itemKey) => /* @__PURE__ */ jsxRuntime.jsx(ProjectCardLoadingSkeleton, {}, itemKey)
9979
+ ) });
9980
+ };
9981
+ var SelfProject = ({ canCreateProject = false }) => {
9982
+ const { data: data2, isLoading, isFetching } = chunkUVMFL4UV_cjs.useGetProjects({ enabled: true });
9983
+ const isPending = isLoading || isFetching;
9984
+ const projectGroups = data2 || [];
9985
+ const {
9986
+ availableEnvironmentOptions,
9987
+ environmentFilter,
9988
+ resetFilters,
9989
+ searchText,
9990
+ setEnvironmentFilter,
9991
+ setSearchText,
9992
+ setViewMode,
9993
+ viewMode,
9994
+ visibleProjectGroups
9995
+ } = useProjectListState(projectGroups);
9996
+ if (!isPending && !projectGroups.length && canCreateProject)
9997
+ return /* @__PURE__ */ jsxRuntime.jsx(ConsoleCreateProject, {});
9998
+ const showAddProject = projectGroups.length < 10 && searchText.trim().length === 0;
9999
+ const hasNoMatches = projectGroups.length > 0 && visibleProjectGroups.length === 0;
10000
+ let projectsContent;
10001
+ if (isPending) {
10002
+ projectsContent = /* @__PURE__ */ jsxRuntime.jsx(SelfProjectLoading, { viewMode });
10003
+ } else if (viewMode === "grid") {
10004
+ projectsContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-4", children: [
10005
+ showAddProject && /* @__PURE__ */ jsxRuntime.jsx(
10006
+ framerMotion.motion.div,
10007
+ {
10008
+ variants: cardVariants,
10009
+ custom: 0,
10010
+ initial: "hidden",
10011
+ animate: "visible",
10012
+ children: /* @__PURE__ */ jsxRuntime.jsx(AddProjectCard, {})
10013
+ }
10014
+ ),
10015
+ visibleProjectGroups.map((project, index) => /* @__PURE__ */ jsxRuntime.jsx(
10016
+ framerMotion.motion.div,
10017
+ {
10018
+ variants: cardVariants,
10019
+ custom: showAddProject ? index + 1 : index,
10020
+ initial: "hidden",
10021
+ animate: "visible",
10022
+ children: project.projects[0] && /* @__PURE__ */ jsxRuntime.jsx(
10023
+ ProjectCard,
10024
+ {
10025
+ project: project.projects[0],
10026
+ projects: project.projects,
10027
+ isShared: project.isShared,
9400
10028
  canOpen: canOpenProject(project)
9401
10029
  }
9402
10030
  )
9403
10031
  },
9404
10032
  project.tenantGroupId
9405
10033
  ))
10034
+ ] });
10035
+ } else {
10036
+ projectsContent = /* @__PURE__ */ jsxRuntime.jsx(
10037
+ ProjectList,
10038
+ {
10039
+ projectGroups: visibleProjectGroups,
10040
+ showAddProject
10041
+ }
10042
+ );
10043
+ }
10044
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "flex flex-col gap-4", children: [
10045
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3", children: [
10046
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [
10047
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "shrink-0 text-base font-semibold text-[hsl(var(--high-emphasis))]", children: "Your Blocks Projects" }),
10048
+ isPending ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-5 w-8 rounded-full" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary/10 text-primary shrink-0 rounded-full px-2 py-0.5 text-xs font-semibold", children: projectGroups.length })
10049
+ ] }),
10050
+ !isPending && canCreateProject && projectGroups.length > 9 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-[hsl(var(--medium-emphasis))]", children: "Please delete an existing project to create a new one." })
10051
+ ] }),
10052
+ (isPending || projectGroups.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(
10053
+ ProjectToolbar,
10054
+ {
10055
+ availableEnvironmentOptions,
10056
+ environmentFilter,
10057
+ onEnvironmentFilterChange: setEnvironmentFilter,
10058
+ onReset: resetFilters,
10059
+ onSearchTextChange: setSearchText,
10060
+ onViewModeChange: setViewMode,
10061
+ searchText,
10062
+ viewMode
10063
+ }
10064
+ ),
10065
+ projectsContent,
10066
+ hasNoMatches && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-10 text-center", children: [
10067
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-muted-foreground", children: searchText.trim() ? "No projects match your search" : "No projects match the selected filters" }),
10068
+ /* @__PURE__ */ jsxRuntime.jsx(
10069
+ Button,
10070
+ {
10071
+ type: "button",
10072
+ variant: "outline",
10073
+ size: "sm",
10074
+ onClick: () => {
10075
+ if (searchText.trim()) setSearchText("");
10076
+ else setEnvironmentFilter([]);
10077
+ },
10078
+ children: searchText.trim() ? "Clear search" : "Clear filters"
10079
+ }
10080
+ )
9406
10081
  ] })
9407
10082
  ] });
9408
10083
  };
@@ -9465,7 +10140,7 @@ var CallbackPage = ({ defaultRedirectUrl }) => {
9465
10140
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-screen items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader, { className: "h-12 w-12 animate-spin text-gray-500" }) });
9466
10141
  };
9467
10142
  function ProfilePage() {
9468
- const { isLoading, error } = chunk6TMMJJRJ_cjs.useInitiateRedirect({
10143
+ const { isLoading, error } = chunkGZSVB47D_cjs.useInitiateRedirect({
9469
10144
  clientId: chunkX4YCRWXO_cjs.getRuntimeEnv("BLOCKS_IAM_CLIENT_ID"),
9470
10145
  redirectUri: chunkX4YCRWXO_cjs.getRuntimeEnv("BLOCKS_IAM_CALLBACK_URL"),
9471
10146
  forwardedTo: "/app/profile"
@@ -9743,7 +10418,7 @@ var ConfirmationModal = ({
9743
10418
  ] })
9744
10419
  ] });
9745
10420
  var DashboardOverview = () => {
9746
- const { name } = chunk6TMMJJRJ_cjs.useBlocksAppConfigStore((state) => state.config);
10421
+ const { name } = chunkGZSVB47D_cjs.useBlocksAppConfigStore((state) => state.config);
9747
10422
  const { data: data2, isFetching } = chunkUVMFL4UV_cjs.useGetProject();
9748
10423
  const {
9749
10424
  endpoints,
@@ -9832,7 +10507,7 @@ var wildcardToRegex2 = (pattern) => {
9832
10507
  const escaped = pattern.replace(/[-/\\^$+?.()|[\]{}]/g, "\\$&");
9833
10508
  return `^${escaped.replace(/\*/g, "[^/]+")}$`;
9834
10509
  };
9835
- function ProjectList({
10510
+ function ProjectList2({
9836
10511
  redirectPaths,
9837
10512
  collapsed = false
9838
10513
  }) {
@@ -10384,8 +11059,8 @@ function EditProject() {
10384
11059
  ] });
10385
11060
  }
10386
11061
  var ProjectCardLoadingSkeleton = () => {
10387
- return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "border-border/60 flex h-[160px] flex-col overflow-hidden rounded-xl border p-4 shadow-sm", children: [
10388
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
11062
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "border-border/60 bg-card flex h-40 flex-col overflow-hidden rounded-xl border p-4 shadow-sm", children: [
11063
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-2", children: [
10389
11064
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
10390
11065
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-4/5" }),
10391
11066
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "mt-1.5 h-4 w-3/5" })
@@ -10398,12 +11073,20 @@ var ProjectCardLoadingSkeleton = () => {
10398
11073
  ] })
10399
11074
  ] });
10400
11075
  };
11076
+ var ProjectListRowLoadingSkeleton = () => {
11077
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "border-border/60 bg-card flex h-14 items-center gap-4 rounded-xl border px-4 py-2 shadow-sm", children: [
11078
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-32" }),
11079
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-5 w-16 shrink-0 rounded-full" }),
11080
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "ml-auto h-4 w-20 shrink-0" }),
11081
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-8 shrink-0 rounded-md" })
11082
+ ] });
11083
+ };
10401
11084
  function SidebarMobileView({
10402
11085
  redirectPaths,
10403
11086
  navigationMenus
10404
11087
  }) {
10405
11088
  const [open, setOpen] = React8.useState(false);
10406
- const { appLightLogo, appDarkLogo } = chunk6TMMJJRJ_cjs.useLogo();
11089
+ const { appLightLogo, appDarkLogo } = chunkGZSVB47D_cjs.useLogo();
10407
11090
  const allowedMenu = chunkQ7Y32IBM_cjs.useFilteredMenus(navigationMenus);
10408
11091
  return /* @__PURE__ */ jsxRuntime.jsxs(Sheet, { open, onOpenChange: setOpen, children: [
10409
11092
  /* @__PURE__ */ jsxRuntime.jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "icon", className: "shrink-0", children: [
@@ -10435,7 +11118,7 @@ function SidebarMobileView({
10435
11118
  /* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
10436
11119
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex w-full flex-col items-start px-6", children: [
10437
11120
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-1 text-sm text-low-emphasis", children: "Project" }),
10438
- /* @__PURE__ */ jsxRuntime.jsx(ProjectList, { redirectPaths })
11121
+ /* @__PURE__ */ jsxRuntime.jsx(ProjectList2, { redirectPaths })
10439
11122
  ] }),
10440
11123
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-3 flex w-full flex-col items-start px-6", children: [
10441
11124
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-1 text-sm text-low-emphasis", children: "Environment" }),
@@ -10453,8 +11136,8 @@ function SidebarMenuDesktop({
10453
11136
  navigationMenus
10454
11137
  }) {
10455
11138
  const { isSidebarOpen, toggleSidebar } = React8.useContext(chunkZVGCCTNK_cjs.SidebarContext);
10456
- const { appLightLogo, appDarkLogo } = chunk6TMMJJRJ_cjs.useLogo();
10457
- const icon = chunk6TMMJJRJ_cjs.useIcon();
11139
+ const { appLightLogo, appDarkLogo } = chunkGZSVB47D_cjs.useLogo();
11140
+ const icon = chunkGZSVB47D_cjs.useIcon();
10458
11141
  const allowedMenu = chunkQ7Y32IBM_cjs.useFilteredMenus(navigationMenus);
10459
11142
  const { isActivePath: isProjectOverviewRoute } = chunkQ7Y32IBM_cjs.useIsActiveMenu("/app/project");
10460
11143
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10503,11 +11186,11 @@ function SidebarMenuDesktop({
10503
11186
  isSidebarOpen ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b px-2 pb-2 pt-2", children: [
10504
11187
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 px-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: "Workspace" }),
10505
11188
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
10506
- /* @__PURE__ */ jsxRuntime.jsx(ProjectList, { redirectPaths }),
11189
+ /* @__PURE__ */ jsxRuntime.jsx(ProjectList2, { redirectPaths }),
10507
11190
  /* @__PURE__ */ jsxRuntime.jsx(RenderConditionally, { condition: !isProjectOverviewRoute, children: /* @__PURE__ */ jsxRuntime.jsx(EnvironmentList, { redirectPaths }) })
10508
11191
  ] })
10509
11192
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b py-1", children: [
10510
- /* @__PURE__ */ jsxRuntime.jsx(ProjectList, { redirectPaths, collapsed: true }),
11193
+ /* @__PURE__ */ jsxRuntime.jsx(ProjectList2, { redirectPaths, collapsed: true }),
10511
11194
  /* @__PURE__ */ jsxRuntime.jsx(RenderConditionally, { condition: !isProjectOverviewRoute, children: /* @__PURE__ */ jsxRuntime.jsx(EnvironmentList, { redirectPaths, collapsed: true }) })
10512
11195
  ] }),
10513
11196
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("nav", { className: chunkYAF2X7W5_cjs.cn("grid w-full items-start gap-1 text-sm"), children: allowedMenu.map((menu) => /* @__PURE__ */ jsxRuntime.jsx(React8.Fragment, { children: menu.type === "menu" ? /* @__PURE__ */ jsxRuntime.jsx(DesktopMenuItem, { menu, isSidebarOpen }) : /* @__PURE__ */ jsxRuntime.jsx(Separator, {}) }, menu.id)) }) })
@@ -11540,116 +12223,6 @@ var DropdownSearchInput = ({
11540
12223
  )
11541
12224
  ] });
11542
12225
  };
11543
- function MultiSelect2({
11544
- label,
11545
- options,
11546
- onChange,
11547
- value: selectedValues
11548
- }) {
11549
- const [buttonRef, popoverWidth] = chunk6TMMJJRJ_cjs.usePopoverWidth();
11550
- const onSelectHandler = (value) => {
11551
- const nextValues = selectedValues.includes(value) ? selectedValues.filter((item) => item !== value) : [...selectedValues, value];
11552
- onChange(nextValues);
11553
- };
11554
- const onResetHandler = () => {
11555
- onChange([]);
11556
- };
11557
- const isMobile = chunkQ7Y32IBM_cjs.useIsMobile();
11558
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
11559
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
11560
- Button,
11561
- {
11562
- ref: buttonRef,
11563
- variant: "outline",
11564
- size: "sm",
11565
- className: "h-8 border-dashed",
11566
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [
11567
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
11568
- /* @__PURE__ */ jsxRuntime.jsx(reactIcons.PlusCircledIcon, { className: "mr-2 h-4 w-4" }),
11569
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: label }),
11570
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sm:hidden", children: label?.split(" ")[0] })
11571
- ] }),
11572
- selectedValues?.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11573
- /* @__PURE__ */ jsxRuntime.jsx(
11574
- Separator,
11575
- {
11576
- orientation: "vertical",
11577
- className: "hidden h-4 sm:mx-2 sm:block"
11578
- }
11579
- ),
11580
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex space-x-1", children: selectedValues.length > 2 ? /* @__PURE__ */ jsxRuntime.jsxs(
11581
- Badge,
11582
- {
11583
- variant: "secondary",
11584
- className: "rounded-sm px-1 font-normal",
11585
- children: [
11586
- selectedValues.length,
11587
- " selected"
11588
- ]
11589
- }
11590
- ) : options.filter((option) => selectedValues.includes(option.value)).map((option) => /* @__PURE__ */ jsxRuntime.jsx(
11591
- Badge,
11592
- {
11593
- variant: "secondary",
11594
- className: "rounded-sm px-1 font-normal",
11595
- children: option.label
11596
- },
11597
- option.value
11598
- )) })
11599
- ] })
11600
- ] })
11601
- }
11602
- ) }),
11603
- /* @__PURE__ */ jsxRuntime.jsx(
11604
- PopoverContent,
11605
- {
11606
- className: "w-auto p-0 sm:w-full",
11607
- align: "start",
11608
- style: isMobile ? { width: popoverWidth ? `${popoverWidth}px` : "auto" } : void 0,
11609
- children: /* @__PURE__ */ jsxRuntime.jsxs(Command, { children: [
11610
- /* @__PURE__ */ jsxRuntime.jsx(CommandInput, { placeholder: label }),
11611
- /* @__PURE__ */ jsxRuntime.jsxs(CommandList, { children: [
11612
- /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: "No results found." }),
11613
- /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: options.map((option) => {
11614
- const isSelected = selectedValues.includes(option.value);
11615
- return /* @__PURE__ */ jsxRuntime.jsxs(
11616
- CommandItem,
11617
- {
11618
- onSelect: () => onSelectHandler(option.value),
11619
- children: [
11620
- /* @__PURE__ */ jsxRuntime.jsx(
11621
- "div",
11622
- {
11623
- className: chunkYAF2X7W5_cjs.cn(
11624
- "mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
11625
- isSelected ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"
11626
- ),
11627
- children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.CheckIcon, { className: chunkYAF2X7W5_cjs.cn("h-4 w-4") })
11628
- }
11629
- ),
11630
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label })
11631
- ]
11632
- },
11633
- option.value
11634
- );
11635
- }) }),
11636
- selectedValues.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11637
- /* @__PURE__ */ jsxRuntime.jsx(CommandSeparator, {}),
11638
- /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(
11639
- CommandItem,
11640
- {
11641
- onSelect: () => onResetHandler(),
11642
- className: "justify-center text-center",
11643
- children: "Clear"
11644
- }
11645
- ) })
11646
- ] })
11647
- ] })
11648
- ] })
11649
- }
11650
- )
11651
- ] });
11652
- }
11653
12226
  var ClearButton = ({ onClear }) => {
11654
12227
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-1", children: /* @__PURE__ */ jsxRuntime.jsx(
11655
12228
  Button,
@@ -11663,7 +12236,7 @@ var ClearButton = ({ onClear }) => {
11663
12236
  };
11664
12237
  function Radio({ label, options, onChange, value }) {
11665
12238
  const [search, setSearch] = React8.useState("");
11666
- const [buttonRef, popoverWidth] = chunk6TMMJJRJ_cjs.usePopoverWidth();
12239
+ const [buttonRef, popoverWidth] = chunkGZSVB47D_cjs.usePopoverWidth();
11667
12240
  const isMobile = chunkQ7Y32IBM_cjs.useIsMobile();
11668
12241
  const selected = React8.useMemo(
11669
12242
  () => options.find((item) => item.value === value) || null,
@@ -11758,82 +12331,6 @@ function Radio({ label, options, onChange, value }) {
11758
12331
  )
11759
12332
  ] });
11760
12333
  }
11761
- var ResetButton = ({ onClick }) => {
11762
- return /* @__PURE__ */ jsxRuntime.jsxs(
11763
- Button,
11764
- {
11765
- type: "button",
11766
- variant: "outline",
11767
- onClick,
11768
- className: "h-8 px-2 lg:px-3",
11769
- children: [
11770
- "Reset",
11771
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "ml-2 h-4 w-4" })
11772
- ]
11773
- }
11774
- );
11775
- };
11776
- var SearchInput = ({
11777
- onChange,
11778
- placeholder = "Search...",
11779
- value,
11780
- className = ""
11781
- }) => {
11782
- const [state, setState] = React8.useState(value);
11783
- const inputRef = React8.useRef(null);
11784
- React8.useEffect(() => {
11785
- setState(value);
11786
- }, [value]);
11787
- const debounced = React8.useRef(
11788
- chunkVTOD5ZQU_cjs.debounce((val) => {
11789
- onChange(val);
11790
- }, 300)
11791
- ).current;
11792
- React8.useEffect(() => {
11793
- return () => {
11794
- debounced.cancel();
11795
- };
11796
- }, [debounced]);
11797
- const handleChange = (event) => {
11798
- event.stopPropagation();
11799
- setState(event.target.value);
11800
- debounced(event.target.value);
11801
- };
11802
- const handleClear = (e) => {
11803
- e.stopPropagation();
11804
- setState("");
11805
- onChange("");
11806
- };
11807
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center rounded-sm border px-2", children: [
11808
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 text-muted-foreground" }),
11809
- /* @__PURE__ */ jsxRuntime.jsx(
11810
- Input,
11811
- {
11812
- ref: inputRef,
11813
- placeholder,
11814
- value: state,
11815
- onChange: handleChange,
11816
- className: chunkYAF2X7W5_cjs.cn(
11817
- "h-8 w-52 border-none p-0 focus-visible:ring-0 focus-visible:ring-offset-0",
11818
- className
11819
- )
11820
- }
11821
- ),
11822
- /* @__PURE__ */ jsxRuntime.jsx(
11823
- Button,
11824
- {
11825
- variant: "ghost",
11826
- size: "xs",
11827
- className: chunkYAF2X7W5_cjs.cn(
11828
- "h-full p-1 pr-0 hover:bg-transparent",
11829
- !value && "invisible"
11830
- ),
11831
- onClick: handleClear,
11832
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4 text-muted-foreground" })
11833
- }
11834
- )
11835
- ] });
11836
- };
11837
12334
  var sortQueryParsers = (initialValues) => ({
11838
12335
  sortProperty: nuqs.parseAsString.withDefault(initialValues.property),
11839
12336
  isDescending: nuqs.parseAsBoolean.withDefault(initialValues.isDescending)
@@ -12612,7 +13109,8 @@ exports.Progress = Progress;
12612
13109
  exports.ProjectActions = ProjectActions;
12613
13110
  exports.ProjectCardLoadingSkeleton = ProjectCardLoadingSkeleton;
12614
13111
  exports.ProjectDetail = ProjectDetail;
12615
- exports.ProjectList = ProjectList;
13112
+ exports.ProjectList = ProjectList2;
13113
+ exports.ProjectListRowLoadingSkeleton = ProjectListRowLoadingSkeleton;
12616
13114
  exports.ProjectOverview = ProjectOverview;
12617
13115
  exports.ProjectRepoList = ProjectRepoList;
12618
13116
  exports.PublicLayout = PublicLayout;
@@ -12740,5 +13238,5 @@ exports.usePaginationQueryParams = usePaginationQueryParams;
12740
13238
  exports.useRightSidePanel = useRightSidePanel;
12741
13239
  exports.useSortQueryParams = useSortQueryParams;
12742
13240
  exports.useWizardStepper = useWizardStepper;
12743
- //# sourceMappingURL=chunk-V4GJPS3E.cjs.map
12744
- //# sourceMappingURL=chunk-V4GJPS3E.cjs.map
13241
+ //# sourceMappingURL=chunk-SG3SZ45K.cjs.map
13242
+ //# sourceMappingURL=chunk-SG3SZ45K.cjs.map