@@ -21,6 +21,7 @@ import ChallengeCard from '../ChallengeCard'
2121import Message from '../Message'
2222import SortIcon from '../../../assets/images/sort-icon.svg'
2323import Select from '../../Select'
24+ import Loader from '../../Loader'
2425
2526import { CHALLENGE_STATUS , PAGE_SIZE , PAGINATION_PER_PAGE_OPTIONS } from '../../../config/constants'
2627import { checkAdmin } from '../../../util/tc'
@@ -352,6 +353,7 @@ class ChallengeList extends Component {
352353 projects,
353354 dashboard,
354355 perPage,
356+ isLoading,
355357 totalChallenges,
356358 partiallyUpdateChallengeDetails,
357359 deleteChallenge,
@@ -678,109 +680,112 @@ class ChallengeList extends Component {
678680 </ div >
679681 </ div >
680682 </ div >
681- { challenges . length === 0 && (
682- < NoChallenge
683- activeProject = { activeProject }
684- selfService = { selfService }
685- />
686- ) }
687- { challenges . length > 0 && (
688- < div className = { styles . header } >
689- < div
690- className = { cn ( styles . col5 , styles . sortable ) }
691- onClick = { ( ) => this . updateSort ( 'type' ) }
692- >
693- < span className = { styles . filterItem } >
694- Type
695- { this . renderSortIcon ( 'type' ) }
696- </ span >
697- </ div >
698- < div
699- className = { cn ( styles . col2 , styles . sortable ) }
700- onClick = { ( ) => this . updateSort ( 'name' ) }
701- >
702- < span className = { styles . filterItem } >
703- Challenge Name
704- { this . renderSortIcon ( 'name' ) }
705- </ span >
706- </ div >
707- < div
708- className = { cn ( styles . col3 , styles . sortable ) }
709- onClick = { ( ) => this . updateSort ( 'startDate' ) }
710- >
711- < span className = { styles . filterItem } >
712- Start Date
713- { this . renderSortIcon ( 'startDate' ) }
714- </ span >
715- </ div >
716- < div
717- className = { cn ( styles . col3 , styles . sortable ) }
718- onClick = { ( ) => this . updateSort ( 'endDate' ) }
719- >
720- < span className = { styles . filterItem } >
721- End Date
722- { this . renderSortIcon ( 'endDate' ) }
723- </ span >
724- </ div >
725- < div
726- className = { cn ( styles . col4 , styles . sortable ) }
727- onClick = { ( ) => this . updateSort ( 'numOfRegistrants' ) }
728- >
729- < span className = { styles . filterItem } >
730- < FontAwesomeIcon icon = { faUser } className = { styles . faIcon } />
731- { this . renderSortIcon ( 'numOfRegistrants' ) }
732- </ span >
733- </ div >
734- < div
735- className = { cn ( styles . col4 , styles . sortable ) }
736- onClick = { ( ) => this . updateSort ( 'numOfSubmissions' ) }
737- >
738- < span className = { styles . filterItem } >
739- < FontAwesomeIcon icon = { faFile } className = { styles . faIcon } />
740- { this . renderSortIcon ( 'numOfSubmissions' ) }
741- </ span >
742- </ div >
743- < div
744- className = { cn ( styles . col3 , styles . sortable ) }
745- onClick = { ( ) => this . updateSort ( 'status' ) }
746- >
747- < span className = { styles . filterItem } >
748- Status
749- { this . renderSortIcon ( 'status' ) }
750- </ span >
751- </ div >
752- < div className = { styles . col6 } > </ div >
753- < div className = { styles . col6 } > </ div >
754- < div className = { styles . col6 } > </ div >
683+ < div className = { styles . header } >
684+ < div
685+ className = { cn ( styles . col5 , styles . sortable ) }
686+ onClick = { ( ) => this . updateSort ( 'type' ) }
687+ >
688+ < span className = { styles . filterItem } >
689+ Type
690+ { this . renderSortIcon ( 'type' ) }
691+ </ span >
755692 </ div >
756- ) }
757- { challenges . length > 0 && (
758- < ul className = { styles . challengeList } >
759- { map ( challenges , c => {
760- return (
761- < li
762- className = { styles . challengeItem }
763- key = { `challenge-card-${ c . id } ` }
764- >
765- < ChallengeCard
766- shouldShowCurrentPhase = { selectedTab === 0 }
767- challenge = { c }
768- setActiveProject = { setActiveProject }
769- reloadChallengeList = { this . reloadChallengeList }
770- partiallyUpdateChallengeDetails = {
771- partiallyUpdateChallengeDetails
772- }
773- deleteChallenge = { deleteChallenge }
774- isBillingAccountExpired = { isBillingAccountExpired }
775- disableHover
776- getStatusText = { this . getStatusTextFunc ( selfService ) }
777- challengeTypes = { challengeTypes }
778- />
779- </ li >
693+ < div
694+ className = { cn ( styles . col2 , styles . sortable ) }
695+ onClick = { ( ) => this . updateSort ( 'name' ) }
696+ >
697+ < span className = { styles . filterItem } >
698+ Challenge Name
699+ { this . renderSortIcon ( 'name' ) }
700+ </ span >
701+ </ div >
702+ < div
703+ className = { cn ( styles . col3 , styles . sortable ) }
704+ onClick = { ( ) => this . updateSort ( 'startDate' ) }
705+ >
706+ < span className = { styles . filterItem } >
707+ Start Date
708+ { this . renderSortIcon ( 'startDate' ) }
709+ </ span >
710+ </ div >
711+ < div
712+ className = { cn ( styles . col3 , styles . sortable ) }
713+ onClick = { ( ) => this . updateSort ( 'endDate' ) }
714+ >
715+ < span className = { styles . filterItem } >
716+ End Date
717+ { this . renderSortIcon ( 'endDate' ) }
718+ </ span >
719+ </ div >
720+ < div
721+ className = { cn ( styles . col4 , styles . sortable ) }
722+ onClick = { ( ) => this . updateSort ( 'numOfRegistrants' ) }
723+ >
724+ < span className = { styles . filterItem } >
725+ < FontAwesomeIcon icon = { faUser } className = { styles . faIcon } />
726+ { this . renderSortIcon ( 'numOfRegistrants' ) }
727+ </ span >
728+ </ div >
729+ < div
730+ className = { cn ( styles . col4 , styles . sortable ) }
731+ onClick = { ( ) => this . updateSort ( 'numOfSubmissions' ) }
732+ >
733+ < span className = { styles . filterItem } >
734+ < FontAwesomeIcon icon = { faFile } className = { styles . faIcon } />
735+ { this . renderSortIcon ( 'numOfSubmissions' ) }
736+ </ span >
737+ </ div >
738+ < div
739+ className = { cn ( styles . col3 , styles . sortable ) }
740+ onClick = { ( ) => this . updateSort ( 'status' ) }
741+ >
742+ < span className = { styles . filterItem } >
743+ Status
744+ { this . renderSortIcon ( 'status' ) }
745+ </ span >
746+ </ div >
747+ < div className = { styles . col6 } > </ div >
748+ < div className = { styles . col6 } > </ div >
749+ < div className = { styles . col6 } > </ div >
750+ </ div >
751+
752+ { isLoading
753+ ? < Loader />
754+ : < >
755+ { challenges . length > 0
756+ ? < >
757+ < ul className = { styles . challengeList } >
758+ { map ( challenges , c => {
759+ return (
760+ < li
761+ className = { styles . challengeItem }
762+ key = { `challenge-card-${ c . id } ` }
763+ >
764+ < ChallengeCard
765+ shouldShowCurrentPhase = { selectedTab === 0 }
766+ challenge = { c }
767+ setActiveProject = { setActiveProject }
768+ reloadChallengeList = { this . reloadChallengeList }
769+ partiallyUpdateChallengeDetails = {
770+ partiallyUpdateChallengeDetails
771+ }
772+ deleteChallenge = { deleteChallenge }
773+ isBillingAccountExpired = { isBillingAccountExpired }
774+ disableHover
775+ getStatusText = { this . getStatusTextFunc ( selfService ) }
776+ challengeTypes = { challengeTypes }
777+ />
778+ </ li >
779+ )
780+ } ) }
781+ </ ul >
782+ </ > : (
783+ < NoChallenge activeProject = { activeProject } selfService = { selfService } />
780784 )
781- } ) }
782- </ ul >
783- ) }
785+ }
786+ </ >
787+ }
788+
784789 < div className = { styles . footer } >
785790 < div className = { styles . perPageContainer } >
786791 < Select
@@ -837,6 +842,7 @@ ChallengeList.propTypes = {
837842 deleteChallenge : PropTypes . func . isRequired ,
838843 isBillingAccountExpired : PropTypes . bool ,
839844 billingStartDate : PropTypes . string ,
845+ isLoading : PropTypes . bool ,
840846 billingEndDate : PropTypes . string ,
841847 isBillingAccountLoadingFailed : PropTypes . bool ,
842848 isBillingAccountLoading : PropTypes . bool ,
0 commit comments