Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const ErrorNotificationProvider: React.FC<{ children: React.ReactNode }>
<Alert
onClose={clearNotification}
severity={notification.severity}
variant="filled"
sx={{
width: "100%",
borderRadius: 6,
Expand Down
103 changes: 58 additions & 45 deletions applications/tari_walletd/web_ui/src/routes/FlowEditor/FlowEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
DialogContent,
DialogActions,
SelectChangeEvent,
FormHelperText,
} from "@mui/material";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
Expand Down Expand Up @@ -178,7 +179,7 @@ function FlowEditor() {

const onAccountChange = (e: SelectChangeEvent) => {
const selected = dataAccountsList?.accounts.find(
(acc: any) => substateIdToString(acc.account.address) === e.target.value,
(acc: any) => substateIdToString(acc.account.component_address) === e.target.value,
);
setAccount(selected);
};
Expand Down Expand Up @@ -272,23 +273,32 @@ function FlowEditor() {
return (
<Grid container spacing={2}>
<Grid item xs={panelOpen ? 9 : 12}>
<Grid item xs={12} md={12} lg={12}>
<PageHeading>Flow Editor</PageHeading>
</Grid>
<Grid item xs={12} md={12} lg={12}>
<StyledPaper>
<div style={{ height: "600px", width: "100%" }}>
<QueryBuilder
theme={themeMode}
getTransactionProps={getTransactionProps}
showGeneratedCode={showGeneratedCode}
executeTransaction={executeTransaction}
onNodesChange={onChange}
onEdgesChange={onChange}
onConnect={onChange}
/>
</div>
</StyledPaper>
<Grid
container
spacing={3}
style={{
margin: 0,
width: "100%",
}}
>
<Grid item xs={12} md={12} lg={12}>
<PageHeading>Flow Editor</PageHeading>
</Grid>
<Grid item xs={12} md={12} lg={12}>
<StyledPaper>
<div style={{ height: "600px", width: "100%" }}>
<QueryBuilder
theme={themeMode}
getTransactionProps={getTransactionProps}
showGeneratedCode={showGeneratedCode}
executeTransaction={executeTransaction}
onNodesChange={onChange}
onEdgesChange={onChange}
onConnect={onChange}
/>
</div>
</StyledPaper>
</Grid>
</Grid>
</Grid>
<Drawer
Expand All @@ -314,20 +324,25 @@ function FlowEditor() {
</Box>
<Box mb={2}>
<FormControl fullWidth size="small">
<InputLabel id="account-select-label">Account used to pay fees</InputLabel>
<InputLabel id="account-select-label">Account</InputLabel>
<Select
labelId="account-select-label"
name="account"
label="Account"
placeholder="Select an account"
value={account ? substateIdToString(account.account.component_address) : ""}
onChange={onAccountChange}
>
{dataAccountsList?.accounts?.map((acc: any) => (
<MenuItem key={substateIdToString(acc.account.address)} value={substateIdToString(acc.account.address)}>
{acc.account.name || substateIdToString(acc.account.address)}
<MenuItem
key={substateIdToString(acc.account.component_address)}
value={substateIdToString(acc.account.component_address)}
>
{acc.account.name || substateIdToString(acc.account.component_address)}
</MenuItem>
))}
</Select>
<FormHelperText>Select the account used to pay fees</FormHelperText>
</FormControl>
{account ? (
<Typography variant="subtitle2" mt={1}>
Expand All @@ -341,12 +356,10 @@ function FlowEditor() {
</Box>
<Divider />
<Box mt={2} mb={2}>
<Typography variant="subtitle2" gutterBottom>
Transaction Fee
</Typography>
<TextField
size="small"
type="number"
label="Transaction Fee"
value={fee}
onChange={(e) => setFee(Number(e.target.value))}
inputProps={{ min: 0 }}
Expand All @@ -369,38 +382,38 @@ function FlowEditor() {
/>
</Box>
<Box mt={2} mb={2}>
<Typography variant="subtitle2" gutterBottom>
Template ID
</Typography>
<Box display="flex" gap={1}>
<TextField
size="small"
value={templateId}
label="Template ID"
onChange={(e) => setTemplateId(e.target.value)}
placeholder="Enter template id"
fullWidth
/>
</Box>
<Box mt={2} mb={2}>
<InputLabel id="template-select-label">Builtin Templates</InputLabel>
<Select
style={{ minWidth: "100%" }}
labelId="template-select-label"
name="templateId"
label="Template Id"
placeholder="Select a builtin template"
value={KNOWN_TEMPLATES.find((t) => t.address === templateId)?.address || ""}
onChange={(e) => setTemplateId(e.target.value)}
>
<MenuItem key={""} value={""}>
<em>None</em>
</MenuItem>
{KNOWN_TEMPLATES.map((template) => (
<MenuItem key={template.address} value={template.address}>
{template.name} {shortenString(template.address)}
<FormControl fullWidth size="small">
<InputLabel id="template-select-label">Builtin Templates</InputLabel>
<Select
labelId="template-select-label"
name="templateId"
label="Builtin Templates"
placeholder="Select a builtin template"
value={KNOWN_TEMPLATES.find((t) => t.address === templateId)?.address || ""}
onChange={(e) => setTemplateId(e.target.value)}
>
<MenuItem key={""} value={""}>
<em>None</em>
</MenuItem>
))}
</Select>
{KNOWN_TEMPLATES.map((template) => (
<MenuItem key={template.address} value={template.address}>
{template.name} {shortenString(template.address)}
</MenuItem>
))}
</Select>
<FormHelperText>Select a builtin template</FormHelperText>
</FormControl>
</Box>
<Box>
<Button variant="contained" onClick={() => refetch()} disabled={!templateId || isLoading}>
Expand Down
48 changes: 27 additions & 21 deletions applications/tari_walletd/web_ui/src/routes/Manifest/Manifest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,28 +193,34 @@ function VariableEditor({
</Button>
</Stack>

<Table>
<TableHead>
<TableRow>
<TableCell>Key</TableCell>
<TableCell>Value</TableCell>
<TableCell>Actions</TableCell>
</TableRow>
</TableHead>
<TableBody>
{Object.entries(variables).map(([k, v]) => (
<TableRow key={k}>
<DataTableCell>{k}</DataTableCell>
<DataTableCell>{v}</DataTableCell>
<DataTableCell>
<Button variant="outlined" color="secondary" onClick={() => onRemove(k)}>
Remove
</Button>
</DataTableCell>
{Object.keys(variables).length > 0 && (
<Table
sx={{
marginBottom: 2,
}}
>
<TableHead>
<TableRow>
<TableCell>Key</TableCell>
<TableCell>Value</TableCell>
<TableCell>Actions</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableHead>
<TableBody>
{Object.entries(variables).map(([k, v]) => (
<TableRow key={k}>
<DataTableCell>{k}</DataTableCell>
<DataTableCell>{v}</DataTableCell>
<DataTableCell>
<Button variant="outlined" color="error" onClick={() => onRemove(k)}>
Remove
</Button>
</DataTableCell>
</TableRow>
))}
</TableBody>
</Table>
)}
</Grid>
);
}
Expand Down
Loading
Loading