Skip to content
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

Added loading component #106

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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ archives/.idea/
.env
.vscode/
.DS_Store
dist
7 changes: 6 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ var browserify = require("browserify");
var source = require('vinyl-source-stream');
var tsify = require("tsify");

gulp.task("default", ["css", "browserify"]);
gulp.task("default", ["css", "img", "browserify"]);

gulp.task("css", function () {
return gulp.src('src/css/*').pipe(gulp.dest('dist/css'));
})

gulp.task("img", function () {
return gulp.src('src/img/*').pipe(gulp.dest('dist/img'));
})

gulp.task("browserify", function () {
return browserify({
basedir: '.',
Expand All @@ -26,4 +30,5 @@ gulp.task("browserify", function () {
gulp.task("watch", function() {
gulp.watch('src/**/*.{ts,tsx}', ['browserify']);
gulp.watch('src/**/*.css', ['css']);
gulp.watch('src/img/*', ['img']);
});
14 changes: 14 additions & 0 deletions src/components/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from 'react';

export interface IAnnotationLoadingProps {}

export default class Loading extends React.Component<IAnnotationLoadingProps, null> {

constructor () {
super();
}

render () {
return (<div className="loading">&nbsp;</div>)
}
}
4 changes: 2 additions & 2 deletions src/components/page-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Link, RouteComponentProps} from 'react-router-dom';
import WebMonitoringDb, {Annotation, Page, Version} from '../services/web-monitoring-db';
import AnnotationForm from './annotation-form';
import DiffView from './diff-view';
import Loading from './loading'

// export type IPageDetailsProps = RouteComponentProps<{pageId: string}>;
export interface IPageDetailsProps extends RouteComponentProps<{pageId: string}> {
Expand Down Expand Up @@ -64,9 +65,8 @@ export default class PageDetails extends React.Component<IPageDetailsProps, IPag

};

// TODO: should factor out a loading view
if (!(this.state.page && this.state.version)) {
return <div>Loading…</div>;
return (<Loading />)
}

const page = this.state.page;
Expand Down
3 changes: 2 additions & 1 deletion src/components/page-list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import {Link, RouteComponentProps} from 'react-router-dom';
import {Page} from '../services/web-monitoring-db';
import Loading from './loading'

// export type IPageListProps = RouteComponentProps<{}>;
export interface IPageListProps extends RouteComponentProps<{}> {
Expand All @@ -14,7 +15,7 @@ export default class PageList extends React.Component<IPageListProps, null> {

render () {
if (!this.props.pages) {
return <div>Loading…</div>;
return (<Loading />)
}

return (
Expand Down
7 changes: 7 additions & 0 deletions src/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,10 @@ ins {
.login-form__footer {
text-align: right;
}

.loading {
margin-left: 20px;
height: 70px;
background-image: url(../img/infinity-loader.svg);
background-repeat: no-repeat;
}
5 changes: 5 additions & 0 deletions src/img/infinity-loader.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.