diff --git a/src/debuggingpage.js b/src/debuggingpage.js
new file mode 100644
index 0000000..afa9348
--- /dev/null
+++ b/src/debuggingpage.js
@@ -0,0 +1,176 @@
+import React from 'react';
+import { Fetch } from './fetch.js';
+import { ProvideDB, DBQueryConsole, DBQueryBar, DBTypeEnum, DBSourceEnum } from './database.js';
+import { PhotoTableLine, MediaTableLine } from './media.js';
+import { do_image_query, do_album_query, image_query_with_where, user_query_from_search_string, maybe_image_query, maybe_album_query } from './queries.js';
+
+const URLLoading = ({ url }) =>
Loading: {url}
;
+const URLError = ({ error }) => Failed to load URL resource: {error.message}
;
+const URLFinished = ({ url, data }) => {url} was loaded: {data.byteLength} bytes received.
;
+
+const DBLoading = ({ sqlite_file }) => Loading: {sqlite_file}
;
+const DBError = ({ error }) => Failed to load database: {error.message}
;
+const DBFinished = ({ sqlite_file, db }) => {sqlite_file} was loaded. Name: {db.state.db_name}.
;
+
+const TestFetch = ({ url }) => (
+
+ {({ loading, error, done, data }) => (
+ <>
+ {loading && }
+ {error && }
+ {done && }
+ >
+ )}
+
+)
+
+export class PhotoFromDB extends React.Component {
+ state = {
+ done: false,
+ photo: false,
+ }
+
+ componentDidMount() {
+ do_image_query(this.props.sql_query, this.props.database, "/test_photos", "/test_photos_thumbs").then(photos => {
+ this.setState({ done: true, photo: photos[0] });
+ });
+ }
+
+ render() {
+ return (
+ <>
+ {!this.state.done && >Querying photo from DB: {this.props.sql_query}
}
+ {this.state.photo && }
+ >
+ );
+ }
+}
+
+export class ImageWhereConsole extends React.Component {
+ state = {
+ processing: false,
+ result: false,
+ where: "",
+ }
+
+ onQueryChangeHandler = whereclause => { this.setState({ where: whereclause }); }
+ onQuerySubmitHandler = () => {
+ this.setState({ processing: true, result: false });
+ this.props.database.queries_async([image_query_with_where(this.state.where)])
+ .then(result => {
+ this.setState({ processing: false, result: JSON.stringify(result) });
+ });
+ }
+
+ render() {
+ return (
+ <>
+
+
+
+
Result:
+ {this.state.result &&
{this.state.result}
}
+
+ >
+ );
+ }
+}
+
+const MediaTable = ({ items }) => (
+ <>
+ {
+ items.map((value, index) => {
+ return value &&
+ })
+ }
+ >
+)
+
+export class TestDBStringQuery extends React.Component {
+ state = {
+ string: false,
+ query: false,
+ sql_image_query: false,
+ sql_album_query: false,
+ photos: false,
+ albums: false,
+ }
+
+ onQueryChangeHandler = str => { this.setState({ string: str }); }
+ onQuerySubmitHandler = () => {
+ var q = user_query_from_search_string(this.state.string);
+ var sql_image_query = maybe_image_query(q);
+ var sql_album_query = maybe_album_query(q);
+ this.setState({ query: q, sql_image_query: sql_image_query, sql_album_query: sql_album_query, photos: false, albums: false });
+ do_image_query(sql_image_query, this.props.db, "/test_photos", "/test_photos_thumbs").then(photos => {
+ console.log(photos);
+ this.setState({ done: true, photos: photos });
+ });
+ do_album_query(sql_album_query, this.props.db, "/test_photos", "/test_photos_thumbs").then(albums => {
+ console.log(albums);
+ this.setState({ done: true, albums: albums });
+ });
+ }
+
+ render() {
+
+ return (
+ <>
+
+
+
+ { this.state.photos && Found {this.state.photos.length} photos.
}
+ { this.state.photos && }
+ { this.state.albums && Found {this.state.albums.length} albums.
}
+ { this.state.albums && }
+
+ >
+ );
+ }
+}
+
+const TestDBFetch = ({ db }) => (
+ <>
+ DB Query Console
+
+ Example photo from DB
+
+ DB WHERE clause image search
+
+ >
+)
+
+const TestDBPlayground = ({ db }) => (
+ <>
+
+ >
+)
+
+export const DebuggingPage = () => (
+ <>
+ Test file fetching:
+
+
+ {({ loading, error, done, db }) => (
+
+ <>
+ {loading && }
+ {error && }
+ {done && (
+ <>
+
+ IndexedDB playground:
+
+ Test DB fetching:
+
+ Test queries:
+
+ >
+ )
+ }
+ >
+ )}
+
+ >
+);
diff --git a/src/index.css b/src/index.css
deleted file mode 100644
index e69de29..0000000
diff --git a/src/index.js b/src/index.js
index 1f8f333..334655d 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,181 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import { Fetch } from './fetch.js';
-import { ProvideDB, DBQueryConsole, DBQueryBar, DBTypeEnum, DBSourceEnum } from './database.js';
-import { PhotoTableLine, MediaTableLine } from './media.js';
-import { do_image_query, do_album_query, image_query_with_where, user_query_from_search_string, maybe_image_query, maybe_album_query } from './queries.js';
-
-import './index.css';
-import { thisExpression } from '@babel/types';
-
-const URLLoading = ({ url }) => Loading: {url}
;
-const URLError = ({ error }) => Failed to load URL resource: {error.message}
;
-const URLFinished = ({ url, data }) => {url} was loaded: {data.byteLength} bytes received.
;
-
-const DBLoading = ({ sqlite_file }) => Loading: {sqlite_file}
;
-const DBError = ({ error }) => Failed to load database: {error.message}
;
-const DBFinished = ({ sqlite_file, db }) => {sqlite_file} was loaded. Name: {db.state.db_name}.
;
-
-const TestFetch = ({ url }) => (
-
- {({ loading, error, done, data }) => (
- <>
- {loading && }
- {error && }
- {done && }
- >
- )}
-
-)
-
-export class PhotoFromDB extends React.Component {
- state = {
- done: false,
- photo: false,
- }
-
- componentDidMount() {
- do_image_query(this.props.sql_query, this.props.database, "/test_photos", "/test_photos_thumbs").then(photos => {
- this.setState({ done: true, photo: photos[0] });
- });
- }
-
- render() {
- return (
- <>
- {!this.state.done && >Querying photo from DB: {this.props.sql_query}
}
- {this.state.photo && }
- >
- );
- }
-}
-
-export class ImageWhereConsole extends React.Component {
- state = {
- processing: false,
- result: false,
- where: "",
- }
-
- onQueryChangeHandler = whereclause => { this.setState({ where: whereclause }); }
- onQuerySubmitHandler = () => {
- this.setState({ processing: true, result: false });
- this.props.database.queries_async([image_query_with_where(this.state.where)])
- .then(result => {
- this.setState({ processing: false, result: JSON.stringify(result) });
- });
- }
-
- render() {
- return (
- <>
-
-
-
-
Result:
- {this.state.result &&
{this.state.result}
}
-
- >
- );
- }
-}
-
-const MediaTable = ({ items }) => (
- <>
- {
- items.map((value, index) => {
- return value &&
- })
- }
- >
-)
-
-export class TestDBStringQuery extends React.Component {
- state = {
- string: false,
- query: false,
- sql_image_query: false,
- sql_album_query: false,
- photos: false,
- albums: false,
- }
-
- onQueryChangeHandler = str => { this.setState({ string: str }); }
- onQuerySubmitHandler = () => {
- var q = user_query_from_search_string(this.state.string);
- var sql_image_query = maybe_image_query(q);
- var sql_album_query = maybe_album_query(q);
- this.setState({ query: q, sql_image_query: sql_image_query, sql_album_query: sql_album_query, photos: false, albums: false });
- do_image_query(sql_image_query, this.props.db, "/test_photos", "/test_photos_thumbs").then(photos => {
- console.log(photos);
- this.setState({ done: true, photos: photos });
- });
- do_album_query(sql_album_query, this.props.db, "/test_photos", "/test_photos_thumbs").then(albums => {
- console.log(albums);
- this.setState({ done: true, albums: albums });
- });
- }
-
- render() {
-
- return (
- <>
-
-
-
- { this.state.photos && Found {this.state.photos.length} photos.
}
- { this.state.photos && }
- { this.state.albums && Found {this.state.albums.length} albums.
}
- { this.state.albums && }
-
- >
- );
- }
-}
-
-const TestDBFetch = ({ db }) => (
- <>
- DB Query Console
-
- Example photo from DB
-
- DB WHERE clause image search
-
- >
-)
-
-const TestDBPlayground = ({ db }) => (
- <>
-
- >
-)
+import { DebuggingPage } from './debuggingpage.js';
ReactDOM.render(
- <>
- Test file fetching:
-
-
- {({ loading, error, done, db }) => (
-
- <>
- {loading && }
- {error && }
- {done && (
- <>
-
- IndexedDB playground:
-
- Test DB fetching:
-
- Test queries:
-
- >
- )
- }
- >
- )}
-
- >,
+ <>>,
document.getElementById('root')
);