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

cartesi / rollups-explorer / 11943333351

20 Nov 2024 11:09PM UTC coverage: 86.535% (-0.07%) from 86.605%
11943333351

push

github

brunomenezes
chore(ci): Set the Preview endpoint when available in the CI settings.

1276 of 1529 branches covered (83.45%)

Branch coverage included in aggregate %.

9077 of 10435 relevant lines covered (86.99%)

44.89 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, useState } from "react";
×
6
import { useInputsConnectionQuery } from "../../graphql/explorer/hooks/queries";
×
7
import { InputOrderByInput, RollupVersion } from "../../graphql/explorer/types";
×
8
import getConfiguredChainId from "../../lib/getConfiguredChain";
×
9
import { checkQuery } from "../../lib/query";
×
10
import InputsTable from "../inputs/inputsTable";
×
11
import Paginated from "../paginated";
×
12
import Search from "../search";
×
13

14
export type InputsProps = {
15
    orderBy?: InputOrderByInput;
16
    appVersion?: RollupVersion;
17
    appAddress?: string;
18
};
19

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

32
    const [queryDebounced] = useDebouncedValue(query, 500);
×
33

34
    const [{ data: data, fetching: fetching }] = useInputsConnectionQuery({
×
35
        variables: {
×
36
            orderBy,
×
37
            limit,
×
38
            after,
×
39
            where: checkQuery(
×
40
                queryDebounced.toLowerCase(),
×
41
                appAddress?.toLowerCase(),
×
42
                chainId,
×
43
                appVersion,
×
44
            ),
×
45
        },
×
46
    });
×
47
    const inputs = data?.inputsConnection.edges.map((edge) => edge.node) ?? [];
×
48

49
    const onChangePagination = useCallback((limit: number, page: number) => {
×
50
        setLimit(limit);
×
51
        setPage(page);
×
52
    }, []);
×
53

54
    return (
×
55
        <Stack>
×
56
            <Search isLoading={fetching} onChange={setQuery} />
×
57
            <Paginated
×
58
                fetching={fetching}
×
59
                totalCount={data?.inputsConnection.totalCount}
×
60
                onChange={onChangePagination}
×
61
            >
62
                <InputsTable
×
63
                    inputs={inputs}
×
64
                    fetching={fetching}
×
65
                    totalCount={data?.inputsConnection.totalCount ?? 0}
×
66
                />
×
67
            </Paginated>
×
68
        </Stack>
×
69
    );
70
};
×
71

72
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

© 2025 Coveralls, Inc