-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from dhis2/v1.0.2
v1.0.2
- Loading branch information
Showing
13 changed files
with
3,948 additions
and
4,711 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
import Spacing from "material-ui/styles/spacing"; | ||
import getMuiTheme from "material-ui/styles/getMuiTheme"; | ||
import { | ||
blue700, | ||
blue100, | ||
orange500, | ||
grey100, | ||
grey500, | ||
darkBlack, | ||
white, | ||
grey400, | ||
} from "material-ui/styles/colors"; | ||
|
||
import { fade } from "material-ui/utils/colorManipulator"; | ||
|
||
const theme = { | ||
spacing: Spacing, | ||
fontFamily: "Roboto, sans-serif", | ||
palette: { | ||
primary1Color: "#276696", | ||
primary2Color: blue700, | ||
primary3Color: blue100, | ||
accent1Color: orange500, | ||
accent2Color: grey100, | ||
accent3Color: grey500, | ||
textColor: darkBlack, | ||
alternateTextColor: white, | ||
canvasColor: white, | ||
borderColor: grey400, | ||
disabledColor: fade(darkBlack, 0.3), | ||
}, | ||
}; | ||
|
||
function createAppTheme(style) { | ||
return { | ||
sideBar: { | ||
backgroundColor: "#F3F3F3", | ||
backgroundColorItem: "transparent", | ||
backgroundColorItemActive: style.palette.accent2Color, | ||
textColor: style.palette.textColor, | ||
textColorActive: style.palette.primary1Color, | ||
borderStyle: "1px solid #e1e1e1", | ||
}, | ||
forms: { | ||
minWidth: 350, | ||
maxWidth: 900, | ||
}, | ||
}; | ||
} | ||
|
||
const muiTheme = getMuiTheme(theme); | ||
const appTheme = createAppTheme(theme); | ||
|
||
export default Object.assign({}, muiTheme, appTheme); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import PropTypes from 'prop-types'; | ||
|
||
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; | ||
|
||
import theme from "./headerbar-theme.jsx"; | ||
|
||
import D2Library from 'd2/lib/d2'; | ||
|
||
import HeaderBarComponent from "d2-ui/lib/app-header/HeaderBar"; | ||
import headerBarStore$ from "d2-ui/lib/app-header/headerBar.store"; | ||
import withStateFrom from "d2-ui/lib/component-helpers/withStateFrom"; | ||
|
||
const dhisConfig = DHIS_CONFIG; // eslint-disable-line | ||
|
||
let HeaderBar = withStateFrom(headerBarStore$, HeaderBarComponent); | ||
|
||
class HeaderBarWrapper extends React.Component { | ||
getChildContext() { | ||
return { | ||
d2: this.props.d2, | ||
muiTheme: theme, | ||
}; | ||
} | ||
|
||
render() { | ||
return ( | ||
<HeaderBar /> | ||
); | ||
} | ||
} | ||
HeaderBarWrapper.childContextTypes = { | ||
d2: PropTypes.object, | ||
muiTheme: PropTypes.object, | ||
}; | ||
|
||
|
||
export default function initHeaderBar(targetSelector){ | ||
D2Library.getManifest('manifest.webapp') | ||
.then((manifest) => { | ||
const baseUrl = process.env.NODE_ENV === 'production' ? manifest.getBaseUrl() : dhisConfig.baseUrl; | ||
D2Library.config.baseUrl = `${baseUrl}/api`; | ||
//log.info(`Loading: ${manifest.name} v${manifest.version}`); | ||
//log.info(`Built ${manifest.manifest_generated_at}`); | ||
}) | ||
.then(D2Library.getUserSettings) | ||
.then((settings) => {}) | ||
.then(D2Library.init) | ||
.then((d2) => { | ||
console.log("D2 initialized", d2); | ||
ReactDOM.render(<MuiThemeProvider><HeaderBarWrapper d2={d2} /></MuiThemeProvider>, document.querySelector(targetSelector)); | ||
}) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.