@@ -49,17 +49,17 @@ export function EmailMessage({
49
49
generateNudge ?: boolean ;
50
50
} ) {
51
51
const [ showReply , setShowReply ] = useState ( defaultShowReply || false ) ;
52
- const [ showReplyAll , setShowReplyAll ] = useState ( false ) ; // New state for "Reply to All"
52
+ const [ showReplyAll , setShowReplyAll ] = useState ( false ) ;
53
53
const [ showDetails , setShowDetails ] = useState ( false ) ;
54
54
55
55
const onReply = useCallback ( ( ) => setShowReply ( true ) , [ ] ) ;
56
- const onReplyAll = useCallback ( ( ) => setShowReplyAll ( true ) , [ ] ) ; // New callback for "Reply to All"
56
+ const onReplyAll = useCallback ( ( ) => setShowReplyAll ( true ) , [ ] ) ;
57
57
const [ showForward , setShowForward ] = useState ( false ) ;
58
58
const onForward = useCallback ( ( ) => setShowForward ( true ) , [ ] ) ;
59
59
60
60
const onCloseCompose = useCallback ( ( ) => {
61
61
setShowReply ( false ) ;
62
- setShowReplyAll ( false ) ; // Reset "Reply to All" state
62
+ setShowReplyAll ( false ) ;
63
63
setShowForward ( false ) ;
64
64
} , [ ] ) ;
65
65
@@ -84,7 +84,7 @@ export function EmailMessage({
84
84
toggleDetails = { toggleDetails }
85
85
showReplyButton = { showReplyButton }
86
86
onReply = { onReply }
87
- onReplyAll = { onReplyAll } // Pass the "Reply to All" callback
87
+ onReplyAll = { onReplyAll }
88
88
onForward = { onForward }
89
89
/>
90
90
@@ -107,10 +107,10 @@ export function EmailMessage({
107
107
onSendSuccess = { onSendSuccess }
108
108
onCloseCompose = { onCloseCompose }
109
109
defaultShowReply = { defaultShowReply }
110
- showReply = { showReply || showReplyAll } // Pass the combined state
110
+ showReply = { showReply || showReplyAll }
111
111
draftMessage = { draftMessage }
112
112
generateNudge = { generateNudge }
113
- replyToAll = { showReplyAll } // Pass the "Reply to All" state
113
+ replyToAll = { showReplyAll }
114
114
/>
115
115
) }
116
116
</ >
@@ -127,7 +127,7 @@ function TopBar({
127
127
showReplyButton,
128
128
onReply,
129
129
onForward,
130
- onReplyAll, // New prop for handling "Reply to All"
130
+ onReplyAll,
131
131
} : {
132
132
message : ParsedMessage ;
133
133
expanded : boolean ;
@@ -136,7 +136,7 @@ function TopBar({
136
136
showReplyButton : boolean ;
137
137
onReply : ( ) => void ;
138
138
onForward : ( ) => void ;
139
- onReplyAll : ( ) => void ; // New prop for handling "Reply to All"
139
+ onReplyAll : ( ) => void ;
140
140
} ) {
141
141
return (
142
142
< div className = "sm:flex sm:items-center sm:justify-between" >
@@ -208,7 +208,7 @@ function ReplyPanel({
208
208
showReply,
209
209
draftMessage,
210
210
generateNudge,
211
- replyToAll, // New prop for "Reply to All"
211
+ replyToAll,
212
212
} : {
213
213
message : ParsedMessage ;
214
214
refetch : ( ) => void ;
@@ -218,23 +218,23 @@ function ReplyPanel({
218
218
showReply : boolean ;
219
219
draftMessage ?: ThreadMessage ;
220
220
generateNudge ?: boolean ;
221
- replyToAll ?: boolean ; // New prop for "Reply to All"
221
+ replyToAll ?: boolean ;
222
222
} ) {
223
223
const replyRef = useRef < HTMLDivElement > ( null ) ;
224
224
225
225
const [ isGeneratingNudge , setIsGeneratingNudge ] = useState ( false ) ;
226
226
const [ nudge , setNudge ] = useState < string | null > ( null ) ;
227
227
228
- // Scroll to the reply panel when it first opens
228
+ // scroll to the reply panel when it first opens
229
229
useEffect ( ( ) => {
230
230
if ( defaultShowReply && replyRef . current ) {
231
+ // hacky using setTimeout
231
232
setTimeout ( ( ) => {
232
233
replyRef . current ?. scrollIntoView ( { behavior : "smooth" , block : "end" } ) ;
233
234
} , 500 ) ;
234
235
}
235
236
} , [ defaultShowReply ] ) ;
236
237
237
- // Generate nudge if enabled
238
238
useEffect ( ( ) => {
239
239
async function loadNudge ( ) {
240
240
setIsGeneratingNudge ( true ) ;
@@ -267,12 +267,11 @@ function ReplyPanel({
267
267
if ( generateNudge ) loadNudge ( ) ;
268
268
} , [ generateNudge , message ] ) ;
269
269
270
- // Prepare the email for replying or forwarding
271
270
const replyingToEmail : ReplyingToEmail = useMemo ( ( ) => {
272
271
if ( showReply ) {
273
272
if ( draftMessage ) return prepareDraftReplyEmail ( draftMessage ) ;
274
273
275
- // Use nudge if available
274
+ // use nudge if available
276
275
if ( nudge ) {
277
276
const nudgeHtml = nudge
278
277
? nudge
@@ -283,12 +282,12 @@ function ReplyPanel({
283
282
: "" ;
284
283
285
284
return replyToAll
286
- ? prepareReplyToAllEmail ( message , nudgeHtml ) // Use "Reply to All" logic
285
+ ? prepareReplyToAllEmail ( message , nudgeHtml )
287
286
: prepareReplyingToEmail ( message , nudgeHtml ) ;
288
287
}
289
288
290
289
return replyToAll
291
- ? prepareReplyToAllEmail ( message ) // Use "Reply to All" logic
290
+ ? prepareReplyToAllEmail ( message )
292
291
: prepareReplyingToEmail ( message ) ;
293
292
}
294
293
return prepareForwardingEmail ( message ) ;
@@ -333,7 +332,7 @@ function ReplyPanel({
333
332
const prepareReplyingToEmail = (
334
333
message : ParsedMessage ,
335
334
content = "" ,
336
- replyToAll = false , // New parameter to handle "Reply to All"
335
+ replyToAll = false ,
337
336
) : ReplyingToEmail => {
338
337
const sentFromUser = message . labelIds ?. includes ( "SENT" ) ;
339
338
0 commit comments