zamis 5 лет назад
Родитель
Сommit
cf7b88fbb0
2 измененных файлов с 17 добавлено и 3 удалено
  1. 1 0
      src/client/js/app.jsx
  2. 16 3
      src/client/js/components/Page/NotFoundAlert.jsx

+ 1 - 0
src/client/js/app.jsx

@@ -89,6 +89,7 @@ Object.assign(componentMappings, {
 
   'not-found-alert': <NotFoundAlert
     onPageCreateClicked={navigationContainer.setEditorMode}
+    isUser={appContainer.currentUser}
     isHidden={pageContainer.state.isForbidden || pageContainer.state.isNotCreatable || pageContainer.state.isTrashPage}
   />,
 

+ 16 - 3
src/client/js/components/Page/NotFoundAlert.jsx

@@ -1,9 +1,11 @@
 import React from 'react';
 import PropTypes from 'prop-types';
 import { withTranslation } from 'react-i18next';
+import { UncontrolledTooltip } from 'reactstrap';
+
 
 const NotFoundAlert = (props) => {
-  const { t, isHidden } = props;
+  const { t, isHidden, isUser } = props;
   function clickHandler(viewType) {
     if (props.onPageCreateClicked === null) {
       return;
@@ -15,21 +17,31 @@ const NotFoundAlert = (props) => {
     return null;
   }
 
+
   return (
     <div className="border border-info p-3">
-      <div className="col-md-12 p-0">
+      <div
+        className="col-md-12 p-0"
+        id="hoge"
+      >
         <h2 className="text-info lead">
           <i className="icon-info pr-2 font-weight-bold" aria-hidden="true"></i>
           {t('not_found_page.page_not_exist_alert')}
         </h2>
         <button
           type="button"
-          className="m-1 pl-3 pr-3 btn bg-info text-white"
+          className={`m-1 pl-3 pr-3 btn bg-info text-white ${!isUser && 'disabled'}`}
           onClick={() => { clickHandler('edit') }}
         >
           <i className="icon-note icon-fw" />
           {t('not_found_page.Create Page')}
         </button>
+
+        {!isUser && (
+        <UncontrolledTooltip placement="top" target="hoge" fade={false}>
+          {t('Not available for guest')}
+        </UncontrolledTooltip>
+      )}
       </div>
     </div>
   );
@@ -40,6 +52,7 @@ NotFoundAlert.propTypes = {
   t: PropTypes.func.isRequired, // i18next
   onPageCreateClicked: PropTypes.func,
   isHidden: PropTypes.bool.isRequired,
+  isUser: PropTypes.bool.isRequired,
 };
 
 export default withTranslation()(NotFoundAlert);