|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
import React, { useState, useEffect } from 'react'; |
|
|
|
|
import React, { useEffect } from 'react'; |
|
|
|
|
|
|
|
|
|
import AppBar, { ActiveTab as AppBarActiveTab } from './components/AppBar'; |
|
|
|
|
import { Query, isQuery, QueryKeys, QueryOrdering, OrderKey, TypesIncluded, isTypesIncluded, isQueryOrdering } from './types/Query'; |
|
|
|
@ -6,8 +6,6 @@ import QueryBrowseWindow from './components/QueryBrowseWindow'; |
|
|
|
|
import { DndProvider } from 'react-dnd'; |
|
|
|
|
import { HTML5Backend } from 'react-dnd-html5-backend'; |
|
|
|
|
|
|
|
|
|
import * as serverApi from './api'; |
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
BrowserRouter as Router, |
|
|
|
|
Switch, |
|
|
|
@ -18,7 +16,6 @@ import { |
|
|
|
|
} from "react-router-dom"; |
|
|
|
|
|
|
|
|
|
const JSURL = require('jsurl'); |
|
|
|
|
const _ = require('lodash'); |
|
|
|
|
|
|
|
|
|
function fixQuery(q: any): Query { |
|
|
|
|
if (!isQuery(q)) { |
|
|
|
@ -61,9 +58,6 @@ function AppBody() { |
|
|
|
|
const itemOrder: QueryOrdering | undefined = JSURL.tryParse(queryParams.get('order'), undefined); |
|
|
|
|
const itemTypes: TypesIncluded | undefined = JSURL.tryParse(queryParams.get('types'), undefined); |
|
|
|
|
|
|
|
|
|
const offset: number | undefined = queryParams.get('offset') ? parseInt(queryParams.get('offset') || '0') : undefined; |
|
|
|
|
const limit: number | undefined = queryParams.get('limit') ? parseInt(queryParams.get('limit') || '0') : undefined; |
|
|
|
|
|
|
|
|
|
const pushQuery = ( |
|
|
|
|
q: Query, |
|
|
|
|
o: QueryOrdering, |
|
|
|
@ -82,11 +76,11 @@ function AppBody() { |
|
|
|
|
const fq = fixQuery(itemQuery); |
|
|
|
|
const fo = fixOrder(itemOrder); |
|
|
|
|
const ft = fixTypes(itemTypes); |
|
|
|
|
if (fq != itemQuery || fo != itemOrder || ft != itemTypes) { |
|
|
|
|
if (fq !== itemQuery || fo !== itemOrder || ft !== itemTypes) { |
|
|
|
|
pushQuery(fq, fo, ft); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
}, [location]); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const onAppBarTabChange = (value: AppBarActiveTab) => { |
|
|
|
|
switch (value) { |
|
|
|
|