@@ -23,6 +23,7 @@ import { MgtPeople } from '../mgt-people/mgt-people';
2323import '../mgt-person/mgt-person' ;
2424import '../sub-components/mgt-arrow-options/mgt-arrow-options' ;
2525import '../sub-components/mgt-dot-options/mgt-dot-options' ;
26+ import '../sub-components/mgt-flyout/mgt-flyout' ;
2627
2728/**
2829 * Defines how a person card is shown when a user interacts with
@@ -842,44 +843,7 @@ export class MgtTasks extends MgtTemplatedComponent {
842843 </ span >
843844 ` ;
844845
845- const task = null ;
846-
847- const assignedPeopleHTML = html `
848- < mgt-people
849- class ="people-newTask "
850- .userIds ="${ [ ] } "
851- .personCardInteraction =${ this . isPeoplePickerVisible ? PersonCardInteraction . none : PersonCardInteraction . hover }
852- >
853- < template data-type ="no-people ">
854- < i class ="login-icon ms-Icon ms-Icon--Contact "> </ i >
855- </ template >
856- </ mgt-people >
857- ` ;
858-
859- const taskPeople =
860- this . dataSource === TasksSource . todo
861- ? null
862- : html `
863- < span class ="TaskDetail TaskPeople ">
864- < span
865- @click =${ ( e : MouseEvent ) => {
866- e . stopPropagation ( ) ;
867- this . showPeoplePicker ( task ) ;
868- } }
869- >
870- ${ assignedPeopleHTML }
871- < div
872- class =${ classMap ( { Picker : true , Hidden : ! this . isPeoplePickerVisible || task !== this . _currentTask } ) }
873- >
874- < mgt-people-picker
875- class ="picker-newTask "
876- @click =${ ( e : MouseEvent ) => e . stopPropagation ( ) }
877- > </ mgt-people-picker >
878- </ div >
879- </ span >
880- </ span >
881- ` ;
882-
846+ const taskPeople = this . dataSource === TasksSource . todo ? null : this . renderAssignedPeople ( null ) ;
883847 const taskAdd = this . _newTaskBeingAdded
884848 ? html `
885849 < div class ="TaskAddButtonContainer "> </ div >
@@ -963,9 +927,7 @@ export class MgtTasks extends MgtTemplatedComponent {
963927 }
964928
965929 private renderTask ( task : ITask ) {
966- const { name = 'Task' , completed = false , dueDate, assignments } = task ;
967-
968- const people = Object . keys ( assignments ) ;
930+ const { name = 'Task' , completed = false , dueDate } = task ;
969931
970932 const isLoading = this . _loadingTasks . includes ( task . id ) ;
971933
@@ -1030,48 +992,8 @@ export class MgtTasks extends MgtTemplatedComponent {
1030992 </ span >
1031993 ` ;
1032994
1033- let taskPeople = null ;
1034- let assignedPeopleHTML = null ;
995+ const taskPeople = this . dataSource !== TasksSource . todo ? this . renderAssignedPeople ( task ) : null ;
1035996
1036- const assignedPeople = Object . keys ( assignments ) . map ( key => {
1037- return key ;
1038- } ) ;
1039-
1040- const noPeopleTemplate = html `
1041- < template data-type ="no-people ">
1042- < i class ="login-icon ms-Icon ms-Icon--Contact "> </ i >
1043- </ template >
1044- ` ;
1045-
1046- if ( this . dataSource !== TasksSource . todo ) {
1047- assignedPeopleHTML = html `
1048- < mgt-people
1049- class ="people- ${ task . id } "
1050- .userIds ="${ assignedPeople } "
1051- .personCardInteraction =${ this . isPeoplePickerVisible
1052- ? PersonCardInteraction . none
1053- : PersonCardInteraction . hover }
1054- > ${ noPeopleTemplate }
1055- </ mgt-people >
1056- ` ;
1057- taskPeople = html `
1058- < span
1059- class ="TaskDetail TaskBucket "
1060- @click =${ ( e : MouseEvent ) => {
1061- this . showPeoplePicker ( task ) ;
1062- e . stopPropagation ( ) ;
1063- } }
1064- >
1065- ${ assignedPeopleHTML }
1066- < div class =${ classMap ( { Picker : true , Hidden : ! this . showPeoplePicker || task !== this . _currentTask } ) } >
1067- < mgt-people-picker
1068- class ="picker- ${ task . id } "
1069- @click =${ ( e : MouseEvent ) => e . stopPropagation ( ) }
1070- > </ mgt-people-picker >
1071- </ div >
1072- </ span >
1073- ` ;
1074- }
1075997 taskDetails = html `
1076998 < div class ="TaskTitle ">
1077999 ${ name }
@@ -1139,6 +1061,52 @@ export class MgtTasks extends MgtTemplatedComponent {
11391061 ` ;
11401062 }
11411063
1064+ private renderAssignedPeople ( task : ITask ) {
1065+ let assignedPeopleHTML = null ;
1066+
1067+ const assignedPeople = task
1068+ ? Object . keys ( task . assignments ) . map ( key => {
1069+ return key ;
1070+ } )
1071+ : [ ] ;
1072+
1073+ const noPeopleTemplate = html `
1074+ < template data-type ="no-people ">
1075+ < i class ="login-icon ms-Icon ms-Icon--Contact "> </ i >
1076+ </ template >
1077+ ` ;
1078+
1079+ const taskId = task ? task . id : 'newTask' ;
1080+
1081+ assignedPeopleHTML = html `
1082+ < mgt-people
1083+ class ="people- ${ taskId } "
1084+ .userIds ="${ assignedPeople } "
1085+ .personCardInteraction =${ this . isPeoplePickerVisible ? PersonCardInteraction . none : PersonCardInteraction . hover }
1086+ > ${ noPeopleTemplate }
1087+ </ mgt-people >
1088+ ` ;
1089+
1090+ return html `
1091+ < mgt-flyout
1092+ class ="TaskDetail TaskPeople "
1093+ @click =${ ( e : MouseEvent ) => {
1094+ this . showPeoplePicker ( task ) ;
1095+ e . stopPropagation ( ) ;
1096+ } }
1097+ .isOpen =${ this . isPeoplePickerVisible && task === this . _currentTask }
1098+ >
1099+ ${ assignedPeopleHTML }
1100+ < div slot ="flyout " class =${ classMap ( { Picker : true } ) } >
1101+ < mgt-people-picker
1102+ class ="picker- ${ taskId } "
1103+ @click =${ ( e : MouseEvent ) => e . stopPropagation ( ) }
1104+ > </ mgt-people-picker >
1105+ </ div >
1106+ </ mgt-flyout >
1107+ ` ;
1108+ }
1109+
11421110 private handleTaskClick ( task : ITask ) {
11431111 if ( task && ! this . isPeoplePickerVisible ) {
11441112 this . fireCustomEvent ( 'taskClick' , { task : task . _raw } ) ;
0 commit comments