@@ -100,36 +100,37 @@ export function ProposalActions({
100100 }
101101 } , [ redirectToNext ] )
102102
103- return (
104- < div className = "buttons" >
105- < div className = "flex gap-8 items-center" >
106- < button
107- type = "button"
108- className = "btn-s btn-default"
109- onClick = { onEditMode }
110- >
111- Edit
112- </ button >
113- { hasBeenEdited && (
114- < button
115- type = "button"
116- className = "btn-s btn-default"
117- onClick = { onResetChanges }
118- >
119- Reset changes
120- </ button >
121- ) }
122- </ div >
103+ const SkipButton = ( {
104+ children = 'Skip' ,
105+ } : {
106+ children ?: React . ReactNode
107+ } ) => (
108+ < button type = "button" className = "btn-s btn-default" onClick = { handleSkip } >
109+ { children }
110+ </ button >
111+ )
112+
113+ const EditButton = ( ) => (
114+ < button type = "button" className = "btn-s btn-default" onClick = { onEditMode } >
115+ Edit translation
116+ </ button >
117+ )
118+
119+ const ResetButton = ( ) => (
120+ < button
121+ type = "button"
122+ className = "btn-s btn-default"
123+ onClick = { onResetChanges }
124+ >
125+ Reset changes
126+ </ button >
127+ )
123128
124- { hasBeenEdited ? (
129+ const renderRightActions = ( ) => {
130+ if ( hasBeenEdited ) {
131+ return (
125132 < div className = "flex gap-8 items-center" >
126- < button
127- type = "button"
128- className = "btn-s btn-default"
129- onClick = { ( ) => handleSkip ( ) }
130- >
131- Skip
132- </ button >
133+ < SkipButton />
133134 < button
134135 type = "button"
135136 className = "btn-s btn-primary"
@@ -144,52 +145,56 @@ export function ProposalActions({
144145 Update proposal
145146 </ button >
146147 </ div >
147- ) : isOwn ? (
148+ )
149+ }
150+
151+ if ( isOwn ) {
152+ return (
148153 < div className = "flex gap-8 items-center" >
149- < button
150- type = "button"
151- className = "btn-s btn-default"
152- onClick = { ( ) => handleSkip ( ) }
153- >
154- Skip
155- </ button >
154+ < SkipButton />
156155 < span > (This is your proposal so you cannot approve it)</ span >
157156 </ div >
158- ) : (
159- < div className = "flex gap-8 items-center" >
160- < button
161- type = "button"
162- className = "btn-s btn-default"
163- onClick = { ( ) => handleSkip ( ) }
164- >
165- Skip
166- </ button >
167- < button
168- type = "button"
169- className = "btn-s btn-default"
170- onClick = { ( ) =>
171- approveProposal ( {
172- translationUuid,
173- proposalUuid : proposal . uuid ,
174- } )
175- }
176- >
177- Approve
178- </ button >
179- < button
180- type = "button"
181- className = "btn-s btn-default"
182- onClick = { ( ) =>
183- rejectProposal ( {
184- translationUuid,
185- proposalUuid : proposal . uuid ,
186- } )
187- }
188- >
189- Reject
190- </ button >
191- </ div >
192- ) }
157+ )
158+ }
159+
160+ return (
161+ < div className = "flex gap-8 items-center" >
162+ < SkipButton > Skip this entry</ SkipButton >
163+ < button
164+ type = "button"
165+ className = "btn-s btn-warning"
166+ onClick = { ( ) =>
167+ rejectProposal ( {
168+ translationUuid,
169+ proposalUuid : proposal . uuid ,
170+ } )
171+ }
172+ >
173+ Reject
174+ </ button >
175+ < button
176+ type = "button"
177+ className = "btn-s btn-primary"
178+ onClick = { ( ) =>
179+ approveProposal ( {
180+ translationUuid,
181+ proposalUuid : proposal . uuid ,
182+ } )
183+ }
184+ >
185+ 👍 Sign Off
186+ </ button >
187+ </ div >
188+ )
189+ }
190+
191+ return (
192+ < div className = "buttons" >
193+ < div className = "flex gap-8 items-center" >
194+ < EditButton />
195+ { hasBeenEdited && < ResetButton /> }
196+ </ div >
197+ { renderRightActions ( ) }
193198 </ div >
194199 )
195200}
0 commit comments