1- import { Box , Card , CardContent , Grid , IconButton , Stack , Typography } from '@mui/material' ;
1+ import { Box , Card , CardContent , Grid , IconButton , Link , Stack , Tooltip , Typography } from '@mui/material' ;
22import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline' ;
33import { DesignReview } from 'shared' ;
44import { meetingStartTimePipe } from '../../../utils/pipes' ;
@@ -8,15 +8,16 @@ import ElectricalServicesIcon from '@mui/icons-material/ElectricalServices';
88import TerminalIcon from '@mui/icons-material/Terminal' ;
99import { useState } from 'react' ;
1010import DRCSummaryModal from '../DesignReviewSummaryModal' ;
11+ import DynamicTooltip from '../../../components/DynamicTooltip' ;
1112
12- export const getTeamTypeIcon = ( teamTypeId : string , isLarge ?: boolean ) => {
13+ export const getTeamTypeIcon = ( teamTypeName : string , isLarge ?: boolean ) => {
1314 const teamIcons : Map < string , JSX . Element > = new Map ( [
1415 [ 'Software' , < TerminalIcon fontSize = { isLarge ? 'large' : 'small' } /> ] ,
1516 [ 'Business' , < WorkOutlineIcon fontSize = { isLarge ? 'large' : 'small' } /> ] ,
1617 [ 'Electrical' , < ElectricalServicesIcon fontSize = { isLarge ? 'large' : 'small' } /> ] ,
1718 [ 'Mechanical' , < ConstructionIcon fontSize = { isLarge ? 'large' : 'small' } /> ]
1819 ] ) ;
19- return teamIcons . get ( teamTypeId ) ;
20+ return teamIcons . get ( teamTypeName ) ;
2021} ;
2122
2223interface CalendarDayCardProps {
@@ -49,24 +50,68 @@ const CalendarDayCard: React.FC<CalendarDayCardProps> = ({ cardDate, events }) =
4950 < Box marginLeft = { 0.5 } marginBottom = { 0.5 } onClick = { ( ) => setIsSummaryModalOpen ( true ) } sx = { { cursor : 'pointer' } } >
5051 < Card sx = { { backgroundColor : 'red' , borderRadius : 1 , minWidth : 140 , maxWidth : 140 , minHeight : 20 , maxHeight : 20 } } >
5152 < Stack direction = "row" >
52- { getTeamTypeIcon ( event . teamType . teamTypeId ) }
53- < Typography marginLeft = { 0.5 } marginBottom = { 0.3 } fontSize = { 14 } >
54- { name + ( event . meetingTimes . length > 0 ? ' ' + meetingStartTimePipe ( event . meetingTimes ) : '' ) }
55- </ Typography >
53+ { getTeamTypeIcon ( event . teamType . name ) }
54+ < DynamicTooltip
55+ title = { name + ( event . meetingTimes . length > 0 ? ' - ' + meetingStartTimePipe ( event . meetingTimes ) : '' ) }
56+ >
57+ < Typography marginLeft = { 0.5 } marginBottom = { 0.3 } fontSize = { 14 } noWrap >
58+ { name + ( event . meetingTimes . length > 0 ? ' ' + meetingStartTimePipe ( event . meetingTimes ) : '' ) }
59+ </ Typography >
60+ </ DynamicTooltip >
5661 </ Stack >
5762 </ Card >
5863 </ Box >
5964 </ >
6065 ) ;
6166 } ;
6267
63- const ExtraEventsCard = ( extraEvents : number ) => {
68+ const ExtraEventNote = ( event : DesignReview ) => {
69+ const [ isSummaryModalOpen , setIsSummaryModalOpen ] = useState ( false ) ;
70+
71+ return (
72+ < >
73+ < DRCSummaryModal open = { isSummaryModalOpen } onHide = { ( ) => setIsSummaryModalOpen ( false ) } designReview = { event } />
74+ < Link style = { { cursor : 'pointer' } } fontSize = { 15 } onClick = { ( ) => setIsSummaryModalOpen ( true ) } >
75+ { event . wbsName + ( event . meetingTimes . length > 0 ? ' - ' + meetingStartTimePipe ( event . meetingTimes ) : '' ) }
76+ </ Link >
77+ </ >
78+ ) ;
79+ } ;
80+
81+ const ExtraEventsCard = ( extraEvents : DesignReview [ ] ) => {
6482 return (
6583 < Box marginLeft = { 0.5 } marginBottom = { 0.2 } >
6684 < Card sx = { { backgroundColor : 'grey' , borderRadius : 1 , minWidth : 140 , maxWidth : 140 , minHeight : 20 , maxHeight : 20 } } >
67- < Typography marginLeft = { 0.5 } marginBottom = { 0.3 } align = "center" >
68- { '+' + extraEvents }
69- </ Typography >
85+ < Tooltip
86+ id = "tooltip"
87+ placement = "right"
88+ PopperProps = { {
89+ popperOptions : {
90+ modifiers : [
91+ {
92+ name : 'flip' ,
93+ options : {
94+ fallbackPlacements : [ 'top' , 'bottom' ] ,
95+ padding : - 1 ,
96+ rootBoundary : 'document'
97+ }
98+ } ,
99+ {
100+ name : 'offset' ,
101+ options : {
102+ offset : [ 0 , - 1 ]
103+ }
104+ }
105+ ]
106+ }
107+ } }
108+ arrow
109+ title = { < Stack direction = "column" > { extraEvents . map ( ( event ) => ExtraEventNote ( event ) ) } </ Stack > }
110+ >
111+ < Typography marginLeft = { 0.5 } marginBottom = { 0.3 } align = "center" >
112+ { '+' + extraEvents . length }
113+ </ Typography >
114+ </ Tooltip >
70115 </ Card >
71116 </ Box >
72117 ) ;
@@ -80,8 +125,8 @@ const CalendarDayCard: React.FC<CalendarDayCardProps> = ({ cardDate, events }) =
80125 events . map ( ( event ) => EventCard ( event ) )
81126 ) : (
82127 < >
83- { EventCard ( events [ 1 ] ) }
84- { ExtraEventsCard ( events . length - 1 ) }
128+ { EventCard ( events [ 0 ] ) }
129+ { ExtraEventsCard ( events . slice ( 1 ) ) }
85130 </ >
86131 ) }
87132 </ CardContent >
0 commit comments