Skip to content

Commit

Permalink
Add configs to enable/disable users and about page
Browse files Browse the repository at this point in the history
  • Loading branch information
moshthepitt committed May 10, 2019
1 parent 57d60f2 commit 063dc16
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
REACT_APP_THEME_COLOR: "000000"
REACT_APP_ENABLE_IRS: "true"
REACT_APP_ENABLE_FI: "true"
REACT_APP_ENABLE_USERS: "true"
REACT_APP_ENABLE_ABOUT: "true"
REACT_APP_DISABLE_LOGIN_PROTECTION: "true"
REACT_APP_SUPERSET_API_BASE: "https://superset.reveal-stage.smartregister.org/"
REACT_APP_SUPERSET_API_ENDPOINT: "slice"
Expand Down
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ REACT_APP_WEBSITE_NAME=Reveal
REACT_APP_THEME_COLOR=000000
REACT_APP_ENABLE_IRS=true
REACT_APP_ENABLE_FI=true
REACT_APP_ENABLE_USERS=true
REACT_APP_ENABLE_ABOUT=true
REACT_APP_DISABLE_LOGIN_PROTECTION=false
REACT_APP_SUPERSET_API_BASE=https://superset.reveal-stage.smartregister.org/ # notice the ending /
REACT_APP_SUPERSET_API_ENDPOINT=slice
Expand Down
32 changes: 21 additions & 11 deletions src/components/page/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ import {
UncontrolledDropdown,
} from 'reactstrap';
import logo from '../../../assets/images/logo.png';
import { ENABLE_FI, ENABLE_IRS, WEBSITE_NAME } from '../../../configs/env';
import {
ENABLE_ABOUT,
ENABLE_FI,
ENABLE_IRS,
ENABLE_USERS,
WEBSITE_NAME,
} from '../../../configs/env';
import { FI_HISTORICAL_URL, FI_URL, IRS_URL, LOGIN_URL, LOGOUT_URL } from '../../../constants';
import './Header.css';

Expand Down Expand Up @@ -104,16 +110,20 @@ export class HeaderComponent extends React.Component<HeaderProps, State> {
</DropdownMenu>
</UncontrolledDropdown>
)}
<NavItem>
<NavLink to="/404" className="nav-link" activeClassName="active">
Users
</NavLink>
</NavItem>
<NavItem>
<NavLink to="/404" className="nav-link" activeClassName="active">
About
</NavLink>
</NavItem>
{ENABLE_USERS && (
<NavItem>
<NavLink to="/404" className="nav-link" activeClassName="active">
Users
</NavLink>
</NavItem>
)}
{ENABLE_ABOUT && (
<NavItem>
<NavLink to="/404" className="nav-link" activeClassName="active">
About
</NavLink>
</NavItem>
)}
</Nav>
<Nav className="ml-0" navbar={true}>
{authenticated ? (
Expand Down
8 changes: 8 additions & 0 deletions src/configs/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export type ENABLE_IRS = typeof ENABLE_IRS;
export const ENABLE_FI = process.env.REACT_APP_ENABLE_FI === 'true';
export type ENABLE_FI = typeof ENABLE_FI;

/** Do you want to enable the users page? */
export const ENABLE_USERS = process.env.REACT_APP_ENABLE_USERS === 'true';
export type ENABLE_USERS = typeof ENABLE_USERS;

/** Do you want to enable the about page? */
export const ENABLE_ABOUT = process.env.REACT_APP_ENABLE_ABOUT === 'true';
export type ENABLE_ABOUT = typeof ENABLE_ABOUT;

/** Do you want to disable login protection? */
export const DISABLE_LOGIN_PROTECTION = process.env.REACT_APP_DISABLE_LOGIN_PROTECTION === 'true';
export type DISABLE_LOGIN_PROTECTION = typeof DISABLE_LOGIN_PROTECTION;
Expand Down

0 comments on commit 063dc16

Please sign in to comment.