@@ -10,14 +10,13 @@ import * as projectActions from '../modules/IDE/actions/project';
1010import { setAllAccessibleOutput } from '../modules/IDE/actions/preferences' ;
1111import { logoutUser } from '../modules/User/actions' ;
1212
13+ import getConfig from '../utils/getConfig' ;
1314import { metaKeyName , } from '../utils/metaKey' ;
1415
1516import CaretLeftIcon from '../images/left-arrow.svg' ;
1617import TriangleIcon from '../images/down-filled-triangle.svg' ;
1718import LogoIcon from '../images/p5js-logo-small.svg' ;
1819
19- const __process = ( typeof global !== 'undefined' ? global : window ) . process ;
20-
2120class Nav extends React . PureComponent {
2221 constructor ( props ) {
2322 super ( props ) ;
@@ -272,7 +271,7 @@ class Nav extends React.PureComponent {
272271 New
273272 </ button >
274273 </ li >
275- { __process . env . LOGIN_ENABLED && ( ! this . props . project . owner || this . isUserOwner ( ) ) &&
274+ { getConfig ( ' LOGIN_ENABLED' ) && ( ! this . props . project . owner || this . isUserOwner ( ) ) &&
276275 < li className = "nav__dropdown-item" >
277276 < button
278277 onClick = { this . handleSave }
@@ -324,7 +323,7 @@ class Nav extends React.PureComponent {
324323 Open
325324 </ Link >
326325 </ li > }
327- { __process . env . UI_COLLECTIONS_ENABLED &&
326+ { getConfig ( ' UI_COLLECTIONS_ENABLED' ) &&
328327 this . props . user . authenticated &&
329328 this . props . project . id &&
330329 < li className = "nav__dropdown-item" >
@@ -337,7 +336,7 @@ class Nav extends React.PureComponent {
337336 Add to Collection
338337 </ Link >
339338 </ li > }
340- { __process . env . EXAMPLES_ENABLED &&
339+ { getConfig ( ' EXAMPLES_ENABLED' ) &&
341340 < li className = "nav__dropdown-item" >
342341 < Link
343342 to = "/p5/sketches"
@@ -587,7 +586,7 @@ class Nav extends React.PureComponent {
587586 My sketches
588587 </ Link >
589588 </ li >
590- { __process . env . UI_COLLECTIONS_ENABLED &&
589+ { getConfig ( ' UI_COLLECTIONS_ENABLED' ) &&
591590 < li className = "nav__dropdown-item" >
592591 < Link
593592 to = { `/${ this . props . user . username } /collections` }
@@ -635,7 +634,7 @@ class Nav extends React.PureComponent {
635634 }
636635
637636 renderUserMenu ( navDropdownState ) {
638- const isLoginEnabled = __process . env . LOGIN_ENABLED ;
637+ const isLoginEnabled = getConfig ( ' LOGIN_ENABLED' ) ;
639638 const isAuthenticated = this . props . user . authenticated ;
640639
641640 if ( isLoginEnabled && isAuthenticated ) {
0 commit comments