groovinads-ui 1.2.74 → 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 -83
- 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,68 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// HOOKS
|
|
5
|
-
import useTextFormatter from '../../hooks/useTextFormatter';
|
|
6
|
-
|
|
7
|
-
const Textarea = ({
|
|
8
|
-
className = '',
|
|
9
|
-
helpText,
|
|
10
|
-
label = 'Label',
|
|
11
|
-
name,
|
|
12
|
-
onChange,
|
|
13
|
-
requiredText,
|
|
14
|
-
showError,
|
|
15
|
-
setShowError,
|
|
16
|
-
size = 'md',
|
|
17
|
-
value = ''
|
|
18
|
-
}) => {
|
|
19
|
-
const { toCamelCase } = useTextFormatter();
|
|
20
|
-
|
|
21
|
-
const sizeClass =
|
|
22
|
-
size === 'lg' ? 'form-control-lg' : size === 'xs' ? 'form-control-xs' : '';
|
|
23
|
-
const id = toCamelCase(label);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (showError) {
|
|
27
|
-
setTimeout(() => {
|
|
28
|
-
setShowError(false);
|
|
29
|
-
}, 3000);
|
|
30
|
-
}
|
|
31
|
-
}, [showError]);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className={`position-relative ${className}`}>
|
|
35
|
-
<div
|
|
36
|
-
className={`form-floating ${showError ? 'not-validated' : ''}`}
|
|
37
|
-
data-error={requiredText}
|
|
38
|
-
>
|
|
39
|
-
<textarea
|
|
40
|
-
className={`form-control ${sizeClass}`}
|
|
41
|
-
onChange={onChange}
|
|
42
|
-
placeholder={label}
|
|
43
|
-
id={id}
|
|
44
|
-
name={name}
|
|
45
|
-
required={!!requiredText}
|
|
46
|
-
value={value || ''}
|
|
47
|
-
/>
|
|
48
|
-
<label htmlFor={id}>{label}</label>
|
|
49
|
-
{helpText && <small className='form-text text-muted'>{helpText}</small>}
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
Textarea.propTypes = {
|
|
56
|
-
className: PropTypes.string,
|
|
57
|
-
helpText: PropTypes.string,
|
|
58
|
-
label: PropTypes.string,
|
|
59
|
-
name: PropTypes.string,
|
|
60
|
-
onChange: PropTypes.func,
|
|
61
|
-
requiredText: PropTypes.string,
|
|
62
|
-
showError: PropTypes.bool,
|
|
63
|
-
setShowError: PropTypes.func,
|
|
64
|
-
size: PropTypes.oneOf(['xs', 'md', 'lg']),
|
|
65
|
-
value: PropTypes.string
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default Textarea;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import Checkbox from './Checkbox';
|
|
2
|
-
import Input from './Input';
|
|
3
|
-
import Radio from './Radio';
|
|
4
|
-
import Switch from './Switch';
|
|
5
|
-
import Textarea from './Textarea';
|
|
6
|
-
import InputChip from './InputChip';
|
|
7
|
-
import InputEmail from './InputEmail';
|
|
8
|
-
|
|
9
|
-
export { Checkbox, Input, Radio, Switch, Textarea, InputChip, InputEmail };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// COMPONENTS
|
|
5
|
-
import Icon from '../Labels/Icon';
|
|
6
|
-
|
|
7
|
-
const Alert = ({
|
|
8
|
-
icon = true,
|
|
9
|
-
animation = false,
|
|
10
|
-
type = 'info',
|
|
11
|
-
size = 'md',
|
|
12
|
-
onClose = null,
|
|
13
|
-
children,
|
|
14
|
-
className = '',
|
|
15
|
-
}) => {
|
|
16
|
-
|
|
17
|
-
const iconMap = {
|
|
18
|
-
info: 'circle-info',
|
|
19
|
-
success: 'check',
|
|
20
|
-
warning: 'triangle-exclamation',
|
|
21
|
-
danger: 'circle-xmark',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<div
|
|
26
|
-
className={`alert ${
|
|
27
|
-
animation ? 'alert-animation' : ''
|
|
28
|
-
} alert-${type} alert-${size} ${className}`}
|
|
29
|
-
role='alert'
|
|
30
|
-
>
|
|
31
|
-
<div className='alert-wrapper'>
|
|
32
|
-
{icon && (
|
|
33
|
-
<Icon
|
|
34
|
-
style={'solid'}
|
|
35
|
-
iconName={iconMap[type]}
|
|
36
|
-
/>
|
|
37
|
-
)}
|
|
38
|
-
<span>{children}</span>
|
|
39
|
-
</div>
|
|
40
|
-
{onClose && (
|
|
41
|
-
<button onClick={onClose} className='btn-close'>
|
|
42
|
-
<Icon
|
|
43
|
-
style={'solid'}
|
|
44
|
-
iconName={'xmark'}
|
|
45
|
-
/>
|
|
46
|
-
</button>
|
|
47
|
-
)}
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
Alert.propTypes = {
|
|
53
|
-
icon: PropTypes.bool,
|
|
54
|
-
animation: PropTypes.bool,
|
|
55
|
-
type: PropTypes.oneOf(['warning', 'danger', 'success', 'info']).isRequired,
|
|
56
|
-
size: PropTypes.oneOf(['xs', 'md', 'lg']),
|
|
57
|
-
onClose: PropTypes.func,
|
|
58
|
-
children: PropTypes.node.isRequired,
|
|
59
|
-
className: PropTypes.string,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export default Alert;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
const Icon = ({
|
|
5
|
-
style = 'solid',
|
|
6
|
-
scale = 1,
|
|
7
|
-
iconName = 'user-bounty-hunter',
|
|
8
|
-
className = '',
|
|
9
|
-
animation = '',
|
|
10
|
-
}) => {
|
|
11
|
-
const iconStyle = `fa-${style}`;
|
|
12
|
-
const iconClass = `fa-${iconName}`;
|
|
13
|
-
|
|
14
|
-
let iconScale;
|
|
15
|
-
switch(scale) {
|
|
16
|
-
case 0.7:
|
|
17
|
-
iconScale = 'icon-07x';
|
|
18
|
-
break;
|
|
19
|
-
case 1:
|
|
20
|
-
iconScale = 'icon-1x';
|
|
21
|
-
break;
|
|
22
|
-
case 2:
|
|
23
|
-
iconScale = 'icon-2x';
|
|
24
|
-
break;
|
|
25
|
-
case 3:
|
|
26
|
-
iconScale = 'icon-3x';
|
|
27
|
-
break;
|
|
28
|
-
case 4:
|
|
29
|
-
iconScale = 'icon-4x';
|
|
30
|
-
break;
|
|
31
|
-
default:
|
|
32
|
-
iconScale = '';
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let iconAnimation;
|
|
36
|
-
switch(animation) {
|
|
37
|
-
case 'beat':
|
|
38
|
-
iconAnimation = 'fa-beat';
|
|
39
|
-
break;
|
|
40
|
-
case 'fade':
|
|
41
|
-
iconAnimation = 'fa-fade';
|
|
42
|
-
break;
|
|
43
|
-
case 'beat-fade':
|
|
44
|
-
iconAnimation = 'fa-beat-fade';
|
|
45
|
-
break;
|
|
46
|
-
case 'bounce':
|
|
47
|
-
iconAnimation = 'fa-bounce';
|
|
48
|
-
break;
|
|
49
|
-
case 'flip':
|
|
50
|
-
iconAnimation = 'fa-flip';
|
|
51
|
-
break;
|
|
52
|
-
case 'shake':
|
|
53
|
-
iconAnimation = 'fa-shake';
|
|
54
|
-
break;
|
|
55
|
-
case 'spin':
|
|
56
|
-
iconAnimation = 'fa-spin';
|
|
57
|
-
break;
|
|
58
|
-
case 'spin-reverse':
|
|
59
|
-
iconAnimation = 'fa-spin fa-spin-reverse';
|
|
60
|
-
break;
|
|
61
|
-
default:
|
|
62
|
-
iconAnimation = '';
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return <i className={`${iconStyle} ${iconClass} ${iconScale} ${iconAnimation} ${className}`} aria-hidden='true'></i>;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
Icon.propTypes = {
|
|
69
|
-
style: PropTypes.oneOf(['light', 'solid', 'regular', 'thin', 'duotone', 'sharp']),
|
|
70
|
-
scale: PropTypes.oneOf([0.7, 1, 2, 3, 4]),
|
|
71
|
-
iconName: PropTypes.string,
|
|
72
|
-
className: PropTypes.string,
|
|
73
|
-
animation: PropTypes.oneOf(['beat', 'fade', 'beat-fade', 'bounce', 'flip', 'shake', 'spin', 'spin-reverse']),
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default Icon;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
const LoginSource = ({
|
|
5
|
-
logo = 'groovinads'
|
|
6
|
-
}) => {
|
|
7
|
-
return (
|
|
8
|
-
<div
|
|
9
|
-
className={`login-source ${logo || ''}`}
|
|
10
|
-
aria-label={`${logo} logo`}
|
|
11
|
-
></div>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
LoginSource.propTypes = {
|
|
16
|
-
logo: PropTypes.oneOf(['groovinads', 'google', 'microsoft', 'linkedin']),
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default LoginSource;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// COMPONENTS
|
|
5
|
-
import Icon from '../Labels/Icon';
|
|
6
|
-
|
|
7
|
-
const PillComponent = ({
|
|
8
|
-
children,
|
|
9
|
-
className = '',
|
|
10
|
-
color = 'neutral',
|
|
11
|
-
closeButton = false,
|
|
12
|
-
onClick,
|
|
13
|
-
}) => {
|
|
14
|
-
return (
|
|
15
|
-
<div className={`pill ${color} ${className}`}>
|
|
16
|
-
<span>{children}</span>
|
|
17
|
-
{closeButton && (
|
|
18
|
-
<button onClick={onClick}>
|
|
19
|
-
<Icon
|
|
20
|
-
style={'solid'}
|
|
21
|
-
iconName={'xmark'}
|
|
22
|
-
scale={0.7}
|
|
23
|
-
/>
|
|
24
|
-
</button>
|
|
25
|
-
)}
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
PillComponent.propTypes = {
|
|
31
|
-
color: PropTypes.oneOf([
|
|
32
|
-
'green',
|
|
33
|
-
'yellow',
|
|
34
|
-
'red',
|
|
35
|
-
'danger',
|
|
36
|
-
'neutral',
|
|
37
|
-
'blue',
|
|
38
|
-
'light',
|
|
39
|
-
'midtone',
|
|
40
|
-
'dark',
|
|
41
|
-
]),
|
|
42
|
-
closeButton: PropTypes.bool,
|
|
43
|
-
onClick: PropTypes.func,
|
|
44
|
-
className: PropTypes.string,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default PillComponent;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
const Spinner = ({
|
|
5
|
-
scale = 1,
|
|
6
|
-
className = '',
|
|
7
|
-
}) => {
|
|
8
|
-
|
|
9
|
-
let iconScale;
|
|
10
|
-
switch(scale) {
|
|
11
|
-
case 0.7:
|
|
12
|
-
iconScale = 'icon-07x';
|
|
13
|
-
break;
|
|
14
|
-
case 1:
|
|
15
|
-
iconScale = 'icon-1x';
|
|
16
|
-
break;
|
|
17
|
-
case 2:
|
|
18
|
-
iconScale = 'icon-2x';
|
|
19
|
-
break;
|
|
20
|
-
case 3:
|
|
21
|
-
iconScale = 'icon-3x';
|
|
22
|
-
break;
|
|
23
|
-
default:
|
|
24
|
-
iconScale = '';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return <i className={`icon fa-solid fa-spinner-third fa-spin ${iconScale} ${className}`} aria-hidden='true'></i>;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
Spinner.propTypes = {
|
|
31
|
-
scale: PropTypes.oneOf([0.7, 1, 2, 3, 4]),
|
|
32
|
-
className: PropTypes.string,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default Spinner;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
const StatusIcon = ({ animated = false, className = '', status = 0 }) => {
|
|
5
|
-
const getStatusClass = (status) => {
|
|
6
|
-
switch (status) {
|
|
7
|
-
case 1:
|
|
8
|
-
return 'active';
|
|
9
|
-
case 3:
|
|
10
|
-
return 'active-warning';
|
|
11
|
-
case 4:
|
|
12
|
-
return 'warning';
|
|
13
|
-
case 5:
|
|
14
|
-
return 'danger';
|
|
15
|
-
default:
|
|
16
|
-
return '';
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<svg
|
|
22
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
23
|
-
viewBox={status === 3 ? '0 0 24 16' : '0 0 16 16'}
|
|
24
|
-
className={`status-icon ${getStatusClass(status)} ${className} ${animated ? 'animated' : ''}`}
|
|
25
|
-
>
|
|
26
|
-
<circle cx={status === 3 ? '12' : '8'} cy='8' r='8' />
|
|
27
|
-
|
|
28
|
-
{(() => {
|
|
29
|
-
switch (status) {
|
|
30
|
-
case 1:
|
|
31
|
-
return (
|
|
32
|
-
<>
|
|
33
|
-
<polyline
|
|
34
|
-
className='line-back'
|
|
35
|
-
points='0 7.99 4.99 7.99 6.29 12 9.82 4 10.99 8 16 8'
|
|
36
|
-
/>
|
|
37
|
-
<polyline
|
|
38
|
-
className='line-front'
|
|
39
|
-
points='0 7.99 4.99 7.99 6.29 12 9.82 4 10.99 8 16 8'
|
|
40
|
-
/>
|
|
41
|
-
</>
|
|
42
|
-
);
|
|
43
|
-
case 3:
|
|
44
|
-
return (
|
|
45
|
-
<>
|
|
46
|
-
<path d='M3.5304 1.14718C4.00269 1.4241 4.13257 1.9886 3.83739 2.37202C2.69207 4.0229 2.01906 5.94004 2.01906 7.96369C2.01906 9.98735 2.69207 11.979 3.83739 13.5873C4.14438 14.0133 4.00269 14.5778 3.5304 14.8548C3.0581 15.1317 2.43231 15.0039 2.13713 14.5459C0.779285 12.682 0 10.424 0 7.96369C0 5.50336 0.779285 3.31995 2.12532 1.41345C2.43231 0.998071 3.0581 0.870262 3.5304 1.14718Z' />
|
|
47
|
-
<path d='M20.4682 1.14658C20.9391 0.869859 21.5631 0.997576 21.8692 1.4233C23.223 3.31777 24 5.5741 24 7.96879C24 10.3635 23.223 12.6837 21.8692 14.5462C21.5631 15.0039 20.9391 15.1316 20.4682 14.8549C19.9973 14.5781 19.8678 14.0141 20.1621 13.5883C21.3158 11.9812 21.9751 10.0655 21.9751 7.96879C21.9751 5.87211 21.3158 4.03085 20.1621 2.38118C19.856 1.98738 19.9973 1.4233 20.4682 1.15722V1.14658Z' />
|
|
48
|
-
<path d='M12 12C12.5523 12 13 11.5523 13 11C13 10.4477 12.5523 10 12 10C11.4477 10 11 10.4477 11 11C11 11.5523 11.4477 12 12 12Z' />
|
|
49
|
-
<path d='M12 3C12.5465 3 13 3.3986 13 3.9021V8.0979C13 8.59091 12.5581 9 12 9C11.4419 9 11 8.6014 11 8.0979V3.9021C11 3.40909 11.4419 3 12 3Z' />
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
default:
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
})()}
|
|
56
|
-
</svg>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
StatusIcon.propTypes = {
|
|
61
|
-
className: PropTypes.string,
|
|
62
|
-
status: PropTypes.number.isRequired,
|
|
63
|
-
animated: PropTypes.bool,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export default StatusIcon;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import Alert from './Alert';
|
|
2
|
-
import Icon from './Icon';
|
|
3
|
-
import LoginSource from './LoginSource';
|
|
4
|
-
import PillComponent from './PillComponent';
|
|
5
|
-
import Spinner from './Spinner';
|
|
6
|
-
import StatusIcon from './StatusIcon';
|
|
7
|
-
|
|
8
|
-
export { Alert, Icon, LoginSource, PillComponent, Spinner, StatusIcon }
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
// BOOTSTRAP
|
|
4
|
-
import Dropdown from 'react-bootstrap/Dropdown';
|
|
5
|
-
|
|
6
|
-
// COMPONENTS
|
|
7
|
-
import Icon from '../../Labels/Icon';
|
|
8
|
-
|
|
9
|
-
// HOOKS
|
|
10
|
-
import { useGetBaseDomain } from '../../../hooks/index';
|
|
11
|
-
|
|
12
|
-
// SERVICES
|
|
13
|
-
import { ComponentsService } from '../../../services/index';
|
|
14
|
-
|
|
15
|
-
const DeckDropdown = () => {
|
|
16
|
-
const [applications, setApplications] = useState([]);
|
|
17
|
-
|
|
18
|
-
const fetchData = async () => {
|
|
19
|
-
try {
|
|
20
|
-
const resp = await ComponentsService.applications();
|
|
21
|
-
resp.forEach((element) => {
|
|
22
|
-
element.app_icon_sm = element.application_icon;
|
|
23
|
-
element.app_name = element.application_name;
|
|
24
|
-
});
|
|
25
|
-
setApplications(resp);
|
|
26
|
-
} catch (error) {
|
|
27
|
-
console.error('fetchData error', error);
|
|
28
|
-
// setShowAPIerrorModal(true);
|
|
29
|
-
// setErrorModalDetail(`${error}`);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const linkToApp = (path, title) => {
|
|
34
|
-
// if path begins with /, path is a subdomain, linkUrl must be window.location.origin + path + '/'
|
|
35
|
-
let linkUrl;
|
|
36
|
-
const base_domain = useGetBaseDomain();
|
|
37
|
-
const nextState = { additionalInformation: 'Updated the URL' };
|
|
38
|
-
|
|
39
|
-
// If path is subdomain
|
|
40
|
-
if (path.startsWith('/')) {
|
|
41
|
-
if (base_domain === 'groovinads.com') {
|
|
42
|
-
linkUrl = window.location.origin + path + '/';
|
|
43
|
-
window.history.pushState(nextState, title, linkUrl);
|
|
44
|
-
} else {
|
|
45
|
-
linkUrl = 'https://deck-dev.groovinads.com' + path + '/';
|
|
46
|
-
}
|
|
47
|
-
} else linkUrl = path;
|
|
48
|
-
|
|
49
|
-
return linkUrl;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const favApp = async (identification) => {
|
|
53
|
-
try {
|
|
54
|
-
await ComponentsService.favApplication(identification);
|
|
55
|
-
setApplications((prev) => {
|
|
56
|
-
const index = prev.findIndex(
|
|
57
|
-
(element) => element?.id_application === identification,
|
|
58
|
-
);
|
|
59
|
-
prev[index].favorite = true;
|
|
60
|
-
return [...prev];
|
|
61
|
-
});
|
|
62
|
-
} catch (error) {
|
|
63
|
-
console.error('favApp error', error);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const unfavApp = async (identification) => {
|
|
68
|
-
try {
|
|
69
|
-
await ComponentsService.unfavApplication(identification);
|
|
70
|
-
|
|
71
|
-
setApplications((prev) => {
|
|
72
|
-
const index = prev.findIndex(
|
|
73
|
-
(element) => element?.id_application === identification,
|
|
74
|
-
);
|
|
75
|
-
prev[index].favorite = false;
|
|
76
|
-
return [...prev];
|
|
77
|
-
});
|
|
78
|
-
} catch (error) {
|
|
79
|
-
console.error('unfavApp error', error);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
if (!applications?.length) fetchData();
|
|
85
|
-
}, []);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<>
|
|
89
|
-
{applications.length ? (
|
|
90
|
-
<Dropdown>
|
|
91
|
-
<Dropdown.Toggle className='btn btn-terciary'>
|
|
92
|
-
<svg
|
|
93
|
-
id='deckApps'
|
|
94
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
95
|
-
className='icon'
|
|
96
|
-
viewBox='0 0 16 16'
|
|
97
|
-
>
|
|
98
|
-
<g>
|
|
99
|
-
<rect x='1' y='1' width='4' height='4' rx='1.25' ry='1.25' />
|
|
100
|
-
<rect x='1' y='6' width='4' height='4' rx='1.25' ry='1.25' />
|
|
101
|
-
<rect x='1' y='11' width='4' height='4' rx='1.25' ry='1.25' />
|
|
102
|
-
<rect x='6' y='1' width='4' height='4' rx='1.25' ry='1.25' />
|
|
103
|
-
<rect x='6' y='6' width='4' height='4' rx='1.25' ry='1.25' />
|
|
104
|
-
<rect x='6' y='11' width='4' height='4' rx='1.25' ry='1.25' />
|
|
105
|
-
<rect x='11' y='1' width='4' height='4' rx='1.25' ry='1.25' />
|
|
106
|
-
<rect x='11' y='6' width='4' height='4' rx='1.25' ry='1.25' />
|
|
107
|
-
<rect x='11' y='11' width='4' height='4' rx='1.25' ry='1.25' />
|
|
108
|
-
</g>
|
|
109
|
-
</svg>
|
|
110
|
-
</Dropdown.Toggle>
|
|
111
|
-
|
|
112
|
-
<Dropdown.Menu as={'ul'}>
|
|
113
|
-
{applications?.filter((item) => item.favorite).length > 0 && (
|
|
114
|
-
<Dropdown.Item as={'li'}>
|
|
115
|
-
<h4 className='dropdown-header'>Favorites</h4>
|
|
116
|
-
</Dropdown.Item>
|
|
117
|
-
)}
|
|
118
|
-
|
|
119
|
-
{applications
|
|
120
|
-
.filter((item) => item.favorite)
|
|
121
|
-
.map((element, i) => {
|
|
122
|
-
return (
|
|
123
|
-
<Dropdown.Item key={i} as={'li'}>
|
|
124
|
-
<div
|
|
125
|
-
onClick={() => {
|
|
126
|
-
window.location.replace(
|
|
127
|
-
linkToApp(
|
|
128
|
-
element.application_url,
|
|
129
|
-
element.application_name,
|
|
130
|
-
),
|
|
131
|
-
);
|
|
132
|
-
}}
|
|
133
|
-
className='link-app'
|
|
134
|
-
>
|
|
135
|
-
<span className='icon-app'>
|
|
136
|
-
<Icon
|
|
137
|
-
style={'solid'}
|
|
138
|
-
iconName={element.app_icon_sm}
|
|
139
|
-
scale={1}
|
|
140
|
-
/>
|
|
141
|
-
</span>
|
|
142
|
-
|
|
143
|
-
<span>{element.app_name}</span>
|
|
144
|
-
</div>
|
|
145
|
-
<button
|
|
146
|
-
className='deck-fav'
|
|
147
|
-
onClick={(e) => {
|
|
148
|
-
e.stopPropagation();
|
|
149
|
-
unfavApp(element.id_application);
|
|
150
|
-
}}
|
|
151
|
-
>
|
|
152
|
-
<Icon style={'solid'} iconName={'star'} scale={1} />
|
|
153
|
-
</button>
|
|
154
|
-
</Dropdown.Item>
|
|
155
|
-
);
|
|
156
|
-
})}
|
|
157
|
-
|
|
158
|
-
{applications?.filter((item) => item.favorite).length > 0 &&
|
|
159
|
-
applications?.filter((item) => !item.favorite).length > 0 && (
|
|
160
|
-
<Dropdown.Divider as={'li'} />
|
|
161
|
-
)}
|
|
162
|
-
|
|
163
|
-
{applications
|
|
164
|
-
.filter((item) => !item.favorite)
|
|
165
|
-
.map((element, i) => {
|
|
166
|
-
return (
|
|
167
|
-
<Dropdown.Item key={i} as={'li'}>
|
|
168
|
-
<div
|
|
169
|
-
onClick={() => {
|
|
170
|
-
window.location.replace(
|
|
171
|
-
linkToApp(
|
|
172
|
-
element.application_url,
|
|
173
|
-
element.application_name,
|
|
174
|
-
),
|
|
175
|
-
);
|
|
176
|
-
}}
|
|
177
|
-
className='link-app'
|
|
178
|
-
>
|
|
179
|
-
<span className='icon-app'>
|
|
180
|
-
<Icon
|
|
181
|
-
style={'solid'}
|
|
182
|
-
iconName={element.app_icon_sm}
|
|
183
|
-
scale={1}
|
|
184
|
-
/>
|
|
185
|
-
</span>
|
|
186
|
-
|
|
187
|
-
<span>{element.app_name}</span>
|
|
188
|
-
</div>
|
|
189
|
-
<button
|
|
190
|
-
className='deck-fav'
|
|
191
|
-
onClick={(e) => {
|
|
192
|
-
e.stopPropagation();
|
|
193
|
-
favApp(element.id_application);
|
|
194
|
-
}}
|
|
195
|
-
>
|
|
196
|
-
<Icon style={'regular'} iconName={'star'} scale={1} />
|
|
197
|
-
</button>
|
|
198
|
-
</Dropdown.Item>
|
|
199
|
-
);
|
|
200
|
-
})}
|
|
201
|
-
</Dropdown.Menu>
|
|
202
|
-
</Dropdown>
|
|
203
|
-
) : (
|
|
204
|
-
<></>
|
|
205
|
-
)}
|
|
206
|
-
</>
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export default DeckDropdown;
|