@@ -80,21 +80,35 @@ const TimerCard: FunctionComponent<TimerCardProps> = ({
8080 } , [ timer ] ) ;
8181
8282 const weekdayLabels = React . useMemo ( ( ) => {
83- return weekdays . map ( ( day , i ) => {
84- const enabled = timerInLocalTime . dow . includes ( day . dow ) ;
83+ return (
84+ < Grid
85+ container
86+ direction = "row"
87+ sx = { {
88+ justifyContent : "space-between"
89+ } }
90+ >
91+ { weekdays . map ( ( day , i ) => {
92+ const enabled = timerInLocalTime . dow . includes ( day . dow ) ;
8593
86- return (
87- < Typography
88- key = { day . label }
89- variant = { "body2" }
90- color = { enabled ? "textPrimary" : "textSecondary" }
91- component = { "span" }
92- sx = { i < weekdays . length - 1 ? { marginRight : 1 } : { } }
93- >
94- { day . label . toUpperCase ( ) . slice ( 0 , 3 ) }
95- </ Typography >
96- ) ;
97- } ) ;
94+ return (
95+ < Grid
96+ item
97+ key = { day . label }
98+ >
99+ < Typography
100+ variant = { "body2" }
101+ color = { enabled ? "textPrimary" : "textSecondary" }
102+ component = { "span" }
103+ sx = { i < weekdays . length - 1 ? { marginRight : 1 } : { } }
104+ >
105+ { day . label . toUpperCase ( ) . slice ( 0 , 3 ) }
106+ </ Typography >
107+ </ Grid >
108+ ) ;
109+ } ) }
110+ </ Grid >
111+ ) ;
98112 } , [ timerInLocalTime ] ) ;
99113
100114 const timeLabel = React . useMemo ( ( ) => {
@@ -126,6 +140,29 @@ const TimerCard: FunctionComponent<TimerCardProps> = ({
126140 return < Typography variant = { "subtitle1" } > { label } </ Typography > ;
127141 } , [ timer ] ) ;
128142
143+ const preActionLabel = React . useMemo ( ( ) => {
144+ if ( timer ?. pre_actions ?. length ) {
145+ return < Typography variant = { "subtitle1" } >
146+ { `${ timer . pre_actions . length } Pre-Action${ timer . pre_actions . length > 1 ? "s" : "" } ` }
147+ </ Typography > ;
148+ } else {
149+ return null ;
150+ }
151+ } , [ timer ] ) ;
152+
153+ const timerLabel = React . useMemo ( ( ) => {
154+ return timer ?. label || "Timer" ;
155+ } , [ timer ] ) ;
156+
157+ const dialogTimerText = React . useMemo ( ( ) => {
158+ if ( timer ?. label ) {
159+ return `"${ timer . label } "` ;
160+ } else {
161+ return "this timer" ;
162+ }
163+
164+ } , [ timer ] ) ;
165+
129166 return (
130167 < Card
131168 key = { timer . id }
@@ -134,9 +171,9 @@ const TimerCard: FunctionComponent<TimerCardProps> = ({
134171 < CardContent >
135172 < Grid
136173 container
137- spacing = { 4 }
138174 alignItems = "center"
139175 justifyContent = "space-between"
176+ sx = { { minWidth : "16rem" } }
140177 >
141178 < Grid item >
142179 < FormControlLabel
@@ -151,10 +188,10 @@ const TimerCard: FunctionComponent<TimerCardProps> = ({
151188 < Typography
152189 variant = "h6"
153190 gutterBottom
154- sx = { { marginBottom : 0 } }
191+ sx = { { marginBottom : 0 , userSelect : "none" } }
155192 title = { timer . id }
156193 >
157- Timer
194+ { timerLabel }
158195 </ Typography >
159196 }
160197 />
@@ -196,6 +233,8 @@ const TimerCard: FunctionComponent<TimerCardProps> = ({
196233
197234 { actionLabel }
198235
236+ { preActionLabel }
237+
199238 < Dialog
200239 open = { deleteDialogOpen }
201240 onClose = { ( ) => {
@@ -205,7 +244,7 @@ const TimerCard: FunctionComponent<TimerCardProps> = ({
205244 < DialogTitle > Delete timer?</ DialogTitle >
206245 < DialogContent >
207246 < DialogContentText >
208- Do you really want to delete this timer ?
247+ Do you really want to delete { dialogTimerText } ?
209248 </ DialogContentText >
210249 </ DialogContent >
211250 < DialogActions >
@@ -250,7 +289,7 @@ const TimerCard: FunctionComponent<TimerCardProps> = ({
250289 < DialogTitle > Execute timer?</ DialogTitle >
251290 < DialogContent >
252291 < DialogContentText >
253- Do you really want to execute this timer right now?
292+ Do you really want to execute { dialogTimerText } right now?
254293 </ DialogContentText >
255294 </ DialogContent >
256295 < DialogActions >
0 commit comments