@@ -2,6 +2,7 @@ import Box from "@mui/material/Box";
22import Typography from "@mui/material/Typography" ;
33import Alert from "@mui/material/Alert" ;
44import Chip from "@mui/material/Chip" ;
5+ import Tooltip from "@mui/material/Tooltip" ;
56import Skeleton from "@mui/material/Skeleton" ;
67import TrendingUpIcon from "@mui/icons-material/TrendingUp" ;
78import TrendingDownIcon from "@mui/icons-material/TrendingDown" ;
@@ -38,6 +39,7 @@ const calculateChange = (
3839
3940interface StatBoxProps {
4041 header : React . ReactNode ;
42+ tooltip : string ;
4143 change ?: number ;
4244 changeType : "percentage" | "absolute" ;
4345 changeDirection ?: "inverse" | "normal" ;
@@ -53,6 +55,7 @@ const StatBox = ({
5355 change,
5456 changeType,
5557 changeDirection = "normal" ,
58+ tooltip,
5659 loading,
5760} : StatBoxProps ) => {
5861 let operator = "%" ;
@@ -95,8 +98,8 @@ const StatBox = ({
9598
9699 const label = {
97100 unknown : "No data to compare" ,
98- up : `${ operator } ${ change } this month` ,
99- down : `${ operator } ${ change } this month` ,
101+ up : `${ operator } ${ Math . abs ( change || 0 ) } this month` ,
102+ down : `${ operator } ${ Math . abs ( change || 0 ) } this month` ,
100103 same : "No change" ,
101104 } ;
102105
@@ -108,35 +111,44 @@ const StatBox = ({
108111 p : 4 ,
109112 textAlign : "center" ,
110113 borderRadius : 1 ,
114+ position : "relative" ,
111115 } }
112116 >
113117 < Box >
114118 < Typography
115- sx = { { fontSize : 32 , mr : 1 , fontWeight : 600 , lineHeight : 1.25 , mb : 1 } }
119+ sx = { {
120+ fontSize : 32 ,
121+ mr : 1 ,
122+ fontWeight : 600 ,
123+ lineHeight : 1.25 ,
124+ mb : 1 ,
125+ } }
116126 >
117127 { loading ? < Skeleton data-testid = "skeleton" /> : header }
118128 </ Typography >
119129 < Typography color = "text.secondary" sx = { { lineHeight : 1.25 } } >
120130 { desc }
121131 </ Typography >
122132 </ Box >
123- < Typography sx = { { lineHeight : 1 } } >
124- < Chip
125- size = "small"
126- variant = "filled"
127- icon = { icons [ trend ] }
128- component = "span"
129- label = { loading ? undefined : label [ trend ] }
130- sx = { {
131- border : "1px solid" ,
132- backgroundColor : bgcolor [ trend ] ,
133- borderColor : borderColor [ trend ] ,
134- color : "white" ,
135- display : "flex" ,
136- mt : 2 ,
137- } }
138- />
139- </ Typography >
133+ < Tooltip arrow title = { < Box sx = { { p : 2 } } > { tooltip } </ Box > } >
134+ < Typography sx = { { lineHeight : 1 } } >
135+ < Chip
136+ size = "small"
137+ variant = "filled"
138+ icon = { icons [ trend ] }
139+ component = "span"
140+ label = { loading ? undefined : label [ trend ] }
141+ sx = { {
142+ border : "1px solid" ,
143+ backgroundColor : bgcolor [ trend ] ,
144+ borderColor : borderColor [ trend ] ,
145+ color : "white" ,
146+ display : "flex" ,
147+ mt : 2 ,
148+ } }
149+ />
150+ </ Typography >
151+ </ Tooltip >
140152 </ Box >
141153 ) ;
142154} ;
@@ -196,28 +208,32 @@ export default function TeamStats({ teamId }: Props) {
196208 } }
197209 >
198210 < StatBox
199- desc = { "Total apps" }
211+ desc = "Total apps"
212+ tooltip = "Number of total apps in this team."
200213 header = { stats ?. totalApps . total }
201214 change = { totalNewApps }
202215 changeType = "absolute"
203216 loading = { loading }
204217 />
205218 < StatBox
206219 desc = "Deployments"
220+ tooltip = "Total number of deployments in the last 30 days. Data is compared against previous 30 days."
207221 header = { stats ?. totalDeployments . current }
208222 change = { deploymentChange }
209223 changeType = "percentage"
210224 loading = { loading }
211225 />
212226 < StatBox
213227 desc = "Avg. deployment duration"
228+ tooltip = "Average time taken for deployments in the last 30 days. Data is compared against previous 30 days."
214229 header = { avgDuration }
215230 change = { avgDurationChange }
216231 changeType = "percentage"
217232 changeDirection = "inverse"
218233 loading = { loading }
219234 />
220235 < StatBox
236+ tooltip = "Total requests accross all domains in this team in the last 30 days. Data is compared against previous 30 days."
221237 desc = "Requests"
222238 header = { totalRequests }
223239 change = { requestChange }
0 commit comments