@@ -47,7 +47,7 @@ import prisma from "@calcom/prisma";
47
47
import type { Prisma } from "@calcom/prisma/client" ;
48
48
import { bookingMetadataSchema } from "@calcom/prisma/zod-utils" ;
49
49
import { customInputSchema , EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils" ;
50
- import { Badge , Button , EmailInput , HeadSeo } from "@calcom/ui" ;
50
+ import { Button , EmailInput , HeadSeo , Badge } from "@calcom/ui" ;
51
51
import { FiX , FiExternalLink , FiChevronLeft , FiCheck , FiCalendar } from "@calcom/ui/components/icon" ;
52
52
53
53
import { timeZone } from "@lib/clock" ;
@@ -199,9 +199,6 @@ export default function Success(props: SuccessProps) {
199
199
seatReferenceUid,
200
200
} = querySchema . parse ( router . query ) ;
201
201
202
- if ( ( isCancellationMode || changes ) && typeof window !== "undefined" ) {
203
- window . scrollTo ( 0 , document . body . scrollHeight ) ;
204
- }
205
202
const tz =
206
203
( isSuccessBookingPage
207
204
? props . bookingInfo . attendees . find ( ( attendee ) => attendee . email === email ) ?. timeZone
@@ -213,10 +210,6 @@ export default function Success(props: SuccessProps) {
213
210
props ?. bookingInfo ?. metadata || { }
214
211
) ?. videoCallUrl ;
215
212
216
- if ( ! location ) {
217
- // Can't use logger.error because it throws error on client. stdout isn't available to it.
218
- console . error ( `No location found ` ) ;
219
- }
220
213
const status = props . bookingInfo ?. status ;
221
214
const reschedule = props . bookingInfo . status === BookingStatus . ACCEPTED ;
222
215
const cancellationReason = props . bookingInfo . cancellationReason || props . bookingInfo . rejectionReason ;
@@ -239,12 +232,24 @@ export default function Success(props: SuccessProps) {
239
232
const [ calculatedDuration , setCalculatedDuration ] = useState < number | undefined > ( undefined ) ;
240
233
241
234
function setIsCancellationMode ( value : boolean ) {
242
- if ( value ) router . query . cancel = "true" ;
243
- else delete router . query . cancel ;
244
- router . replace ( {
245
- pathname : router . pathname ,
246
- query : { ...router . query } ,
247
- } ) ;
235
+ const query_ = { ...router . query } ;
236
+
237
+ if ( value ) {
238
+ query_ . cancel = "true" ;
239
+ } else {
240
+ if ( query_ . cancel ) {
241
+ delete query_ . cancel ;
242
+ }
243
+ }
244
+
245
+ router . replace (
246
+ {
247
+ pathname : router . pathname ,
248
+ query : { ...query_ } ,
249
+ } ,
250
+ undefined ,
251
+ { scroll : false }
252
+ ) ;
248
253
}
249
254
250
255
const eventNameObject = {
@@ -514,23 +519,21 @@ export default function Success(props: SuccessProps) {
514
519
< >
515
520
< div className = "font-medium" > { t ( "who" ) } </ div >
516
521
< div className = "col-span-2 last:mb-0" >
517
- < >
518
- { bookingInfo ?. user && (
519
- < div className = "mb-3" >
520
- < p >
521
- < span className = "mr-2" > { bookingInfo . user . name } </ span >
522
- < Badge variant = "blue" > { t ( "Host" ) } </ Badge >
523
- </ p >
524
- < p className = "text-bookinglight" > { bookingInfo . user . email } </ p >
522
+ { bookingInfo ?. user && (
523
+ < div className = "mb-3" >
524
+ < div >
525
+ < span className = "mr-2" > { bookingInfo . user . name } </ span >
526
+ < Badge variant = "blue" > { t ( "Host" ) } </ Badge >
525
527
</ div >
526
- ) }
527
- { bookingInfo ?. attendees . map ( ( attendee ) => (
528
- < div key = { attendee . name } className = "mb-3 last:mb-0" >
529
- { attendee . name && < p > { attendee . name } </ p > }
530
- < p className = "text-bookinglight" > { attendee . email } </ p >
531
- </ div >
532
- ) ) }
533
- </ >
528
+ < p className = "text-bookinglight" > { bookingInfo . user . email } </ p >
529
+ </ div >
530
+ ) }
531
+ { bookingInfo ?. attendees . map ( ( attendee ) => (
532
+ < div key = { attendee . name } className = "mb-3 last:mb-0" >
533
+ { attendee . name && < p > { attendee . name } </ p > }
534
+ < p className = "text-bookinglight" > { attendee . email } </ p >
535
+ </ div >
536
+ ) ) }
534
537
</ div >
535
538
</ >
536
539
) }
0 commit comments