Skip to content

Commit 4819972

Browse files
committed
Create slots on Timeline click
Refactor candidate placeholder Co-authored-by: Tomas Roun <[email protected]> Fix tooltips and hide placeholder when x button is hovered Do not expand 2 days if end of slot is next day
1 parent aaf9c29 commit 4819972

File tree

6 files changed

+341
-131
lines changed

6 files changed

+341
-131
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import {Popup} from 'semantic-ui-react';
4+
/**
5+
* Displays a placeholder for a candidate time slot when the Timeline is hovered.
6+
*/
7+
export default function CandidatePlaceholder({visible, left, width, time}) {
8+
if (!visible) {
9+
return null;
10+
}
11+
12+
return (
13+
<Popup
14+
content={time}
15+
open={true}
16+
position="top center"
17+
trigger={
18+
<div
19+
style={{
20+
boxSizing: 'border-box',
21+
position: 'absolute',
22+
left: `${left}%`,
23+
width: `${width}%`,
24+
top: 5,
25+
height: 'calc(100% - 10px)',
26+
zIndex: 1000,
27+
background: 'rgba(0, 0, 0, 0.2)',
28+
borderRadius: '3px',
29+
display: 'block',
30+
pointerEvents: 'none',
31+
}}
32+
/>
33+
}
34+
/>
35+
);
36+
}
37+
38+
CandidatePlaceholder.propTypes = {
39+
visible: PropTypes.bool.isRequired,
40+
width: PropTypes.number.isRequired,
41+
left: PropTypes.number.isRequired,
42+
time: PropTypes.string.isRequired,
43+
};

newdle/client/src/components/creation/timeslots/CandidateSlot.js

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function SlotEditWidget({startTime, onChange, isValidTime, slot}) {
1616
<Popup
1717
className={styles['timepicker-popup']}
1818
on="click"
19+
onClick={e => e.stopPropagation()}
1920
content={
2021
<>
2122
<TimePicker
@@ -63,11 +64,14 @@ export default function CandidateSlot({
6364
endTime,
6465
onDelete,
6566
onChangeSlotTime,
67+
onMouseEnter,
68+
onMouseLeave,
6669
isValidTime,
6770
text,
6871
}) {
6972
const slot = (
7073
<Slot
74+
onClick={e => e.stopPropagation()}
7175
width={width}
7276
pos={pos}
7377
moreStyles={styles['candidate']}
@@ -82,6 +86,8 @@ export default function CandidateSlot({
8286
name="times circle outline"
8387
onClick={onDelete}
8488
className={`${styles['clickable']} ${styles['delete-btn']}`}
89+
onMouseEnter={onMouseEnter}
90+
onMouseLeave={onMouseLeave}
8591
/>
8692
</Slot>
8793
);
@@ -102,6 +108,8 @@ CandidateSlot.propTypes = {
102108
endTime: PropTypes.string.isRequired,
103109
onDelete: PropTypes.func.isRequired,
104110
onChangeSlotTime: PropTypes.func.isRequired,
111+
onMouseEnter: PropTypes.func.isRequired,
112+
onMouseLeave: PropTypes.func.isRequired,
105113
isValidTime: PropTypes.func.isRequired,
106114
text: PropTypes.string,
107115
};

0 commit comments

Comments
 (0)