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

cartesi / rollups-explorer / 10317825307

09 Aug 2024 10:34AM CUT coverage: 93.674% (-0.05%) from 93.722%
10317825307

Pull #223

github

nevendyulgerov
chore(packages/ui): Revert change
Pull Request #223: #220 Upgrade mantine packages

1147 of 1362 branches covered (84.21%)

Branch coverage included in aggregate %.

18 of 18 new or added lines in 4 files covered. (100.0%)

9 existing lines in 1 file now uncovered.

12403 of 13103 relevant lines covered (94.66%)

39.54 hits per line

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

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

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

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

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

1✔
28
const ConnectionUrlColumn: FC<ColumnProps> = ({ application }) => {
1✔
29
    const { getConnection } = useConnectionConfig();
×
30
    const connection = getConnection(application.id 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

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

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

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

1✔
180
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