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

cartesi / rollups-explorer / 15725286037

18 Jun 2025 06:11AM UTC coverage: 87.514% (-0.01%) from 87.526%
15725286037

push

github

web-flow
#308 Add a new package to source the domains (#347)

1620 of 1886 branches covered (85.9%)

Branch coverage included in aggregate %.

23 of 28 new or added lines in 15 files covered. (82.14%)

1 existing line in 1 file now uncovered.

11045 of 12586 relevant lines covered (87.76%)

60.11 hits per line

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

82.54
/apps/web/src/components/specification/components/DecodingPreview.tsx
1
"use client";
1✔
2
import { CodeHighlight } from "@mantine/code-highlight";
1✔
3
import {
4
    Alert,
5
    Card,
6
    px,
7
    Stack,
8
    Text,
9
    Textarea,
10
    Title,
11
    useMantineTheme,
12
} from "@mantine/core";
1✔
13
import { decodePayload } from "../decoder";
1✔
14
import { useSpecFormContext } from "../form/context";
1✔
15
import { buildSpecification, stringifyContent } from "../utils";
1✔
16
import { isNilOrEmpty } from "ramda-adjunct";
1✔
17

18
export const DecodingPreview = () => {
1✔
19
    const form = useSpecFormContext();
156✔
20
    const values = form.getTransformedValues();
156✔
21
    const { encodedData } = values;
156✔
22
    const tempSpec = buildSpecification(values);
156✔
23
    const envelope =
156✔
24
        tempSpec && encodedData ? decodePayload(tempSpec, encodedData) : null;
156✔
25
    const content = envelope?.result ? stringifyContent(envelope.result) : null;
156✔
26
    const theme = useMantineTheme();
156✔
27
    const themeDefaultProps = theme.components?.AppShell?.defaultProps ?? {};
156!
28
    const headerHeight = themeDefaultProps?.header.height;
156✔
29
    const cardTop = !isNilOrEmpty(headerHeight)
156✔
30
        ? headerHeight + px("1rem")
156!
NEW
31
        : px("4.75rem");
×
32

33
    return (
156✔
34
        <Card shadow="sm" withBorder pos="sticky" top={cardTop}>
156✔
35
            <Title order={3}>Preview</Title>
156✔
36
            <Stack gap="lg">
156✔
37
                <Textarea
156✔
38
                    resize="vertical"
156✔
39
                    rows={5}
156✔
40
                    label="Data"
156✔
41
                    id="encoded-data-preview"
156✔
42
                    description="Encoded data to test against specification"
156✔
43
                    {...form.getInputProps("encodedData")}
156✔
44
                />
156✔
45

46
                {content && (
156✔
47
                    <CodeHighlight
1✔
48
                        data-testid="preview-decoded-data"
1✔
49
                        withCopyButton={false}
1✔
50
                        language="json"
1✔
51
                        code={content}
1✔
52
                    />
1✔
53
                )}
54

55
                {envelope?.error && (
156!
56
                    <Alert
×
57
                        color="yellow"
×
58
                        title="Keep changing your specification"
×
59
                    >
60
                        <Text style={{ whiteSpace: "pre-line" }}>
×
61
                            {envelope.error.message}
×
62
                        </Text>
×
63
                    </Alert>
×
64
                )}
65
            </Stack>
156✔
66
        </Card>
156✔
67
    );
68
};
156✔
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