• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cartesi / rollups-explorer / 11726651411

07 Nov 2024 03:57PM CUT coverage: 86.104% (-0.5%) from 86.605%
11726651411

Pull #256

github

nevendyulgerov
chore(packages/ui): Cleanup
Pull Request #256: #251 Add ABI encoding for raw input form

1366 of 1627 branches covered (83.96%)

Branch coverage included in aggregate %.

756 of 920 new or added lines in 13 files covered. (82.17%)

9428 of 10909 relevant lines covered (86.42%)

47.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

11.11
/packages/ui/src/GenericInputForm/TupleComponents.tsx
1
import React, { FC, Fragment } from "react";
1✔
2
import { InputLabel } from "./FunctionSignature";
1✔
3
import { Fieldset, FieldsetProps, TextInput } from "@mantine/core";
1✔
4
import { useFormContext } from "./context";
1✔
5
import { AbiInputParam } from "./types";
6

7
interface TupleComponentsProps extends FieldsetProps {
8
    input: AbiInputParam;
9
}
10

11
export const TupleComponents: FC<TupleComponentsProps> = (props) => {
1✔
NEW
12
    const form = useFormContext();
×
NEW
13
    const { input, ...restProps } = props;
×
NEW
14
    const { value: abiFunctionParams } =
×
NEW
15
        form.getInputProps("abiFunctionParams");
×
NEW
16
    const firstStandardInput = input.components.find((c) => c.type !== "tuple");
×
NEW
17
    const firstStandardInputIndex = input.components.findIndex(
×
NEW
18
        (c) =>
×
NEW
19
            c.name == firstStandardInput?.name &&
×
NEW
20
            c.type === firstStandardInput?.type,
×
NEW
21
    );
×
22

NEW
23
    return (
×
NEW
24
        <Fieldset {...restProps} legend={<InputLabel input={input} />}>
×
NEW
25
            {input.components.map((component, componentIndex) => {
×
NEW
26
                const isFirstStandardInput =
×
NEW
27
                    componentIndex === firstStandardInputIndex;
×
NEW
28
                const targetIndex = abiFunctionParams.findIndex(
×
NEW
29
                    (p: AbiInputParam) =>
×
NEW
30
                        p.tupleName === input.name &&
×
NEW
31
                        p.type === component.type &&
×
NEW
32
                        p.name === component.name,
×
NEW
33
                );
×
34

NEW
35
                return (
×
NEW
36
                    <Fragment
×
NEW
37
                        key={`${input.name}-${input.type}-${component.name}-${component.type}`}
×
38
                    >
NEW
39
                        {component.type === "tuple" ? (
×
NEW
40
                            <TupleComponents input={component} mt={16} />
×
41
                        ) : (
NEW
42
                            <TextInput
×
NEW
43
                                key={`${component.name}-${component.type}`}
×
NEW
44
                                label={<InputLabel input={component} />}
×
NEW
45
                                placeholder={`Enter ${component.type} value`}
×
NEW
46
                                mt={isFirstStandardInput ? 0 : 16}
×
NEW
47
                                withAsterisk
×
NEW
48
                                {...form.getInputProps(
×
NEW
49
                                    `abiFunctionParams.${targetIndex}.value`,
×
NEW
50
                                )}
×
NEW
51
                            />
×
52
                        )}
NEW
53
                    </Fragment>
×
54
                );
NEW
55
            })}
×
NEW
56
        </Fieldset>
×
57
    );
NEW
58
};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc