Skip to content

fix(walletui): flow editor layout - #1593

Merged
sdbondi merged 2 commits into
tari-project:developmentfrom
NovaT82:walletui
Oct 7, 2025
Merged

fix(walletui): flow editor layout#1593
sdbondi merged 2 commits into
tari-project:developmentfrom
NovaT82:walletui

Conversation

@NovaT82

@NovaT82 NovaT82 commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Description

Just tidied up the margins and layouts of the flow editor for better consistency
Also added ui fixes to Templates and Manifest pages.

Screenshot 2025-10-03 at 14 14 17

Motivation and Context

UI Improvements

How Has This Been Tested?

Manually

What process can a PR reviewer use to test or verify this change?

Open the wallet and go to the flow editor page

Breaking Changes

  • None
  • Requires data directory to be deleted
  • Other - Please specify

Summary by CodeRabbit

  • Refactor

    • Flow Editor layout restructured for full-width content; header and editor reinstated inside a nested grid.
    • Template selection in Flow Editor refactored into a labeled dropdown with helper text and preserved “None” option.
  • New Features / UX

    • Templates page: unified loading/error handling, new heading and content container, conditional account selector, table with expandable rows and pagination.
    • Manifest: variables table now shown only when variables exist.
  • Bug Fixes

    • Account selection now matches by component address; menu item keys/values corrected.
  • Style

    • Alerts use filled appearance; Remove button uses error color.

@coderabbitai

coderabbitai Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Refactors several web UI components: restructures FlowEditor layout and changes account/template selection to use component_address, adds helper text and labels, sets Alert variant to filled, and conditionally renders the Manifest variables table with adjusted Remove button styling. No exported/public API changes.

Changes

Cohort / File(s) Summary
Flow Editor UI & selection logic
applications/tari_walletd/web_ui/src/routes/FlowEditor/FlowEditor.tsx
- Add FormHelperText import and helper texts
- onAccountChange matches by component_address instead of address
- Wrap main content in container Grid and reintroduce header/editor in nested Grid (PageHeading, StyledPaper, QueryBuilder preserved)
- Drawer: relabel account to “Account”, add placeholder, use component_address for MenuItem keys/values, add FormHelperText
- Transaction Fee now a labeled TextField
- Template selection replaced with FormControl + InputLabel + Select driven by KNOWN_TEMPLATES, include “None” option and helper text; minor UI text tweaks
Error notification appearance
applications/tari_walletd/web_ui/src/contexts/ErrorNotificationContext.tsx
- Set variant="filled" on Alert inside ErrorNotificationProvider (appearance change only)
Manifest variables table & actions
applications/tari_walletd/web_ui/src/routes/Manifest/Manifest.tsx
- Render variables Table only when there is ≥1 variable (Object.keys(variables).length check)
- Add sx margin on Table when shown
- Replace secondary with error color for Remove button
- Expand table structure with explicit TableHead/TableBody rows and cells; onRemove(k) retained
Templates layout & data handling
applications/tari_walletd/web_ui/src/routes/Templates/Templates.tsx
- Consolidate MUI imports to @mui/material bulk import
- Introduce PageHeading, StyledPaper, FetchStatusCheck and use them
- Replace simple loading branch with unified loading/error handling via FetchStatusCheck
- Rework layout to top control bar with conditional Account selector and main Table of templates
- Implement expandable rows (Collapse) for function details; protect missing data and wire pagination/handlers; surface error.message when present

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant FE as FlowEditor (UI)
  participant AS as Account Select
  participant ST as Frontend State

  User->>AS: open account dropdown, choose account
  AS-->>FE: selected component_address
  FE->>ST: onAccountChange(component_address)
  Note right of FE: matching by component_address (was address)
Loading
sequenceDiagram
  autonumber
  actor User
  participant FE as FlowEditor (UI)
  participant TS as Builtin Template Select
  participant ST as Frontend State

  User->>TS: open templates, pick builtin template
  TS-->>FE: template key/value
  FE->>ST: lookup via KNOWN_TEMPLATES -> set templateId
  Note right of FE: selection wrapped in FormControl/InputLabel + FormHelperText
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • sdbondi

Poem

"A rabbit hops through grids and rows,
Labels bloom where helper text grows.
Addresses now point the right way,
Templates tidy up the day.
Filled alerts glow — a cheerful sight,
Hop, click, render — all feels right!" 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
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 “fix(walletui): flow editor layout” clearly summarizes the primary change by indicating a layout fix in the wallet UI’s flow editor and follows conventional commit style, making it concise, specific, and directly related to the main content of the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • 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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (1)
applications/tari_walletd/web_ui/src/routes/FlowEditor/FlowEditor.tsx (1)

276-302: Consider using styled components for inline styles.

The layout refactoring improves consistency as intended. The nested Grid structure with explicit spacing is appropriate for the Flow Editor layout.

For consistency with the existing codebase pattern (e.g., StyledPaper on line 288), consider extracting the inline style object into a styled component:

const StyledGridContainer = styled(Grid)(({ theme }) => ({
  margin: 0,
  width: '100%',
}));

Then use it as:

-        <Grid
-          container
-          spacing={3}
-          style={{
-            margin: 0,
-            width: "100%",
-          }}
-        >
+        <StyledGridContainer container spacing={3}>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7458abd and ad3dde0.

📒 Files selected for processing (1)
  • applications/tari_walletd/web_ui/src/routes/FlowEditor/FlowEditor.tsx (6 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
applications/tari_walletd/web_ui/src/routes/FlowEditor/FlowEditor.tsx (2)
applications/tari_walletd/web_ui/src/utils/helpers.tsx (2)
  • substateIdToString (100-109)
  • shortenString (134-143)
crates/wallet/sdk/src/models/account.rs (1)
  • account (60-62)
⏰ 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). (6)
  • GitHub Check: check stable
  • GitHub Check: machete
  • GitHub Check: test
  • GitHub Check: check nightly
  • GitHub Check: clippy
  • GitHub Check: fmt
🔇 Additional comments (5)
applications/tari_walletd/web_ui/src/routes/FlowEditor/FlowEditor.tsx (5)

50-50: LGTM!

The FormHelperText import is correctly added and used throughout the component for providing helper text to form controls.


326-356: Improved account selection UX.

The changes improve the UI by:

  • Simplifying the label to "Account" while moving the explanation to helper text
  • Using component_address consistently for MenuItem keys and values
  • Adding descriptive helper text "Select the account used to pay fees"

Note: The placeholder prop on line 332 won't display in a controlled Select component with a value, but it doesn't cause any issues.


359-368: LGTM!

The Transaction Fee input now uses an integrated label, which is cleaner and more consistent with Material UI form patterns.


384-423: Well-structured template selection.

The template section improvements include:

  • Labeled TextField for Template ID
  • Proper FormControl wrapper for builtin templates
  • Clear None option for deselection
  • Helpful guidance text

The value lookup logic on line 403 correctly finds the matching template by address, and the MenuItem mapping is implemented correctly.


180-185: Account property usage verified

The Account type in bindings/src/types/Account.ts includes component_address and no address field exists; using component_address for matching is correct.

@github-actions

github-actions Bot commented Oct 3, 2025

Copy link
Copy Markdown

Test Results (CI)

448 tests  +27   447 ✅ +26   1h 33m 7s ⏱️ + 45m 8s
 77 suites +15     0 💤 ± 0 
  2 files   + 1     1 ❌ + 1 

For more details on these failures, see this check.

Results for commit 5da9d0d. ± Comparison against base commit 7458abd.

♻️ This comment has been updated with latest results.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (2)
applications/tari_walletd/web_ui/src/routes/Templates/Templates.tsx (2)

95-100: Reset pagination when switching accounts

If I switch from an account that was on a later page to one with fewer templates, we keep requesting the old page index. The API then returns an empty list even though the new account has data, so the table appears blank. Please reset pagination (and related state) when the account changes.

   const onAccountChange = (e: SelectChangeEvent) => {
     const selected = dataAccountsList?.accounts.find(
       (account: AccountInfo) => substateIdToString(account.account.component_address) === e.target.value,
     );
-    setAccount(selected);
+    setAccount(selected);
+    setPage(0);
+    setOpen([]);
+    setTemplatesCount(0);
   };

102-109: Handle zero-template responses so counts stay correct

When the backend returns zero templates (e.g., switching to an empty account), this effect never fires, leaving templatesCount at the previous non-zero value and the pagination shows stale totals. It also leaves the open array from the prior response. Please update the state for every response, including when templatesResponse.templates.length === 0.

-  useEffect(() => {
-    if (templatesResponse && templatesResponse.templates.length > 0) {
-      let opens = new Array<boolean>(templatesResponse.templates.length);
-      opens.fill(false);
-      setOpen(opens);
-      setTemplatesCount(templatesResponse.total_templates);
-    }
-  }, [templatesResponse]);
+  useEffect(() => {
+    if (!templatesResponse) {
+      setOpen([]);
+      setTemplatesCount(0);
+      return;
+    }
+
+    setOpen(Array.from({ length: templatesResponse.templates.length }, () => false));
+    setTemplatesCount(templatesResponse.total_templates ?? 0);
+  }, [templatesResponse]);
🧹 Nitpick comments (1)
applications/tari_walletd/web_ui/src/routes/Templates/Templates.tsx (1)

159-258: Add keys to fragments for stable row rendering

Each iteration returns a fragment (<>…</>) without a key, triggering React warnings and risking diff instability. Wrap the fragment in React.Fragment (or move the key to it) so React can reconcile the rows cleanly.

-                      {templatesResponse?.templates.map((template: AuthoredTemplate, index: number) => {
-                        return (
-                          <>
+                      {templatesResponse?.templates.map((template: AuthoredTemplate, index: number) => {
+                        return (
+                          <React.Fragment key={`template-${index}`}>
                             <TableRow key={`template-${index}-1`}>
@@
-                            {open[index] ? (
-                              <TableRow key={`template-${index}-open`}>
+                            {open[index] ? (
+                              <TableRow key={`template-${index}-open`}>
@@
-                            ) : null}
-                          </>
+                            ) : null}
+                          </React.Fragment>
                         );
                       })}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad3dde0 and 5da9d0d.

📒 Files selected for processing (3)
  • applications/tari_walletd/web_ui/src/contexts/ErrorNotificationContext.tsx (1 hunks)
  • applications/tari_walletd/web_ui/src/routes/Manifest/Manifest.tsx (1 hunks)
  • applications/tari_walletd/web_ui/src/routes/Templates/Templates.tsx (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
applications/tari_walletd/web_ui/src/routes/Templates/Templates.tsx (7)
applications/tari_walletd/web_ui/src/services/api/hooks/useTemplatesAuthored.tsx (1)
  • useListTemplatesAuthored (8-19)
applications/tari_walletd/web_ui/src/utils/helpers.tsx (3)
  • substateIdToString (100-109)
  • handleChangePage (152-158)
  • handleChangeRowsPerPage (160-167)
bindings/src/types/wallet-daemon-client/AccountInfo.ts (1)
  • AccountInfo (5-5)
bindings/src/types/wallet-daemon-client/AuthoredTemplate.ts (1)
  • AuthoredTemplate (6-12)
applications/tari_walletd/web_ui/src/components/CopyAddress.tsx (1)
  • CopyAddress (32-43)
bindings/src/types/FunctionDef.ts (1)
  • FunctionDef (5-5)
bindings/src/types/ArgDef.ts (1)
  • ArgDef (4-4)
⏰ 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). (7)
  • GitHub Check: check-title
  • GitHub Check: check stable
  • GitHub Check: file licenses
  • GitHub Check: machete
  • GitHub Check: test
  • GitHub Check: clippy
  • GitHub Check: check nightly
🔇 Additional comments (2)
applications/tari_walletd/web_ui/src/contexts/ErrorNotificationContext.tsx (1)

91-91: LGTM! Visual consistency improvement.

Adding variant="filled" to the Alert component is a valid MUI styling prop that enhances visual consistency across the UI without affecting any behavior or functionality.

applications/tari_walletd/web_ui/src/routes/Manifest/Manifest.tsx (1)

196-223: LGTM! Excellent UI improvements.

The conditional rendering of the variables table is a great UX enhancement that prevents displaying an empty table. The complete table structure with proper headers improves accessibility, and the color="error" for the Remove button is semantically appropriate for a destructive action. The added margin aligns perfectly with the PR's objective of tidying layouts.

@sdbondi
sdbondi merged commit 9bc1d18 into tari-project:development Oct 7, 2025
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants