@fixefy/fixefy-ui-components 0.0.4 → 0.0.6
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/dist-cjs/ActionsTray/ActionsTray.jsx +146 -0
- package/dist-cjs/ActionsTray/index.js +4 -0
- package/dist-cjs/ActionsTray/styles/actions_tray.styles.jsx +55 -0
- package/dist-cjs/AggregationsBar/Aggregations.jsx +27 -0
- package/dist-cjs/AggregationsBar/helpers/structureReader.jsx +41 -0
- package/dist-cjs/AggregationsBar/index.js +5 -0
- package/dist-cjs/AggregationsBar/operations/query.js +66 -0
- package/dist-cjs/AsyncDropdown/AsyncDropdown.jsx +209 -0
- package/dist-cjs/AsyncDropdown/helpers/helpers.js +81 -0
- package/dist-cjs/AsyncDropdown/index.js +5 -0
- package/dist-cjs/AsyncDropdown/styles/dropdown.styles.jsx +130 -0
- package/dist-cjs/FxAvatar/FxAvatar.jsx +34 -0
- package/dist-cjs/FxAvatar/helpers/stringToColor.js +17 -0
- package/dist-cjs/FxAvatar/index.js +5 -0
- package/dist-cjs/FxAvatar/styles/avatar.styles.jsx +75 -0
- package/dist-cjs/FxButton/{button.jsx → FxButton.jsx} +3 -3
- package/dist-cjs/FxButton/index.js +3 -3
- package/dist-cjs/FxChip/FxChip.jsx +14 -0
- package/dist-cjs/FxChip/index.js +5 -0
- package/dist-cjs/FxChip/styles/chip.styles.jsx +48 -0
- package/dist-cjs/FxIcon/FxIcon.jsx +29 -0
- package/dist-cjs/FxIcon/content/dynamic_icon.jsx +7 -0
- package/dist-cjs/FxIcon/content/index.js +7 -0
- package/dist-cjs/FxIcon/content/lazy_icon.jsx +22 -0
- package/dist-cjs/FxIcon/index.js +5 -0
- package/dist-cjs/FxModal/FxModal.jsx +36 -0
- package/dist-cjs/FxModal/index.js +5 -0
- package/dist-cjs/FxModal/styles/modal.style.jsx +34 -0
- package/dist-cjs/FxNotes/FxNotes.jsx +101 -0
- package/dist-cjs/FxNotes/helpers/stringToColor.js +20 -0
- package/dist-cjs/FxNotes/index.js +5 -0
- package/dist-cjs/FxNotes/operations/queries.js +24 -0
- package/dist-cjs/FxNotes/styles/notes.styles.jsx +120 -0
- package/dist-cjs/FxNumberField/FxNumberField.jsx +30 -0
- package/dist-cjs/FxNumberField/index.js +5 -0
- package/dist-cjs/FxNumberField/styles/number_field.styles.js +87 -0
- package/dist-cjs/FxProgressCircle/FxProgressCircle.jsx +28 -0
- package/dist-cjs/FxProgressCircle/index.js +5 -0
- package/dist-cjs/FxProgressCircle/styles/progress_circle.styles.jsx +27 -0
- package/dist-cjs/FxProgressCounter/ProgressCounter.jsx +45 -0
- package/dist-cjs/FxProgressCounter/index.js +5 -0
- package/dist-cjs/FxProgressCounter/styles/progress_counter.styles.js +36 -0
- package/dist-cjs/FxShowMore/FxShowMore.jsx +47 -0
- package/dist-cjs/FxShowMore/index.js +5 -0
- package/dist-cjs/FxShowMore/styles/show_more.styles.js +43 -0
- package/dist-cjs/FxSlider/FxSlider.jsx +10 -0
- package/dist-cjs/FxSlider/index.js +5 -0
- package/dist-cjs/Score/Score.jsx +57 -0
- package/dist-cjs/Score/index.js +5 -0
- package/dist-cjs/Score/styles/score.styles.js +33 -0
- package/dist-cjs/StatisticsBar/StatisticsBar.jsx +95 -0
- package/dist-cjs/StatisticsBar/index.js +5 -0
- package/dist-cjs/StatisticsBar/styles/statistics.styles.js +33 -0
- package/dist-cjs/Tag/Tag.jsx +6 -6
- package/dist-cjs/index.js +15 -1
- package/dist-es/ActionsTray/ActionsTray.jsx +141 -0
- package/dist-es/ActionsTray/index.js +1 -1
- package/dist-es/ActionsTray/styles/actions_tray.styles.jsx +76 -0
- package/dist-es/AggregationsBar/Aggregations.jsx +22 -0
- package/dist-es/AggregationsBar/helpers/structureReader.jsx +32 -0
- package/dist-es/AggregationsBar/index.js +1 -0
- package/dist-es/AggregationsBar/operations/query.js +63 -0
- package/dist-es/AsyncDropdown/AsyncDropdown.jsx +228 -0
- package/dist-es/AsyncDropdown/helpers/helpers.js +77 -0
- package/dist-es/AsyncDropdown/index.js +1 -0
- package/dist-es/AsyncDropdown/styles/dropdown.styles.jsx +143 -0
- package/dist-es/FxAvatar/FxAvatar.jsx +32 -0
- package/dist-es/FxAvatar/helpers/stringToColor.js +13 -0
- package/dist-es/FxAvatar/index.js +1 -0
- package/dist-es/FxAvatar/styles/avatar.styles.jsx +68 -0
- package/dist-es/FxButton/{button.jsx → FxButton.jsx} +1 -1
- package/dist-es/FxButton/index.js +1 -1
- package/dist-es/FxChip/FxChip.jsx +9 -0
- package/dist-es/FxChip/index.js +1 -0
- package/dist-es/FxChip/styles/chip.styles.jsx +45 -0
- package/dist-es/FxIcon/FxIcon.jsx +24 -0
- package/dist-es/FxIcon/content/dynamic_icon.jsx +2 -0
- package/dist-es/FxIcon/content/index.js +2 -0
- package/dist-es/FxIcon/content/lazy_icon.jsx +17 -0
- package/dist-es/FxIcon/index.js +1 -0
- package/dist-es/FxModal/FxModal.jsx +30 -0
- package/dist-es/FxModal/index.js +1 -0
- package/dist-es/FxModal/styles/modal.style.jsx +31 -0
- package/dist-es/FxNotes/FxNotes.jsx +102 -0
- package/dist-es/FxNotes/helpers/stringToColor.js +16 -0
- package/dist-es/FxNotes/index.js +1 -0
- package/dist-es/FxNotes/operations/queries.js +20 -0
- package/dist-es/FxNotes/styles/notes.styles.jsx +116 -0
- package/dist-es/FxNumberField/FxNumberField.jsx +25 -0
- package/dist-es/FxNumberField/index.js +1 -0
- package/dist-es/FxNumberField/styles/number_field.styles.js +84 -0
- package/dist-es/FxProgressCircle/FxProgressCircle.jsx +23 -0
- package/dist-es/FxProgressCircle/index.js +1 -0
- package/dist-es/FxProgressCircle/styles/progress_circle.styles.jsx +28 -0
- package/dist-es/FxProgressCounter/ProgressCounter.jsx +38 -0
- package/dist-es/FxProgressCounter/index.js +1 -0
- package/dist-es/FxProgressCounter/styles/progress_counter.styles.js +33 -0
- package/dist-es/FxShowMore/FxShowMore.jsx +42 -0
- package/dist-es/FxShowMore/index.js +1 -0
- package/dist-es/FxShowMore/styles/show_more.styles.js +53 -0
- package/dist-es/FxSlider/FxSlider.jsx +5 -0
- package/dist-es/FxSlider/index.js +1 -0
- package/dist-es/Score/Score.jsx +57 -0
- package/dist-es/Score/index.js +1 -0
- package/dist-es/Score/styles/score.styles.js +35 -0
- package/dist-es/StatisticsBar/StatisticsBar.jsx +91 -0
- package/dist-es/StatisticsBar/index.js +1 -0
- package/dist-es/StatisticsBar/styles/statistics.styles.js +38 -0
- package/dist-es/Tag/Tag.jsx +6 -6
- package/dist-es/index.js +8 -1
- package/dist-types/ActionsTray/ActionsTray.d.ts +3 -0
- package/dist-types/ActionsTray/index.d.ts +2 -0
- package/dist-types/ActionsTray/styles/actions_tray.styles.d.ts +8 -0
- package/dist-types/AggregationsBar/Aggregations.d.ts +3 -0
- package/dist-types/AggregationsBar/helpers/structureReader.d.ts +1 -0
- package/dist-types/AggregationsBar/index.d.ts +2 -0
- package/dist-types/AggregationsBar/operations/query.d.ts +1 -0
- package/dist-types/AsyncDropdown/AsyncDropdown.d.ts +3 -0
- package/dist-types/AsyncDropdown/helpers/helpers.d.ts +4 -0
- package/dist-types/AsyncDropdown/index.d.ts +2 -0
- package/dist-types/AsyncDropdown/styles/dropdown.styles.d.ts +7 -0
- package/dist-types/FxAvatar/FxAvatar.d.ts +3 -0
- package/dist-types/FxAvatar/helpers/stringToColor.d.ts +1 -0
- package/dist-types/FxAvatar/index.d.ts +2 -0
- package/dist-types/FxAvatar/styles/avatar.styles.d.ts +7 -0
- package/dist-types/FxButton/FxButton.d.ts +6 -0
- package/dist-types/FxButton/index.d.ts +2 -2
- package/dist-types/FxChip/FxChip.d.ts +3 -0
- package/dist-types/FxChip/index.d.ts +2 -0
- package/dist-types/FxChip/styles/chip.styles.d.ts +3 -0
- package/dist-types/FxIcon/FxIcon.d.ts +3 -0
- package/dist-types/FxIcon/content/dynamic_icon.d.ts +5 -0
- package/dist-types/FxIcon/content/index.d.ts +2 -0
- package/dist-types/FxIcon/content/lazy_icon.d.ts +9 -0
- package/dist-types/FxIcon/index.d.ts +1 -0
- package/dist-types/FxModal/FxModal.d.ts +3 -0
- package/dist-types/FxModal/index.d.ts +2 -0
- package/dist-types/FxModal/styles/modal.style.d.ts +4 -0
- package/dist-types/FxNotes/FxNotes.d.ts +3 -0
- package/dist-types/FxNotes/helpers/stringToColor.d.ts +1 -0
- package/dist-types/FxNotes/index.d.ts +2 -0
- package/dist-types/FxNotes/operations/queries.d.ts +1 -0
- package/dist-types/FxNotes/styles/notes.styles.d.ts +13 -0
- package/dist-types/FxNumberField/FxNumberField.d.ts +3 -0
- package/dist-types/FxNumberField/index.d.ts +2 -0
- package/dist-types/FxNumberField/styles/number_field.styles.d.ts +1 -0
- package/dist-types/FxProgressCircle/FxProgressCircle.d.ts +3 -0
- package/dist-types/FxProgressCircle/index.d.ts +2 -0
- package/dist-types/FxProgressCircle/styles/progress_circle.styles.d.ts +5 -0
- package/dist-types/FxProgressCounter/ProgressCounter.d.ts +3 -0
- package/dist-types/FxProgressCounter/index.d.ts +2 -0
- package/dist-types/FxProgressCounter/styles/progress_counter.styles.d.ts +5 -0
- package/dist-types/FxShowMore/FxShowMore.d.ts +3 -0
- package/dist-types/FxShowMore/index.d.ts +2 -0
- package/dist-types/FxShowMore/styles/show_more.styles.d.ts +6 -0
- package/dist-types/FxSlider/FxSlider.d.ts +3 -0
- package/dist-types/FxSlider/index.d.ts +2 -0
- package/dist-types/Score/Score.d.ts +3 -0
- package/dist-types/Score/index.d.ts +2 -0
- package/dist-types/Score/styles/score.styles.d.ts +7 -0
- package/dist-types/StatisticsBar/StatisticsBar.d.ts +3 -0
- package/dist-types/StatisticsBar/index.d.ts +2 -0
- package/dist-types/StatisticsBar/styles/statistics.styles.d.ts +2 -0
- package/dist-types/Tag/Tag.d.ts +2 -2
- package/dist-types/Tag/index.d.ts +1 -1
- package/dist-types/index.d.ts +9 -2
- package/package.json +5 -2
- package/dist-cjs/ActionsTray/actions_tray.jsx +0 -1
- package/dist-cjs/ActionsTray/styles/actionsTray.styles.jsx +0 -1
- package/dist-es/ActionsTray/actions_tray.jsx +0 -1
- package/dist-es/ActionsTray/styles/actionsTray.styles.jsx +0 -1
- package/dist-types/ActionsTray/actions_tray.d.ts +0 -0
- package/dist-types/ActionsTray/styles/actionsTray.styles.d.ts +0 -0
- package/dist-types/FxButton/button.d.ts +0 -6
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyledListBox = exports.StyledClose = exports.Listbox = exports.InputWrapper = exports.Loading = exports.Label = exports.Root = void 0;
|
|
4
|
+
const styles_1 = require("@mui/material/styles");
|
|
5
|
+
exports.Root = (0, styles_1.styled)('div')(() => ({
|
|
6
|
+
color: 'rgba(0,0,0,.85)',
|
|
7
|
+
fontSize: 14,
|
|
8
|
+
}));
|
|
9
|
+
exports.Label = (0, styles_1.styled)('label')(() => ({
|
|
10
|
+
padding: '0 0 4px',
|
|
11
|
+
lineHeight: '1.5',
|
|
12
|
+
display: 'block',
|
|
13
|
+
}));
|
|
14
|
+
exports.Loading = (0, styles_1.styled)('div')(() => ({
|
|
15
|
+
width: 30,
|
|
16
|
+
height: 30,
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
['& span']: {
|
|
21
|
+
width: '20px !important',
|
|
22
|
+
height: '20px !important',
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
exports.InputWrapper = (0, styles_1.styled)('div')(({ theme, hasValue, disabled }) => {
|
|
26
|
+
const defaultBorder = `1px solid ${theme.palette.greyscale[200]}`;
|
|
27
|
+
const hasValueBorder = `1px solid ${theme.palette.primary[500]}`;
|
|
28
|
+
const disabledBorder = `1px solid ${theme.palette.greyscale[200]}`;
|
|
29
|
+
const activeBorder = `1px solid ${theme.palette.primary[500]}`;
|
|
30
|
+
return {
|
|
31
|
+
border: disabled ? disabledBorder : hasValue ? hasValueBorder : defaultBorder,
|
|
32
|
+
backgroundColor: theme.palette.common.white,
|
|
33
|
+
borderRadius: 4,
|
|
34
|
+
padding: 1,
|
|
35
|
+
display: 'flex',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
flexWrap: 'wrap',
|
|
38
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
39
|
+
['&:hover']: {
|
|
40
|
+
border: disabled ? disabledBorder : activeBorder,
|
|
41
|
+
borderRadius: 4,
|
|
42
|
+
},
|
|
43
|
+
['&:focus']: {
|
|
44
|
+
border: disabled ? disabledBorder : activeBorder,
|
|
45
|
+
borderRadius: 4,
|
|
46
|
+
},
|
|
47
|
+
['& > svg']: {
|
|
48
|
+
color: disabled ? theme.palette.greyscale[300] : theme.palette.primary['500'],
|
|
49
|
+
marginRight: 8,
|
|
50
|
+
},
|
|
51
|
+
['& input']: Object.assign(Object.assign({ cursor: disabled ? 'not-allowed' : 'pointer', backgroundColor: theme.palette.common.white, color: theme.palette.typography.title, height: 36, boxSizing: 'border-box', padding: '4px 6px 4px 16px', width: 0, minWidth: 30, flexGrow: 1, border: 0, margin: 0, outline: 0 }, theme.typography.body1), { lineHeight: '20px', ['& ::placeholder']: {
|
|
52
|
+
color: hasValue ? theme.palette.typography.title : theme.palette.greyscale[400],
|
|
53
|
+
} }),
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
exports.Listbox = (0, styles_1.styled)('ul')(({ theme }) => ({
|
|
57
|
+
margin: 0,
|
|
58
|
+
padding: 0,
|
|
59
|
+
position: 'absolute',
|
|
60
|
+
listStyle: 'none',
|
|
61
|
+
backgroundColor: theme.palette.common.white,
|
|
62
|
+
overflow: 'auto',
|
|
63
|
+
maxHeight: 250,
|
|
64
|
+
minHeight: 250,
|
|
65
|
+
borderRadius: 4,
|
|
66
|
+
boxShadow: '0px 0px 10px rgba(86, 135, 147, 0.2)',
|
|
67
|
+
zIndex: 1,
|
|
68
|
+
maxWidth: 270,
|
|
69
|
+
minWidth: 270,
|
|
70
|
+
top: 48,
|
|
71
|
+
left: -42,
|
|
72
|
+
['& div']: {
|
|
73
|
+
textOverflow: 'ellipsis',
|
|
74
|
+
whiteSpace: 'nowrap',
|
|
75
|
+
overflow: 'hidden',
|
|
76
|
+
},
|
|
77
|
+
}));
|
|
78
|
+
exports.StyledClose = (0, styles_1.styled)('div')(() => ({
|
|
79
|
+
position: 'absolute',
|
|
80
|
+
bottom: 0,
|
|
81
|
+
}));
|
|
82
|
+
exports.StyledListBox = (0, styles_1.styled)('ul')(({ theme, hasClearBtn }) => ({
|
|
83
|
+
margin: 0,
|
|
84
|
+
padding: 0,
|
|
85
|
+
listStyle: 'none',
|
|
86
|
+
backgroundColor: theme.palette.common.white,
|
|
87
|
+
overflow: 'auto',
|
|
88
|
+
maxHeight: hasClearBtn ? 190 : 230,
|
|
89
|
+
zIndex: 1,
|
|
90
|
+
textOverflow: 'ellipsis',
|
|
91
|
+
whiteSpace: 'nowrap',
|
|
92
|
+
overflowX: 'hidden',
|
|
93
|
+
paddingTop: 8,
|
|
94
|
+
paddingBottom: 8,
|
|
95
|
+
maxWidth: 270,
|
|
96
|
+
minWidth: 270,
|
|
97
|
+
['& div']: {
|
|
98
|
+
textOverflow: 'ellipsis',
|
|
99
|
+
whiteSpace: 'nowrap',
|
|
100
|
+
overflow: 'hidden',
|
|
101
|
+
},
|
|
102
|
+
['& li']: {
|
|
103
|
+
paddingRight: 16,
|
|
104
|
+
paddingLeft: 16,
|
|
105
|
+
display: 'flex',
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
justifyContent: 'flex-start',
|
|
108
|
+
height: 40,
|
|
109
|
+
cursor: 'pointer',
|
|
110
|
+
textOverflow: 'ellipsis',
|
|
111
|
+
whiteSpace: 'nowrap',
|
|
112
|
+
overflow: 'hidden',
|
|
113
|
+
maxWidth: 270,
|
|
114
|
+
minWidth: 270,
|
|
115
|
+
},
|
|
116
|
+
['& li:hover']: {
|
|
117
|
+
backgroundColor: '#F6F9FA',
|
|
118
|
+
},
|
|
119
|
+
["& li[aria-selected='true']"]: {
|
|
120
|
+
fontWeight: 900,
|
|
121
|
+
backgroundColor: '#F6F9FA',
|
|
122
|
+
},
|
|
123
|
+
["& li[data-focus='true']"]: {
|
|
124
|
+
backgroundColor: '#F6F9FA',
|
|
125
|
+
cursor: 'pointer',
|
|
126
|
+
['& svg ']: {
|
|
127
|
+
color: 'currentColor',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
}));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FxAvatar = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const fixefy_ui_utils_1 = require("@fixefy/fixefy-ui-utils");
|
|
7
|
+
const stringToColor_1 = require("./helpers/stringToColor");
|
|
8
|
+
const avatar_styles_1 = require("./styles/avatar.styles");
|
|
9
|
+
function FxAvatar({ users, max = 5, isEditable = false, onEdit }) {
|
|
10
|
+
const [backgroundcolors, setBackgroundColors] = (0, react_1.useState)({});
|
|
11
|
+
const avatars = users.length > max ? users.slice(0, max - 1) : users;
|
|
12
|
+
const isMoreThanMax = users.length > max;
|
|
13
|
+
return (<avatar_styles_1.AvatarWrapper>
|
|
14
|
+
<avatar_styles_1.AvatarGroup>
|
|
15
|
+
{avatars.map((user, index) => {
|
|
16
|
+
const userName = user.first_name + ' ' + user.last_name;
|
|
17
|
+
return (<avatar_styles_1.FxTooltip key={index} title={(0, fixefy_ui_utils_1.titleCase)(userName)}>
|
|
18
|
+
<avatar_styles_1.StyledAvatar sx={{
|
|
19
|
+
backgroundColor: backgroundcolors[userName]
|
|
20
|
+
? backgroundcolors[userName]
|
|
21
|
+
: (0, stringToColor_1.stringToColor)(userName, (color) => {
|
|
22
|
+
setBackgroundColors(Object.assign(Object.assign({}, backgroundcolors), { [userName]: color }));
|
|
23
|
+
}),
|
|
24
|
+
}} src={user.image_url} alt={userName}>
|
|
25
|
+
{(0, fixefy_ui_utils_1.titleCase)(userName.slice(0, 1))}
|
|
26
|
+
</avatar_styles_1.StyledAvatar>
|
|
27
|
+
</avatar_styles_1.FxTooltip>);
|
|
28
|
+
})}
|
|
29
|
+
{isMoreThanMax && <avatar_styles_1.StyledMoreAvatar>{`+${users.length - max + 1}`}</avatar_styles_1.StyledMoreAvatar>}
|
|
30
|
+
</avatar_styles_1.AvatarGroup>
|
|
31
|
+
{isEditable && <avatar_styles_1.EditIcon onClick={onEdit && onEdit}/>}
|
|
32
|
+
</avatar_styles_1.AvatarWrapper>);
|
|
33
|
+
}
|
|
34
|
+
exports.FxAvatar = FxAvatar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringToColor = void 0;
|
|
4
|
+
const stringToColor = (string, callBack) => {
|
|
5
|
+
let hash = 0;
|
|
6
|
+
let color = '#';
|
|
7
|
+
for (let i = 0; i < string.length; i += 1) {
|
|
8
|
+
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
9
|
+
}
|
|
10
|
+
for (let i = 0; i < 3; i += 1) {
|
|
11
|
+
const value = (hash >> (i * 8)) & 0xff;
|
|
12
|
+
color += `00${value.toString(16)}`.substr(-2);
|
|
13
|
+
}
|
|
14
|
+
callBack && callBack(color);
|
|
15
|
+
return color;
|
|
16
|
+
};
|
|
17
|
+
exports.stringToColor = stringToColor;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FxTooltip = exports.EditIcon = exports.StyledMoreAvatar = exports.StyledAvatar = exports.AvatarGroup = exports.AvatarWrapper = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const styles_1 = require("@mui/material/styles");
|
|
8
|
+
const material_2 = require("@mui/material");
|
|
9
|
+
const Tooltip_1 = tslib_1.__importDefault(require("@mui/material/Tooltip"));
|
|
10
|
+
const EditOutlined_1 = tslib_1.__importDefault(require("@mui/icons-material/EditOutlined"));
|
|
11
|
+
require("@fixefy/fxutils.page_context");
|
|
12
|
+
exports.AvatarWrapper = (0, styles_1.styled)("div")(() => ({
|
|
13
|
+
display: "flex",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
justifyContent: "space-between",
|
|
16
|
+
flexDirection: "row",
|
|
17
|
+
}));
|
|
18
|
+
exports.AvatarGroup = (0, styles_1.styled)("div")(() => ({
|
|
19
|
+
display: "flex",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
justifyContent: "space-between",
|
|
22
|
+
flexDirection: "row",
|
|
23
|
+
"&>:first-of-type": {
|
|
24
|
+
marginLeft: 0,
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
27
|
+
exports.StyledAvatar = (0, styles_1.styled)(material_1.Avatar)(({ theme }) => ({
|
|
28
|
+
width: 32,
|
|
29
|
+
height: 32,
|
|
30
|
+
border: `2px solid ${theme.palette.common.white}`,
|
|
31
|
+
marginLeft: "-8px",
|
|
32
|
+
fontFamily: "Open Sans",
|
|
33
|
+
fontStyle: "normal",
|
|
34
|
+
fontWeight: "normal",
|
|
35
|
+
fontSize: 14,
|
|
36
|
+
lineHeight: "20px",
|
|
37
|
+
letterSpacing: "0.15px",
|
|
38
|
+
}));
|
|
39
|
+
exports.StyledMoreAvatar = (0, styles_1.styled)(material_1.Avatar)(({ theme }) => ({
|
|
40
|
+
width: 32,
|
|
41
|
+
height: 32,
|
|
42
|
+
border: `2px solid ${theme.palette.common.white}`,
|
|
43
|
+
marginLeft: "-8px",
|
|
44
|
+
fontFamily: "Open Sans",
|
|
45
|
+
fontStyle: "normal",
|
|
46
|
+
fontWeight: "normal",
|
|
47
|
+
fontSize: 11,
|
|
48
|
+
lineHeight: "16px",
|
|
49
|
+
letterSpacing: "0.1px",
|
|
50
|
+
color: theme.palette.greyscale.dark,
|
|
51
|
+
backgroundColor: theme.palette.greyscale.light,
|
|
52
|
+
}));
|
|
53
|
+
exports.EditIcon = (0, styles_1.styled)(EditOutlined_1.default)(({ theme }) => ({
|
|
54
|
+
cursor: "pointer",
|
|
55
|
+
color: theme.palette.primary.light,
|
|
56
|
+
}));
|
|
57
|
+
exports.FxTooltip = (0, styles_1.styled)((_a) => {
|
|
58
|
+
var { className } = _a, props = tslib_1.__rest(_a, ["className"]);
|
|
59
|
+
return (<Tooltip_1.default {...props} placement="top" arrow classes={{ popper: className }}/>);
|
|
60
|
+
})(({ theme }) => ({
|
|
61
|
+
[`& .${material_2.tooltipClasses.arrow}`]: {
|
|
62
|
+
color: theme.palette.primary.main,
|
|
63
|
+
},
|
|
64
|
+
[`& .${material_2.tooltipClasses.tooltip}`]: {
|
|
65
|
+
backgroundColor: theme.palette.primary.main,
|
|
66
|
+
padding: 12,
|
|
67
|
+
fontFamily: "Open Sans",
|
|
68
|
+
fontStyle: "normal",
|
|
69
|
+
fontWeight: "normal",
|
|
70
|
+
fontSize: 14,
|
|
71
|
+
lineHeight: "20px",
|
|
72
|
+
textAlign: "center",
|
|
73
|
+
letterSpacing: "0.15px",
|
|
74
|
+
},
|
|
75
|
+
}));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FxButton = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const button_styles_1 = require("./styles/button.styles");
|
|
7
|
-
function
|
|
7
|
+
function FxButton(_a) {
|
|
8
8
|
var { type = 'primary', children } = _a, rest = tslib_1.__rest(_a, ["type", "children"]);
|
|
9
9
|
return <button_styles_1.ButtonStyled {...rest}>{children}</button_styles_1.ButtonStyled>;
|
|
10
10
|
}
|
|
11
|
-
exports.
|
|
11
|
+
exports.FxButton = FxButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.FxButton = void 0;
|
|
4
|
+
var FxButton_1 = require("./FxButton");
|
|
5
|
+
Object.defineProperty(exports, "FxButton", { enumerable: true, get: function () { return FxButton_1.FxButton; } });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FxChip = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const fixefy_ui_utils_1 = require("@fixefy/fixefy-ui-utils");
|
|
7
|
+
const chip_styles_1 = require("./styles/chip.styles");
|
|
8
|
+
const FxChip = (props) => {
|
|
9
|
+
const { status, label, type = 'status', scoreValue = 0, minimized = false, variant = 'outlined', onClick } = props;
|
|
10
|
+
const newStatus = status ? status.split(' ').join('_') : status;
|
|
11
|
+
const value = typeof label === 'number' ? label.toFixed(2) : label;
|
|
12
|
+
return type === 'status' ? <chip_styles_1.StatusChipStyled status={newStatus} label={(0, fixefy_ui_utils_1.titleCase)(value)} variant={variant} onClick={onClick}/> : <chip_styles_1.ScoreChipStyled score={scoreValue} scoreLabel={(0, fixefy_ui_utils_1.getScoreColor)(scoreValue)} label={(0, fixefy_ui_utils_1.titleCase)(value)} minimized={minimized} variant={variant} onClick={onClick}/>;
|
|
13
|
+
};
|
|
14
|
+
exports.FxChip = FxChip;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatusChipStyled = exports.ScoreChipStyled = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
require("@fixefy/fxutils.page_context");
|
|
7
|
+
exports.ScoreChipStyled = (0, styles_1.styled)(material_1.Chip)(({ theme, scoreLabel, minimized }) => {
|
|
8
|
+
const color = theme.palette.score[scoreLabel];
|
|
9
|
+
return {
|
|
10
|
+
height: 20,
|
|
11
|
+
minWidth: minimized ? 35 : 80,
|
|
12
|
+
maxWidth: 120,
|
|
13
|
+
backgroundColor: color,
|
|
14
|
+
['& .MuiChip-label']: {
|
|
15
|
+
color: theme.palette.common.white,
|
|
16
|
+
fontSize: 9,
|
|
17
|
+
fontWeight: 600,
|
|
18
|
+
paddingLeft: minimized ? 0 : 'inherit',
|
|
19
|
+
paddingRight: minimized ? 0 : 'inherit',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
exports.StatusChipStyled = (0, styles_1.styled)(material_1.Chip)(({ theme, status, variant }) => {
|
|
24
|
+
let backgroundColor, border, labelColor;
|
|
25
|
+
if (theme.palette.status[status]) {
|
|
26
|
+
if (variant === 'filled') {
|
|
27
|
+
backgroundColor = theme.palette.status[status]['border'];
|
|
28
|
+
labelColor = theme.palette.common.white;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
backgroundColor = theme.palette.status[status]['background'];
|
|
32
|
+
}
|
|
33
|
+
border = theme.palette.status[status]['border'];
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
height: 20,
|
|
37
|
+
minWidth: 80,
|
|
38
|
+
maxWidth: 120,
|
|
39
|
+
['& .MuiChip-label']: {
|
|
40
|
+
fontSize: 9,
|
|
41
|
+
fontWeight: 600,
|
|
42
|
+
lineHeight: '12px',
|
|
43
|
+
color: labelColor ? labelColor : theme.palette.statistics.label,
|
|
44
|
+
},
|
|
45
|
+
backgroundColor,
|
|
46
|
+
border: `1px solid ${border}`,
|
|
47
|
+
};
|
|
48
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FxIcon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const content_1 = require("./content");
|
|
7
|
+
const fixefy_ui_utils_1 = require("@fixefy/fixefy-ui-utils");
|
|
8
|
+
const MUIIcons = tslib_1.__importStar(require("@mui/icons-material"));
|
|
9
|
+
const iconsModule = [];
|
|
10
|
+
const FxIcon = ({ className, color, fontSize, icon, height, sx, root, width }) => {
|
|
11
|
+
if (!icon)
|
|
12
|
+
throw Error('Provide a property `icon`');
|
|
13
|
+
let rv;
|
|
14
|
+
const splittedPath = icon.split('/');
|
|
15
|
+
const iconWithoutPath = (0, fixefy_ui_utils_1.toPascalCase)(splittedPath[splittedPath.length - 1]);
|
|
16
|
+
const name = (0, fixefy_ui_utils_1.toPascalCase)(icon);
|
|
17
|
+
if (iconsModule[iconWithoutPath]) {
|
|
18
|
+
rv = <content_1.DynamicIcon icon={iconsModule[iconWithoutPath]} sx={sx}/>;
|
|
19
|
+
}
|
|
20
|
+
else if (MUIIcons[iconWithoutPath]) {
|
|
21
|
+
const MUIIcon = MUIIcons[iconWithoutPath];
|
|
22
|
+
rv = <MUIIcon className={className} color={color} sx={Object.assign(Object.assign({}, sx), { fontSize })}/>;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
rv = <content_1.LazyIcon icon={icon} sx={sx} width={width} height={height}/>;
|
|
26
|
+
}
|
|
27
|
+
return rv;
|
|
28
|
+
};
|
|
29
|
+
exports.FxIcon = FxIcon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamicIcon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const DynamicIcon = ({ icon: IconComponent, sx }) => (IconComponent ? <IconComponent sx={sx}/> : null);
|
|
7
|
+
exports.DynamicIcon = DynamicIcon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LazyIcon = exports.DynamicIcon = void 0;
|
|
4
|
+
var dynamic_icon_1 = require("./dynamic_icon");
|
|
5
|
+
Object.defineProperty(exports, "DynamicIcon", { enumerable: true, get: function () { return dynamic_icon_1.DynamicIcon; } });
|
|
6
|
+
var lazy_icon_1 = require("./lazy_icon");
|
|
7
|
+
Object.defineProperty(exports, "LazyIcon", { enumerable: true, get: function () { return lazy_icon_1.LazyIcon; } });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LazyIcon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const fixefy_ui_utils_1 = require("@fixefy/fixefy-ui-utils");
|
|
8
|
+
const image_1 = tslib_1.__importDefault(require("next/image"));
|
|
9
|
+
const iconsModule = [];
|
|
10
|
+
const LazyIcon = ({ icon, root, sx, width, height }) => {
|
|
11
|
+
const [isError, setError] = (0, react_1.useState)(false);
|
|
12
|
+
const handleError = (isError) => setError(isError);
|
|
13
|
+
if (isError) {
|
|
14
|
+
return (<material_1.Avatar>
|
|
15
|
+
<material_1.Typography fontSize={29} fontWeight={600}>
|
|
16
|
+
{(0, fixefy_ui_utils_1.toInitials)(icon)}
|
|
17
|
+
</material_1.Typography>
|
|
18
|
+
</material_1.Avatar>);
|
|
19
|
+
}
|
|
20
|
+
return <image_1.default alt={icon} width={width} height={height} loader={(obj) => (0, fixefy_ui_utils_1.imageLoader)(Object.assign(Object.assign({}, obj), { root }))} src={icon} onLoad={() => handleError(false)} onError={() => handleError(true)}/>;
|
|
21
|
+
};
|
|
22
|
+
exports.LazyIcon = LazyIcon;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FxModal = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const modal_style_1 = require("./styles/modal.style");
|
|
8
|
+
const FxDialogTitle = (props) => {
|
|
9
|
+
const { children } = props, other = tslib_1.__rest(props, ["children"]);
|
|
10
|
+
return <modal_style_1.StyledDialogTitle {...other}>{children}</modal_style_1.StyledDialogTitle>;
|
|
11
|
+
};
|
|
12
|
+
const FxInlineDialogTitle = (props) => {
|
|
13
|
+
const { children } = props, other = tslib_1.__rest(props, ["children"]);
|
|
14
|
+
return <modal_style_1.StyledInlineDialogTitle {...other}>{children}</modal_style_1.StyledInlineDialogTitle>;
|
|
15
|
+
};
|
|
16
|
+
const IconTitle = ({ icon, title, inline }) => {
|
|
17
|
+
const renderObject = inline ? (<material_1.Box sx={{ display: 'flex', alignItems: 'center' }}>
|
|
18
|
+
{icon}
|
|
19
|
+
<FxInlineDialogTitle id="customized-dialog-title">{title}</FxInlineDialogTitle>
|
|
20
|
+
</material_1.Box>) : (<>
|
|
21
|
+
{icon && icon}
|
|
22
|
+
{title && <FxDialogTitle id="customized-dialog-title">{title}</FxDialogTitle>}
|
|
23
|
+
</>);
|
|
24
|
+
return renderObject;
|
|
25
|
+
};
|
|
26
|
+
const FxModal = (_a) => {
|
|
27
|
+
var { isOpen = false, isIconTitleInline = false, icon, onClose, children, title, actions } = _a, rest = tslib_1.__rest(_a, ["isOpen", "isIconTitleInline", "icon", "onClose", "children", "title", "actions"]);
|
|
28
|
+
return (<div>
|
|
29
|
+
<modal_style_1.FxDialog {...rest} fullWidth onClose={onClose} aria-labelledby="customized-dialog-title" open={isOpen}>
|
|
30
|
+
<IconTitle icon={icon} title={title} inline={isIconTitleInline}/>
|
|
31
|
+
<material_1.DialogContent>{children}</material_1.DialogContent>
|
|
32
|
+
{actions && <modal_style_1.DialogActionsStyled>{actions}</modal_style_1.DialogActionsStyled>}
|
|
33
|
+
</modal_style_1.FxDialog>
|
|
34
|
+
</div>);
|
|
35
|
+
};
|
|
36
|
+
exports.FxModal = FxModal;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialogActionsStyled = exports.StyledInlineDialogTitle = exports.StyledDialogTitle = exports.FxDialog = void 0;
|
|
4
|
+
const styles_1 = require("@mui/material/styles");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
exports.FxDialog = (0, styles_1.styled)(material_1.Dialog)(() => ({
|
|
7
|
+
'& .MuiDialog-paper': {
|
|
8
|
+
borderRadius: 8,
|
|
9
|
+
padding: '24px',
|
|
10
|
+
maxWidth: 'fit-content',
|
|
11
|
+
},
|
|
12
|
+
'& .MuiDialogContent-root': {
|
|
13
|
+
padding: 0,
|
|
14
|
+
},
|
|
15
|
+
'& .MuiDialogActions-root': {
|
|
16
|
+
margin: '24px 0 0 0',
|
|
17
|
+
padding: 0,
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
exports.StyledDialogTitle = (0, styles_1.styled)(material_1.DialogTitle)(() => ({
|
|
21
|
+
fontSize: 14,
|
|
22
|
+
fontWeight: 900,
|
|
23
|
+
margin: '8px 0',
|
|
24
|
+
}));
|
|
25
|
+
exports.StyledInlineDialogTitle = (0, styles_1.styled)(material_1.DialogTitle)(() => ({
|
|
26
|
+
fontSize: 19,
|
|
27
|
+
fontWeight: 600,
|
|
28
|
+
color: '#568793',
|
|
29
|
+
margin: '8px 16px',
|
|
30
|
+
padding: 0,
|
|
31
|
+
}));
|
|
32
|
+
exports.DialogActionsStyled = (0, styles_1.styled)(material_1.DialogActions)(({ theme }) => ({
|
|
33
|
+
justifyContent: 'flex-start',
|
|
34
|
+
}));
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FxNotes = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const notes_styles_1 = require("./styles/notes.styles");
|
|
7
|
+
const queries_1 = require("./operations/queries");
|
|
8
|
+
const client_1 = require("@apollo/client");
|
|
9
|
+
const stringToColor_1 = require("./helpers/stringToColor");
|
|
10
|
+
const fixefy_ui_utils_1 = require("@fixefy/fixefy-ui-utils");
|
|
11
|
+
const FxNotes = ({ notes, onChange, sendOnEnter = true, onSend }) => {
|
|
12
|
+
const [comment, setComment] = (0, react_1.useState)('');
|
|
13
|
+
const [backgroundcolors, setBackgroundColors] = (0, react_1.useState)({});
|
|
14
|
+
const [anchorEl, setAnchorEl] = react_1.default.useState(null);
|
|
15
|
+
const inputRef = (0, react_1.useRef)();
|
|
16
|
+
const { data, loading } = (0, client_1.useQuery)(queries_1.ME);
|
|
17
|
+
const { me } = data;
|
|
18
|
+
const handleClick = (event) => {
|
|
19
|
+
setAnchorEl(event.currentTarget);
|
|
20
|
+
};
|
|
21
|
+
const handleClose = () => {
|
|
22
|
+
setAnchorEl(null);
|
|
23
|
+
};
|
|
24
|
+
const handleEnterKeyPressed = () => {
|
|
25
|
+
setComment((prevState) => {
|
|
26
|
+
if (prevState) {
|
|
27
|
+
onSend &&
|
|
28
|
+
onSend({
|
|
29
|
+
created_at: new Date().getTime(),
|
|
30
|
+
created_by: me.username,
|
|
31
|
+
text: prevState,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return '';
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
(0, react_1.useEffect)(() => {
|
|
38
|
+
onChange && onChange(comment);
|
|
39
|
+
}, [comment]);
|
|
40
|
+
(0, react_1.useEffect)(() => {
|
|
41
|
+
if (inputRef.current) {
|
|
42
|
+
inputRef.current.addEventListener('keyup', (event) => {
|
|
43
|
+
if (event.keyCode === 13) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
handleEnterKeyPressed();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return inputRef && inputRef.current && inputRef.current.removeEventListener('keyup', handleEnterKeyPressed);
|
|
50
|
+
}, []);
|
|
51
|
+
const open = Boolean(anchorEl);
|
|
52
|
+
const id = open ? 'simple-popover' : undefined;
|
|
53
|
+
return (<notes_styles_1.CommentsContainer>
|
|
54
|
+
|
|
55
|
+
<notes_styles_1.CommentWrapper>
|
|
56
|
+
<notes_styles_1.StyledAvatar sx={{
|
|
57
|
+
backgroundColor: backgroundcolors[me.username]
|
|
58
|
+
? backgroundcolors[me.username]
|
|
59
|
+
: (0, stringToColor_1.stringToColor)(me.username, (color) => {
|
|
60
|
+
setBackgroundColors(Object.assign(Object.assign({}, backgroundcolors), { [me.username]: color }));
|
|
61
|
+
}),
|
|
62
|
+
}} src={me && me.image_url}>
|
|
63
|
+
{me && (0, fixefy_ui_utils_1.titleCase)(me.username.slice(0, 1))}
|
|
64
|
+
</notes_styles_1.StyledAvatar>
|
|
65
|
+
<notes_styles_1.CommentInput type="text" value={comment} ref={inputRef} onChange={(e) => {
|
|
66
|
+
setComment(e.currentTarget.value);
|
|
67
|
+
}}/>
|
|
68
|
+
|
|
69
|
+
</notes_styles_1.CommentWrapper>
|
|
70
|
+
{notes && notes.length ? (<notes_styles_1.CommentsWrapper>
|
|
71
|
+
<notes_styles_1.CommentsScrollWrapper>
|
|
72
|
+
{notes
|
|
73
|
+
.slice()
|
|
74
|
+
.reverse()
|
|
75
|
+
.map((comment, index) => {
|
|
76
|
+
return (<notes_styles_1.UserCommentWrapper key={index}>
|
|
77
|
+
<notes_styles_1.StyledAvatar sx={{
|
|
78
|
+
backgroundColor: backgroundcolors[comment.created_by]
|
|
79
|
+
? backgroundcolors[comment.created_by]
|
|
80
|
+
: (0, stringToColor_1.stringToColor)(comment.created_by, (color) => {
|
|
81
|
+
setBackgroundColors(Object.assign(Object.assign({}, backgroundcolors), { [comment.created_by]: color }));
|
|
82
|
+
}),
|
|
83
|
+
}}>
|
|
84
|
+
{(0, fixefy_ui_utils_1.titleCase)(comment.created_by.slice(0, 1))}
|
|
85
|
+
</notes_styles_1.StyledAvatar>
|
|
86
|
+
<notes_styles_1.UserComment>
|
|
87
|
+
<notes_styles_1.CommentUserTitle>{comment.created_by}</notes_styles_1.CommentUserTitle>
|
|
88
|
+
<notes_styles_1.CommentDate>
|
|
89
|
+
{(0, fixefy_ui_utils_1.normalizeTimestamp)(comment.created_at, {
|
|
90
|
+
dateOnly: true,
|
|
91
|
+
})}
|
|
92
|
+
</notes_styles_1.CommentDate>
|
|
93
|
+
<notes_styles_1.CommentDesc>{comment.text}</notes_styles_1.CommentDesc>
|
|
94
|
+
</notes_styles_1.UserComment>
|
|
95
|
+
</notes_styles_1.UserCommentWrapper>);
|
|
96
|
+
})}
|
|
97
|
+
</notes_styles_1.CommentsScrollWrapper>
|
|
98
|
+
</notes_styles_1.CommentsWrapper>) : null}
|
|
99
|
+
</notes_styles_1.CommentsContainer>);
|
|
100
|
+
};
|
|
101
|
+
exports.FxNotes = FxNotes;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringToColor = void 0;
|
|
4
|
+
const stringToColor = (string, callBack) => {
|
|
5
|
+
let hash = 0;
|
|
6
|
+
let color = '#';
|
|
7
|
+
if (!string) {
|
|
8
|
+
return '#000';
|
|
9
|
+
}
|
|
10
|
+
for (let i = 0; i < string.length; i += 1) {
|
|
11
|
+
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
12
|
+
}
|
|
13
|
+
for (let i = 0; i < 3; i += 1) {
|
|
14
|
+
const value = (hash >> (i * 8)) & 0xff;
|
|
15
|
+
color += `00${value.toString(16)}`.substr(-2);
|
|
16
|
+
}
|
|
17
|
+
callBack && callBack(color);
|
|
18
|
+
return color;
|
|
19
|
+
};
|
|
20
|
+
exports.stringToColor = stringToColor;
|