Skip to content

Replace "Loading..." screen with progress bar at the top of the page #2481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { inject as service } from '@ember/service';
export default Route.extend({
flashMessages: service(),
googleCharts: service(),
pageProgress: service(),
session: service(),

beforeModel() {
Expand All @@ -15,6 +16,13 @@ export default Route.extend({
},

actions: {
loading(transition) {
let { pageProgress } = this;
pageProgress.start(transition.targetName);
transition.promise.finally(() => pageProgress.done());
return true;
},

didTransition() {
this.flashMessages.step();
},
Expand Down
15 changes: 15 additions & 0 deletions app/styles/application.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
--link-color: rgb(0, 172, 91);
--link-hover-color: #007940;
--separator-color: #284725;
--yellow: #ffc833;
}

* {
Expand All @@ -31,6 +32,20 @@ body {
align-items: center;
}

:global(.page-progress) {
position: fixed;
pointer-events: none;

:global(.bar) {
position: fixed;
left: 0;
width: 0;
height: 3px;
box-shadow: 0 0 10px rgba(0, 13, 41, 0.8);
background: var(--yellow) !important;
}
}

h1 {
@media only screen and (max-width: 400px) {
font-size: 1.5em;
Expand Down
12 changes: 0 additions & 12 deletions app/styles/loading.module.css

This file was deleted.

1 change: 1 addition & 0 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{{title "crates.io: Rust Package Registry" separator=' - ' prepend=true}}

<PageProgress/>
<Header/>

<main local-class="main">
Expand Down
3 changes: 0 additions & 3 deletions app/templates/loading.hbs

This file was deleted.

3 changes: 3 additions & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ module.exports = function (defaults) {
before: [require('postcss-nested')],
},
},
'ember-cli-page-progress': {
includeCss: false,
},
fingerprint: {
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg', 'ttf', 'woff', 'woff2'],
},
Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"ember-cli-meta-tags": "^6.0.0",
"ember-cli-mirage": "^1.1.6",
"ember-cli-moment-shim": "^3.7.1",
"ember-cli-page-progress": "^2.0.0",
"ember-cli-sri": "2.1.1",
"ember-cli-uglify": "^3.0.0",
"ember-click-outside": "^1.3.0",
Expand Down