Skip to content

Commit f1659c8

Browse files
Venkataramanan VenkateswaranVenkataramanan Venkateswaran
authored andcommitted
Venkataramanan fix: sonarqube issues
1 parent b52b307 commit f1659c8

1 file changed

Lines changed: 1 addition & 189 deletions

File tree

src/components/WeeklySummariesReport/components/WeeklySummariesToggleFilter.jsx

Lines changed: 1 addition & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import PropTypes from 'prop-types';
22
import { Label } from 'reactstrap';
33
import styles from '../WeeklySummariesReport.module.css';
44
import ReactTooltip from 'react-tooltip';
5-
import { toggleField, setChildField } from '~/utils/stateHelper';
6-
// import SlideToggle from './SlideToggle';
7-
// import cn from 'classnames';
5+
import { toggleField } from '~/utils/stateHelper';
86

97
export default function WeeklySummariesToggleFilter({
108
state,
@@ -15,8 +13,6 @@ export default function WeeklySummariesToggleFilter({
1513
hasPermission,
1614
canSeeBioHighlight,
1715
}) {
18-
// const safeColors = state.selectedSpecialColors || { purple: false, green: false, navy: false };
19-
2016
const handleTrophyToggleChange = () => {
2117
toggleField(setState, 'selectedTrophies');
2218
};
@@ -29,148 +25,8 @@ export default function WeeklySummariesToggleFilter({
2925
toggleField(setState, 'selectedOverTime');
3026
};
3127

32-
// const handleSpecialColorToggleChange = (color, isEnabled) => {
33-
// setState(prevState => ({
34-
// ...prevState,
35-
// selectedSpecialColors: {
36-
// ...prevState.selectedSpecialColors,
37-
// [color]: isEnabled,
38-
// },
39-
// }));
40-
// };
41-
4228
return (
4329
<div className={`${styles.filterContainer}`}>
44-
{/* {hasPermissionToFilter && (
45-
<div className={`${styles.filterStyle}`}>
46-
<span>Filter by Special Colors</span>
47-
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', marginTop: '2px' }}>
48-
{['purple', 'green', 'navy'].map(color => (
49-
<div key={`${color}-toggle`} style={{ display: 'flex', alignItems: 'center' }}>
50-
<div className={`${styles.switchToggleControl}`}>
51-
<input
52-
type="checkbox"
53-
className={`${styles.switchToggle}`}
54-
id={`${formId}-${color}-toggle`}
55-
checked={state.selectedSpecialColors[color]}
56-
disabled={!editable}
57-
onChange={e =>
58-
setChildField(setState, 'selectedSpecialColors', color, e.target.checked)
59-
}
60-
/>
61-
<Label
62-
className={`${styles.switchToggleLabel}`}
63-
for={`${formId}-${color}-toggle`}
64-
>
65-
<span className={`${styles.switchToggleInner}`} />
66-
<span className={`${styles.switchToggleSwitch}`} />
67-
</Label>
68-
</div>
69-
<span
70-
style={{
71-
marginLeft: '3px',
72-
fontSize: 'inherit',
73-
textTransform: 'capitalize',
74-
whiteSpace: 'nowrap',
75-
fontWeight: 'normal',
76-
}}
77-
>
78-
{color}
79-
</span>
80-
</div>
81-
))}
82-
</div>
83-
</div>
84-
)} */}
85-
{/* {(hasPermissionToFilter || canSeeBioHighlight) && (
86-
<div className={`${styles.filterStyle} ml-3`} style={{ minWidth: 'max-content' }}>
87-
<span>Filter by Bio Status</span>
88-
<div className={styles.switchToggleControl}>
89-
<input
90-
type="checkbox"
91-
className={styles.switchToggle}
92-
id={`${formId}-bio-status-toggle`}
93-
checked={state.selectedBioStatus}
94-
disabled={!editable}
95-
onChange={handleBioStatusToggleChange}
96-
/>
97-
<Label className={`${styles.switchToggleLabel}`} for={`${formId}-bio-status-toggle`}>
98-
<span className={styles.switchToggleInner} />
99-
<span className={styles.switchToggleSwitch} />
100-
</Label>
101-
</div>
102-
</div>
103-
)} */}
104-
{/* {hasPermissionToFilter && (
105-
<div className={`${styles.filterStyle}`}>
106-
<span>Filter by Special Colors</span>
107-
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', marginTop: '2px' }}>
108-
{['purple', 'green', 'navy'].map(color => (
109-
<div key={`${color}-toggle`} style={{ display: 'flex', alignItems: 'center' }}>
110-
<div className={`${styles.switchToggleControl}`}>
111-
<input
112-
type="checkbox"
113-
className={`${styles.switchToggle}`}
114-
id={`${formId}-${color}-toggle`}
115-
// 🟢 FIX: Use safeColors here to prevent the crash
116-
checked={safeColors[color] || false}
117-
disabled={!editable}
118-
onChange={e =>
119-
setChildField(setState, 'selectedSpecialColors', color, e.target.checked)
120-
}
121-
/>
122-
<Label
123-
className={`${styles.switchToggleLabel}`}
124-
for={`${formId}-${color}-toggle`}
125-
>
126-
<span className={`${styles.switchToggleInner}`} />
127-
<span className={`${styles.switchToggleSwitch}`} />
128-
</Label>
129-
</div>
130-
<span
131-
style={{
132-
marginLeft: '3px',
133-
fontSize: 'inherit',
134-
textTransform: 'capitalize',
135-
whiteSpace: 'nowrap',
136-
fontWeight: 'normal',
137-
}}
138-
>
139-
{color}
140-
</span>
141-
</div>
142-
))}
143-
</div>
144-
</div>
145-
)}
146-
{hasPermissionToFilter && state.selectedCodes.length > 0 && (
147-
<div className={cn(styles.filterStyle, styles.filterMarginRight, 'mt-2', 'mb-2', 'ml-7')}>
148-
<span className={styles.selectAllLabel}>Select All (Visible Users): </span>
149-
<div className={styles.dotSelector}>
150-
{['purple', 'green', 'navy'].map(color => (
151-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
152-
<span
153-
key={color}
154-
onClick={e => {
155-
e.preventDefault();
156-
handleBulkDotClick(color);
157-
}}
158-
className={cn(styles.bulkDot, state.bulkSelectedColors[color] && styles.active)}
159-
style={{
160-
display: 'inline-block',
161-
width: '15px',
162-
height: '15px',
163-
margin: '0 5px',
164-
borderRadius: '50%',
165-
backgroundColor: state.bulkSelectedColors[color] ? color : 'transparent',
166-
border: `3px solid ${color}`,
167-
cursor: 'pointer',
168-
}}
169-
/>
170-
))}
171-
</div>
172-
</div>
173-
)} */}
17430
{(hasPermissionToFilter || props.hasPermission('highlightEligibleBios')) && (
17531
<div
17632
className={`${styles.filterStyle} ${styles.marginRight}`}
@@ -191,26 +47,6 @@ export default function WeeklySummariesToggleFilter({
19147
</div>
19248
</div>
19349
)}
194-
{/* old */}
195-
{/* {hasPermissionToFilter && (
196-
<div className={`${styles.filterStyle} ml-3`} style={{ minWidth: 'max-content' }}>
197-
<span>Filter by Trophies</span>
198-
<div className={`${styles.switchToggleControl}`}>
199-
<input
200-
type="checkbox"
201-
className={`${styles.switchToggle}`}
202-
id={`${formId}-trophy-toggle`}
203-
checked={state.selectedTrophies}
204-
disabled={!editable}
205-
onChange={handleTrophyToggleChange}
206-
/>
207-
<Label className={`${styles.switchToggleLabel}`} for={`${formId}-trophy-toggle`}>
208-
<span className={`${styles.switchToggleInner}`} />
209-
<span className={`${styles.switchToggleSwitch}`} />
210-
</Label>
211-
</div>
212-
</div>
213-
)} */}
21450
{hasPermissionToFilter && (
21551
<div
21652
className={`${styles.filterStyle} ${styles.marginRight}`}
@@ -231,30 +67,6 @@ export default function WeeklySummariesToggleFilter({
23167
</div>
23268
</div>
23369
)}
234-
{/* {hasPermissionToFilter && (
235-
<div className={`${styles.filterStyle} ml-3`} style={{ minWidth: 'max-content' }}>
236-
<span>Filter by Over Hours</span>
237-
<div className={`${styles.switchToggleControl}`}>
238-
<input
239-
type="checkbox"
240-
className={`${styles.switchToggle}`}
241-
id={`${formId}-over-hours-toggle`}
242-
checked={state.selectedOverTime}
243-
disabled={!editable}
244-
onChange={handleOverHoursToggleChange}
245-
/>
246-
<Label className={`${styles.switchToggleLabel}`} for={`${formId}-over-hours-toggle`}>
247-
<span className={`${styles.switchToggleInner}`} />
248-
<span className={`${styles.switchToggleSwitch}`} />
249-
</Label>
250-
</div>
251-
<ReactTooltip id="filterTooltip" place="top" effect="solid" className="custom-tooltip">
252-
<span style={{ whiteSpace: 'normal', wordWrap: 'break-word', maxWidth: '200px' }}>
253-
Filter people who contributed more than 25% of their committed hours
254-
</span>
255-
</ReactTooltip>
256-
</div>
257-
)} */}
25870
{hasPermissionToFilter && (
25971
<div className={`${styles.filterStyle}`} style={{ minWidth: 'max-content' }}>
26072
<span>Filter by Over Hours</span>

0 commit comments

Comments
 (0)