|
|
@@ -1,9 +1,36 @@ |
|
|
|
import { h, Component } from 'preact';
|
|
|
|
import WBBrowseDialogProjectList from 'wb-browse-dialog-project-list';
|
|
|
|
import WBBrowseDialogCollectionList from 'wb-browse-dialog-project-list';
|
|
|
|
import linkState from 'linkstate';
|
|
|
|
|
|
|
|
class WBBrowseDialog extends Component {
|
|
|
|
render({ app, id }, { mode }) {
|
|
|
|
constructor(...args) {
|
|
|
|
super(...args);
|
|
|
|
this.state.history = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
resetSearch() {
|
|
|
|
this.setState({
|
|
|
|
'textSearch': null,
|
|
|
|
'textSearchInput': null
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
pushHistory(child) {
|
|
|
|
const { history } = this.state;
|
|
|
|
history.push([ child, { textSearch } ]);
|
|
|
|
this.state.history = history.slice(history.length - 1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
popHistory() {
|
|
|
|
if (this.history.length === 0)
|
|
|
|
return;
|
|
|
|
const entry = history.pop();
|
|
|
|
this.setState(entry[1]);
|
|
|
|
entry[0].popHistory();
|
|
|
|
}
|
|
|
|
|
|
|
|
render({ app, id }, { mode, textSearch, textSearchInput }) {
|
|
|
|
return (
|
|
|
|
<div class="modal" id={ id } tabindex="-1" role="dialog">
|
|
|
|
<div class="modal-dialog modal-lg" role="document">
|
|
|
@@ -16,9 +43,10 @@ class WBBrowseDialog extends Component { |
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal-body">
|
|
|
|
<button class="btn btn-sm btn-outline-primary">Back</button>
|
|
|
|
|
|
|
|
<input class="form-control" type="search" placeholder="Search" />
|
|
|
|
<div>
|
|
|
|
<h5>Go to: <a href="#">Home</a>, <a href="#">All Projects</a>,
|
|
|
|
<a href="#">All Users</a>, <a href="#">Shared with Me</a></h5>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="input-group mb-3">
|
|
|
|
<div class="input-group-prepend">
|
|
|
@@ -26,15 +54,20 @@ class WBBrowseDialog extends Component { |
|
|
|
</div>
|
|
|
|
|
|
|
|
<input type="text" class="form-control" placeholder="Search"
|
|
|
|
aria-label="Search" />
|
|
|
|
aria-label="Search" value={ textSearchInput }
|
|
|
|
onChange={ linkState(this, 'textSearchInput') } />
|
|
|
|
|
|
|
|
<div class="input-group-append">
|
|
|
|
<button class="btn btn-outline-primary" type="button">Search</button>
|
|
|
|
<button class="btn btn-outline-primary" type="button"
|
|
|
|
onclick={ () => this.setState({ 'textSearch': this.state.textSearchInput }) }>Search</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Projects</h5>
|
|
|
|
<WBBrowseDialogProjectList app={ app } />
|
|
|
|
<WBBrowseDialogProjectList app={ app } textSearch={ textSearch }
|
|
|
|
resetSearch={ () => this.resetSearch() }
|
|
|
|
pushHistory={ () => this.pushHistory() }
|
|
|
|
popHistory={ () => this.popHistory() } />
|
|
|
|
|
|
|
|
{ mode === 'collection-content' ? (
|
|
|
|
<h5>Content</h5>
|
|
|
|