Skip to content

Commit c9fa20d

Browse files
authored
Add left margin to timeline and fix colors in edit mode (#500)
Display placeholder only in the green timeline Display participants if not in edit mode
1 parent d3357d2 commit c9fa20d

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

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

+13-10
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ function TimelineInput({minHour, maxHour}) {
270270
<div>
271271
<div
272272
ref={timelineRef}
273+
style={{position: 'relative'}}
273274
className={`${styles['timeline-input']} ${styles['edit']}`}
274275
onClick={event => {
275276
handleMouseDown(event);
@@ -424,10 +425,12 @@ ClickToAddTimeSlots.propTypes = {
424425

425426
function TimelineContent({busySlots: allBusySlots, minHour, maxHour}) {
426427
const dispatch = useDispatch();
427-
const [editing, setEditing] = useState(false);
428+
const candidates = useSelector(getTimeslotsForActiveDate);
429+
430+
const [_editing, setEditing] = useState(false);
431+
const editing = _editing || !!candidates.length;
428432
const date = useSelector(getCreationCalendarActiveDate);
429433
const pastCandidates = useSelector(getPreviousDayTimeslots);
430-
const candidates = useSelector(getTimeslotsForActiveDate);
431434

432435
const copyTimeSlots = () => {
433436
pastCandidates.forEach(time => {
@@ -436,12 +439,6 @@ function TimelineContent({busySlots: allBusySlots, minHour, maxHour}) {
436439
setEditing(true);
437440
};
438441

439-
if (!editing && candidates.length === 0) {
440-
return (
441-
<ClickToAddTimeSlots startEditing={() => setEditing(true)} copyTimeSlots={copyTimeSlots} />
442-
);
443-
}
444-
445442
return (
446443
<>
447444
<div className={styles['timeline-rows']}>
@@ -454,7 +451,13 @@ function TimelineContent({busySlots: allBusySlots, minHour, maxHour}) {
454451
return <BusyColumn {...slot} key={key} />;
455452
})
456453
)}
457-
<TimelineInput minHour={minHour} maxHour={maxHour} />
454+
{editing && <TimelineInput minHour={minHour} maxHour={maxHour} />}
455+
{!editing && (
456+
<ClickToAddTimeSlots
457+
startEditing={() => setEditing(true)}
458+
copyTimeSlots={copyTimeSlots}
459+
/>
460+
)}
458461
</div>
459462
{editing && candidates.length === 0 && (
460463
<div className={styles['add-first-text']}>
@@ -556,7 +559,7 @@ export default function Timeline({date, availability, defaultMinHour, defaultMax
556559
</Grid>
557560
</Grid.Column>
558561
</Grid.Row>
559-
<Grid.Row>
562+
<Grid.Row className={styles['timeline-content']}>
560563
<Grid.Column>
561564
<div className={styles['timeline-slot-picker']}>
562565
<TimelineHeader hourSeries={hourSeries} hourSpan={hourSpan} hourStep={hourStep} />

newdle/client/src/components/creation/timeslots/Timeline.module.scss

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ $rows-border-width: 5px;
1717
}
1818
}
1919

20+
.timeline-content {
21+
@media screen and (min-width: 1200px) {
22+
margin-left: $label-width;
23+
}
24+
}
25+
2026
.timeline-date {
2127
color: $coral;
2228
}
@@ -46,8 +52,6 @@ $rows-border-width: 5px;
4652
}
4753
.timeline-rows {
4854
position: relative;
49-
background-color: lighten($green, 27%);
50-
border: $rows-border-width solid lighten($green, 22%);
5155

5256
.timeline-row {
5357
height: $row-height;
@@ -219,6 +223,9 @@ $rows-border-width: 5px;
219223
padding-top: 10px;
220224
padding-bottom: 10px;
221225

226+
background-color: lighten($green, 27%);
227+
border: $rows-border-width solid lighten($green, 22%);
228+
222229
.add-btn-wrapper {
223230
display: flex;
224231
align-items: center;

newdle/client/src/locales/es/messages.po

+7-7
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ msgstr ""
111111
msgid "Choose your participants"
112112
msgstr "Elige a los participantes"
113113

114-
#: src/components/creation/timeslots/Timeline.js:462
114+
#: src/components/creation/timeslots/Timeline.js:465
115115
msgid "Click the timeline to add your first time slot"
116116
msgstr ""
117117

118-
#: src/components/creation/timeslots/Timeline.js:408
118+
#: src/components/creation/timeslots/Timeline.js:409
119119
msgid "Click to add time slots"
120120
msgstr ""
121121

@@ -145,7 +145,7 @@ msgstr ""
145145
msgid "Copied!"
146146
msgstr ""
147147

148-
#: src/components/creation/timeslots/Timeline.js:413
148+
#: src/components/creation/timeslots/Timeline.js:414
149149
msgid "Copy time slots from previous day"
150150
msgstr ""
151151

@@ -406,7 +406,7 @@ msgstr ""
406406
msgid "Please log in again to confirm your identity"
407407
msgstr ""
408408

409-
#: src/components/creation/timeslots/Timeline.js:520
409+
#: src/components/creation/timeslots/Timeline.js:523
410410
msgid "Revert to the local timezone"
411411
msgstr ""
412412

@@ -523,11 +523,11 @@ msgstr ""
523523
msgid "Timeslots"
524524
msgstr ""
525525

526-
#: src/components/creation/timeslots/Timeline.js:528
526+
#: src/components/creation/timeslots/Timeline.js:531
527527
msgid "Timezone"
528528
msgstr ""
529529

530-
#: src/components/creation/timeslots/Timeline.js:526
530+
#: src/components/creation/timeslots/Timeline.js:529
531531
msgid "Timezone {revertIcon}"
532532
msgstr ""
533533

@@ -637,7 +637,7 @@ msgstr ""
637637
msgid "switch back to the <0>{defaultUserTz}</0> timezone"
638638
msgstr ""
639639

640-
#: src/components/creation/timeslots/Timeline.js:316
640+
#: src/components/creation/timeslots/Timeline.js:317
641641
msgid "{0, plural, =0 {No participants registered} one {# participant registered} other {# participants registered}}"
642642
msgstr ""
643643

0 commit comments

Comments
 (0)