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

cartesi / rollups-explorer / 11943333351

20 Nov 2024 11:09PM CUT 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

33.09
/apps/web/src/components/applications/applicationsTable.tsx
1
"use client";
1✔
2

3
import { ActionIcon, Box, Group, Tooltip } from "@mantine/core";
1✔
4
import { Address as AddressType } from "abitype/dist/types/abi";
5
import Link from "next/link";
1✔
6
import { FC } from "react";
7
import {
8
    TbInbox,
9
    TbPlugConnected,
10
    TbPlugConnectedX,
11
    TbStack2,
12
} from "react-icons/tb";
1✔
13
import { ApplicationItemFragment } from "../../graphql/explorer/operations";
14
import { useConnectionConfig } from "../../providers/connectionConfig/hooks";
1✔
15
import Address from "../address";
1✔
16
import ResponsiveTable from "../responsiveTable";
1✔
17

18
export interface ApplicationsTableProps {
19
    applications: ApplicationItemFragment[];
20
    fetching: boolean;
21
    totalCount: number;
22
}
23

24
interface ColumnProps {
25
    application: ApplicationItemFragment;
26
}
27

28
const ConnectionUrlColumn: FC<ColumnProps> = ({ application }) => {
1✔
29
    const { getConnection } = useConnectionConfig();
×
30
    const connection = getConnection(application.address as AddressType);
×
31
    return (
×
32
        <Box
×
33
            display="flex"
×
34
            w="max-content"
×
35
            style={{
×
36
                alignItems: "center",
×
37
                justifyContent: "center",
×
38
            }}
×
39
        >
40
            {connection?.url ?? "N/A"}
×
41
        </Box>
×
42
    );
43
};
×
44

45
const ApplicationDataColumn: FC<ColumnProps> = ({ application }) => {
1✔
46
    const { hasConnection, removeConnection, showConnectionModal } =
×
47
        useConnectionConfig();
×
48
    const appId = application.address as AddressType;
×
49
    const version = application.rollupVersion;
×
50

51
    return (
×
52
        <Box
×
53
            display="flex"
×
54
            w="max-content"
×
55
            style={{
×
56
                alignItems: "center",
×
57
                justifyContent: "center",
×
58
            }}
×
59
        >
60
            <Group gap="xs">
×
61
                <Tooltip label="Summary">
×
62
                    <Link
×
63
                        href={`/applications/${appId}/${version}`}
×
64
                        data-testid="applications-summary-link"
×
65
                    >
66
                        <ActionIcon variant="default">
×
67
                            <TbStack2 />
×
68
                        </ActionIcon>
×
69
                    </Link>
×
70
                </Tooltip>
×
71
                <Tooltip label="Inputs">
×
72
                    <Link
×
73
                        href={`/applications/${appId}/${version}/inputs`}
×
74
                        data-testid="applications-link"
×
75
                    >
76
                        <ActionIcon variant="default">
×
77
                            <TbInbox />
×
78
                        </ActionIcon>
×
79
                    </Link>
×
80
                </Tooltip>
×
81
                {hasConnection(appId) ? (
×
82
                    <Tooltip label="Remove connection">
×
83
                        <ActionIcon
×
84
                            data-testid="remove-connection"
×
85
                            variant="default"
×
86
                            onClick={() => removeConnection(appId)}
×
87
                        >
88
                            <TbPlugConnectedX />
×
89
                        </ActionIcon>
×
90
                    </Tooltip>
×
91
                ) : (
92
                    <Tooltip label="Add a connection">
×
93
                        <ActionIcon
×
94
                            data-testid="add-connection"
×
95
                            variant="default"
×
96
                            onClick={() => showConnectionModal(appId)}
×
97
                        >
98
                            <TbPlugConnected />
×
99
                        </ActionIcon>
×
100
                    </Tooltip>
×
101
                )}
102
            </Group>
×
103
        </Box>
×
104
    );
105
};
×
106

107
const ApplicationsTable: FC<ApplicationsTableProps> = ({
1✔
108
    applications,
5✔
109
    fetching,
5✔
110
    totalCount,
5✔
111
}) => {
5✔
112
    return (
5✔
113
        <ResponsiveTable<ApplicationItemFragment>
5✔
114
            items={applications}
5✔
115
            fetching={fetching}
5✔
116
            totalCount={totalCount}
5✔
117
            columns={[
5✔
118
                {
5✔
119
                    key: "id",
5✔
120
                    label: "Id",
5✔
121
                    render: (application) => {
5✔
122
                        const address = application.address as AddressType;
×
123
                        return (
×
124
                            <Box
×
125
                                display="flex"
×
126
                                w="max-content"
×
127
                                style={{
×
128
                                    alignItems: "center",
×
129
                                    justifyContent: "center",
×
130
                                }}
×
131
                            >
132
                                <Address value={address} icon shorten />
×
133
                            </Box>
×
134
                        );
135
                    },
×
136
                },
5✔
137
                {
5✔
138
                    key: "owner",
5✔
139
                    label: "Owner",
5✔
140
                    render: (application) => (
5✔
141
                        <Box
×
142
                            display="flex"
×
143
                            w="max-content"
×
144
                            style={{
×
145
                                alignItems: "center",
×
146
                                justifyContent: "center",
×
147
                            }}
×
148
                        >
149
                            {application.owner ? (
×
150
                                <Address
×
151
                                    value={application.owner as AddressType}
×
152
                                    icon
×
153
                                    shorten
×
154
                                />
×
155
                            ) : (
156
                                "N/A"
×
157
                            )}
158
                        </Box>
×
159
                    ),
160
                },
5✔
161
                {
5✔
162
                    key: "url",
5✔
163
                    label: "URL",
5✔
164
                    render: (application) => (
5✔
165
                        <ConnectionUrlColumn application={application} />
×
166
                    ),
167
                },
5✔
168
                {
5✔
169
                    key: "data",
5✔
170
                    label: "Data",
5✔
171
                    sticky: true,
5✔
172
                    render: (application) => (
5✔
173
                        <ApplicationDataColumn application={application} />
×
174
                    ),
175
                },
5✔
176
            ]}
5✔
177
        />
5✔
178
    );
179
};
5✔
180

181
export default ApplicationsTable;
1✔
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