• 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

0.0
/apps/web/src/components/inputs/inputs.tsx
1
"use client";
×
2

3
import { Stack } from "@mantine/core";
×
4
import { useDebouncedValue } from "@mantine/hooks";
×
5
import { FC, useCallback, useMemo, useState } from "react";
×
NEW
6
import { useInputsConnectionQuery } from "@cartesi/rollups-explorer-domain/explorer-hooks";
×
7
import {
8
    InputOrderByInput,
9
    RollupVersion,
NEW
10
} from "@cartesi/rollups-explorer-domain/explorer-types";
×
11
import { useUrlSearchParams } from "../../hooks/useUrlSearchParams";
×
12
import getConfiguredChainId from "../../lib/getConfiguredChain";
×
13
import { checkQuery } from "../../lib/query";
×
14
import InputsTable from "../inputs/inputsTable";
×
15
import Paginated from "../paginated";
×
16
import Search from "../search";
×
17

18
export type InputsProps = {
19
    orderBy?: InputOrderByInput;
20
    appVersion?: RollupVersion;
21
    appAddress?: string;
22
};
23

24
const Inputs: FC<InputsProps> = ({
×
25
    orderBy = InputOrderByInput.TimestampDesc,
×
26
    appAddress,
×
27
    appVersion,
×
28
}) => {
×
29
    const chainId = getConfiguredChainId();
×
30
    const [{ query: urlQuery }] = useUrlSearchParams();
×
31
    const [query, setQuery] = useState(urlQuery);
×
32
    const [limit, setLimit] = useState(10);
×
33
    const [page, setPage] = useState(1);
×
34
    const after = page === 1 ? undefined : ((page - 1) * limit).toString();
×
35

36
    const [queryDebounced] = useDebouncedValue(query, 500);
×
37

38
    const [{ data: data, fetching: fetching }] = useInputsConnectionQuery({
×
39
        variables: {
×
40
            orderBy,
×
41
            limit,
×
42
            after,
×
43
            where: checkQuery(
×
44
                queryDebounced.toLowerCase(),
×
45
                appAddress?.toLowerCase(),
×
46
                chainId,
×
47
                appVersion,
×
48
            ),
×
49
        },
×
50
    });
×
51
    const totalCount = data?.inputsConnection.totalCount ?? 0;
×
52

53
    const inputs = useMemo(
×
54
        () => data?.inputsConnection.edges.map((edge) => edge.node) ?? [],
×
55
        [data?.inputsConnection.edges],
×
56
    );
×
57

58
    const onChangePagination = useCallback((limit: number, page: number) => {
×
59
        setLimit(limit);
×
60
        setPage(page);
×
61
    }, []);
×
62

63
    /**
64
     * @description Memoized paginated table component
65
     * The memoization is required so that the component doesn't re-render
66
     * whenever the search input value changes
67
     */
68
    const MemoizedTable = useMemo(
×
69
        () => (
×
70
            <Paginated
×
71
                fetching={fetching}
×
72
                totalCount={totalCount}
×
73
                onChange={onChangePagination}
×
74
            >
75
                <InputsTable
×
76
                    inputs={inputs}
×
77
                    fetching={fetching}
×
78
                    totalCount={totalCount}
×
79
                />
×
80
            </Paginated>
×
81
        ),
82
        [fetching, onChangePagination, inputs, totalCount],
×
83
    );
×
84

85
    return (
×
86
        <Stack>
×
87
            <Search isLoading={fetching} onChange={setQuery} />
×
88
            {MemoizedTable}
×
89
        </Stack>
×
90
    );
91
};
×
92

93
export default Inputs;
×
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

© 2026 Coveralls, Inc