• 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/providers/connectionConfig/connectionConfigProvider.tsx
1
"use client";
×
2
import { Modal } from "@mantine/core";
×
3
import React, { FC, useEffect, useReducer } from "react";
×
4
import AppConnectionForm from "../../components/connection/connectionForm";
×
5
import { ConnectionConfigContext } from "./connectionConfigContext";
×
6
import { useConnectionConfig, useConnectionConfigActions } from "./hooks";
×
7
import { connectionConfigReducer, initialState } from "./reducer";
×
8
import { ConnectionConfigProviderProps } from "./types";
9
import localRepository from "./localRepository";
×
10

11
const ConnectionConfigProvider: FC<ConnectionConfigProviderProps> = ({
×
12
    children,
×
13
    repository = localRepository,
×
14
}) => {
×
15
    const [state, dispatch] = useReducer(connectionConfigReducer, initialState);
×
16
    const store = React.useMemo(
×
17
        () => ({ state, dispatch, repository }),
×
18
        [state, repository],
×
19
    );
×
20

21
    const closeModal = () => dispatch({ type: "HIDE_CONNECTION_MODAL" });
×
22

23
    useEffect(() => {
×
24
        dispatch({
×
25
            type: "SET_FETCHING",
×
26
            payload: true,
×
27
        });
×
28
        repository
×
29
            .list()
×
30
            .then((connections) =>
×
31
                dispatch({
×
32
                    type: "SET_CONNECTIONS",
×
33
                    payload: connections,
×
34
                }),
×
35
            )
×
36
            .catch((err) =>
×
37
                console.error(`Error trying to fetch connections: ${err}`),
×
38
            )
×
39
            .finally(() =>
×
40
                dispatch({
×
41
                    type: "SET_FETCHING",
×
42
                    payload: false,
×
43
                }),
×
44
            );
×
45
    }, [repository]);
×
46

47
    return (
×
48
        <ConnectionConfigContext.Provider value={store}>
×
49
            {children}
×
50
            <Modal
×
51
                opened={state.showConnectionModal}
×
52
                onClose={closeModal}
×
53
                title="Create App Connection"
×
54
                closeOnClickOutside={false}
×
55
            >
56
                <AppConnectionForm
×
57
                    onSubmitted={closeModal}
×
58
                    application={state.connectionAddress}
×
59
                />
×
60
            </Modal>
×
61
        </ConnectionConfigContext.Provider>
×
62
    );
63
};
×
64

65
export {
66
    ConnectionConfigProvider,
67
    useConnectionConfig,
68
    useConnectionConfigActions,
69
};
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