Skip to content

Commit ff080c6

Browse files
committed
When there is a space after a sentence, highlighting and adding effects are applied to all the text below
#1503 #1505
1 parent 8be49cf commit ff080c6

File tree

3 files changed

+179
-151
lines changed

3 files changed

+179
-151
lines changed

src/components/ChallengeEditor/Description-Field/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -850,16 +850,21 @@ class DescriptionField extends Component {
850850
}
851851
} else {
852852
text = cm.getSelection()
853+
let trimText = text.trim()
854+
let lastSpaces = ''
855+
for (let i = trimText.length; i < text.length; i++) {
856+
lastSpaces += text[i]
857+
}
853858
if (type === 'bold') {
854-
text = text.split('**').join('')
859+
trimText = trimText.split('**').join('')
855860
// text = text.split('__').join('');
856861
} else if (type === 'italic') {
857-
text = text.split('*').join('')
862+
trimText = trimText.split('*').join('')
858863
// text = text.split('_').join('');
859864
} else if (type === 'strikethrough') {
860-
text = text.split('~~').join('')
865+
trimText = trimText.split('~~').join('')
861866
}
862-
cm.replaceSelection(start + text + end)
867+
cm.replaceSelection(start + trimText + end + lastSpaces)
863868

864869
startPoint.ch += startChars.length
865870
endPoint.ch = startPoint.ch + text.length

src/components/ChallengeEditor/Submissions/Submissions.module.scss

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,12 @@ $base-unit: 5px;
1818
.container {
1919
@include roboto;
2020

21-
max-width: 966px;
2221
margin-left: auto;
2322
margin-right: auto;
24-
25-
.top-title {
26-
margin-top: -30px;
27-
margin-bottom: 20px;
28-
text-align: center;
29-
display: flex;
30-
justify-content: center;
31-
gap: 40px;
32-
}
23+
display: flex;
24+
justify-content: center;
25+
flex-wrap: wrap;
26+
gap: 40px;
3327

3428
div {
3529
white-space: nowrap;
@@ -196,12 +190,32 @@ $base-unit: 5px;
196190
}
197191
}
198192

193+
.empty-left {
194+
flex: 1;
195+
196+
@media (max-width: 1420px) {
197+
display: none;
198+
}
199+
}
200+
201+
.top-title {
202+
text-align: center;
203+
display: flex;
204+
justify-content: flex-start;
205+
gap: 40px;
206+
flex: 1;
207+
208+
@media (max-width: 1420px) {
209+
justify-content: center;
210+
}
211+
}
212+
199213
.container.dev {
200214
margin: 0;
201215
width: 100%;
202216
margin: 0 auto;
203217
padding-bottom: 30px;
204-
margin-top: 50px;
218+
margin-top: 20px;
205219
line-height: 50px;
206220
// text-align: center;
207221

@@ -327,6 +341,12 @@ $base-unit: 5px;
327341
}
328342
}
329343

344+
.submissionsContainer {
345+
display: flex;
346+
flex-direction: column;
347+
max-width: 966px;
348+
}
349+
330350
.tooltip {
331351
font-size: 14px;
332352
margin: 10px 10px 0 10px;

src/components/ChallengeEditor/Submissions/index.js

Lines changed: 139 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,146 @@ class SubmissionsComponent extends React.Component {
306306

307307
return (
308308
<div className={cn(styles.container, styles.dev, styles['non-mm'])}>
309-
<div className={styles['top-title']} >
309+
<div className={styles['empty-left']} />
310+
<div className={styles.submissionsContainer}>
311+
<div className={styles.head}>
312+
{!isF2F && !isBugHunt && (
313+
<button
314+
type='button'
315+
onClick={() => {
316+
this.onSortChange({
317+
field: 'Rating',
318+
sort: field === 'Rating' ? revertSort : 'desc'
319+
})
320+
}}
321+
className={cn(styles['col-2'], styles['header-sort'])}
322+
>
323+
<span>Rating</span>
324+
<div
325+
className={cn(styles['col-arrow'], {
326+
[styles['col-arrow-sort-asc']]:
327+
field === 'Rating' && sort === 'asc',
328+
[styles['col-arrow-is-sorting']]: field === 'Rating'
329+
})}
330+
>
331+
<ReactSVG path={assets(`${ArrowDown}`)} />
332+
</div>
333+
</button>
334+
)}
335+
<button
336+
type='button'
337+
onClick={() => {
338+
this.onSortChange({
339+
field: 'Username',
340+
sort: field === 'Username' ? revertSort : 'desc'
341+
})
342+
}}
343+
className={cn(styles['col-3'], styles['header-sort'])}
344+
>
345+
<span>Username</span>
346+
<div
347+
className={cn(styles['col-arrow'], {
348+
[styles['col-arrow-sort-asc']]: field === 'Username' && sort === 'asc',
349+
[styles['col-arrow-is-sorting']]: field === 'Username'
350+
})}
351+
>
352+
<ReactSVG path={assets(`${ArrowDown}`)} />
353+
</div>
354+
</button>
355+
<button
356+
type='button'
357+
onClick={() => {
358+
this.onSortChange({
359+
field: 'Submission Date',
360+
sort: field === 'Submission Date' ? revertSort : 'desc'
361+
})
362+
}}
363+
className={cn(styles['col-4'], styles['header-sort'])}
364+
>
365+
<span>Submission Date</span>
366+
<div
367+
className={cn(styles['col-arrow'], {
368+
[styles['col-arrow-sort-asc']]: field === 'Submission Date' && sort === 'asc',
369+
[styles['col-arrow-is-sorting']]: field === 'Submission Date'
370+
})}
371+
>
372+
<ReactSVG path={assets(`${ArrowDown}`)} />
373+
</div>
374+
</button>
375+
<button
376+
type='button'
377+
onClick={() => {
378+
this.onSortChange({
379+
field: 'Initial / Final Score',
380+
sort: field === 'Initial / Final Score' ? revertSort : 'desc'
381+
})
382+
}}
383+
className={cn(styles['col-5'], styles['header-sort'])}
384+
>
385+
<span>Initial / Final Score</span>
386+
<div
387+
className={cn('col-arrow', {
388+
'col-arrow-sort-asc':
389+
field === 'Initial / Final Score' && sort === 'asc',
390+
'col-arrow-is-sorting': field === 'Initial / Final Score'
391+
})}
392+
>
393+
<ReactSVG path={assets(`${ArrowDown}`)} />
394+
</div>
395+
</button>
396+
</div>
397+
{sortedSubmissions.map(s => (
398+
<div
399+
key={_.get(s.registrant, 'memberHandle', '') + s.created}
400+
className={styles.row}
401+
>
402+
{!isF2F && !isBugHunt && (
403+
<div
404+
className={cn(styles['col-2'], styles[`level-${getRatingLevel(_.get(s.registrant, 'rating', 0))}`])}
405+
>
406+
{s.registrant && !_.isNil(s.registrant.rating)
407+
? s.registrant.rating
408+
: '-'}
409+
</div>
410+
)}
411+
<div className={styles['col-3']}>
412+
<a
413+
href={`${window.origin}/members/${_.get(
414+
s.registrant,
415+
'memberHandle',
416+
''
417+
)}`}
418+
target={`${
419+
_.includes(window.origin, 'www') ? '_self' : '_blank'
420+
}`}
421+
rel='noopener noreferrer'
422+
className={cn(
423+
styles['handle'],
424+
styles[`level-${getRatingLevel(_.get(s.registrant, 'rating', 0))}`]
425+
)}
426+
>
427+
{_.get(s.registrant, 'memberHandle', '')}
428+
</a>
429+
</div>
430+
<div className={styles['col-4']}>
431+
{moment(s.created).format('MMM DD, YYYY HH:mm')}
432+
</div>
433+
<div className={styles['col-5']}>
434+
<a href={`${SUBMISSION_REVIEW_APP_URL}/${challenge.legacyId}/submissions/${s.id} `} target='_blank'>
435+
{!_.isEmpty(s.review) && s.review[0].score
436+
? parseFloat(s.review[0].score).toFixed(2)
437+
: 'N/A'}
438+
&zwnj; &zwnj;/ &zwnj;
439+
{s.reviewSummation && s.reviewSummation[0].aggregateScore
440+
? parseFloat(s.reviewSummation[0].aggregateScore).toFixed(2)
441+
: 'N/A'}
442+
</a>
443+
</div>
444+
</div>
445+
))}
446+
</div>
310447

448+
<div className={styles['top-title']} >
311449
<div className={styles.btnManageSubmissions} >
312450
<PrimaryButton
313451
text='Manage Submissions'
@@ -364,141 +502,6 @@ class SubmissionsComponent extends React.Component {
364502
/>
365503
</div>
366504
</div>
367-
<div className={styles.head}>
368-
{!isF2F && !isBugHunt && (
369-
<button
370-
type='button'
371-
onClick={() => {
372-
this.onSortChange({
373-
field: 'Rating',
374-
sort: field === 'Rating' ? revertSort : 'desc'
375-
})
376-
}}
377-
className={cn(styles['col-2'], styles['header-sort'])}
378-
>
379-
<span>Rating</span>
380-
<div
381-
className={cn(styles['col-arrow'], {
382-
[styles['col-arrow-sort-asc']]:
383-
field === 'Rating' && sort === 'asc',
384-
[styles['col-arrow-is-sorting']]: field === 'Rating'
385-
})}
386-
>
387-
<ReactSVG path={assets(`${ArrowDown}`)} />
388-
</div>
389-
</button>
390-
)}
391-
<button
392-
type='button'
393-
onClick={() => {
394-
this.onSortChange({
395-
field: 'Username',
396-
sort: field === 'Username' ? revertSort : 'desc'
397-
})
398-
}}
399-
className={cn(styles['col-3'], styles['header-sort'])}
400-
>
401-
<span>Username</span>
402-
<div
403-
className={cn(styles['col-arrow'], {
404-
[styles['col-arrow-sort-asc']]: field === 'Username' && sort === 'asc',
405-
[styles['col-arrow-is-sorting']]: field === 'Username'
406-
})}
407-
>
408-
<ReactSVG path={assets(`${ArrowDown}`)} />
409-
</div>
410-
</button>
411-
<button
412-
type='button'
413-
onClick={() => {
414-
this.onSortChange({
415-
field: 'Submission Date',
416-
sort: field === 'Submission Date' ? revertSort : 'desc'
417-
})
418-
}}
419-
className={cn(styles['col-4'], styles['header-sort'])}
420-
>
421-
<span>Submission Date</span>
422-
<div
423-
className={cn(styles['col-arrow'], {
424-
[styles['col-arrow-sort-asc']]: field === 'Submission Date' && sort === 'asc',
425-
[styles['col-arrow-is-sorting']]: field === 'Submission Date'
426-
})}
427-
>
428-
<ReactSVG path={assets(`${ArrowDown}`)} />
429-
</div>
430-
</button>
431-
<button
432-
type='button'
433-
onClick={() => {
434-
this.onSortChange({
435-
field: 'Initial / Final Score',
436-
sort: field === 'Initial / Final Score' ? revertSort : 'desc'
437-
})
438-
}}
439-
className={cn(styles['col-5'], styles['header-sort'])}
440-
>
441-
<span>Initial / Final Score</span>
442-
<div
443-
className={cn('col-arrow', {
444-
'col-arrow-sort-asc':
445-
field === 'Initial / Final Score' && sort === 'asc',
446-
'col-arrow-is-sorting': field === 'Initial / Final Score'
447-
})}
448-
>
449-
<ReactSVG path={assets(`${ArrowDown}`)} />
450-
</div>
451-
</button>
452-
</div>
453-
{sortedSubmissions.map(s => (
454-
<div
455-
key={_.get(s.registrant, 'memberHandle', '') + s.created}
456-
className={styles.row}
457-
>
458-
{!isF2F && !isBugHunt && (
459-
<div
460-
className={cn(styles['col-2'], styles[`level-${getRatingLevel(_.get(s.registrant, 'rating', 0))}`])}
461-
>
462-
{s.registrant && !_.isNil(s.registrant.rating)
463-
? s.registrant.rating
464-
: '-'}
465-
</div>
466-
)}
467-
<div className={styles['col-3']}>
468-
<a
469-
href={`${window.origin}/members/${_.get(
470-
s.registrant,
471-
'memberHandle',
472-
''
473-
)}`}
474-
target={`${
475-
_.includes(window.origin, 'www') ? '_self' : '_blank'
476-
}`}
477-
rel='noopener noreferrer'
478-
className={cn(
479-
styles['handle'],
480-
styles[`level-${getRatingLevel(_.get(s.registrant, 'rating', 0))}`]
481-
)}
482-
>
483-
{_.get(s.registrant, 'memberHandle', '')}
484-
</a>
485-
</div>
486-
<div className={styles['col-4']}>
487-
{moment(s.created).format('MMM DD, YYYY HH:mm')}
488-
</div>
489-
<div className={styles['col-5']}>
490-
<a href={`${SUBMISSION_REVIEW_APP_URL}/${challenge.legacyId}/submissions/${s.id} `} target='_blank'>
491-
{!_.isEmpty(s.review) && s.review[0].score
492-
? parseFloat(s.review[0].score).toFixed(2)
493-
: 'N/A'}
494-
&zwnj; &zwnj;/ &zwnj;
495-
{s.reviewSummation && s.reviewSummation[0].aggregateScore
496-
? parseFloat(s.reviewSummation[0].aggregateScore).toFixed(2)
497-
: 'N/A'}
498-
</a>
499-
</div>
500-
</div>
501-
))}
502505
</div>
503506
)
504507
}

0 commit comments

Comments
 (0)