Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Add a loading indicator to the application to show application activi…
Browse files Browse the repository at this point in the history
…ty while auth launch and data retrieval are taking place (#4)
  • Loading branch information
zplata authored Jun 22, 2017
1 parent 60e8bc7 commit 4900643
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CHANGELOG

* 1.2.0
- Implemented a loading indicator while app loads and data is fetched
* 1.1.0
- Update recommendation text to have more clinical value
* 1.0.0
Expand Down
41 changes: 41 additions & 0 deletions app/loading-indicator.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.loading-indicator {
margin: 100px auto 0;
width: 70px;
text-align: center;
}

.loading-indicator > div {
width: 18px;
height: 18px;
background-color: #000;

border-radius: 100%;
display: inline-block;
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

.loading-indicator .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}

.loading-indicator .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}

@-webkit-keyframes sk-bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0) }
40% { -webkit-transform: scale(1.0) }
}

@keyframes sk-bouncedelay {
0%, 80%, 100% {
-webkit-transform: scale(0);
transform: scale(0);
} 40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
}
26 changes: 12 additions & 14 deletions build/js/bundle.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel='stylesheet' type='text/css' href='styles.css'>
-->
<link rel='stylesheet' type='text/css' href='build/css/styles.css'>
<link rel='stylesheet' type='text/css' href='app/loading-indicator.css'>
<style>
body {
margin: 0;
Expand All @@ -16,6 +17,11 @@
<title>SMART ASCVD Risk App</title>
</head>
<body>
<div id='loadingIndicator' class='loading-indicator'>
<div class='bounce1'></div>
<div class='bounce2'></div>
<div class='bounce3'></div>
</div>
<div id='container'></div>
<script src='lib/fhir-client.min.js'></script>
<script src='lib/jquery.min.js'></script>
Expand Down
5 changes: 5 additions & 0 deletions index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import './app/polyfill';

ASCVDRisk.fetchPatientData().then(
() => {
const loadingNode = document.getElementById('loadingIndicator');
while (loadingNode.firstChild) {
loadingNode.removeChild(loadingNode.firstChild);
}
loadingNode.parentNode.removeChild(loadingNode);
ReactDOM.render(<App />, document.getElementById('container'));
},
);
8 changes: 7 additions & 1 deletion launch.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" hidden>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name='viewport' content='width=device-width, initial-scale=1' />
<title>SMART ASCVD Risk App</title>
<link rel='stylesheet' type='text/css' href='app/loading-indicator.css'>
<script src='lib/fhir-client.min.js'></script>
</head>
<body>
<div id='loadingIndicator' class='loading-indicator'>
<div class='bounce1'></div>
<div class='bounce2'></div>
<div class='bounce3'></div>
</div>
<script>
FHIR.oauth2.authorize({
'client_id': 'my_web_app',
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.DefinePlugin({'process.env': {NODE_ENV: JSON.stringify('production')}}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(),
new ExtractTextPlugin('../css/styles.css')
Expand Down

0 comments on commit 4900643

Please sign in to comment.