Sfoglia il codice sorgente

81664 name refactor

SULLEY\ryo-h 4 anni fa
parent
commit
7cfaeb90e4

+ 12 - 12
packages/app/src/components/SearchPage.jsx

@@ -35,8 +35,8 @@ class SearchPage extends React.Component {
       searchResultCount: 0,
       activePage: 1,
       pagingLimit: 10, // change to an appropriate limit number
-      excludeUsersHome: true,
-      excludeTrash: true,
+      isExcludeUnderUserPage: true,
+      isExcludeUnderTrashPage: true,
     };
 
     this.changeURL = this.changeURL.bind(this);
@@ -44,8 +44,8 @@ class SearchPage extends React.Component {
     this.searchHandler = this.searchHandler.bind(this);
     this.selectPage = this.selectPage.bind(this);
     this.toggleCheckBox = this.toggleCheckBox.bind(this);
-    this.onExcludeUsersHome = this.onExcludeUsersHome.bind(this);
-    this.onExcludeTrash = this.onExcludeTrash.bind(this);
+    this.switchIncludingUnderUserPage = this.switchIncludingUnderUserPage.bind(this);
+    this.switchIncludingUnderTrashPage = this.switchIncludingUnderTrashPage.bind(this);
     this.onPagingNumberChanged = this.onPagingNumberChanged.bind(this);
   }
 
@@ -68,12 +68,12 @@ class SearchPage extends React.Component {
     return query;
   }
 
-  onExcludeUsersHome() {
-    this.setState({ excludeUsersHome: !this.state.excludeUsersHome });
+  switchIncludingUnderUserPage() {
+    this.setState({ isExcludeUnderUserPage: !this.state.isExcludeUnderUserPage });
   }
 
-  onExcludeTrash() {
-    this.setState({ excludeTrash: !this.state.excludeTrash });
+  switchIncludingUnderTrashPage() {
+    this.setState({ isExcludeUnderTrashPage: !this.state.isExcludeUnderTrashPage });
   }
 
   changeURL(keyword, refreshHash) {
@@ -91,10 +91,10 @@ class SearchPage extends React.Component {
     let query = keyword;
 
     // pages included in specific path are not retrived when prefix is added
-    if (this.state.excludeTrash) {
+    if (this.state.isExcludeUnderTrashPage) {
       query = `${query} -prefix:${specificPathNames.trash}`;
     }
-    if (this.state.excludeUsersHome) {
+    if (this.state.isExcludeUnderUserPage) {
       query = `${query} -prefix:${specificPathNames.user}`;
     }
 
@@ -224,8 +224,8 @@ class SearchPage extends React.Component {
         searchingKeyword={this.state.searchingKeyword}
         appContainer={this.props.appContainer}
         onSearchInvoked={this.searchHandler}
-        onExcludeUsersHome={this.onExcludeUsersHome}
-        onExcludeTrash={this.onExcludeTrash}
+        switchIncludingUnderUserPage={this.switchIncludingUnderUserPage}
+        switchIncludingUnderTrashPage={this.switchIncludingUnderTrashPage}
       >
       </SearchControl>
     );

+ 4 - 4
packages/app/src/components/SearchPage/FilterOptionModal.tsx

@@ -9,8 +9,8 @@ import {
 type Props = {
   isOpen: boolean,
   onClose: () => void,
-  onExcludeUsersHome?: () => void,
-  onExcludeTrash?: () => void,
+  switchIncludingUnderUserPage?: () => void,
+  switchIncludingUnderTrashPage?: () => void,
 }
 
 // todo: implement filtering search result
@@ -32,7 +32,7 @@ const FilterOptionModal: FC<Props> = (props: Props) => {
                 className="mr-2"
                 type="checkbox"
                 id="flexCheckDefault"
-                onClick={props.onExcludeUsersHome}
+                onClick={props.switchIncludingUnderUserPage}
               />
               {t('Include Subordinated Target Page', { target: '/user' })}
             </label>
@@ -43,7 +43,7 @@ const FilterOptionModal: FC<Props> = (props: Props) => {
                 className="mr-2"
                 type="checkbox"
                 id="flexCheckChecked"
-                onClick={props.onExcludeTrash}
+                onClick={props.switchIncludingUnderTrashPage}
               />
               {t('Include Subordinated Target Page', { target: '/trash' })}
             </label>

+ 12 - 12
packages/app/src/components/SearchPage/SearchControl.tsx

@@ -10,8 +10,8 @@ type Props = {
   searchingKeyword: string,
   appContainer: AppContainer,
   onSearchInvoked: (data : any[]) => boolean,
-  onExcludeUsersHome?: () => void,
-  onExcludeTrash?: () => void,
+  switchIncludingUnderUserPage?: () => void,
+  switchIncludingUnderTrashPage?: () => void,
 }
 
 const SearchControl: FC <Props> = (props: Props) => {
@@ -22,15 +22,15 @@ const SearchControl: FC <Props> = (props: Props) => {
   const SearchPageFormTypeAny : any = SearchPageForm;
   const { t } = useTranslation('');
 
-  const onExcludeUsersHome = () => {
-    if (props.onExcludeUsersHome != null) {
-      props.onExcludeUsersHome();
+  const switchIncludingUnderUserPage = () => {
+    if (props.switchIncludingUnderUserPage != null) {
+      props.switchIncludingUnderUserPage();
     }
   };
 
-  const onExcludeTrash = () => {
-    if (props.onExcludeTrash != null) {
-      props.onExcludeTrash();
+  const switchIncludingUnderTrashPage = () => {
+    if (props.switchIncludingUnderTrashPage != null) {
+      props.switchIncludingUnderTrashPage();
     }
   };
 
@@ -62,8 +62,8 @@ const SearchControl: FC <Props> = (props: Props) => {
       <FilterOptionModal
         isOpen={isFileterOptionModalShown || false}
         onClose={closePageRenameModalHandler}
-        onExcludeUsersHome={onExcludeUsersHome}
-        onExcludeTrash={onExcludeTrash}
+        switchIncludingUnderUserPage={switchIncludingUnderUserPage}
+        switchIncludingUnderTrashPage={switchIncludingUnderTrashPage}
       />
     );
   };
@@ -110,7 +110,7 @@ const SearchControl: FC <Props> = (props: Props) => {
                 className="mr-2"
                 type="checkbox"
                 id="flexCheckDefault"
-                onClick={() => onExcludeUsersHome()}
+                onClick={() => switchIncludingUnderUserPage()}
               />
               {t('Include Subordinated Target Page', { target: '/user' })}
             </label>
@@ -121,7 +121,7 @@ const SearchControl: FC <Props> = (props: Props) => {
                 className="mr-2"
                 type="checkbox"
                 id="flexCheckChecked"
-                onClick={() => onExcludeTrash()}
+                onClick={() => switchIncludingUnderTrashPage()}
               />
               {t('Include Subordinated Target Page', { target: '/trash' })}
             </label>