fixed search and loading more for search

This commit is contained in:
kyle hoell
2020-12-03 17:21:45 -05:00
parent 93b33ea0d6
commit 50c2dfa9b6
4 changed files with 13 additions and 4 deletions
+2
View File
@@ -316,6 +316,8 @@ export const startLoadMoreFiles = (parent="/", sortby="DEFAULT", search="", star
return (dispatch) => {
console.log("search", search)
//dispatch(setLoading(true))
dispatch(setLoadingMoreItems(true));
+4 -1
View File
@@ -48,10 +48,13 @@ class HeaderContainer extends React.Component {
}
searchOnChange = (e) => {
const value = e.target.value;
this.searchValue = value;
console.log("search on change", value);
this.props.dispatch(setSearch(value))
this.searchSuggested()
}
+6 -2
View File
@@ -48,6 +48,7 @@ class HomePageContainer extends React.Component {
this.props.dispatch(startResetParentList());
} else if (pathname.includes("/search")) {
console.log("login check set search")
this.setSearchItems();
return;
@@ -90,6 +91,7 @@ class HomePageContainer extends React.Component {
const idSplit = isGoogle ? history.location.pathname.split("/folder-google/") : isPersonal ? history.location.pathname.split("/folder-personal/") : history.location.pathname.split("/folder/");
const id = idSplit[1];
this.props.dispatch(setSearch(""))
this.props.dispatch(setCurrentRouteType("folder"))
isGoogle ? this.props.dispatch(setIsGoogle()) : this.props.dispatch(setNotGoogle())
this.props.dispatch(setQuickFiles([]));
@@ -120,6 +122,7 @@ class HomePageContainer extends React.Component {
if (pathname === "/home") {
this.props.dispatch(setSearch(""))
this.getFiles();
this.props.dispatch(startSetStorage());
this.props.dispatch(resetCurrentlySearching());
@@ -144,7 +147,7 @@ class HomePageContainer extends React.Component {
this.props.dispatch(startSetFolders(undefined, undefined, value));
this.props.dispatch(setParent)
this.props.dispatch(setParentList(["/"], ["Home"]))
this.props.dispatch(setSearch(""))
// this.props.dispatch(setSearch(""))
this.props.dispatch(startSetStorage());
}
@@ -199,7 +202,7 @@ class HomePageContainer extends React.Component {
this.props.dispatch(startSetFileAndFolderItems("",parent, undefined, value, undefined, storageType, folderSearch))
this.props.dispatch(setCurrentlySearching());
parent ? this.props.dispatch(startSetParentList(parent)) : this.props.dispatch(setParentList(["/"], ["Home"]))
this.props.dispatch(setSearch(""))
this.props.dispatch(setSearch(value))
this.props.dispatch(startSetStorage());
this.props.dispatch(resetStorageSwitcherStorage())
this.props.dispatch(setQuickFiles([]))
@@ -223,6 +226,7 @@ class HomePageContainer extends React.Component {
} else if (this.lastLocationKey !== history.location.key) {
this.props.dispatch(setSearch(""))
this.props.dispatch(setCurrentRouteType("home"))
this.props.dispatch(setNotGoogle());
this.getFiles(this.clearCache);
+1 -1
View File
@@ -32,7 +32,7 @@ const MainSection = React.forwardRef((props, ref) => {
{props.routeType === "search" ?
<div class="file__control--panel folder__view" style={{paddingBottom:"0", marginBottom:"-50px"}}>
<div class="results__files">
<h2><span class="counter__result">{props.files.length + props.folders.length}</span> <span class="result__word">results</span> for <span class="result__search--word">{props.cachedSearch}</span></h2>
<h2><span class="counter__result">{props.files.length + props.folders.length >= 50 ? "50+" : props.files.length + props.folders.length}</span> <span class="result__word">results</span> for <span class="result__search--word">{props.cachedSearch}</span></h2>
<p class="searching__result">You are searching in <span class="root__parent">{props.parent === "/" ? "Home" : props.parentNameList.length !== 0 ? props.parentNameList[props.parentNameList.length - 1] : "Unknown"}</span> <span class="spacer"><img style={{height:"11px", marginTop:"2px", display:"none"}} src="/assets/smallspacer.svg" alt="spacer"/></span><span class="current__folder"></span> <a href="#" style={{display:"none"}} class='search__filter--global'>Show results from everywhere</a></p>
</div>
</div> : undefined}