1
+ import { Spinner , SpinnerSize } from "@fluentui/react" ;
1
2
import { uniqueId } from "lodash" ;
2
3
import * as React from "react" ;
3
4
import { useSelector } from "react-redux" ;
@@ -72,9 +73,29 @@ const getAssetDownloadURL = async (os: OS): Promise<string> => {
72
73
* Internal facing page for downloading desktop version of BFF.
73
74
*/
74
75
export default function Download ( ) {
76
+ const [ isLoading , setIsLoading ] = React . useState ( true ) ;
75
77
const [ error , setError ] = React . useState < string > ( ) ;
78
+ const [ isAicsEmployee , setIsAicsEmployee ] = React . useState ( false ) ;
79
+
76
80
const { fileDownloadService } = useSelector ( interaction . selectors . getPlatformDependentServices ) ;
77
- const isAicsEmployee = useSelector ( interaction . selectors . isAicsEmployee ) ;
81
+ const fileService = useSelector ( interaction . selectors . getHttpFileService ) ;
82
+
83
+ // Check if AICS employee
84
+ React . useEffect ( ( ) => {
85
+ setIsLoading ( true ) ;
86
+ fileService
87
+ . isNetworkAccessible ( )
88
+ . then ( setIsAicsEmployee )
89
+ . finally ( ( ) => setIsLoading ( false ) ) ;
90
+ } , [ fileService , setIsAicsEmployee ] ) ;
91
+
92
+ if ( ! isLoading ) {
93
+ return (
94
+ < div >
95
+ < Spinner size = { SpinnerSize . large } />
96
+ </ div >
97
+ ) ;
98
+ }
78
99
79
100
// Only show download button if user is an AICS employee
80
101
// should ever get here, but just in case
@@ -99,11 +120,12 @@ export default function Download() {
99
120
} ;
100
121
101
122
return (
102
- < div className = { styles . root } >
123
+ < div >
103
124
{ error && (
104
- < div className = { styles . section } >
105
- < div className = { styles . error } > The following error occurred: { error } </ div >
106
- </ div >
125
+ < >
126
+ < h2 > Error</ h2 >
127
+ < p className = { styles . error } > { error } </ p >
128
+ </ >
107
129
) }
108
130
< div className = { styles . section } >
109
131
< div className = { styles . downloadContainer } >
@@ -118,8 +140,8 @@ export default function Download() {
118
140
</ div >
119
141
</ div >
120
142
< div className = { styles . section } >
121
- < h2 className = { styles . header } > Installation Instructions</ h2 >
122
- < p > To install the BioFile Finder, follow the OS specific instructions below. </ p >
143
+ < h2 > Installation Instructions</ h2 >
144
+ < h3 > To install the BioFile Finder, follow the OS specific instructions below</ h3 >
123
145
< Instructions os = { os } />
124
146
</ div >
125
147
</ div >
0 commit comments