291291
292292 <div v-else-if =" generatedMessage" class =" flex items-center gap-2" >
293293 <ButtonStyled >
294- <button :disabled =" loadingModerationDecision" @click =" goBackToStages " >
294+ <button :disabled =" loadingModerationDecision" @click =" previousStage " >
295295 <LeftArrowIcon aria-hidden="true" />
296296 Edit
297297 </button >
340340 <LeftArrowIcon aria-hidden="true" /> Previous
341341 </button >
342342 </ButtonStyled >
343- <ButtonStyled v-if =" ! isLastVisibleStage " color="brand">
344- <button @click =" nextStage" ><RightArrowIcon aria-hidden="true" /> Next</button >
345- </ButtonStyled >
346- <ButtonStyled v-else color="brand" :disabled =" loadingMessage " >
347- <button @click =" generateMessage" >
348- <CheckIcon aria-hidden="true" />
349- {{ loadingMessage ? 'Generating...' : 'Generate Message' }}
343+ <ButtonStyled color="brand" :disabled =" isLastVisibleStage && loadingMessage " >
344+ <button @click =" nextStage" >
345+ <template v-if =" isLastVisibleStage " >
346+ <CheckIcon aria-hidden="true" />
347+ {{ loadingMessage ? 'Generating...' : 'Generate Message' }}
348+ </template >
349+ <template v-else >
350+ <RightArrowIcon aria-hidden="true" /> Next
351+ </template >
350352 </button >
351353 </ButtonStyled >
352354 </div >
@@ -1259,7 +1261,7 @@ function handleKeybinds(event: KeyboardEvent) {
12591261 tryApprove : () => sendMessage (approveSendStatus .value ),
12601262 tryReject : () => sendMessage (' rejected' ),
12611263 tryWithhold : () => sendMessage (' withheld' ),
1262- tryEditMessage: goBackToStages ,
1264+ tryEditMessage: previousStage ,
12631265
12641266 tryCopyLink : async (permalink : boolean , relative : boolean , page : boolean ) => {
12651267 let url = ` `
@@ -1511,8 +1513,12 @@ function shouldShowStageIndex(stageIndex: number): boolean {
15111513}
15121514
15131515function previousStage() {
1514- let targetStage = currentStage .value - 1
1516+ if (generatedMessage .value ) {
1517+ goBackToStages ()
1518+ return
1519+ }
15151520
1521+ let targetStage = currentStage .value - 1
15161522 while (targetStage >= 0 ) {
15171523 if (shouldShowStageIndex (targetStage )) {
15181524 currentStage .value = targetStage
@@ -1523,15 +1529,18 @@ function previousStage() {
15231529}
15241530
15251531function nextStage() {
1526- let targetStage = currentStage .value + 1
1532+ if ( generatedMessage .value ) return
15271533
1534+ let targetStage = currentStage .value + 1
15281535 while (targetStage < resolvedStages .value .length ) {
15291536 if (shouldShowStageIndex (targetStage )) {
15301537 currentStage .value = targetStage
15311538 return
15321539 }
15331540 targetStage ++
15341541 }
1542+
1543+ generateMessage ()
15351544}
15361545
15371546function goBackToStages() {
0 commit comments