mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 03:43:34 +00:00 
			
		
		
		
	Create ProfilePage container
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
		
							parent
							
								
									b871d26eaf
								
							
						
					
					
						commit
						9bc1791d5d
					
				@ -8,7 +8,6 @@
 | 
				
			|||||||
import React, { useState } from 'react';
 | 
					import React, { useState } from 'react';
 | 
				
			||||||
import { FormattedMessage } from 'react-intl';
 | 
					import { FormattedMessage } from 'react-intl';
 | 
				
			||||||
import { withRouter } from 'react-router-dom';
 | 
					import { withRouter } from 'react-router-dom';
 | 
				
			||||||
import { get } from 'lodash';
 | 
					 | 
				
			||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
 | 
					import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
 | 
				
			||||||
import { ButtonDropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap';
 | 
					import { ButtonDropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap';
 | 
				
			||||||
import { auth } from 'strapi-helper-plugin';
 | 
					import { auth } from 'strapi-helper-plugin';
 | 
				
			||||||
@ -16,24 +15,20 @@ import Wrapper from './components';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const Logout = ({ history: { push } }) => {
 | 
					const Logout = ({ history: { push } }) => {
 | 
				
			||||||
  const [isOpen, setIsOpen] = useState(false);
 | 
					  const [isOpen, setIsOpen] = useState(false);
 | 
				
			||||||
  const toggle = () => setIsOpen(prev => !prev);
 | 
					 | 
				
			||||||
  const handleGoTo = () => {
 | 
					 | 
				
			||||||
    const id = get(auth.getUserInfo(), 'id');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const handleGoTo = () => {
 | 
				
			||||||
    push({
 | 
					    push({
 | 
				
			||||||
      pathname: `/plugins/content-manager/collectionType/strapi::administrator/${id}`,
 | 
					      pathname: `/me`,
 | 
				
			||||||
      search: '?redirectUrl=/plugins/content-manager/collectionType/strapi::administrator',
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
  const handleGoToAdministrator = () => {
 | 
					 | 
				
			||||||
    push({
 | 
					 | 
				
			||||||
      pathname: '/plugins/content-manager/collectionType/strapi::administrator',
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const handleLogout = () => {
 | 
					  const handleLogout = () => {
 | 
				
			||||||
    auth.clearAppStorage();
 | 
					    auth.clearAppStorage();
 | 
				
			||||||
    push('/auth/login');
 | 
					    push('/auth/login');
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const toggle = () => setIsOpen(prev => !prev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const userInfo = auth.getUserInfo();
 | 
					  const userInfo = auth.getUserInfo();
 | 
				
			||||||
  const displayName = userInfo.username || `${userInfo.firstname} ${userInfo.lastname}`;
 | 
					  const displayName = userInfo.username || `${userInfo.firstname} ${userInfo.lastname}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -48,9 +43,6 @@ const Logout = ({ history: { push } }) => {
 | 
				
			|||||||
          <DropdownItem onClick={handleGoTo} className="item">
 | 
					          <DropdownItem onClick={handleGoTo} className="item">
 | 
				
			||||||
            <FormattedMessage id="app.components.Logout.profile" />
 | 
					            <FormattedMessage id="app.components.Logout.profile" />
 | 
				
			||||||
          </DropdownItem>
 | 
					          </DropdownItem>
 | 
				
			||||||
          <DropdownItem onClick={handleGoToAdministrator} className="item">
 | 
					 | 
				
			||||||
            <FormattedMessage id="app.components.Logout.admin" />
 | 
					 | 
				
			||||||
          </DropdownItem>
 | 
					 | 
				
			||||||
          <DropdownItem onClick={handleLogout}>
 | 
					          <DropdownItem onClick={handleLogout}>
 | 
				
			||||||
            <FormattedMessage id="app.components.Logout.logout" />
 | 
					            <FormattedMessage id="app.components.Logout.logout" />
 | 
				
			||||||
            <FontAwesomeIcon icon="sign-out-alt" />
 | 
					            <FontAwesomeIcon icon="sign-out-alt" />
 | 
				
			||||||
 | 
				
			|||||||
@ -34,6 +34,7 @@ import NotFoundPage from '../NotFoundPage';
 | 
				
			|||||||
import OnboardingVideos from '../Onboarding';
 | 
					import OnboardingVideos from '../Onboarding';
 | 
				
			||||||
import SettingsPage from '../SettingsPage';
 | 
					import SettingsPage from '../SettingsPage';
 | 
				
			||||||
import PluginDispatcher from '../PluginDispatcher';
 | 
					import PluginDispatcher from '../PluginDispatcher';
 | 
				
			||||||
 | 
					import ProfilePage from '../ProfilePage';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  disableGlobalOverlayBlocker,
 | 
					  disableGlobalOverlayBlocker,
 | 
				
			||||||
  enableGlobalOverlayBlocker,
 | 
					  enableGlobalOverlayBlocker,
 | 
				
			||||||
@ -186,6 +187,7 @@ export class Admin extends React.Component {
 | 
				
			|||||||
            <Content>
 | 
					            <Content>
 | 
				
			||||||
              <Switch>
 | 
					              <Switch>
 | 
				
			||||||
                <Route path="/" render={props => this.renderRoute(props, HomePage)} exact />
 | 
					                <Route path="/" render={props => this.renderRoute(props, HomePage)} exact />
 | 
				
			||||||
 | 
					                <Route path="/me" component={ProfilePage} />
 | 
				
			||||||
                <Route path="/plugins/:pluginId" render={this.renderPluginDispatcher} />
 | 
					                <Route path="/plugins/:pluginId" render={this.renderPluginDispatcher} />
 | 
				
			||||||
                <Route
 | 
					                <Route
 | 
				
			||||||
                  path="/list-plugins"
 | 
					                  path="/list-plugins"
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					import React from 'react';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const ProfilePage = () => {
 | 
				
			||||||
 | 
					  return (
 | 
				
			||||||
 | 
					    <div>
 | 
				
			||||||
 | 
					      <div>COMING SOON</div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default ProfilePage;
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user