diff --git a/client/src/components/dotplot/err.js b/client/src/components/dotplot/err.js new file mode 100644 index 00000000..d8f1b86c --- /dev/null +++ b/client/src/components/dotplot/err.js @@ -0,0 +1,20 @@ +import React from "react"; +import * as globals from "../../globals"; + +const ErrorLoading = ({ error, width, height }) => { + console.log(error); // log to console as this is an unepected error + return ( +
+ Failure loading dotplot +
+ ); +}; + +export default ErrorLoading; diff --git a/client/src/components/dotplot/index.js b/client/src/components/dotplot/index.js index 80019785..7f0f313e 100644 --- a/client/src/components/dotplot/index.js +++ b/client/src/components/dotplot/index.js @@ -5,7 +5,9 @@ import Async from "react-async"; import memoize from "memoize-one"; // import * as d3 from "d3"; -import * as globals from "../../globals"; +import ErrorLoading from "./err"; +import StillLoading from "./load"; + import { createCategorySummaryFromDfCol } from "../../util/stateManager/controlsHelpers"; import { @@ -233,109 +235,64 @@ class Dotplot extends React.Component { left: 0, }} > - - - - - - {(error) => ( - - )} - - - {(asyncProps) => { - const { - colorAccessor, - categoryData, - width, - height, - categorySummary, - colorData, - } = asyncProps; - return ( - + + + + + {(error) => ( + - {this.dotplot( - "tissue", - categoryData, - categorySummary, - colorAccessor, - colorData, - width, - height - )} - - ); - }} - - + error={error} + /> + )} + + + {(asyncProps) => { + const { + colorAccessor, + categoryData, + width, + height, + categorySummary, + colorData, + } = asyncProps; + return this.dotplot( + "tissue", + categoryData, + categorySummary, + colorAccessor, + colorData, + width, + height + ); + }} + + + ); } } -const ErrorLoading = ({ error, width, height }) => { - console.log(error); // log to console as this is an unepected error - return ( -
- Failure loading dotplot -
- ); -}; - -const StillLoading = ({ width, height }) => { - /* - Render a busy/loading indicator - */ - return ( -
-
- Loading dotplot -
-
- ); -}; - export default Dotplot; diff --git a/client/src/components/dotplot/load.js b/client/src/components/dotplot/load.js new file mode 100644 index 00000000..3f25b08d --- /dev/null +++ b/client/src/components/dotplot/load.js @@ -0,0 +1,30 @@ +import React from "react"; + +const StillLoading = ({ width, height }) => { + /* + Render a busy/loading indicator + */ + return ( +
+
+ Loading dotplot +
+
+ ); +}; + +export default StillLoading;