groovinads-ui 1.2.75 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +628 -236
- package/dist/index.es.js +2 -15
- package/dist/index.js +2 -15
- package/index.d.ts +364 -0
- package/package.json +87 -79
- package/.babelrc +0 -3
- package/.eslintignore +0 -2
- package/.eslintrc.cjs +0 -32
- package/.prettierignore +0 -9
- package/.prettierrc +0 -7
- package/.storybook/main.js +0 -19
- package/.storybook/preview-head.html +0 -6
- package/.storybook/preview.js +0 -13
- package/.yarn/releases/yarn-4.1.1.cjs +0 -893
- package/.yarnrc.yml +0 -3
- package/rollup.config.mjs +0 -42
- package/src/components/Button/Button.jsx +0 -78
- package/src/components/Button/index.js +0 -3
- package/src/components/Dropdowns/DropdownComponent.jsx +0 -135
- package/src/components/Dropdowns/DropdownFilter.jsx +0 -304
- package/src/components/Dropdowns/DropdownMultiSelect.jsx +0 -304
- package/src/components/Dropdowns/DropdownSimpleDatePicker.jsx +0 -175
- package/src/components/Dropdowns/DropdownsDatePicker/DropdownDatePicker.jsx +0 -313
- package/src/components/Dropdowns/DropdownsDatePicker/PeriodAndDetailDropdowns.tsx +0 -351
- package/src/components/Dropdowns/DropdownsDatePicker/index.js +0 -3
- package/src/components/Dropdowns/index.js +0 -7
- package/src/components/Inputs/Checkbox.jsx +0 -55
- package/src/components/Inputs/Input.jsx +0 -155
- package/src/components/Inputs/InputChip.jsx +0 -168
- package/src/components/Inputs/InputEmail.jsx +0 -175
- package/src/components/Inputs/Radio.jsx +0 -57
- package/src/components/Inputs/Switch.jsx +0 -70
- package/src/components/Inputs/Textarea.jsx +0 -68
- package/src/components/Inputs/index.js +0 -9
- package/src/components/Labels/Alert.jsx +0 -62
- package/src/components/Labels/Icon.jsx +0 -76
- package/src/components/Labels/LoginSource.jsx +0 -19
- package/src/components/Labels/PillComponent.jsx +0 -47
- package/src/components/Labels/Spinner.jsx +0 -35
- package/src/components/Labels/StatusIcon.jsx +0 -66
- package/src/components/Labels/index.js +0 -8
- package/src/components/Navigation/Dropdowns/DeckDropdown.jsx +0 -210
- package/src/components/Navigation/Dropdowns/DropdownClient.jsx +0 -171
- package/src/components/Navigation/Dropdowns/UserDropdown.jsx +0 -69
- package/src/components/Navigation/Dropdowns/index.js +0 -5
- package/src/components/Navigation/Navbar.jsx +0 -81
- package/src/components/Navigation/Sidebar.jsx +0 -201
- package/src/components/Navigation/Stepper.jsx +0 -22
- package/src/components/Navigation/Tabnav.jsx +0 -73
- package/src/components/Navigation/index.js +0 -6
- package/src/components/Toasts/Toast/ToastCardComponent.jsx +0 -47
- package/src/components/Toasts/ToastComponent.jsx +0 -45
- package/src/components/Toasts/ToastProgress.jsx +0 -118
- package/src/components/Toasts/index.js +0 -4
- package/src/components/index.js +0 -50
- package/src/hooks/index.js +0 -4
- package/src/hooks/useGetBaseDomain.jsx +0 -9
- package/src/hooks/useTextFormatter.jsx +0 -48
- package/src/index.js +0 -51
- package/src/services/components.services.js +0 -29
- package/src/services/helpers.js +0 -32
- package/src/services/index.jsx +0 -10
- package/src/services/url.path.js +0 -29
- package/src/stories/Alert.stories.jsx +0 -11
- package/src/stories/Button.stories.jsx +0 -20
- package/src/stories/Checkbox.stories.jsx +0 -17
- package/src/stories/DropdownComponent.stories.jsx +0 -89
- package/src/stories/DropdownDatePicker.stories.jsx +0 -69
- package/src/stories/DropdownFilter.stories.jsx +0 -60
- package/src/stories/DropdownMultiSelect.stories.jsx +0 -72
- package/src/stories/DropdownSimpleDatePicker.stories.jsx +0 -64
- package/src/stories/Icon.stories.jsx +0 -11
- package/src/stories/Input.stories.jsx +0 -20
- package/src/stories/InputChip.stories.jsx +0 -44
- package/src/stories/InputEmail.stories.jsx +0 -27
- package/src/stories/Layout.stories.jsx +0 -73
- package/src/stories/LoginSource.stories.jsx +0 -11
- package/src/stories/Navbar.stories.jsx +0 -24
- package/src/stories/PillComponent.stories.jsx +0 -22
- package/src/stories/Radio.stories.jsx +0 -18
- package/src/stories/Sidebar.stories.jsx +0 -169
- package/src/stories/Spinner.stories.jsx +0 -11
- package/src/stories/StatusIcon.stories.jsx +0 -11
- package/src/stories/Stepper.stories.jsx +0 -16
- package/src/stories/Switch.stories.jsx +0 -17
- package/src/stories/Tabnav.stories.jsx +0 -55
- package/src/stories/Textarea.stories.jsx +0 -20
- package/src/stories/ToastComponent.stories.jsx +0 -62
- package/src/stories/ToastProgress.stories.jsx +0 -11
- package/version.js +0 -8
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
// SERVICES
|
|
4
|
-
import { ComponentsService } from '../../../services';
|
|
5
|
-
import { Dropdown } from 'react-bootstrap';
|
|
6
|
-
|
|
7
|
-
// COMPONENTS
|
|
8
|
-
import Input from '../../Inputs/Input';
|
|
9
|
-
import Icon from '../../Labels/Icon';
|
|
10
|
-
|
|
11
|
-
const DropdownClients = ({ profileSelectedClient }) => {
|
|
12
|
-
const [generalSkeleton, setGeneralSkeleton] = useState(false);
|
|
13
|
-
|
|
14
|
-
const [showDropdownSkeleton, setshowDropdownSkeleton] = useState(false);
|
|
15
|
-
|
|
16
|
-
const { id_client, client_name, email } = profileSelectedClient;
|
|
17
|
-
const initial_client = { id_client, client_name, email };
|
|
18
|
-
|
|
19
|
-
const [clientsList, setClientsList] = useState([]);
|
|
20
|
-
const [searchInput, setSearchInput] = useState('');
|
|
21
|
-
const [selectedClient, setSelectedClient] = useState(initial_client);
|
|
22
|
-
|
|
23
|
-
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
24
|
-
|
|
25
|
-
const clientInitials = selectedClient?.client_name?.slice(0, 2);
|
|
26
|
-
const toggleDropdown = () => setDropdownOpen((prev) => !prev);
|
|
27
|
-
|
|
28
|
-
const fetchClientsData = async () => {
|
|
29
|
-
try {
|
|
30
|
-
setshowDropdownSkeleton(true);
|
|
31
|
-
const clientsList = await ComponentsService.getClientsList();
|
|
32
|
-
|
|
33
|
-
setClientsList(clientsList);
|
|
34
|
-
setshowDropdownSkeleton(false);
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error('fetchClientsData error', error);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const filterClients = () => {
|
|
41
|
-
return clientsList.filter(
|
|
42
|
-
({ client_name, id_client, email }) =>
|
|
43
|
-
`${client_name} ${id_client}`
|
|
44
|
-
.toLowerCase()
|
|
45
|
-
.includes(searchInput.toLowerCase()) ||
|
|
46
|
-
email?.toLowerCase()?.includes(searchInput?.toLowerCase()),
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const changeClient = async (client) => {
|
|
51
|
-
try {
|
|
52
|
-
setGeneralSkeleton(true);
|
|
53
|
-
setshowDropdownSkeleton(true);
|
|
54
|
-
|
|
55
|
-
await ComponentsService.clientsLogin(client.id_client);
|
|
56
|
-
|
|
57
|
-
setSelectedClient(client);
|
|
58
|
-
|
|
59
|
-
// Check if current url ends with '/', if not, add it and redirect to that url
|
|
60
|
-
// If it currently ends with '/', just reload that url
|
|
61
|
-
if (window.location.href.slice(-1) !== '/')
|
|
62
|
-
window.location.replace(window.location.href + '/');
|
|
63
|
-
else window.location.reload();
|
|
64
|
-
} catch (error) {
|
|
65
|
-
console.error(' error en ClientsDropdowns ', error);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
fetchClientsData();
|
|
71
|
-
}, []);
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<>
|
|
75
|
-
{showDropdownSkeleton || generalSkeleton ? (
|
|
76
|
-
<div className='bottom-list loading'>
|
|
77
|
-
<div className='dropdown-clients'>
|
|
78
|
-
<div className='client-logo load'></div>
|
|
79
|
-
<div className='dropdown-clients-wrapper load-paragraph w-75'>
|
|
80
|
-
<div className='load text small mb-0'></div>
|
|
81
|
-
<div className='load text small mb-0'></div>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
) : (
|
|
86
|
-
<div className='bottom-list'>
|
|
87
|
-
<Dropdown
|
|
88
|
-
drop='up'
|
|
89
|
-
className='dropdown-clients'
|
|
90
|
-
show={clientsList.length <= 1 ? false : dropdownOpen}
|
|
91
|
-
onToggle={toggleDropdown}
|
|
92
|
-
>
|
|
93
|
-
<Dropdown.Toggle variant='client-selector' onClick={toggleDropdown}>
|
|
94
|
-
{/* Logo cliente. Si no tiene logo, usar el genérico generado. Ver JS en la parte inferior */}
|
|
95
|
-
{selectedClient ? (
|
|
96
|
-
<div className='client-logo'>
|
|
97
|
-
<p>{clientInitials}</p>
|
|
98
|
-
</div>
|
|
99
|
-
) : (
|
|
100
|
-
<img src='/react.svg' alt='' className='client-logo' />
|
|
101
|
-
)}
|
|
102
|
-
|
|
103
|
-
<div className='dropdown-clients-wrapper'>
|
|
104
|
-
<p className='dropdown-client-name'>
|
|
105
|
-
{selectedClient?.client_name || 'Client name'} [
|
|
106
|
-
{selectedClient?.id_client}]
|
|
107
|
-
</p>
|
|
108
|
-
<p className='dropdown-client-email'>
|
|
109
|
-
{selectedClient?.email || 'Client Email'}
|
|
110
|
-
</p>
|
|
111
|
-
</div>
|
|
112
|
-
{clientsList.length > 1 ? (
|
|
113
|
-
<Icon
|
|
114
|
-
style={'solid'}
|
|
115
|
-
iconName={'chevron-up'}
|
|
116
|
-
scale={1}
|
|
117
|
-
className={'icon caret'}
|
|
118
|
-
/>
|
|
119
|
-
) : (
|
|
120
|
-
<></>
|
|
121
|
-
)}
|
|
122
|
-
</Dropdown.Toggle>
|
|
123
|
-
<Dropdown.Menu>
|
|
124
|
-
<Dropdown.Item as={'div'} onClick={(e) => e.stopPropagation()}>
|
|
125
|
-
<Input
|
|
126
|
-
size={'xs'}
|
|
127
|
-
label={'Search client'}
|
|
128
|
-
icon={'magnifying-glass'}
|
|
129
|
-
className='w-100'
|
|
130
|
-
value={searchInput}
|
|
131
|
-
onChange={(e) => setSearchInput(e.target.value)}
|
|
132
|
-
/>
|
|
133
|
-
</Dropdown.Item>
|
|
134
|
-
<Dropdown.Item as={'ul'} className='client-list'>
|
|
135
|
-
{filterClients().length ? (
|
|
136
|
-
filterClients().map((client) => (
|
|
137
|
-
<li
|
|
138
|
-
className='client'
|
|
139
|
-
key={client.id_client}
|
|
140
|
-
onClick={() => changeClient(client)}
|
|
141
|
-
>
|
|
142
|
-
<p className='dropdown-client-name'>
|
|
143
|
-
{client.client_name} [{client.id_client}]
|
|
144
|
-
</p>
|
|
145
|
-
<p className='dropdown-client-email'>{client.email}</p>
|
|
146
|
-
</li>
|
|
147
|
-
))
|
|
148
|
-
) : (
|
|
149
|
-
<li>
|
|
150
|
-
<div className='empty-space'>
|
|
151
|
-
<img
|
|
152
|
-
src={'https://ui.groovinads.com/assets/not-found.svg'}
|
|
153
|
-
alt='Sad magnifier on abstract background'
|
|
154
|
-
/>
|
|
155
|
-
<div className='empty-space-text-wrapper'>
|
|
156
|
-
<h5 className='mb-1'>Client not found</h5>
|
|
157
|
-
<p>It looks like this client does not exist.</p>
|
|
158
|
-
</div>
|
|
159
|
-
</div>
|
|
160
|
-
</li>
|
|
161
|
-
)}
|
|
162
|
-
</Dropdown.Item>
|
|
163
|
-
</Dropdown.Menu>
|
|
164
|
-
</Dropdown>
|
|
165
|
-
</div>
|
|
166
|
-
)}
|
|
167
|
-
</>
|
|
168
|
-
);
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export default DropdownClients;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
// BOOTSTRAP
|
|
4
|
-
import Dropdown from 'react-bootstrap/Dropdown';
|
|
5
|
-
|
|
6
|
-
// COMPONENTS
|
|
7
|
-
import Icon from '../../Labels/Icon';
|
|
8
|
-
|
|
9
|
-
// SERVICES
|
|
10
|
-
import { ComponentsService } from '../../../services';
|
|
11
|
-
|
|
12
|
-
const UserDropdown = () => {
|
|
13
|
-
|
|
14
|
-
const [groovinProfile, setGroovinProfile] = useState({});
|
|
15
|
-
|
|
16
|
-
const handleLogout = async() => {
|
|
17
|
-
const resp = await ComponentsService.authLogout().then(() => {
|
|
18
|
-
window.location.href = '/';
|
|
19
|
-
}).catch((error) => {
|
|
20
|
-
console.error( error)
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
ComponentsService.authStatus().then((resp) => {
|
|
26
|
-
|
|
27
|
-
const { google_name: fullNameAuth, google_picture: imageAuth } = resp?.auth_data;
|
|
28
|
-
|
|
29
|
-
const splitFullNameAuth = fullNameAuth?.split(' ');
|
|
30
|
-
const nameAuth = splitFullNameAuth ? splitFullNameAuth[0] : undefined;
|
|
31
|
-
|
|
32
|
-
setGroovinProfile({imageAuth, nameAuth})
|
|
33
|
-
|
|
34
|
-
}).catch((error) => {
|
|
35
|
-
console.log('Error', error);
|
|
36
|
-
})
|
|
37
|
-
}, []);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Dropdown>
|
|
41
|
-
<Dropdown.Toggle className='btn btn-user'>
|
|
42
|
-
<div className='avatar'>
|
|
43
|
-
{/* Imagen de perfil */}
|
|
44
|
-
<img src={groovinProfile.imageAuth} />
|
|
45
|
-
</div>
|
|
46
|
-
{/* Nombre */}
|
|
47
|
-
<span>{groovinProfile.nameAuth}</span>
|
|
48
|
-
<Icon
|
|
49
|
-
style={'solid'}
|
|
50
|
-
iconName={'chevron-down'}
|
|
51
|
-
scale={1}
|
|
52
|
-
className={'icon caret'}
|
|
53
|
-
/>
|
|
54
|
-
</Dropdown.Toggle>
|
|
55
|
-
<Dropdown.Menu as={'ul'} align={'end'}>
|
|
56
|
-
<Dropdown.Item as={'li'}
|
|
57
|
-
onClick={handleLogout}
|
|
58
|
-
>
|
|
59
|
-
<Icon
|
|
60
|
-
iconName={'right-from-bracket'}
|
|
61
|
-
/>
|
|
62
|
-
<span>Logout</span>
|
|
63
|
-
</Dropdown.Item>
|
|
64
|
-
</Dropdown.Menu>
|
|
65
|
-
</Dropdown>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export default UserDropdown;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// BOOTSTRAP
|
|
5
|
-
import Container from 'react-bootstrap/Container';
|
|
6
|
-
|
|
7
|
-
// COMPONENTS
|
|
8
|
-
import { DeckDropdown, UserDropdown } from './Dropdowns';
|
|
9
|
-
import { Button } from '../Button';
|
|
10
|
-
|
|
11
|
-
// ASSETS
|
|
12
|
-
const appLogo = 'https://ui.groovinads.com/assets/groovinads-logo.svg';
|
|
13
|
-
|
|
14
|
-
const Navbar = ({
|
|
15
|
-
logoUrl,
|
|
16
|
-
showDeckMenu = false,
|
|
17
|
-
showUserMenu = false,
|
|
18
|
-
children,
|
|
19
|
-
show,
|
|
20
|
-
setShow,
|
|
21
|
-
}) => {
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<div id='ga-header' className='header fixed-top shadow-2'>
|
|
25
|
-
<Container fluid className='navbar'>
|
|
26
|
-
<div className='brand-wrapper'>
|
|
27
|
-
{/* Sidebar collapse */}
|
|
28
|
-
<Button
|
|
29
|
-
className={show ? 'sidebar-toggler' : 'sidebar-toggler collapsed'} // Necesito que agreguen o quiten la clase 'collapsed' para que el icono cambie
|
|
30
|
-
variant='terciary'
|
|
31
|
-
type='button'
|
|
32
|
-
onClick={() => setShow((prev) => !prev)}
|
|
33
|
-
>
|
|
34
|
-
<svg
|
|
35
|
-
className='icon'
|
|
36
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
37
|
-
viewBox='0 0 16 16'
|
|
38
|
-
>
|
|
39
|
-
<path
|
|
40
|
-
className='top'
|
|
41
|
-
d='M1,3c0-.55.45-1,1-1h12c.55,0,1,.45,1,1s-.45,1-1,1H2c-.55,0-1-.45-1-1Z'
|
|
42
|
-
/>
|
|
43
|
-
<path
|
|
44
|
-
className='mid'
|
|
45
|
-
d='M1,8c0-.55.45-1,1-1h12c.55,0,1,.45,1,1s-.45,1-1,1H2c-.55,0-1-.45-1-1Z'
|
|
46
|
-
/>
|
|
47
|
-
<path
|
|
48
|
-
className='bottom'
|
|
49
|
-
d='M15,13c0,.55-.45,1-1,1H2c-.55,0-1-.45-1-1s.45-1,1-1h12c.55,0,1,.45,1,1Z'
|
|
50
|
-
/>
|
|
51
|
-
</svg>
|
|
52
|
-
</Button>
|
|
53
|
-
{/* Dropdown apps */}
|
|
54
|
-
{/* TODO: conditional */}
|
|
55
|
-
{showDeckMenu && <DeckDropdown />}
|
|
56
|
-
|
|
57
|
-
<img
|
|
58
|
-
src={logoUrl || appLogo}
|
|
59
|
-
className='ga-logo'
|
|
60
|
-
alt='Groovinads logo'
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
{(children || showUserMenu) && (
|
|
64
|
-
<div className='nav-wrapper'>
|
|
65
|
-
{children}
|
|
66
|
-
{showUserMenu && <UserDropdown />}
|
|
67
|
-
</div>
|
|
68
|
-
)}
|
|
69
|
-
</Container>
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
Navbar.propTypes = {
|
|
75
|
-
logoUrl: PropTypes.string,
|
|
76
|
-
showDeckMenu: PropTypes.bool,
|
|
77
|
-
showUserMenu: PropTypes.bool,
|
|
78
|
-
children: PropTypes.node,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default Navbar;
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import { Collapse } from 'react-bootstrap';
|
|
3
|
-
import { useMediaQuery } from 'react-responsive';
|
|
4
|
-
|
|
5
|
-
// SERVICES
|
|
6
|
-
import { ComponentsService } from '../../services';
|
|
7
|
-
|
|
8
|
-
// PROP TYPES
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
|
|
11
|
-
// COMPONENTES
|
|
12
|
-
import { Icon } from '../Labels';
|
|
13
|
-
import { DropdownClients } from './Dropdowns';
|
|
14
|
-
|
|
15
|
-
const Sidebar = ({
|
|
16
|
-
api,
|
|
17
|
-
customLinks,
|
|
18
|
-
defaultOpened = true,
|
|
19
|
-
show,
|
|
20
|
-
setShow,
|
|
21
|
-
onNavigate,
|
|
22
|
-
selectedClient,
|
|
23
|
-
showClients = false,
|
|
24
|
-
setGroovinProfile,
|
|
25
|
-
inModal = false,
|
|
26
|
-
customUrl,
|
|
27
|
-
}) => {
|
|
28
|
-
const isMobile = inModal
|
|
29
|
-
? true
|
|
30
|
-
: useMediaQuery({ query: '(max-width: 992px)' });
|
|
31
|
-
|
|
32
|
-
const url = customUrl !== undefined ? customUrl : window.location.pathname; // to get current url
|
|
33
|
-
|
|
34
|
-
const [sidebarLinks, setSidebarLinks] = useState([]);
|
|
35
|
-
const [openIndex, setOpenIndex] = useState(null);
|
|
36
|
-
const [innerShow, setInnerShow] = useState(isMobile ? false : defaultOpened);
|
|
37
|
-
|
|
38
|
-
const sidebarRef = useRef(null);
|
|
39
|
-
const firstOpen = useRef(true);
|
|
40
|
-
|
|
41
|
-
const handleToggle = (index) => {
|
|
42
|
-
setOpenIndex(openIndex === index ? null : index);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const fetchData = async () => {
|
|
46
|
-
const resp = await ComponentsService.getInfo(api);
|
|
47
|
-
setSidebarLinks(resp);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (api) fetchData();
|
|
52
|
-
}, [api]);
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
setInnerShow(firstOpen.current ? defaultOpened : show);
|
|
56
|
-
}, [show]);
|
|
57
|
-
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (isMobile && setShow && !inModal) setShow(innerShow);
|
|
60
|
-
if (!inModal)
|
|
61
|
-
setInnerShow(isMobile ? false : firstOpen.current ? defaultOpened : show);
|
|
62
|
-
firstOpen.current = false;
|
|
63
|
-
}, []);
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<Collapse in={innerShow} dimension={'width'}>
|
|
67
|
-
<nav id='sidebarMenu' className='sidebar' ref={sidebarRef}>
|
|
68
|
-
{!inModal ? (
|
|
69
|
-
<div className='position-relative d-none d-lg-block'>
|
|
70
|
-
<button
|
|
71
|
-
className='collapse-button'
|
|
72
|
-
// Toggle the sidebar
|
|
73
|
-
onClick={() => {
|
|
74
|
-
setInnerShow((prev) => !prev);
|
|
75
|
-
setShow(!show);
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
78
|
-
<Icon className='collapse-icon' iconName='chevron-left' />
|
|
79
|
-
</button>
|
|
80
|
-
</div>
|
|
81
|
-
) : (
|
|
82
|
-
<></>
|
|
83
|
-
)}
|
|
84
|
-
|
|
85
|
-
{/* SECTIONS */}
|
|
86
|
-
<div className='scroll'>
|
|
87
|
-
{customLinks.map((section, i) => (
|
|
88
|
-
<div className='sidebar-section' key={`sectionIndex${i}`}>
|
|
89
|
-
{section.title ? <h4>{section.title}</h4> : <></>}
|
|
90
|
-
|
|
91
|
-
{/* PROPS LINKS */}
|
|
92
|
-
|
|
93
|
-
<ul className='nav'>
|
|
94
|
-
{(section.backData ? sidebarLinks : section.links || []).map(
|
|
95
|
-
(linkSection, y) => (
|
|
96
|
-
<li className='nav-item' key={`linksSections${y}`}>
|
|
97
|
-
{/* CHILDREN - If has children, the collapse is expanded */}
|
|
98
|
-
{linkSection.children && linkSection.children.length ? (
|
|
99
|
-
<>
|
|
100
|
-
<button
|
|
101
|
-
className={`btn-toggle ${
|
|
102
|
-
openIndex !== `${i}.${y}` ? 'collapsed' : ''
|
|
103
|
-
}`}
|
|
104
|
-
onClick={() => handleToggle(`${i}.${y}`)}
|
|
105
|
-
aria-controls='example-collapse-text'
|
|
106
|
-
aria-expanded={openIndex === `${i}.${y}`}
|
|
107
|
-
>
|
|
108
|
-
<Icon iconName={linkSection.icon} />
|
|
109
|
-
{linkSection.name}
|
|
110
|
-
</button>
|
|
111
|
-
|
|
112
|
-
{/* COLLAPSE */}
|
|
113
|
-
<Collapse in={openIndex === `${i}.${y}`}>
|
|
114
|
-
<ul className='btn-toggle-nav'>
|
|
115
|
-
{linkSection.children.map((childSection, x) => (
|
|
116
|
-
<li key={`childSectionIndex${x}`}>
|
|
117
|
-
<button
|
|
118
|
-
className={`nav-link ${
|
|
119
|
-
url === childSection.url ? 'active' : ''
|
|
120
|
-
}`}
|
|
121
|
-
onClick={() => onNavigate(childSection.url)}
|
|
122
|
-
>
|
|
123
|
-
{childSection.name}
|
|
124
|
-
</button>
|
|
125
|
-
</li>
|
|
126
|
-
))}
|
|
127
|
-
</ul>
|
|
128
|
-
</Collapse>
|
|
129
|
-
</>
|
|
130
|
-
) : (
|
|
131
|
-
<>
|
|
132
|
-
<button
|
|
133
|
-
className={`nav-link ${
|
|
134
|
-
url === linkSection.url ? 'active' : ''
|
|
135
|
-
}`}
|
|
136
|
-
onClick={() => onNavigate(linkSection.url)}
|
|
137
|
-
>
|
|
138
|
-
<Icon iconName={linkSection.icon} />
|
|
139
|
-
|
|
140
|
-
{linkSection.pendingType ? (
|
|
141
|
-
<div className='link-wrapper'>
|
|
142
|
-
{linkSection.name}
|
|
143
|
-
{linkSection.pendingLength > 0 &&
|
|
144
|
-
(linkSection.pendingType === 'warning' ? (
|
|
145
|
-
<Icon
|
|
146
|
-
iconName='triangle-exclamation'
|
|
147
|
-
className='warning-icon'
|
|
148
|
-
style='duotone'
|
|
149
|
-
/>
|
|
150
|
-
) : linkSection.pendingType === 'badge' ? (
|
|
151
|
-
<span className='badge'>
|
|
152
|
-
{linkSection.pendingLength}
|
|
153
|
-
</span>
|
|
154
|
-
) : null)}
|
|
155
|
-
</div>
|
|
156
|
-
) : (
|
|
157
|
-
linkSection.name
|
|
158
|
-
)}
|
|
159
|
-
</button>
|
|
160
|
-
</>
|
|
161
|
-
)}
|
|
162
|
-
</li>
|
|
163
|
-
),
|
|
164
|
-
)}
|
|
165
|
-
</ul>
|
|
166
|
-
</div>
|
|
167
|
-
))}
|
|
168
|
-
</div>
|
|
169
|
-
{showClients ? (
|
|
170
|
-
<DropdownClients
|
|
171
|
-
profileSelectedClient={selectedClient}
|
|
172
|
-
showClients={showClients}
|
|
173
|
-
setGroovinProfile={setGroovinProfile}
|
|
174
|
-
/>
|
|
175
|
-
) : (
|
|
176
|
-
<></>
|
|
177
|
-
)}
|
|
178
|
-
</nav>
|
|
179
|
-
</Collapse>
|
|
180
|
-
);
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
Sidebar.propTypes = {
|
|
184
|
-
api: PropTypes.string,
|
|
185
|
-
customLinks: PropTypes.array.isRequired,
|
|
186
|
-
defaultOpened: PropTypes.bool,
|
|
187
|
-
show: PropTypes.bool, // Add show prop for controlling visibility
|
|
188
|
-
setShow: PropTypes.func, // Add setShow prop for controlling visibility
|
|
189
|
-
onNavigate: PropTypes.func.isRequired, // Nueva prop para manejar la navegación
|
|
190
|
-
selectedClient: PropTypes.object,
|
|
191
|
-
showClients: PropTypes.oneOf([true, false, 'single']),
|
|
192
|
-
setGroovinProfile: PropTypes.func,
|
|
193
|
-
inModal: PropTypes.bool,
|
|
194
|
-
customUrl: PropTypes.oneOfType([
|
|
195
|
-
PropTypes.string,
|
|
196
|
-
PropTypes.oneOf([undefined]),
|
|
197
|
-
]),
|
|
198
|
-
pendingType: PropTypes.oneOf(['warning', 'badge']),
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
export default Sidebar;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
const Stepper = ({
|
|
5
|
-
list,
|
|
6
|
-
current
|
|
7
|
-
}) => {
|
|
8
|
-
return <ol className='stepper'>
|
|
9
|
-
{list.map((step, index) => {
|
|
10
|
-
return <li key={'Stepper' + index} className={current === index ? 'current' : ''}>
|
|
11
|
-
<span>{step}</span>
|
|
12
|
-
</li>;
|
|
13
|
-
})}
|
|
14
|
-
</ol>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
Stepper.propTypes = {
|
|
18
|
-
list: PropTypes.array.isRequired,
|
|
19
|
-
current: PropTypes.number.isRequired
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default Stepper;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Nav } from 'react-bootstrap';
|
|
4
|
-
|
|
5
|
-
// COMPONENTS
|
|
6
|
-
import { Icon } from '../Labels';
|
|
7
|
-
|
|
8
|
-
// HOOKS
|
|
9
|
-
import useTextFormatter from '../../hooks/useTextFormatter';
|
|
10
|
-
|
|
11
|
-
function Tabnav({
|
|
12
|
-
tabs = [],
|
|
13
|
-
activeTab = 1,
|
|
14
|
-
navigateTab = false,
|
|
15
|
-
setActiveTab,
|
|
16
|
-
onNavigate,
|
|
17
|
-
}) {
|
|
18
|
-
const { toCamelCase } = useTextFormatter();
|
|
19
|
-
|
|
20
|
-
// initial activeTab (in case it's not sent, it has a default value)
|
|
21
|
-
const [activeTabState, setActiveTabState] = useState(activeTab);
|
|
22
|
-
|
|
23
|
-
const handleSelect = (k) => {
|
|
24
|
-
if (navigateTab) {
|
|
25
|
-
const tab = tabs.find((tab) => toCamelCase(tab.tab) === k);
|
|
26
|
-
onNavigate(tab.url);
|
|
27
|
-
} else {
|
|
28
|
-
const tabIndex = tabs.findIndex((tab) => toCamelCase(tab.tab) === k) + 1;
|
|
29
|
-
setActiveTab ? setActiveTab(tabIndex) : setActiveTabState(tabIndex);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const formatTabsName = (tab) => {
|
|
34
|
-
if (tab === 'api_keys') return 'API Keys';
|
|
35
|
-
|
|
36
|
-
const tabReplace = tab.replace('_', ' ');
|
|
37
|
-
return tabReplace.charAt(0).toUpperCase() + tabReplace.slice(1);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
setActiveTabState(activeTab);
|
|
42
|
-
}, [activeTab]);
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<Nav
|
|
46
|
-
variant='tabs'
|
|
47
|
-
activeKey={toCamelCase(tabs[activeTabState - 1]?.tab)}
|
|
48
|
-
onSelect={handleSelect}
|
|
49
|
-
>
|
|
50
|
-
{(tabs || [])?.map(({ tab, badgeNumber, warningIcon }, index) => {
|
|
51
|
-
return (
|
|
52
|
-
<Nav.Item key={`tabs.tab: ${index}`}>
|
|
53
|
-
<Nav.Link eventKey={toCamelCase(tab)}>
|
|
54
|
-
{warningIcon && <Icon iconName='triangle-exclamation' />}
|
|
55
|
-
{formatTabsName(tab)}
|
|
56
|
-
{badgeNumber && <span className='tab-badge'>{badgeNumber}</span>}
|
|
57
|
-
</Nav.Link>
|
|
58
|
-
</Nav.Item>
|
|
59
|
-
);
|
|
60
|
-
})}
|
|
61
|
-
</Nav>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
Tabnav.propTypes = {
|
|
66
|
-
tabs: PropTypes.array.isRequired,
|
|
67
|
-
activeTab: PropTypes.number,
|
|
68
|
-
customFunction: PropTypes.bool,
|
|
69
|
-
navigateTab: PropTypes.bool,
|
|
70
|
-
setExternalTab: PropTypes.func,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default Tabnav;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React, { children, useState } from 'react';
|
|
2
|
-
import Toast from 'react-bootstrap/Toast';
|
|
3
|
-
import { Icon } from '../../Labels';
|
|
4
|
-
|
|
5
|
-
function ToastCardComponent({ variant, autoClose, children, className, position }) {
|
|
6
|
-
const [show, setShow] = useState(true);
|
|
7
|
-
|
|
8
|
-
const toggleShow = () => setShow(!show);
|
|
9
|
-
|
|
10
|
-
const variantIcons = {
|
|
11
|
-
info: 'circle-info',
|
|
12
|
-
success: 'circle-check',
|
|
13
|
-
warning: 'triangle-exclamation',
|
|
14
|
-
error: 'circle-xmark',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Toast
|
|
19
|
-
onClose={toggleShow}
|
|
20
|
-
show={show}
|
|
21
|
-
delay={autoClose ? 3500 : null}
|
|
22
|
-
autohide={autoClose}
|
|
23
|
-
className={`${position} ${variant} ${className ? className : ''}`}
|
|
24
|
-
>
|
|
25
|
-
<Toast.Body>
|
|
26
|
-
<div className='toast-wrapper'>
|
|
27
|
-
<div className='toast-type'>
|
|
28
|
-
<Icon
|
|
29
|
-
style={'solid'}
|
|
30
|
-
iconName={variantIcons[variant]}
|
|
31
|
-
scale={1}
|
|
32
|
-
className={'icon'}
|
|
33
|
-
/>
|
|
34
|
-
</div>
|
|
35
|
-
<span>{children}</span>
|
|
36
|
-
</div>
|
|
37
|
-
{!autoClose && (
|
|
38
|
-
<button className='btn-close' onClick={toggleShow}>
|
|
39
|
-
<Icon style={'solid'} iconName={'xmark'} scale={1} />
|
|
40
|
-
</button>
|
|
41
|
-
)}
|
|
42
|
-
</Toast.Body>
|
|
43
|
-
</Toast>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default ToastCardComponent;
|