1- import React , { useRef , useContext } from "react " ;
1+ import Popup from "reactjs-popup " ;
22import PropTypes from "prop-types" ;
3- import NavButton from "../Button/NavButton" ;
43import { createUseStyles } from "react-jss" ;
5- import Button from "../Button/Button" ;
64import { useReactToPrint } from "react-to-print" ;
7- import { PdfPrint } from "../PdfPrint/PdfPrint" ;
5+ import { useRef , useContext } from "react" ;
6+
7+ import Button from "../Button/Button" ;
8+ import CalculationsContext from "../../contexts/CalculationsContext" ;
9+ import NavButton from "../Button/NavButton" ;
810import NumberedLink from "./NumberedLink" ;
9- import { formatDatetime } from "../../helpers/util" ;
10- import UserContext from "../../contexts/UserContext" ;
11- import Popup from "reactjs-popup" ;
1211import ProjectContextMenu from "../Projects/ProjectContextMenu" ;
13- import { useReplaceAriaAttribute } from "hooks/useReplaceAriaAttribute" ;
12+ import UserContext from "../../contexts/UserContext" ;
13+ import { PdfPrint } from "../PdfPrint/PdfPrint" ;
1414import { formatCalculation } from "../../helpers/Calculations" ;
15- import CalculationsContext from "../../contexts/CalculationsContext" ;
15+ import { formatDatetime } from "../../helpers/util" ;
16+ import { useReplaceAriaAttribute } from "../../hooks/useReplaceAriaAttribute" ;
1617
1718const useStyles = createUseStyles ( {
1819 allButtonsWrapper : {
@@ -46,14 +47,21 @@ const useStyles = createUseStyles({
4647 } ,
4748 navButtonGroup : {
4849 display : "flex" ,
49- alignItems : "center"
50+ alignItems : "center" ,
51+ } ,
52+ navButton : {
53+ margin : "0.5em" ,
54+ padding : "0.3em 0.4em .05em"
55+ } ,
56+ numberedLinksGroup : {
57+ display : "flex" ,
58+ alignItems : "center" ,
59+ margin : "0.1em 0 0"
60+ } ,
61+ callToActionButton : {
62+ margin : "0.5em" ,
63+ padding : "0.8em 1em" ,
5064 } ,
51- numberedNavButton : {
52- margin : "0.2em" ,
53- padding : "0.1em 0.3em" ,
54- minHeight : "min-content" ,
55- fontSize : "1.5rem"
56- }
5765} ) ;
5866
5967const WizardFooter = ( {
@@ -128,41 +136,44 @@ const WizardFooter = ({
128136 id = "leftNavArrow"
129137 navDirection = "previous"
130138 color = "colorPrimary"
139+ className = { classes . navButton }
131140 isVisible = {
132141 page !== 1 &&
133- ! project . dateSnapshotted &&
134- ( ! shareView || isAdmin )
142+ ! project . dateSnapshotted &&
143+ ( ! shareView || isAdmin )
135144 }
136145 isDisabled = {
137146 ( shareView && ! isAdmin ) ||
138- ! ! project . dateSnapshotted ||
139- Number ( page ) === 1
147+ ! ! project . dateSnapshotted ||
148+ Number ( page ) === 1
140149 }
141150 onClick = { ( ) => {
142151 onPageChange ( Number ( page ) - 1 ) ;
143152 } }
144153 />
145154
146- { showNumberedLinks &&
147- Array . from ( { length : 5 } , ( _ , i ) => i + 1 ) . map ( p => (
148- < NumberedLink
149- key = { `nav-page-${ p } ` }
150- id = { `nav-page-${ p } ` }
151- className = { classes . numberedNavButton }
152- onClick = { ( ) => onPageChange ( p ) }
153- isActive = { p === Number ( page ) }
154- disabled = {
155- ( shareView && ! isAdmin ) ||
156- ( p === 4 && projectLevel === 0 ) ||
157- ( ! project . dateSnapshotted &&
158- p > Number ( page ) &&
159- setDisabledForNextNavButton ( ) )
160- }
161- ariaLabel = { `go to page ${ p } ` }
162- >
163- { p }
164- </ NumberedLink >
165- ) ) }
155+ { showNumberedLinks && (
156+ < div className = { classes . numberedLinksGroup } >
157+ { Array . from ( { length : 5 } , ( _ , i ) => i + 1 ) . map ( p => (
158+ < NumberedLink
159+ key = { `nav-page-${ p } ` }
160+ id = { `nav-page-${ p } ` }
161+ onClick = { ( ) => onPageChange ( p ) }
162+ isActive = { p === Number ( page ) }
163+ disabled = {
164+ ( shareView && ! isAdmin ) ||
165+ ( p === 4 && projectLevel === 0 ) ||
166+ ( ! project . dateSnapshotted &&
167+ p > Number ( page ) &&
168+ setDisabledForNextNavButton ( ) )
169+ }
170+ ariaLabel = { `go to page ${ p } ` }
171+ >
172+ { p }
173+ </ NumberedLink >
174+ ) ) }
175+ </ div >
176+ ) }
166177
167178 { ( ! shareView || isAdmin ) && ! project ?. id ? (
168179 < div className = { classes . pageNumberCounter } >
@@ -174,6 +185,7 @@ const WizardFooter = ({
174185 id = "rightNavArrow"
175186 navDirection = "next"
176187 color = "colorPrimary"
188+ className = { classes . navButton }
177189 isVisible = { page !== 5 }
178190 isDisabled = { setDisabledForNextNavButton ( ) }
179191 onClick = { ( ) => {
@@ -190,7 +202,11 @@ const WizardFooter = ({
190202 trigger = {
191203 // needs element wrapped around Button so reactjs-popup has something to anchor on
192204 < div id = { elementId } >
193- < Button id = "action" variant = "tertiary" >
205+ < Button
206+ id = "action"
207+ variant = "tertiary"
208+ className = { classes . callToActionButton }
209+ >
194210 ACTION
195211 </ Button >
196212 </ div >
@@ -232,6 +248,7 @@ const WizardFooter = ({
232248 < Button
233249 id = "saveButton"
234250 variant = "primary"
251+ className = { classes . callToActionButton }
235252 disabled = { setDisabledSaveButton ( ) }
236253 isDisplayed = { setDisplaySaveButton ( ) }
237254 onClick = { onSave }
@@ -262,9 +279,9 @@ const WizardFooter = ({
262279 < strong > Status: </ strong >
263280 { ! formattedDateSnapshotted
264281 ? "Draft"
265- : project . shareCount
266- ? "Shared Snapshot"
267- : "Snapshot" }
282+ : project . loginId === loggedInUserId
283+ ? "Snapshot"
284+ : "Shared Snapshot" }
268285 </ div >
269286 { formattedDateSubmitted ? (
270287 < div >
@@ -292,35 +309,35 @@ const WizardFooter = ({
292309
293310WizardFooter . propTypes = {
294311 classes : PropTypes . any ,
295- rules : PropTypes . any ,
296- page : PropTypes . any ,
297- onPageChange : PropTypes . any ,
298- pageNumber : PropTypes . any ,
299- isFinalPage : PropTypes . bool ,
300- setDisabledForNextNavButton : PropTypes . any ,
301- setDisabledSaveButton : PropTypes . any ,
302- setDisplaySaveButton : PropTypes . any ,
303- onSave : PropTypes . any ,
304- submitModalOpen : PropTypes . any ,
305- handleSubmitModalOpen : PropTypes . any ,
306- handleSubmitModalClose : PropTypes . any ,
307- targetNotReachedModalOpen : PropTypes . any ,
308- showCopyAndEditSnapshot : PropTypes . func ,
309- showSubmitModal : PropTypes . func ,
310312 handleCsvModalOpen : PropTypes . func ,
311- handleHideModalOpen : PropTypes . func ,
313+ handleDROModalOpenWithPreCheck : PropTypes . func ,
312314 handleDeleteModalOpen : PropTypes . func ,
315+ handleHideModalOpen : PropTypes . func ,
313316 handlePrintPdf : PropTypes . func ,
314- handleSnapshotModalOpen : PropTypes . func ,
315317 handleRenameSnapshotModalOpen : PropTypes . func ,
316318 handleShareSnapshotModalOpen : PropTypes . func ,
317- handleDROModalOpenWithPreCheck : PropTypes . func ,
319+ handleSnapshotModalOpen : PropTypes . func ,
320+ handleSubmitModalClose : PropTypes . any ,
321+ handleSubmitModalOpen : PropTypes . any ,
318322 isDroCommitted : PropTypes . func ,
323+ isFinalPage : PropTypes . bool ,
319324 isSubmittingSnapshot : PropTypes . object ,
320325 onDownload : PropTypes . any ,
326+ onPageChange : PropTypes . any ,
327+ onSave : PropTypes . any ,
328+ page : PropTypes . any ,
329+ pageNumber : PropTypes . any ,
321330 project : PropTypes . any ,
331+ rules : PropTypes . any ,
322332 selectProject : PropTypes . any ,
323- shareView : PropTypes . bool
333+ setDisabledForNextNavButton : PropTypes . any ,
334+ setDisabledSaveButton : PropTypes . any ,
335+ setDisplaySaveButton : PropTypes . any ,
336+ shareView : PropTypes . bool ,
337+ showCopyAndEditSnapshot : PropTypes . func ,
338+ showSubmitModal : PropTypes . func ,
339+ submitModalOpen : PropTypes . any ,
340+ targetNotReachedModalOpen : PropTypes . any ,
324341} ;
325342
326343export default WizardFooter ;
0 commit comments