Skip to content

feat: disable some features when blockchain is down#1971

Merged
stalniy merged 7 commits intoakash-network:mainfrom
jzsfkzm:feature/1948-disable-parts-when-blockchain-down
Sep 30, 2025
Merged

feat: disable some features when blockchain is down#1971
stalniy merged 7 commits intoakash-network:mainfrom
jzsfkzm:feature/1948-disable-parts-when-blockchain-down

Conversation

@jzsfkzm
Copy link
Contributor

@jzsfkzm jzsfkzm commented Sep 25, 2025

closes #1948

Summary by CodeRabbit

  • New Features

    • App-wide "Network Down" handling: shows a top banner and replaces/full-suppresses impacted UI (Authorizations displays a minimal notice) and disables actions (Deploy, Create Deployment/Certificate, Connect Managed Wallet, Accept Bid, Close Deployment); Settings hides Certificates when down.
  • Refactor

    • Consolidated top-banner system into a single provider/component to centralize banner logic and prioritization.
  • Style

    • Improved ARIA-disabled styling for buttons/links for better accessibility.
  • Tests

    • Added tests for disabled states and network-down scenarios.

@jzsfkzm jzsfkzm requested a review from a team as a code owner September 25, 2025 21:11
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

Adds blockchain-down awareness by reading settings.isBlockchainDown across UI: disables deploy/transaction actions, gates queries, hides certificates/authorizations, introduces TopBannerProvider/TopBanner, adds ARIA-disabled button styling, and updates tests and dependency wiring to include useSettings.

Changes

Cohort / File(s) Summary
Authorizations & Settings gating
apps/deploy-web/src/components/authorizations/Authorizations.tsx, apps/deploy-web/src/components/settings/SettingsContainer.tsx
Use useSettings(); show blockchain-down notice in Authorizations and hide Certificates fieldset in Settings when settings.isBlockchainDown.
Create actions gated (deploy/lease/cert)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx, apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx, apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
Import/use useSettings; include settings.isBlockchainDown in disabled conditions for create certificate / create lease / create deployment actions; add useSettings to DEPENDENCIES where applicable.
Navigation / CTA accessibility
apps/deploy-web/src/components/deployments/DeploymentList.tsx, apps/deploy-web/src/components/home/YourAccount.tsx, apps/deploy-web/src/components/layout/Sidebar.tsx
Read useSettings() and add aria-disabled={settings.isBlockchainDown} to Deploy links/buttons for accessibility when blockchain is down.
Wallet connect & dependency injection
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
Introduce dependencies prop/DEPENDENCIES bundle (now includes useSettings); read settings.isBlockchainDown and include in disabled/start-trial gating; component signature updated to accept optional dependencies.
Top banner consolidation & provider
apps/deploy-web/src/components/layout/Layout.tsx, apps/deploy-web/src/components/layout/TopBanner.tsx, apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx, apps/deploy-web/src/context/TopBannerProvider/index.ts
Add TopBannerProvider and useTopBanner; centralize banner rendering into TopBanner (Maintenance → NetworkDown → CreditCard); wrap Layout with provider and re-export provider/hook.
Banner hook API change
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
Signature changed to no-arg; removed maintenance flag dependency and simplified memo deps/logic for credit-card banner visibility.
Query gating for grants/allowances
apps/deploy-web/src/queries/useGrantsQuery.ts
Add useSettings() and include !settings.isBlockchainDown in query options.enabled gating for grants/allowances queries.
SettingsProvider export change
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
Export SettingsProviderContext (was private) to enable test/mocking and consumer access.
UI ARIA-disabled styling
packages/ui/components/button.tsx
Add aria-[disabled='true'] CSS rules (pointer-events none, reduced opacity) to button base styles.
Tests updated/added
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx, apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx, apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx, apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
Extend mocks to include isBlockchainDown; add/adjust tests asserting disabled states when blockchain is down; inject mocked useSettings or MockSettingsProvider where needed.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant App as Layout
  participant TBP as TopBannerProvider
  participant TBanner as TopBanner
  participant Settings as SettingsProvider

  User->>App: Load page
  App->>TBP: Mount TopBannerProvider
  TBP->>Settings: read settings (isBlockchainDown)
  TBP->>TBP: compute hasBanner (maintenance || isBlockchainDown || credit-card)
  App->>TBanner: render selected banner
  alt Maintenance open
    TBanner-->>User: show Maintenance banner
  else Blockchain down
    TBanner-->>User: show Network Down banner
  else Credit card
    TBanner-->>User: show Credit Card banner
  else
    TBanner-->>User: no banner
  end
Loading
sequenceDiagram
  participant UI as UI Components
  participant Settings as SettingsProvider

  UI->>Settings: useSettings()
  Settings-->>UI: { isBlockchainDown }
  alt isBlockchainDown == true
    UI-->>UI: set aria-disabled / disabled on deploy/tx buttons
    UI-->>UI: hide certificates/authorizations sections
    UI-->>UI: prevent query enablement for grants/allowances
  else
    UI-->>UI: normal interactive behavior
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • baktun14
  • ygrishajev

Poem

I hop the console paths today,
A banner hums — nodes drift away.
Buttons nap and lists lie still,
I guard the fields on silent hill.
When chains return — I’ll spring and play. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning While the pull request correctly disables and hides the targeted UI elements—deploy buttons, create transaction buttons, certificates list, and authorization list—and adds a network-down banner, it introduces new test files instead of only updating existing tests as the linked issue specifies. Remove the newly added test files and incorporate the necessary test coverage into the existing test suites in order to comply with the requirement of updating only existing tests.
Out of Scope Changes Check ⚠️ Warning The pull request includes refactoring of the TopBanner and useHasCreditCardBanner APIs as well as changes to SettingsProviderContext exports and the addition of entirely new test suites, which fall outside the scoped goal of adjusting UI behavior for blockchain downtime. Revert or isolate the unrelated refactors—such as the TopBanner consolidation, signature changes in useHasCreditCardBanner, and SettingsProviderContext export adjustments—and remove the additional test suites so that only the changes directly required by issue #1948 remain.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the primary change by indicating that various features will be disabled when the blockchain is down, directly reflecting the intent of the changeset without including extraneous details.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (8)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (4)

100-105: Critical: hasSettings computed incorrectly; nullish-coalescing corrupts types

hasSettings ends up being an object (or other non-boolean), then ?? assigns objects to string vars (defaultApiNode/defaultRpcNode). This will break downstream logic at runtime.

Apply this diff to fix boolean computation and assignments:

-      const hasSettings =
-        settingsStr && settings.apiEndpoint && settings.rpcEndpoint && settings.selectedNode && nodes?.find(x => x.id === settings.selectedNode?.id);
-      let defaultApiNode = hasSettings ?? settings.apiEndpoint;
-      let defaultRpcNode = hasSettings ?? settings.rpcEndpoint;
-      let selectedNode = hasSettings ?? settings.selectedNode;
+      const hasSettings = Boolean(
+        settingsStr &&
+          settings.apiEndpoint &&
+          settings.rpcEndpoint &&
+          settings.selectedNode &&
+          nodes?.some(x => x.id === settings.selectedNode?.id)
+      );
+      let defaultApiNode = settings.apiEndpoint;
+      let defaultRpcNode = settings.rpcEndpoint;
+      let selectedNode = settings.selectedNode;

86-99: Set isBlockchainDown based on node statuses

The flag is added but never derived; UI will never enter offline mode. Compute it after fetching statuses and persist in settings.

Apply this diff:

       const { data: nodes } = await externalApiHttpClient.get<Array<{ id: string; api: string; rpc: string }>>(selectedNetwork.nodesUrl);
       const nodesWithStatuses: Array<BlockchainNode> = await Promise.all(
         nodes.map(async node => {
           const nodeStatus = await loadNodeStatus(node.rpc);

           return {
             ...node,
             status: nodeStatus.status,
             latency: nodeStatus.latency,
             nodeInfo: nodeStatus.nodeInfo
           };
         })
       );
+      const blockchainDown = nodesWithStatuses.every(n => n.status !== "active" || n.nodeInfo?.sync_info.catching_up !== false);

       const hasSettings = Boolean(
         settingsStr &&
           settings.apiEndpoint &&
           settings.rpcEndpoint &&
           settings.selectedNode &&
           nodes?.some(x => x.id === settings.selectedNode?.id)
       );
       let defaultApiNode = settings.apiEndpoint;
       let defaultRpcNode = settings.rpcEndpoint;
       let selectedNode = settings.selectedNode;

       // If the user has a custom node set, use it no matter the status
       if (hasSettings && settings.isCustomNode) {
         const nodeStatus = await loadNodeStatus(settings.rpcEndpoint);
         const customNodeUrl = new URL(settings.apiEndpoint);

         const customNode: Partial<BlockchainNode> = {
           status: nodeStatus.status,
           latency: nodeStatus.latency,
           nodeInfo: nodeStatus.nodeInfo,
           id: customNodeUrl.hostname
         };

-        updateSettings({ ...settings, apiEndpoint: defaultApiNode, rpcEndpoint: defaultRpcNode, selectedNode, customNode, nodes: nodesWithStatuses });
+        updateSettings({
+          ...settings,
+          apiEndpoint: defaultApiNode,
+          rpcEndpoint: defaultRpcNode,
+          selectedNode,
+          customNode,
+          nodes: nodesWithStatuses,
+          isBlockchainDown: blockchainDown
+        });
       }

       // If the user has no settings or the selected node is inactive, use the fastest available active node
       if (!hasSettings || (hasSettings && settings.selectedNode?.status === "inactive")) {
         const randomNode = getFastestNode(nodesWithStatuses);
         // Use cosmos.directory as a backup if there's no active nodes in the list
         defaultApiNode = randomNode?.api || "https://rest.cosmos.directory/akash";
         defaultRpcNode = randomNode?.rpc || "https://rpc.cosmos.directory/akash";
         selectedNode = randomNode || {
           api: defaultApiNode,
           rpc: defaultRpcNode,
           status: "active",
           latency: 0,
           nodeInfo: null,
           id: "https://rest.cosmos.directory/akash"
         };
-        updateSettings({ ...settings, apiEndpoint: defaultApiNode, rpcEndpoint: defaultRpcNode, selectedNode, nodes: nodesWithStatuses });
+        updateSettings({
+          ...settings,
+          apiEndpoint: defaultApiNode,
+          rpcEndpoint: defaultRpcNode,
+          selectedNode,
+          nodes: nodesWithStatuses,
+          isBlockchainDown: blockchainDown
+        });
       } else {
         defaultApiNode = settings.apiEndpoint;
         defaultRpcNode = settings.rpcEndpoint;
         selectedNode = settings.selectedNode;
-        updateSettings({ ...settings, apiEndpoint: defaultApiNode, rpcEndpoint: defaultRpcNode, selectedNode, nodes: nodesWithStatuses });
+        updateSettings({
+          ...settings,
+          apiEndpoint: defaultApiNode,
+          rpcEndpoint: defaultRpcNode,
+          selectedNode,
+          nodes: nodesWithStatuses,
+          isBlockchainDown: blockchainDown
+        });
       }

Also applies to: 118-119, 121-141


265-283: Refresh path should also update isBlockchainDown

Keep the flag in sync during status refreshes.

Apply this diff:

       setSettings(prevSettings => {
         const selectedNode = _nodes.find(node => node.id === prevSettings.selectedNode?.id);

-        const newSettings = {
+        const blockchainDown =
+          _isCustomNode
+            ? (_customNode?.status !== "active" || _customNode?.nodeInfo?.sync_info.catching_up !== false)
+            : _nodes.every(n => n.status !== "active" || n.nodeInfo?.sync_info.catching_up !== false);
+
+        const newSettings: Settings = {
           ...prevSettings,
           nodes: _nodes,
           selectedNode,
-          customNode: _customNode
+          customNode: _customNode,
+          isBlockchainDown: blockchainDown
         };

204-211: Avoid any in TS API

updateSettings uses any. Type this as Settings to comply with codebase TS rules.

Apply this diff:

-  const updateSettings = (newSettings: any) => {
+  const updateSettings = (newSettings: Settings) => {
     setSettings(prevSettings => {
       clearQueries(prevSettings, newSettings);
       setLocalStorageItem("settings", JSON.stringify(newSettings));

       return newSettings;
     });
   };

As per coding guidelines

apps/deploy-web/src/components/layout/Sidebar.tsx (1)

308-319: Aria-disabled on Link doesn’t block keyboard activation; prevent navigation and focus

Pressing Enter will still navigate. Add an onClick guard and remove from tab order when disabled.

Apply this diff:

-  const onDeployClick = () => {
-    setDeploySdl(null);
-  };
+  const onDeployClick: React.MouseEventHandler<HTMLAnchorElement> = ev => {
+    if (settings.isBlockchainDown) {
+      ev.preventDefault();
+      ev.stopPropagation();
+      return;
+    }
+    setDeploySdl(null);
+  };
         <Link
           className={cn(buttonVariants({ variant: "default", size: isNavOpen ? "lg" : "icon" }), "h-[45px] w-full leading-4", {
             ["h-[45px] w-[45px] min-w-0 pb-2 pt-2"]: !isNavOpen
           })}
           href={UrlService.newDeployment()}
           onClick={onDeployClick}
           data-testid="sidebar-deploy-button"
-          aria-disabled={settings.isBlockchainDown}
+          aria-disabled={settings.isBlockchainDown}
+          tabIndex={settings.isBlockchainDown ? -1 : undefined}
         >
apps/deploy-web/src/components/home/YourAccount.tsx (1)

155-157: Aria-disabled on Link doesn’t block keyboard activation; prevent navigation and focus

Pressing Enter on the Deploy link will still navigate. Add an onClick guard and tabIndex handling.

Apply this diff:

-  const onDeployClick = () => {
-    setDeploySdl(null);
-  };
+  const onDeployClick: React.MouseEventHandler<HTMLAnchorElement> = ev => {
+    if (settings.isBlockchainDown) {
+      ev.preventDefault();
+      ev.stopPropagation();
+      return;
+    }
+    setDeploySdl(null);
+  };
-                <Link
+                <Link
                   href={UrlService.newDeployment()}
                   className={cn(buttonVariants({ variant: "default" }))}
                   onClick={onDeployClick}
-                  aria-disabled={settings.isBlockchainDown}
+                  aria-disabled={settings.isBlockchainDown}
+                  tabIndex={settings.isBlockchainDown ? -1 : undefined}
                 >

Also applies to: 233-241

apps/deploy-web/src/components/deployments/DeploymentList.tsx (2)

187-192: Also disable the top “Deploy” link consistently.

Same issue as the empty‑state link; it still navigates while down. Mirror the click guard and disabled styling.

Apply this diff:

-              <Link href={UrlService.newDeployment()} className={cn("ml-auto", buttonVariants({ variant: "default", size: "sm" }))} onClick={onDeployClick}>
+              <Link
+                href={UrlService.newDeployment()}
+                className={cn(
+                  "ml-auto",
+                  buttonVariants({ variant: "default", size: "sm" }),
+                  { "pointer-events-none opacity-50": settings.isBlockchainDown }
+                )}
+                onClick={e => {
+                  if (settings.isBlockchainDown) {
+                    e.preventDefault();
+                    return;
+                  }
+                  onDeployClick();
+                }}
+                aria-disabled={settings.isBlockchainDown}
+              >

175-179: Disable bulk “Close selected” when blockchain is down.

This initiates on-chain txs; should be disabled during downtime.

Apply this diff:

-                  <Button onClick={onCloseSelectedDeployments} color="secondary">
+                  <Button onClick={onCloseSelectedDeployments} color="secondary" disabled={settings.isBlockchainDown}>
🧹 Nitpick comments (7)
apps/deploy-web/src/components/layout/TopBanner.tsx (1)

24-30: Announce network-down banner to screen readers

Add ARIA semantics so the message is announced when injected.

Apply this diff:

 export function NetworkDownBanner() {
   return (
-    <div className="fixed top-0 z-10 flex h-[40px] w-full items-center justify-center bg-primary px-3 py-2 md:space-x-4">
+    <div
+      className="fixed top-0 z-10 flex h-[40px] w-full items-center justify-center bg-primary px-3 py-2 md:space-x-4"
+      role="status"
+      aria-live="polite"
+      aria-atomic="true"
+    >
       <span className="text-xs font-semibold text-white md:text-sm">The network is down. Unable to change deployments at the moment.</span>
     </div>
   );
 }
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2)

184-193: Return type of getFastestNode can be undefined

When nodes is empty, nodes[0] is undefined. Consider reflecting this in the return type or guarding callers.

Apply this minimal change:

-  const getFastestNode = (nodes: Array<BlockchainNode>) => {
+  const getFastestNode = (nodes: Array<BlockchainNode>): BlockchainNode | undefined => {

And keep using optional chaining at call sites (already done).


287-300: Provider value omission

isBlockchainDown is not exposed via the context value. Downstream consumers reading settings.isBlockchainDown are fine, but if any component needs the flag directly, exposing it here improves ergonomics.

Apply this diff if you want to expose it directly:

     <SettingsProviderContext.Provider
       value={{
         settings,
         setSettings: updateSettings,
         isLoadingSettings,
         refreshNodeStatuses,
         isRefreshingNodeStatus,
-        isSettingsInit
+        isSettingsInit
       }}
     >

Alternatively, leave as-is since settings.isBlockchainDown is present. Based on learnings

apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)

31-36: Remove unused dep in useMemo.

isCreatingCert isn’t used in the computation; drop it from deps.

Apply this diff:

-  }, [isLocalCertExpired, isCreatingCert, localCert]);
+  }, [isLocalCertExpired, localCert]);
apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)

212-219: Short‑circuit queries when blockchain is down to avoid unnecessary calls.

The page hides content, but hooks still fetch. Add enabled: !settings.isBlockchainDown (and/or zero refetchInterval) on data hooks to prevent network churn and errors while down.

Example (apply similarly to all queries on this page):

const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants(
  address,
  pageIndex.deployment,
  pageSize.deployment,
  {
    refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval,
    select: selectNonMasterGrants,
    enabled: !settings.isBlockchainDown && !debouncedSearchGrantee,
  }
);

const { data: granteeGrants, isLoading: isLoadingGranteeGrants } = useGranteeGrants(address, {
  refetchInterval: isRefreshing === "granteeGrants" ? refreshingInterval : defaultRefetchInterval,
  enabled: !settings.isBlockchainDown,
});

const { data: allowancesIssued, isLoading: isLoadingAllowancesIssued } = useAllowancesIssued(
  address,
  pageIndex.fee,
  pageSize.fee,
  {
    refetchInterval: isRefreshing === "allowancesIssued" ? refreshingInterval : defaultRefetchInterval,
    select: selectNonMasterAllowances,
    enabled: !settings.isBlockchainDown,
  }
);

256-266: Show clear (X) only when there’s a value.

Minor UX nit: hide the end icon when input is empty.

Apply this diff:

-                      endIcon={
-                        <Button
+                      endIcon={
+                        !!searchGrantee && (
+                        <Button
                           variant="text"
                           size="icon"
                           onClick={() => {
                             setSearchGrantee("");
                             setSearchError(null);
                           }}
                         >
                           <Xmark />
-                        </Button>
+                        </Button>
+                        )
                       }

458-459: Fix grammar in confirmation copy.

Apply this diff:

-                Deleting allowance to will revoke their ability to fees on your behalf.
+                Deleting allowances will revoke their ability to pay fees on your behalf.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61dc080 and 1baf6e4.

📒 Files selected for processing (13)
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx (1 hunks)
  • apps/deploy-web/src/components/home/YourAccount.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Layout.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Sidebar.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/TopBanner.tsx (1 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (6 hunks)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1 hunks)
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx (3 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (3 hunks)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2 hunks)
  • packages/ui/components/button.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use type any or cast to type any. Always define the proper TypeScript types.

Files:

  • apps/deploy-web/src/components/layout/Sidebar.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • packages/ui/components/button.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code

Files:

  • apps/deploy-web/src/components/layout/Sidebar.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • packages/ui/components/button.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
🧬 Code graph analysis (9)
apps/deploy-web/src/components/layout/Sidebar.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/layout/Layout.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
  • useHasCreditCardBanner (11-35)
apps/deploy-web/src/components/layout/TopBanner.tsx (1)
  • NetworkDownBanner (24-30)
apps/deploy-web/src/components/settings/SettingsContainer.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/shared/Fieldset.tsx (1)
  • Fieldset (12-23)
apps/deploy-web/src/components/settings/CertificateList.tsx (1)
  • CertificateList (12-114)
apps/deploy-web/src/components/deployments/DeploymentList.tsx (3)
apps/deploy-web/src/utils/urlUtils.ts (1)
  • UrlService (16-81)
apps/provider-console/src/utils/styleUtils.ts (1)
  • cn (4-6)
packages/ui/components/button.tsx (1)
  • buttonVariants (46-46)
apps/deploy-web/src/components/home/YourAccount.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
  • SettingsLayout (24-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (9)
packages/ui/components/button.tsx (1)

9-9: ARIA-disabled styling: LGTM; verify keyboard interaction at call sites

The added aria-[disabled='true'] classes are correct and consistent with disabled styling.

Please ensure anchor/Link usages that rely on aria-disabled also prevent keyboard activation (Enter/Space) via onClick guards and/or tabIndex adjustments. See my comments in Sidebar.tsx and YourAccount.tsx.

apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)

28-29: Settings shape extension: LGTM

Adding isBlockchainDown to Settings and defaultSettings looks good and non-breaking.

Also applies to: 48-50

apps/deploy-web/src/components/layout/Sidebar.tsx (1)

64-65: Import and usage: LGTM

Reading settings from context here is appropriate.

apps/deploy-web/src/components/settings/SettingsContainer.tsx (1)

12-12: Hiding Certificates when blockchain is down: LGTM

This aligns with the offline-mode requirement to hide the certificates list.

Confirm that Authorizations are similarly hidden per the issue scope.

Also applies to: 25-25, 73-77

apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1)

351-355: Create Deployment disabled during downtime: LGTM

Correctly gates the action using settings.isBlockchainDown.

apps/deploy-web/src/components/home/YourAccount.tsx (1)

45-46: Context usage: LGTM

Consuming settings here is appropriate and consistent.

apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)

21-22: Disable Start Trial when blockchain is down: LGTM

Composed disabled state with isWalletLoading is correct.

Also applies to: 40-41

apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)

46-48: LGTM: Button disables certificate creation when blockchain is down.

Gates the action correctly via disabled.

apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)

414-417: LGTM on disabling tx actions; confirm manifest re-send behavior.

  • Disabling Close Deployment and Accept Bid during downtime looks correct.
  • You allow “Re-send Manifest” when there’s an active bid even if the blockchain is down. If that’s intended (no chain tx), keep it; otherwise, include settings.isBlockchainDown in the hasActiveBid path too.
  • Ensure CustomDropdownLinkItem truly blocks onClick when disabled.

Also applies to: 427-429, 449-452, 601-608

@jzsfkzm jzsfkzm force-pushed the feature/1948-disable-parts-when-blockchain-down branch from 1baf6e4 to 3e5662c Compare September 25, 2025 22:06
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)

69-88: Gate data fetching while the chain is offline.

We hide the authorizations UI when settings.isBlockchainDown is true, but all of the queries (useGranterGrants, useGranteeGrants, useAllowancesIssued, useAllowance, and the exact-grantee lookup) still spin. When the chain/API is actually down, these hooks keep retrying and surface toast errors, and Layout stays in the global loading state, so the offline banner is masked. We should short-circuit the queries through their enabled flag (and/or early returns) whenever the chain is down.

One example fix:

   const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants(address, pageIndex.deployment, pageSize.deployment, {
-    refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval,
-    select: selectNonMasterGrants,
-    enabled: !debouncedSearchGrantee
+    refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval,
+    select: selectNonMasterGrants,
+    enabled: !settings.isBlockchainDown && !debouncedSearchGrantee
   });

Please apply the same guard to the other grant/allowance hooks so the page stays quiet in offline mode.

🧹 Nitpick comments (4)
apps/deploy-web/src/components/layout/TopBanner.tsx (1)

24-30: Expose the banner state to screen readers

Right now the banner silently appears in the DOM, but without role/aria-live assistive tech won’t announce that the network is down. Add a polite live region (or role="alert" if you prefer assertive) so the status change is communicated.

-export function NetworkDownBanner() {
-  return (
-    <div className="fixed top-0 z-10 flex h-[40px] w-full items-center justify-center bg-primary px-3 py-2 md:space-x-4">
+export function NetworkDownBanner() {
+  return (
+    <div role="status" aria-live="polite" className="fixed top-0 z-10 flex h-[40px] w-full items-center justify-center bg-primary px-3 py-2 md:space-x-4">
       <span className="text-xs font-semibold text-white md:text-sm">The network is down. Unable to change deployments at the moment.</span>
     </div>
   );
 }
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (1)

365-366: Setup accepts isBlockchainDown: good; add an assertion when down.

Now that setup can simulate downtime, add at least one expectation proving primary actions are disabled when isBlockchainDown is true (e.g., Accept Bid/Re-send Manifest and Close Deployment). As per coding guidelines for apps//.spec.tsx, prefer queryBy* in expectations.

Example (inside existing "lease creation" describe):

+    it("disables lease actions when blockchain is down", async () => {
+      await setupLeaseCreation({ isBlockchainDown: true });
+      await waitFor(() => {
+        expect(screen.queryByRole("button", { name: /Accept Bid/i })).toBeDisabled();
+      });
+    });

As per coding guidelines

apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (1)

42-46: Downtime param supported: add a disabled-state check.

Add a test that sets isBlockchainDown: true and expects the button to be disabled. In this package, use queryBy* per guidelines.

Example:

+  it("disables Create Certificate when blockchain is down", () => {
+    setup({ isBlockchainDown: true });
+    expect(screen.queryByRole("button", { name: /create certificate/i })).toBeDisabled();
+  });

As per coding guidelines

apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)

44-49: Guard onClick to no-op when disabled (robust with asChild).

Button disabled blocks clicks for native buttons, but if rendered asChild (e.g., anchor), disabled doesn’t stop onClick. Add a defensive guard.

Apply this diff:

-      <d.Button
+      <d.Button
         className={warningText ? "mt-4" : ""}
         {...buttonProps}
         disabled={buttonProps?.disabled || settings.isBlockchainDown || isCreatingCert}
-        onClick={_createCertificate}
+        onClick={e => {
+          if (buttonProps?.disabled || settings.isBlockchainDown || isCreatingCert) {
+            e.preventDefault();
+            return;
+          }
+          _createCertificate();
+        }}
       >
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1baf6e4 and 3e5662c.

📒 Files selected for processing (15)
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (2 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx (1 hunks)
  • apps/deploy-web/src/components/home/YourAccount.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Layout.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Sidebar.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/TopBanner.tsx (1 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (7 hunks)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1 hunks)
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx (3 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (3 hunks)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2 hunks)
  • packages/ui/components/button.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/layout/Sidebar.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use type any or cast to type any. Always define the proper TypeScript types.

Files:

  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
  • packages/ui/components/button.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code

Files:

  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
  • packages/ui/components/button.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() to mock dependencies in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test.

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block in test files
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

Files:

  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx

📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)

Use queryBy methods instead of getBy methods in test expectations in .spec.tsx files

Files:

  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧬 Code graph analysis (4)
apps/deploy-web/src/components/home/YourAccount.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/utils/urlUtils.ts (1)
  • UrlService (16-81)
apps/provider-console/src/utils/styleUtils.ts (1)
  • cn (4-6)
apps/deploy-web/src/components/deployments/DeploymentList.tsx (2)
apps/deploy-web/src/utils/urlUtils.ts (1)
  • UrlService (16-81)
apps/provider-console/src/utils/styleUtils.ts (1)
  • cn (4-6)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
  • SettingsLayout (24-58)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
  • DEPENDENCIES (66-104)
apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
  • DEPENDENCIES (63-68)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (13)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (1)

460-476: Mocked useSettings wiring looks correct.

The mock shape matches Settings and unblocks downtime simulations.

packages/ui/components/button.tsx (1)

9-9: ARIA-disabled styling: LGTM; note anchor keyboard activation.

The new aria-[disabled] utilities are good. Remember: on anchors/links, aria-disabled + pointer-events-none won’t stop keyboard activation. Ensure Link wrappers also preventDefault() when aria-disabled.

apps/deploy-web/src/components/home/YourAccount.tsx (1)

16-16: New dependency useSettings: LGTM.

apps/deploy-web/src/components/deployments/DeploymentList.tsx (1)

227-232: Aria-disabled on Link doesn’t prevent navigation; use click guard.

This was already flagged earlier for this exact spot. Please apply the previously suggested onClick preventDefault when down.

apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (1)

58-73: Mocked useSettings wiring looks correct.

apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)

21-29: Settings type and defaults extended with isBlockchainDown: LGTM.

Merges cleanly with persisted settings and defaults to false.

Also applies to: 42-50

apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)

25-26: Good: consuming settings for gating.

apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (6)

35-35: New dependency useSettings: LGTM.


102-104: Injected dependency added: LGTM.


115-116: Consuming settings: LGTM.


415-417: Dropdown “Close Deployment” disabled when down: LGTM.


450-451: All-closed flow disabled when down: LGTM.


602-609: Trial/zero-bids close button disabled when down: LGTM.

@jzsfkzm jzsfkzm force-pushed the feature/1948-disable-parts-when-blockchain-down branch from 3e5662c to 8789cba Compare September 26, 2025 11:21
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)

204-211: Type safety: avoid any in updateSettings

updateSettings(newSettings: any) violates our TS guidelines. Type it as Settings.

As per coding guidelines

-  const updateSettings = (newSettings: any) => {
+  const updateSettings = (newSettings: Settings) => {
🧹 Nitpick comments (1)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)

212-218: Good offline gating, but pause queries when down

Rendering a lightweight offline view is good. However, the data hooks above still fire and may error/spam logs while the chain is down. Add enabled: !settings.isBlockchainDown to:

  • useGranterGrants, useGranteeGrants
  • useAllowancesIssued
  • useExactDeploymentGrantsQuery (keep enabled: false, but guard refetch triggers)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e5662c and 8789cba.

📒 Files selected for processing (15)
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (2 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx (1 hunks)
  • apps/deploy-web/src/components/home/YourAccount.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Layout.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Sidebar.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/TopBanner.tsx (1 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (7 hunks)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1 hunks)
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx (3 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (3 hunks)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2 hunks)
  • packages/ui/components/button.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
  • packages/ui/components/button.tsx
  • apps/deploy-web/src/components/layout/Sidebar.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use type any or cast to type any. Always define the proper TypeScript types.

Files:

  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code

Files:

  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
🧬 Code graph analysis (3)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
  • SettingsLayout (24-58)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
  • DEPENDENCIES (66-104)
apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
  • DEPENDENCIES (63-68)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (7)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)

44-49: LGTM: respects blockchain-down state

Disabling the certificate creation button when isBlockchainDown or creating is in progress is correct and aligns with the objective.

apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (6)

102-104: LGTM: exposing useSettings as a dependency

Adding useSettings to DEPENDENCIES is consistent with the DI pattern used here.


115-116: LGTM: local access to settings

Consuming settings via d.useSettings() is correct.


415-417: LGTM: menu action disabled while down

Disabling “Close Deployment” when isBlockchainDown prevents tx initiation during downtime.


450-452: LGTM: all-closed action gated

The “Close Deployment” button is correctly disabled under downtime.


602-609: LGTM: trial card close action gated

The “Close Deployment” CTA in the trial empty-state respects isBlockchainDown.


428-431: Bug: “Re-send Manifest” still enabled when blockchain is down

When hasActiveBid is true, the button is always enabled, violating the offline rule and enabling a path that can create a cert/tx on click.

Apply:

-                disabled={
-                  hasActiveBid ? false : settings.isBlockchainDown || dseqList.some(gseq => !selectedBids[gseq]) || isSendingManifest || isCreatingLeases
-                }
+                disabled={
+                  settings.isBlockchainDown ||
+                  isSendingManifest ||
+                  isCreatingLeases ||
+                  (!hasActiveBid && dseqList.some(gseq => !selectedBids[gseq]))
+                }

Please ensure tests cover both paths:

  • “Accept Bid” disabled when down (existing).
  • “Re-send Manifest” disabled when down (hasActiveBid = true).

Run:

#!/bin/bash
rg -nP -C2 'Re-send Manifest|data-testid="create-lease-button"' apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx

@jzsfkzm jzsfkzm force-pushed the feature/1948-disable-parts-when-blockchain-down branch from 8789cba to 57e842c Compare September 26, 2025 13:23
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (4)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)

256-266: Add accessible labels to icon-only buttons

Icon-only buttons need accessible names.

-                        <Button
+                        <Button
                           variant="text"
                           size="icon"
                           onClick={() => {
                             setSearchGrantee("");
                             setSearchError(null);
                           }}
+                          aria-label="Clear search"
+                          title="Clear search"
                         >
                           <Xmark />
                         </Button>
-                    <Button variant="ghost" size="icon" className="rounded-full" onClick={onRefreshSearchClick}>
+                    <Button
+                      variant="ghost"
+                      size="icon"
+                      className="rounded-full"
+                      onClick={onRefreshSearchClick}
+                      aria-label="Refresh search"
+                      title="Refresh search"
+                    >
                       <Refresh className="text-xs" />
                     </Button>

Also applies to: 268-271

apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)

307-339: Defense-in-depth: Early-return in actions when offline

Recommend guarding createLease (and similarly handleCloseDeployment) against accidental invocation (e.g., programmatic click) when settings.isBlockchainDown is true. Show an error and return early.

Example:

 async function createLease() {
   setIsCreatingLeases(true);
 
   try {
+    if (settings.isBlockchainDown) {
+      enqueueSnackbar(<Snackbar title="Network unavailable" subTitle="Blockchain is down. Please try again later." iconVariant="error" />, {
+        variant: "error",
+        autoHideDuration: 5000
+      });
+      return;
+    }

Optionally mirror the same check at the start of handleCloseDeployment.

apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (2)

9-12: Use Testing Library queryBy and role-based assertions.*

Per repo guideline for apps/deploy-web/*.spec.tsx, prefer queryBy methods (and role where possible) and use toBeDisabled/toBeEnabled.

Apply this diff:

-  it("renders button enabled when blockchain is up", () => {
-    const { getByText } = setup({ isBlockchainDown: false });
-
-    expect(getByText("Start Trial").parentElement).not.toHaveAttribute("disabled");
-  });
+  it("renders button enabled when blockchain is up", () => {
+    const { queryByRole } = setup({ isBlockchainDown: false });
+    expect(queryByRole("button", { name: /start trial/i })).not.toBeDisabled();
+  });
@@
-  it("renders button disabled when blockchain is down", () => {
-    const { getByText } = setup({ isBlockchainDown: true });
-
-    expect(getByText("Start Trial").parentElement).toHaveAttribute("disabled");
-  });
+  it("renders button disabled when blockchain is down", () => {
+    const { queryByRole } = setup({ isBlockchainDown: true });
+    expect(queryByRole("button", { name: /start trial/i })).toBeDisabled();
+  });

As per coding guidelines

Also applies to: 15-18


20-20: Remove unused setup parameter.

isRegistered is unused; drop it to avoid noise.

Apply this diff:

-  function setup(input?: { isRegistered?: boolean; isBlockchainDown?: boolean }) {
+  function setup(input?: { isBlockchainDown?: boolean }) {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8789cba and 57e842c.

📒 Files selected for processing (16)
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (2 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx (1 hunks)
  • apps/deploy-web/src/components/home/YourAccount.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Layout.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Sidebar.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/TopBanner.tsx (1 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (7 hunks)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1 hunks)
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx (3 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (2 hunks)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2 hunks)
  • packages/ui/components/button.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • packages/ui/components/button.tsx
  • apps/deploy-web/src/components/layout/Sidebar.tsx
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use type any or cast to type any. Always define the proper TypeScript types.

Files:

  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code

Files:

  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() to mock dependencies in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test.

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block in test files
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

Files:

  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx

📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)

Use queryBy methods instead of getBy methods in test expectations in .spec.tsx files

Files:

  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧬 Code graph analysis (6)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
  • DEPENDENCIES (66-104)
apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
  • DEPENDENCIES (63-68)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (2)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
  • ConnectManagedWalletButton (27-53)
apps/deploy-web/src/hooks/useFlag.tsx (1)
  • useFlag (8-8)
apps/deploy-web/src/components/home/YourAccount.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/utils/urlUtils.ts (1)
  • UrlService (16-81)
apps/provider-console/src/utils/styleUtils.ts (1)
  • cn (4-6)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
  • SettingsLayout (24-58)
apps/deploy-web/src/components/shared/Fieldset.tsx (1)
  • Fieldset (12-23)
apps/deploy-web/src/components/layout/Layout.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
  • useHasCreditCardBanner (11-35)
apps/deploy-web/src/components/layout/TopBanner.tsx (1)
  • NetworkDownBanner (21-27)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)
apps/deploy-web/src/components/new-deployment/BidGroup.tsx (1)
  • BidGroup (32-160)
apps/deploy-web/tests/seeders/bid.ts (1)
  • buildRpcBid (7-81)
🪛 GitHub Check: validate / validate-app
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx

[failure] 5-5:
All imports in the declaration are only used as types. Use import type


[failure] 1-1:
Run autofix to sort these imports!

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (19)
apps/deploy-web/src/components/home/YourAccount.tsx (1)

234-238: Disabled Deploy link still fires navigation and handler

aria-disabled on a Next Link is cosmetic—clicks (and keyboard activation) still navigate and run onDeployClick, so the Deploy flow stays reachable while settings.isBlockchainDown is true. Prevent the default action (and stop propagation) when offline before calling onDeployClick.

-                  onClick={onDeployClick}
+                  onClick={event => {
+                    if (settings.isBlockchainDown) {
+                      event.preventDefault();
+                      event.stopPropagation();
+                      return;
+                    }
+                    onDeployClick();
+                  }}
apps/deploy-web/src/components/layout/Layout.tsx (1)

74-107: Hide CreditCardBanner when the network is down to prevent banner overlap

CreditCardBanner and NetworkDownBanner both render at top:0, so when settings.isBlockchainDown is true the banners stack on top of each other. Gate the credit-card banner behind the blockchain-up state (and adjust hasBanner accordingly) so only one top banner is visible at a time.

-  const hasBanner = hasCreditCardBanner || isMaintenanceBannerOpen || settings.isBlockchainDown;
+  const hasBanner = (!settings.isBlockchainDown && hasCreditCardBanner) || isMaintenanceBannerOpen || settings.isBlockchainDown;-      {hasCreditCardBanner && <CreditCardBanner />}
-      {settings.isBlockchainDown && (
-        <>
-          <NetworkDownBanner />
-        </>
-      )}
+      {!settings.isBlockchainDown && hasCreditCardBanner && <CreditCardBanner />}
+      {settings.isBlockchainDown && <NetworkDownBanner />}
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)

44-48: LGTM – disables certificate actions when offline

The button now respects the blockchain-down flag while preserving the existing busy-state guard. Nice alignment with the offline-mode requirements.

apps/deploy-web/src/components/authorizations/Authorizations.tsx (4)

10-10: LGTM: settings wiring added

Importing useSettings here makes sense for the offline gating.


50-50: Verify SettingsProvider always supplies settings

Ensure SettingsProviderContext has a non-null default and this route is always wrapped; otherwise settings could be undefined at runtime.


221-233: LGTM: header actions only in blockchain-up branch

Actions are hidden in offline mode and gated by address.


458-459: Fix copy: incorrect sentence (previous feedback still applies)

“Deleting allowance to will revoke their ability to fees on your behalf.” → grammar issue.

-                Deleting allowance to will revoke their ability to fees on your behalf.
+                Deleting this allowance will revoke their ability to pay fees on your behalf.
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (7)

34-34: Good: Settings wired in

Importing useSettings is correct for gating UI on chain downtime.


102-104: Good: Dependencies surface extended

Exposing useBlock and useSettings through DEPENDENCIES keeps the component testable.


115-115: Good: Reading settings from provider

Using d.useSettings() locally simplifies conditional UI logic.


415-417: Good: Disable Close Deployment in menu when chain is down

Matches requirement to block chain transactions during downtime.


450-452: Good: All-closed path gated

Close Deployment action is correctly disabled when blockchain is down.


602-609: Good: Trial warning card action gated

Close Deployment here also respects isBlockchainDown.


428-431: Bug: “Re-send Manifest” remains enabled when blockchain is down

When hasActiveBid is true, the button is always enabled, which can trigger certificate creation (a chain tx) if the local cert is expired. Must still disable when settings.isBlockchainDown. This was flagged previously and remains unresolved.

Apply this diff:

-                disabled={
-                  hasActiveBid ? false : settings.isBlockchainDown || dseqList.some(gseq => !selectedBids[gseq]) || isSendingManifest || isCreatingLeases
-                }
+                disabled={
+                  settings.isBlockchainDown ||
+                  isSendingManifest ||
+                  isCreatingLeases ||
+                  (!hasActiveBid && dseqList.some(gseq => !selectedBids[gseq]))
+                }
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)

395-396: Good: setup accepts isBlockchainDown

Propagating this flag through setup enables targeted scenarios.


491-506: Good: useSettings mock includes isBlockchainDown

Mocking SettingsProvider with isBlockchainDown ensures component gating is exercised in tests.

apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (3)

20-52: Good test structure with setup pattern.

Setup function is at the bottom of the root describe, takes a single param with inline type, returns the object under test, and avoids shared state.

As per coding guidelines


1-5: Sort imports to satisfy lint autofix.

Import order is failing lint. Please run the repo’s autofix to sort imports.

Run locally:

  • pnpm lint --fix
  • or npx eslint --fix apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx

Based on static analysis hints


5-5: Retain useFlag as a value import or update the annotation
useFlag is used in ReturnType<typeof useFlag>, so it must remain a value import. If you’d rather use a type-only import, switch your mock’s annotation to the exported FeatureFlagHook type instead of ReturnType<typeof useFlag>, for example:

import type { FeatureFlagHook } from "@src/hooks/useFlag";

const mockUseFlag: FeatureFlagHook = jest.fn((flag) => {
  /* … */
});

Otherwise, keep the original import { useFlag } so the typeof useFlag query still resolves.

Likely an incorrect or invalid review comment.

@jzsfkzm jzsfkzm force-pushed the feature/1948-disable-parts-when-blockchain-down branch from 57e842c to 04054b9 Compare September 26, 2025 13:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/deploy-web/src/components/layout/Sidebar.tsx (1)

309-316: Sidebar “Deploy” link still navigable; prevent navigation when offline

aria-disabled alone doesn’t block clicks. Users can still navigate to New Deployment. Prevent navigation (and keyboard activation) when isBlockchainDown.

Apply:

-        <Link
+        <Link
           className={cn(buttonVariants({ variant: "default", size: isNavOpen ? "lg" : "icon" }), "h-[45px] w-full leading-4", {
             ["h-[45px] w-[45px] min-w-0 pb-2 pt-2"]: !isNavOpen
           })}
-          href={UrlService.newDeployment()}
-          onClick={onDeployClick}
+          href={settings.isBlockchainDown ? "#" : UrlService.newDeployment()}
+          onClick={e => {
+            if (settings.isBlockchainDown) {
+              e.preventDefault();
+              return;
+            }
+            onDeployClick();
+          }}
           data-testid="sidebar-deploy-button"
-          aria-disabled={settings.isBlockchainDown}
+          aria-disabled={settings.isBlockchainDown}
+          tabIndex={settings.isBlockchainDown ? -1 : undefined}
+          className={cn(
+            buttonVariants({ variant: "default", size: isNavOpen ? "lg" : "icon" }),
+            "h-[45px] w-full leading-4",
+            { ["h-[45px] w-[45px] min-w-0 pb-2 pt-2"]: !isNavOpen },
+            { ["pointer-events-none opacity-60"]: settings.isBlockchainDown }
+          )}
         >
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57e842c and 04054b9.

📒 Files selected for processing (16)
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (2 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx (1 hunks)
  • apps/deploy-web/src/components/home/YourAccount.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Layout.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Sidebar.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/TopBanner.tsx (1 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (7 hunks)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1 hunks)
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx (3 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (2 hunks)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2 hunks)
  • packages/ui/components/button.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use type any or cast to type any. Always define the proper TypeScript types.

Files:

  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • packages/ui/components/button.tsx
  • apps/deploy-web/src/components/layout/Sidebar.tsx
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code

Files:

  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • packages/ui/components/button.tsx
  • apps/deploy-web/src/components/layout/Sidebar.tsx
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() to mock dependencies in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test.

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block in test files
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

Files:

  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx

📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)

Use queryBy methods instead of getBy methods in test expectations in .spec.tsx files

Files:

  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧠 Learnings (2)
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
PR: akash-network/console#1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.

Applied to files:

  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files

Applied to files:

  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧬 Code graph analysis (6)
apps/deploy-web/src/components/layout/Sidebar.tsx (1)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/settings/SettingsContainer.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/shared/Fieldset.tsx (1)
  • Fieldset (12-23)
apps/deploy-web/src/components/settings/CertificateList.tsx (1)
  • CertificateList (12-114)
apps/deploy-web/src/components/layout/Layout.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
  • useHasCreditCardBanner (11-35)
apps/deploy-web/src/components/layout/TopBanner.tsx (1)
  • NetworkDownBanner (21-27)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
  • DEPENDENCIES (66-104)
apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
  • DEPENDENCIES (63-68)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (303-305)
apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
  • SettingsLayout (24-58)
apps/deploy-web/src/components/shared/Fieldset.tsx (1)
  • Fieldset (12-23)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)
apps/deploy-web/src/components/new-deployment/BidGroup.tsx (1)
  • BidGroup (32-160)
apps/deploy-web/tests/seeders/bid.ts (1)
  • buildRpcBid (7-81)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (12)
packages/ui/components/button.tsx (1)

9-9: Good coverage for aria-disabled styling.

Nice touch adding the aria-[disabled='true'] fallbacks so our asChild usage (e.g., links) visually and functionally mirrors the native disabled state.

apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1)

354-354: Create Deployment correctly disabled when blockchain is down

Added settings.isBlockchainDown to the disabled condition. Matches PR objective and prevents chain tx initiation from this entrypoint.

apps/deploy-web/src/components/settings/SettingsContainer.tsx (1)

73-77: Hide Certificates section when blockchain is down — aligns with requirements

Conditionally omitting the Certificates fieldset matches the “Hide certificates list” objective.

apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)

490-506: Mocked useSettings shape looks correct

The injected useSettings returns the expected structure and propagates isBlockchainDown into the SUT cleanly.


151-179: Test doesn’t isolate blockchain-down gating and violates queryBy guideline

This asserts disabled state without selecting a bid; button is disabled anyway when no bid is selected. Also use queryBy* per repo rules for apps/deploy-web .spec.tsx.

Mirror the earlier suggestion to select a bid via the mocked BidGroup and assert with queryBy + toBeDisabled().

As per coding guidelines

apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1)

44-49: Create Certificate button is correctly disabled when blockchain is down

Gating on settings.isBlockchainDown alongside isCreatingCert is correct and consistent with the PR.

apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)

415-417: Close Deployment correctly disabled when offline

Dropdown action, closed‑state button, and trial card action all respect isBlockchainDown. Good.

Also applies to: 450-452, 602-609

apps/deploy-web/src/components/authorizations/Authorizations.tsx (4)

212-219: Offline view should also stop queries and loading overlay

UI hides lists when offline, but hooks still run and Layout may show a spinner. Gate queries with enabled: !settings.isBlockchainDown and compute isLoading as !settings.isBlockchainDown && .... Also short‑circuit submit handlers if offline.


243-245: Copy fix: “allow you to authorize”

Insert missing “to”.

-                  These authorizations allow you authorize other addresses to spend on deployments or deployment deposits using your funds. You can revoke these
+                  These authorizations allow you to authorize other addresses to spend on deployments or deployment deposits using your funds. You can revoke these

354-356: Copy fix: “allow you to authorize”

Mirror the earlier grammar correction.

-                  These authorizations allow you authorize other addresses to spend on transaction fees using your funds. You can revoke these authorizations at
+                  These authorizations allow you to authorize other addresses to spend on transaction fees using your funds. You can revoke these authorizations at

458-460: Copy fix: clarify sentence

Improve clarity and grammar.

-                Deleting allowance to will revoke their ability to fees on your behalf.
+                Deleting this allowance will revoke their ability to pay fees on your behalf.
apps/deploy-web/src/components/layout/Layout.tsx (1)

74-74: Avoid stacked, overlapping banners; show NetworkDownBanner exclusively

When the network is down, hide the credit-card banner to prevent overlapping at top:0 and layout glitches.

Apply:

-  const hasBanner = hasCreditCardBanner || isMaintenanceBannerOpen || settings.isBlockchainDown;
+  const hasBanner = (!settings.isBlockchainDown && hasCreditCardBanner) || isMaintenanceBannerOpen || settings.isBlockchainDown;
-      {hasCreditCardBanner && <CreditCardBanner />}
-      {settings.isBlockchainDown && (
-        <>
-          <NetworkDownBanner />
-        </>
-      )}
+      {!settings.isBlockchainDown && hasCreditCardBanner && <CreditCardBanner />}
+      {settings.isBlockchainDown && <NetworkDownBanner />}

Also applies to: 100-107

@jzsfkzm jzsfkzm force-pushed the feature/1948-disable-parts-when-blockchain-down branch from 0b12f30 to 45348c9 Compare September 29, 2025 11:00
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)

69-80: Block offline fetches and stop the spinner when the chain is down

Queries are still firing while settings.isBlockchainDown is true, which will keep hammering the indexer/chain and surface avoidable errors/spinners in offline mode. We need to gate them and also avoid showing the global loader when the network is known down.
Apply something like:

-const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants(address, pageIndex.deployment, pageSize.deployment, {
-  refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval,
-  select: selectNonMasterGrants,
-  enabled: !debouncedSearchGrantee
-});
+const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants(address, pageIndex.deployment, pageSize.deployment, {
+  refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval,
+  select: selectNonMasterGrants,
+  enabled: !settings.isBlockchainDown && !debouncedSearchGrantee
+});

 const { data: granteeGrants, isLoading: isLoadingGranteeGrants } = useGranteeGrants(address, {
   refetchInterval: isRefreshing === "granteeGrants" ? refreshingInterval : defaultRefetchInterval
+  enabled: !settings.isBlockchainDown
 });

 const { data: allowancesIssued, isLoading: isLoadingAllowancesIssued } = useAllowancesIssued(address, pageIndex.fee, pageSize.fee, {
   refetchInterval: isRefreshing === "allowancesIssued" ? refreshingInterval : defaultRefetchInterval,
-  select: selectNonMasterAllowances
+  select: selectNonMasterAllowances,
+  enabled: !settings.isBlockchainDown
 });

+const computedIsLoading = !settings.isBlockchainDown && isLoading;-  return (
-    <Layout isLoading={isLoading}>
+  return (
+    <Layout isLoading={computedIsLoading}>

Please make the same adjustment for any other hooks in this component (and elsewhere if applicable) so we don’t trigger requests or overlays in offline mode.

Also applies to: 90-97, 209-213


119-143: No-op destructive actions once we detect offline

If settings.isBlockchainDown flips true after the modal opens, these handlers will continue to broadcast revoke transactions. Add an early return so we never sign/broadcast while offline:

 async function onDeleteGrantsConfirmed() {
-  if (!deletingGrants) return;
+  if (!deletingGrants || settings.isBlockchainDown) return;
…
 async function onDeleteAllowanceConfirmed() {
-  if (!deletingAllowances) return;
+  if (!deletingAllowances || settings.isBlockchainDown) return;

Same pattern should be applied to other submit flows in this component.

apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)

13-33: Credit card banner keeps showing after the user no longer qualifies

isBannerVisible only ever flips to true. Once the user satisfies the credit-card requirements (managed wallet/trial), shouldShowBanner turns false, yet the effect never resets isBannerVisible, so TopBanner keeps rendering the credit-card banner indefinitely. Please recompute the visible state from shouldShowBanner so it closes when the prerequisites are met.

   useEffect(() => {
-    if (shouldShowBanner) {
-      setIsBannerVisible(true);
-    }
+    setIsBannerVisible(shouldShowBanner);
   }, [shouldShowBanner]);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b12f30 and 45348c9.

📒 Files selected for processing (18)
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (2 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx (1 hunks)
  • apps/deploy-web/src/components/home/YourAccount.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Layout.tsx (4 hunks)
  • apps/deploy-web/src/components/layout/Sidebar.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/TopBanner.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (7 hunks)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1 hunks)
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx (3 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (2 hunks)
  • apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (1 hunks)
  • apps/deploy-web/src/context/TopBannerProvider/index.ts (1 hunks)
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1 hunks)
  • packages/ui/components/button.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/deploy-web/src/context/TopBannerProvider/index.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx
  • apps/deploy-web/src/components/layout/Sidebar.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use type any or cast to type any. Always define the proper TypeScript types.

Files:

  • packages/ui/components/button.tsx
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
  • apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code

Files:

  • packages/ui/components/button.tsx
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
  • apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() to mock dependencies in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test.

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block in test files
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

Files:

  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx

📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)

Use queryBy methods instead of getBy methods in test expectations in .spec.tsx files

Files:

  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧠 Learnings (5)
📓 Common learnings
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
📚 Learning: 2025-09-29T03:58:26.404Z
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/home/YourAccount.tsx:234-239
Timestamp: 2025-09-29T03:58:26.404Z
Learning: In the Akash Network Console project, the UI components use CSS approach for disabling elements with aria-disabled="true" using "aria-[disabled='true']:pointer-events-none aria-[disabled='true']:opacity-50" classes, as seen in the button component. This pattern should be extended to links for consistency.

Applied to files:

  • packages/ui/components/button.tsx
📚 Learning: 2025-09-29T03:55:35.883Z
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.

Applied to files:

  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files

Applied to files:

  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
PR: akash-network/console#1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.

Applied to files:

  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧬 Code graph analysis (6)
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (2)
apps/deploy-web/src/hooks/useUser.ts (1)
  • useUser (7-20)
apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (1)
  • useWallet (355-357)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (4)
apps/deploy-web/src/context/TopBannerProvider/index.ts (1)
  • TopBannerProvider (1-1)
apps/deploy-web/src/types/component.ts (1)
  • FCWithChildren (4-4)
apps/deploy-web/src/hooks/useVariant.tsx (1)
  • useVariant (12-12)
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
  • useHasCreditCardBanner (11-35)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (5)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (2)
  • DEPENDENCIES (66-104)
  • Props (61-64)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
  • DEPENDENCIES (10-16)
  • Props (18-22)
apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
  • DEPENDENCIES (63-68)
packages/ui/components/button.tsx (1)
  • ButtonProps (36-38)
apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (1)
  • useWallet (355-357)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)
apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
  • SettingsLayout (24-58)
apps/deploy-web/src/components/shared/Fieldset.tsx (1)
  • Fieldset (12-23)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)
apps/deploy-web/src/components/new-deployment/BidGroup.tsx (1)
  • BidGroup (32-160)
apps/deploy-web/tests/seeders/bid.ts (1)
  • buildRpcBid (7-81)
apps/deploy-web/src/components/layout/Layout.tsx (2)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (2)
  • TopBannerProvider (18-39)
  • useTopBanner (41-41)
apps/deploy-web/src/components/layout/TopBanner.tsx (1)
  • TopBanner (49-65)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (7)
packages/ui/components/button.tsx (1)

9-9: Consistent aria-disabled styling

Nice touch adding the aria-[disabled='true'] variants so Slot-based buttons and links inherit the same disabled affordances—this keeps our accessibility pattern uniform. Based on learnings

apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (1)

58-73: Nice alignment with the updated useSettings contract.

Wiring isBlockchainDown into the stubbed settings object keeps the test harness in sync with the component’s new gating logic without altering existing call sites. Good call spreading the base dependencies so only the override is customized.

apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)

242-245: Fix copy: “allow you authorize” → “allow you to authorize”

Grammar issue persists here; please insert the missing “to” so the sentence reads correctly.


353-356: Fix copy: “allow you authorize” → “allow you to authorize”

Same grammar fix needed in the fee authorizations section.


448-459: Fix copy: “Deleting allowance to will…”

The confirmation text is still broken English. Update it to something like “Deleting this allowance will revoke their ability to pay fees on your behalf.”

apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)

27-32: Dependency injection keeps the button testable.

Threading useFlag, useRouter, and useSettings through the dependencies prop lets us stub them in stories/tests while defaulting to the real hooks in production. Nice quality-of-life improvement.

apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (1)

151-178: Fix test to assert blockchain gating correctly

The Accept Bid button here is already disabled because no bid is selected, so the test still passes even when isBlockchainDown is false. Please select a bid via the mocked BidGroup before asserting, and switch the expectation to queryByRole per the spec guidelines so you actually verify the offline gate.

Apply this diff:

-    const { getByRole } = setup({
+    setup({
       BidGroup,
       bids,
       isBlockchainDown: true
     });
-    await waitFor(() => {
-      expect(getByRole("button", { name: /Accept Bid/i })).toHaveAttribute("disabled");
-    });
+    await waitFor(() => expect(BidGroup).toHaveBeenCalled());
+    const bidGroupProps = (BidGroup as jest.Mock).mock.calls[0][0];
+    act(() => {
+      bidGroupProps.handleBidSelected(mapToBidDto(bids[0]));
+    });
+    await waitFor(() => {
+      expect(screen.queryByRole("button", { name: /Accept Bid/i })).toBeDisabled();
+    });

As per coding guidelines

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (8)
apps/deploy-web/src/queries/useGrantsQuery.ts (5)

18-28: Avoid mutating the incoming options object; compute a local enabled

Directly assigning to options.enabled can introduce subtle side effects if callers reuse the same object. Compute a local enabled and pass it to useQuery so intent is explicit and side‑effect free.

Apply:

-  options.enabled = options.enabled !== false && !!address && !!authzHttpService.defaults.baseURL && !settings.isBlockchainDown;
+  const enabled =
+    (options.enabled !== false) &&
+    !!address &&
+    !!authzHttpService.defaults.baseURL &&
+    !settings.isBlockchainDown;
@@
-    ...options
+    ...options,
+    enabled

32-41: Same here: don’t mutate options; pass a computed enabled

Repeat the no‑mutation pattern for this hook as well.

-  options.enabled = options.enabled !== false && !!address && !!authzHttpService.defaults.baseURL && !settings.isBlockchainDown;
+  const enabled =
+    (options.enabled !== false) &&
+    !!address &&
+    !!authzHttpService.defaults.baseURL &&
+    !settings.isBlockchainDown;
@@
-    ...options
+    ...options,
+    enabled

50-61: Same pattern: compute enabled locally

Keeps behavior identical while avoiding mutation.

-  options.enabled = options.enabled !== false && !!address && !!authzHttpService.defaults.baseURL && !settings.isBlockchainDown;
+  const enabled =
+    (options.enabled !== false) &&
+    !!address &&
+    !!authzHttpService.defaults.baseURL &&
+    !settings.isBlockchainDown;
@@
-    ...options
+    ...options,
+    enabled

68-78: Same pattern for allowancesGranted

Compute and pass enabled; don’t modify the caller’s object.

-  options.enabled = options.enabled !== false && !!address && !!chainApiHttpClient.defaults.baseURL && !settings.isBlockchainDown;
+  const enabled =
+    (options.enabled !== false) &&
+    !!address &&
+    !!chainApiHttpClient.defaults.baseURL &&
+    !settings.isBlockchainDown;
@@
-    ...options
+    ...options,
+    enabled

7-7: Unify useSettings import to barrel
In apps/deploy-web/src/queries/useGrantsQuery.ts, import useSettings from "@src/context/SettingsProvider" instead of "@src/context/SettingsProvider/SettingsProviderContext" to match the rest of the codebase.

apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (3)

32-41: Memoize provider value to reduce unnecessary consumer re‑renders

Creating a new object each render forces all consumers to re‑render even when fields don’t change. Wrap value in useMemo.

-  const value = {
-    hasBanner,
-    isMaintenanceBannerOpen,
-    setIsMaintenanceBannerOpen,
-    isBlockchainDown: settings.isBlockchainDown,
-    hasCreditCardBanner
-  };
+  const value = React.useMemo(
+    () => ({
+      hasBanner,
+      isMaintenanceBannerOpen,
+      setIsMaintenanceBannerOpen,
+      isBlockchainDown: settings.isBlockchainDown,
+      hasCreditCardBanner
+    }),
+    [hasBanner, isMaintenanceBannerOpen, settings.isBlockchainDown, hasCreditCardBanner]
+  );

43-43: Return the context value directly to preserve referential identity

Spreading creates a new object on each call, defeating memoization and triggering effects that depend on the hook result. Return the context value as‑is.

-export const useTopBanner = () => ({ ...React.useContext(TopBannerContext) });
+export const useTopBanner = () => React.useContext(TopBannerContext);

21-21: Use the barrel export for useSettings
All imports of useSettings should come from the SettingsProvider index (e.g. @src/context/SettingsProvider or relative ../SettingsProvider), not directly from SettingsProviderContext. Update any deep imports (e.g. …/SettingsProvider/SettingsProviderContext) to the barrel path for consistency.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8426129 and 9f8f8b4.

📒 Files selected for processing (2)
  • apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (1 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.ts (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use type any or cast to type any. Always define the proper TypeScript types.

Files:

  • apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx
  • apps/deploy-web/src/queries/useGrantsQuery.ts
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code

Files:

  • apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx
  • apps/deploy-web/src/queries/useGrantsQuery.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
🧬 Code graph analysis (2)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (3)
apps/deploy-web/src/types/component.ts (1)
  • FCWithChildren (4-4)
apps/deploy-web/src/hooks/useVariant.tsx (1)
  • useVariant (12-12)
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
  • useHasCreditCardBanner (11-35)
apps/deploy-web/src/queries/useGrantsQuery.ts (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (333-335)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (28-30)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (1)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (1)

24-26: Nice: maintenance banner now auto‑opens when the flag resolves true

Switching to a reactive open via useWhen addresses the prior “never opens after hydration” issue flagged earlier.

@jzsfkzm jzsfkzm force-pushed the feature/1948-disable-parts-when-blockchain-down branch from 9f8f8b4 to 7c948aa Compare September 29, 2025 15:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (2)

178-187: Avoid as any in Axios mocks

The cast to any violates our TS guideline. Use a deep mock and a typed AxiosResponse instead.

Apply this diff:

-import type { AxiosInstance } from "axios";
-import { mock } from "jest-mock-extended";
+import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
+import { mock, mockDeep } from "jest-mock-extended";
@@
-      const chainApiHttpClient = mock<AxiosInstance>({
-        defaults: { baseURL: "https://api.akash.network" },
-        get: jest.fn().mockResolvedValue({
-          data: {
-            allowances: mockData,
-            pagination: { next_key: null, total: mockData.length }
-          }
-        })
-      } as any);
+      const chainApiHttpClient = mockDeep<AxiosInstance>();
+      chainApiHttpClient.defaults.baseURL = "https://api.akash.network";
+      const axiosResponse: AxiosResponse<{
+        allowances: typeof mockData;
+        pagination: { next_key: null; total: number };
+      }> = {
+        data: {
+          allowances: mockData,
+          pagination: { next_key: null, total: mockData.length }
+        },
+        status: 200,
+        statusText: "OK",
+        headers: {},
+        // minimal config to satisfy type; no runtime impact in tests
+        config: {} as AxiosRequestConfig
+      };
+      chainApiHttpClient.get.mockResolvedValue(axiosResponse);

1-222: Remove all as any casts in spec files
The scan uncovered as any in:

  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx (line 223)
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (lines 186, 213)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (line 140)
  • apps/deploy-web/src/queries/useAnonymousUserQuery/useAnonymousUserQuery.spec.tsx (lines 82, 111, 251)

Replace each cast with explicit TypeScript types or properly typed mocks per repo conventions.

🧹 Nitpick comments (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)

294-312: Double‑check “down” criteria doesn’t ignore catching_up

isBlockchainDown flips only on status === "inactive". If nodes are “active” but still catching_up, UI will not enter offline mode. Confirm product intent; if catching_up should also gate writes, include nodeInfo?.sync_info.catching_up in the predicate.

apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (1)

13-29: Minor: allow overriding isBlockchainDown in mocks

Consider parameterizing createMockSettingsContext to override settings.isBlockchainDown per test without re‑declaring the provider.

Example:

-const createMockSettingsContext = (): SettingsContextType =>
+const createMockSettingsContext = (overrides?: Partial<SettingsContextType>): SettingsContextType =>
   mock({
     settings: {
       apiEndpoint: "https://api.example.com",
       rpcEndpoint: "https://rpc.example.com",
       isCustomNode: false,
       nodes: [],
       selectedNode: null,
       customNode: null,
-      isBlockchainDown: false
+      isBlockchainDown: false
     },
     setSettings: jest.fn(),
     isLoadingSettings: false,
     isSettingsInit: true,
     refreshNodeStatuses: jest.fn(),
     isRefreshingNodeStatus: false
-  });
+  }, overrides);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f8f8b4 and 7c948aa.

📒 Files selected for processing (3)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (9 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.ts (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/deploy-web/src/queries/useGrantsQuery.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() to mock dependencies in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test.

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block in test files
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

Files:

  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx

📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)

Use queryBy methods instead of getBy methods in test expectations in .spec.tsx files

Files:

  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use type any or cast to type any. Always define the proper TypeScript types.

Files:

  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code

Files:

  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files

Applied to files:

  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
🧬 Code graph analysis (2)
apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2)
  • SettingsContextType (41-41)
  • SettingsProviderContext (43-43)
apps/deploy-web/tests/unit/query-client.tsx (1)
  • setupQuery (9-30)
apps/deploy-web/src/queries/useGrantsQuery.ts (1)
  • useAllowancesGranted (67-78)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2)
apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (1)
  • ContextType (42-59)
apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
  • ContextType (38-59)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (3)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)

43-43: Publicly exporting Settings context — LGTM

Making the context export public is appropriate for tests and custom providers. No behavioral regressions detected.

apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (2)

31-35: Nice: local SettingsContext test wrapper

This wrapper keeps tests decoupled from the real provider and lets you toggle isBlockchainDown. Solid approach.


1-12: Conformance: aligns with testing rules

  • Uses jest-mock-extended.
  • No beforeEach.
  • No getBy queries in UI tests here.
    All good.

@stalniy stalniy force-pushed the feature/1948-disable-parts-when-blockchain-down branch from 5f94a68 to 0b052e2 Compare September 30, 2025 06:44
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)

69-87: Gate queries with blockchain-down flag.

The query hooks will fire even when the blockchain is down, potentially causing errors or unnecessary load. Add enabled: !settings.isBlockchainDown to the query options to prevent them from executing in offline mode.

Apply this diff to gate the queries:

 const { data: granterGrants, isLoading: isLoadingGranterGrants } = useGranterGrants(address, pageIndex.deployment, pageSize.deployment, {
   refetchInterval: isRefreshing === "granterGrants" ? refreshingInterval : defaultRefetchInterval,
   select: selectNonMasterGrants,
-  enabled: !debouncedSearchGrantee
+  enabled: !settings.isBlockchainDown && !debouncedSearchGrantee
 });
 const { data: granteeGrants, isLoading: isLoadingGranteeGrants } = useGranteeGrants(address, {
-  refetchInterval: isRefreshing === "granteeGrants" ? refreshingInterval : defaultRefetchInterval
+  refetchInterval: isRefreshing === "granteeGrants" ? refreshingInterval : defaultRefetchInterval,
+  enabled: !settings.isBlockchainDown
 });
 const { data: allowancesIssued, isLoading: isLoadingAllowancesIssued } = useAllowancesIssued(address, pageIndex.fee, pageSize.fee, {
   refetchInterval: isRefreshing === "allowancesIssued" ? refreshingInterval : defaultRefetchInterval,
-  select: selectNonMasterAllowances
+  select: selectNonMasterAllowances,
+  enabled: !settings.isBlockchainDown
 });
♻️ Duplicate comments (2)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (1)

458-459: Fix grammar in deletion confirmation.

The popup text contains grammar errors: "Deleting allowance to will revoke their ability to fees on your behalf."

Apply this diff:

-                Deleting allowance to will revoke their ability to fees on your behalf.
+                Deleting this allowance will revoke their ability to pay fees on your behalf.
apps/deploy-web/src/components/deployments/DeploymentList.tsx (1)

226-235: Aria-disabled on Link doesn't prevent navigation; apply onClick guard and disabled styling.

Setting aria-disabled on an anchor doesn't stop navigation or the onClick handler. The Link remains clickable when the blockchain is down. Based on learnings, you should prevent default navigation and add disabled styling.

Apply this diff:

                <Link
                  href={UrlService.newDeployment()}
-                  className={cn(buttonVariants({ variant: "default", size: "lg" }), "mt-4")}
-                  onClick={onDeployClick}
+                  className={cn(
+                    buttonVariants({ variant: "default", size: "lg" }),
+                    "mt-4",
+                    "aria-[disabled='true']:pointer-events-none aria-[disabled='true']:opacity-50"
+                  )}
+                  onClick={e => {
+                    if (settings.isBlockchainDown) {
+                      e.preventDefault();
+                      return;
+                    }
+                    onDeployClick();
+                  }}
                  aria-disabled={settings.isBlockchainDown}
                >

Based on learnings.

🧹 Nitpick comments (4)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)

15-19: Consider including useWallet in DEPENDENCIES for consistency.

While useFlag, useRouter, and useSettings are now injected via the DEPENDENCIES bundle, useWallet is still imported and called directly (line 29). For consistency and testability, consider adding useWallet to the DEPENDENCIES object so all hooks can be mocked uniformly in tests.

Apply this diff:

 const DEPENDENCIES = {
   useFlag,
   useRouter,
-  useSettings
+  useSettings,
+  useWallet
 };

And update the component to use it:

-  const { connectManagedWallet, hasManagedWallet, isWalletLoading } = useWallet();
+  const { connectManagedWallet, hasManagedWallet, isWalletLoading } = d.useWallet();
apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)

209-209: Prevent loading overlay when blockchain is down.

The isLoading flag should be gated to prevent showing a spinner when the blockchain is offline.

Apply this diff:

+const computedIsLoading = !settings.isBlockchainDown && isLoading;
+
 return (
-  <Layout isLoading={isLoading}>
+  <Layout isLoading={computedIsLoading}>
     <NextSeo title="Settings Authorizations" />

119-143: Add defensive guards for blockchain-down state.

Although the UI is hidden when the blockchain is down, add defensive guards to the transaction handlers in case the blockchain state changes during an operation.

Apply this diff:

 async function onDeleteGrantsConfirmed() {
+  if (settings.isBlockchainDown) return;
   if (!deletingGrants) return;

   const messages = deletingGrants.map(grant => TransactionMessageData.getRevokeMsg(address, grant.grantee, grant.authorization["@type"]));
   const response = await signAndBroadcastTx(messages);

   if (response) {
     setIsRefreshing("granterGrants");
     setDeletingGrants(null);
     setSelectedGrants([]);
   }
 }

 async function onDeleteAllowanceConfirmed() {
+  if (settings.isBlockchainDown) return;
   if (!deletingAllowances) return;

   const messages = deletingAllowances.map(allowance => TransactionMessageData.getRevokeAllowanceMsg(address, allowance.grantee));
   const response = await signAndBroadcastTx(messages);

   if (response) {
     setIsRefreshing("allowancesIssued");
     setDeletingAllowances(null);
     setSelectedAllowances([]);
   }
 }
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (1)

43-43: Consider removing the spread operator for better dependency tracking.

Spreading the context ({...React.useContext(TopBannerContext)}) creates a new object on every call, breaking referential equality. If consumers later use const banner = useTopBanner() in dependency arrays, effects will rerun unnecessarily. Current usage destructures immediately, avoiding this, but it's a maintainability risk.

Consider returning the context directly:

-export const useTopBanner = () => ({ ...React.useContext(TopBannerContext) });
+export const useTopBanner = () => React.useContext(TopBannerContext);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f94a68 and 0b052e2.

📒 Files selected for processing (21)
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (2 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx (1 hunks)
  • apps/deploy-web/src/components/home/YourAccount.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/Layout.tsx (4 hunks)
  • apps/deploy-web/src/components/layout/Sidebar.tsx (3 hunks)
  • apps/deploy-web/src/components/layout/TopBanner.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (7 hunks)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1 hunks)
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx (3 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (2 hunks)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1 hunks)
  • apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (1 hunks)
  • apps/deploy-web/src/context/TopBannerProvider/index.ts (1 hunks)
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (9 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.ts (5 hunks)
  • packages/ui/components/button.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
  • packages/ui/components/button.tsx
  • apps/deploy-web/src/context/TopBannerProvider/index.ts
  • apps/deploy-web/src/components/home/YourAccount.tsx
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.spec.tsx
  • apps/deploy-web/src/components/layout/Sidebar.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • apps/deploy-web/src/components/settings/SettingsContainer.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use type any or cast to type any. Always define the proper TypeScript types.

Files:

  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/queries/useGrantsQuery.ts
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code

Files:

  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/queries/useGrantsQuery.ts
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx
  • apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
  • apps/deploy-web/src/components/authorizations/Authorizations.tsx
  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() to mock dependencies in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test.

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block in test files
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

Files:

  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx

📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)

Use queryBy methods instead of getBy methods in test expectations in .spec.tsx files

Files:

  • apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.
📚 Learning: 2025-09-29T03:58:26.404Z
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/home/YourAccount.tsx:234-239
Timestamp: 2025-09-29T03:58:26.404Z
Learning: In the Akash Network Console project, the UI components use CSS approach for disabling elements with aria-disabled="true" using "aria-[disabled='true']:pointer-events-none aria-[disabled='true']:opacity-50" classes, as seen in the button component. This pattern should be extended to links for consistency.

Applied to files:

  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
📚 Learning: 2025-09-29T03:55:35.883Z
Learnt from: stalniy
PR: akash-network/console#1971
File: apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx:47-48
Timestamp: 2025-09-29T03:55:35.883Z
Learning: In the Akash Network Console project, when blockchain is down (settings.isBlockchainDown), disabling buttons like "Start Trial" is acceptable instead of completely hiding them.

Applied to files:

  • apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx
🧬 Code graph analysis (9)
apps/deploy-web/src/components/layout/TopBanner.tsx (2)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (1)
  • useTopBanner (43-43)
apps/deploy-web/src/context/TopBannerProvider/index.ts (1)
  • useTopBanner (1-1)
apps/deploy-web/src/queries/useGrantsQuery.ts (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
  • useSettings (333-335)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (28-30)
apps/deploy-web/src/components/layout/Layout.tsx (2)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (2)
  • TopBannerProvider (19-41)
  • useTopBanner (43-43)
apps/deploy-web/src/components/layout/TopBanner.tsx (1)
  • TopBanner (49-65)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (1)
  • DEPENDENCIES (66-104)
apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
  • DEPENDENCIES (63-68)
apps/deploy-web/src/context/TopBannerProvider/TopBannerProvider.tsx (4)
apps/deploy-web/src/context/TopBannerProvider/index.ts (1)
  • TopBannerProvider (1-1)
apps/deploy-web/src/types/component.ts (1)
  • FCWithChildren (4-4)
apps/deploy-web/src/hooks/useVariant.tsx (1)
  • useVariant (12-12)
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (1)
  • useHasCreditCardBanner (11-35)
apps/deploy-web/src/components/deployments/DeploymentList.tsx (3)
apps/deploy-web/src/utils/urlUtils.ts (1)
  • UrlService (16-81)
apps/provider-console/src/utils/styleUtils.ts (1)
  • cn (4-6)
packages/ui/components/button.tsx (1)
  • buttonVariants (46-46)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (4)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (2)
  • DEPENDENCIES (66-104)
  • Props (61-64)
apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)
  • DEPENDENCIES (10-16)
  • Props (18-22)
apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (1)
  • DEPENDENCIES (63-68)
apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (1)
  • useWallet (355-357)
apps/deploy-web/src/components/authorizations/Authorizations.tsx (3)
apps/deploy-web/src/components/settings/SettingsLayout.tsx (1)
  • SettingsLayout (24-58)
apps/deploy-web/src/components/shared/Fieldset.tsx (1)
  • Fieldset (12-23)
packages/ui/components/custom/popup.tsx (1)
  • Popup (101-330)
apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (3)
apps/deploy-web/src/components/new-deployment/BidGroup.tsx (1)
  • BidGroup (32-160)
apps/deploy-web/tests/seeders/bid.ts (1)
  • buildRpcBid (7-81)
apps/deploy-web/src/queries/useBidQuery.ts (1)
  • mapToBidDto (19-31)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (18)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (3)

21-25: LGTM!

The Props interface correctly extends ButtonProps and adds the optional dependencies prop typed from the DEPENDENCIES object, following the dependency injection pattern used across the codebase.


27-31: LGTM!

The component signature correctly implements the dependency injection pattern with a default value, and hooks are properly called through the dependencies object. The destructuring of settings from d.useSettings() is correct.


47-47: LGTM!

The disabled logic correctly integrates settings.isBlockchainDown to disable the button when the blockchain is down. This approach (disabling rather than hiding) is consistent with the project's design decision for this button.

Based on learnings.

apps/deploy-web/src/components/authorizations/Authorizations.tsx (2)

10-10: LGTM: Settings integration.

The useSettings hook is correctly imported and used to access the blockchain-down state.

Also applies to: 50-50


212-465: LGTM: Blockchain-down conditional structure.

The two-branch layout correctly hides the authorizations UI when the blockchain is down and displays an informative notice to the user.

apps/deploy-web/src/queries/useGrantsQuery.ts (2)

7-7: LGTM! Consistent settings integration.

The useSettings import and hook calls follow the established pattern across the codebase.

Also applies to: 18-18, 32-32, 50-50, 68-68


22-22: LGTM! Proper blockchain-down gating.

All grant-related queries are correctly disabled when the blockchain is down, preventing unnecessary network calls.

Also applies to: 35-35, 54-54, 71-71

apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (2)

8-8: LGTM! Proper dependency injection setup.

The useSettings import and DEPENDENCIES map update enable testable blockchain-down gating.

Also applies to: 14-16


25-25: LGTM! Certificate creation properly gated.

The button correctly disables when blockchain is down, preventing certificate transactions during downtime. Based on learnings.

Also applies to: 47-47

apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (4)

34-34: LGTM! Proper settings integration.

The useSettings import and DEPENDENCIES update follow the established pattern.

Also applies to: 102-104


115-115: LGTM!

Settings properly destructured for use throughout the component.


415-417: LGTM! Close Deployment actions properly gated.

All Close Deployment buttons correctly disable when blockchain is down, preventing transaction attempts during downtime.

Also applies to: 448-450, 600-609


428-428: LGTM! Accept Bid button properly gates blockchain operations.

The disabled condition correctly prioritizes settings.isBlockchainDown, preventing both lease creation and manifest resend when blockchain is down. The fix from previous review comments has been properly applied.

apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.spec.tsx (2)

151-187: LGTM! Test properly verifies blockchain-down gating.

The test correctly isolates the isBlockchainDown condition by selecting a bid first, ensuring the button's disabled state is due to blockchain downtime rather than missing selection. Uses queryBy methods as per coding guidelines.


403-403: LGTM! Test harness properly wired for settings.

The isBlockchainDown parameter and useSettings mock correctly propagate blockchain state to the component under test, enabling comprehensive testing of the gating logic.

Also applies to: 499-514

apps/deploy-web/src/components/layout/TopBanner.tsx (1)

49-65: LGTM! Clean priority-based banner rendering.

The orchestrator correctly renders banners in priority order (maintenance → network down → credit card), preventing overlap. The if-else structure ensures mutual exclusivity.

apps/deploy-web/src/components/layout/Layout.tsx (2)

104-104: className prop usage is valid. Nav’s className prop accepts ClassValue and is merged via cn(), which natively supports object literals for conditional classes. No changes needed.


112-112: Incorrect review comment: mdDrawerClassName object syntax is valid. Sidebar’s mdDrawerClassName prop is typed as ClassValue (supports object mappings) and is applied via clsx, so using

mdDrawerClassName={{ ["h-[calc(100%-40px)] mt-[97px]"]: hasBanner }}

will correctly include those classes when hasBanner is true. No change needed.

Likely an incorrect or invalid review comment.

@stalniy stalniy merged commit 64d5bef into akash-network:main Sep 30, 2025
62 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adjust UI when blockchain nodes are down (offline mode)

2 participants

Comments