mirror of
https://github.com/strapi/strapi.git
synced 2025-09-22 06:50:51 +00:00
Merge branch 'main' into chore/tracking-edit-field-name
This commit is contained in:
commit
882eccae19
@ -2,7 +2,7 @@ import React, { useRef, useState } from 'react';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
import { NavLink as RouterNavLink } from 'react-router-dom';
|
import { NavLink as RouterNavLink, useLocation } from 'react-router-dom';
|
||||||
import { Divider } from '@strapi/design-system/Divider';
|
import { Divider } from '@strapi/design-system/Divider';
|
||||||
import {
|
import {
|
||||||
MainNav,
|
MainNav,
|
||||||
@ -19,7 +19,7 @@ import { Typography } from '@strapi/design-system/Typography';
|
|||||||
import { Stack } from '@strapi/design-system/Stack';
|
import { Stack } from '@strapi/design-system/Stack';
|
||||||
import Write from '@strapi/icons/Write';
|
import Write from '@strapi/icons/Write';
|
||||||
import Exit from '@strapi/icons/Exit';
|
import Exit from '@strapi/icons/Exit';
|
||||||
import { auth, usePersistentState, useAppInfos } from '@strapi/helper-plugin';
|
import { auth, usePersistentState, useAppInfos, useTracking } from '@strapi/helper-plugin';
|
||||||
import useConfigurations from '../../hooks/useConfigurations';
|
import useConfigurations from '../../hooks/useConfigurations';
|
||||||
|
|
||||||
const LinkUserWrapper = styled(Box)`
|
const LinkUserWrapper = styled(Box)`
|
||||||
@ -59,6 +59,8 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|||||||
const [condensed, setCondensed] = usePersistentState('navbar-condensed', false);
|
const [condensed, setCondensed] = usePersistentState('navbar-condensed', false);
|
||||||
const { userDisplayName } = useAppInfos();
|
const { userDisplayName } = useAppInfos();
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
const { trackUsage } = useTracking();
|
||||||
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
const initials = userDisplayName
|
const initials = userDisplayName
|
||||||
.split(' ')
|
.split(' ')
|
||||||
@ -82,6 +84,10 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleClickOnLink = (destination = null) => {
|
||||||
|
trackUsage('willNavigate', { from: pathname, to: destination });
|
||||||
|
};
|
||||||
|
|
||||||
const menuTitle = formatMessage({
|
const menuTitle = formatMessage({
|
||||||
id: 'app.components.LeftMenu.navbrand.title',
|
id: 'app.components.LeftMenu.navbrand.title',
|
||||||
defaultMessage: 'Strapi Dashboard',
|
defaultMessage: 'Strapi Dashboard',
|
||||||
@ -110,7 +116,12 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<NavSections>
|
<NavSections>
|
||||||
<NavLink as={RouterNavLink} to="/content-manager" icon={<Write />}>
|
<NavLink
|
||||||
|
as={RouterNavLink}
|
||||||
|
to="/content-manager"
|
||||||
|
icon={<Write />}
|
||||||
|
onClick={() => handleClickOnLink('/content-manager')}
|
||||||
|
>
|
||||||
{formatMessage({ id: 'global.content-manager', defaultMessage: 'Content manager' })}
|
{formatMessage({ id: 'global.content-manager', defaultMessage: 'Content manager' })}
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
|
||||||
@ -125,7 +136,13 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|||||||
const Icon = link.icon;
|
const Icon = link.icon;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavLink as={RouterNavLink} to={link.to} key={link.to} icon={<Icon />}>
|
<NavLink
|
||||||
|
as={RouterNavLink}
|
||||||
|
to={link.to}
|
||||||
|
key={link.to}
|
||||||
|
icon={<Icon />}
|
||||||
|
onClick={() => handleClickOnLink(link.to)}
|
||||||
|
>
|
||||||
{formatMessage(link.intlLabel)}
|
{formatMessage(link.intlLabel)}
|
||||||
</NavLink>
|
</NavLink>
|
||||||
);
|
);
|
||||||
@ -152,6 +169,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|||||||
to={link.to}
|
to={link.to}
|
||||||
key={link.to}
|
key={link.to}
|
||||||
icon={<LinkIcon />}
|
icon={<LinkIcon />}
|
||||||
|
onClick={() => handleClickOnLink(link.to)}
|
||||||
>
|
>
|
||||||
{formatMessage(link.intlLabel)}
|
{formatMessage(link.intlLabel)}
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
@ -229,14 +229,14 @@ FormApiTokenContainer.propTypes = {
|
|||||||
values: PropTypes.shape({
|
values: PropTypes.shape({
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
description: PropTypes.string,
|
description: PropTypes.string,
|
||||||
lifespan: PropTypes.string,
|
lifespan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
type: PropTypes.string,
|
type: PropTypes.string,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
isCreating: PropTypes.bool.isRequired,
|
isCreating: PropTypes.bool.isRequired,
|
||||||
apiToken: PropTypes.shape({
|
apiToken: PropTypes.shape({
|
||||||
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
type: PropTypes.string,
|
type: PropTypes.string,
|
||||||
lifespan: PropTypes.number,
|
lifespan: PropTypes.string,
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
accessKey: PropTypes.string,
|
accessKey: PropTypes.string,
|
||||||
permissions: PropTypes.array,
|
permissions: PropTypes.array,
|
||||||
|
@ -50,7 +50,7 @@ FormBody.propTypes = {
|
|||||||
apiToken: PropTypes.shape({
|
apiToken: PropTypes.shape({
|
||||||
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
type: PropTypes.string,
|
type: PropTypes.string,
|
||||||
lifespan: PropTypes.number,
|
lifespan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
accessKey: PropTypes.string,
|
accessKey: PropTypes.string,
|
||||||
permissions: PropTypes.array,
|
permissions: PropTypes.array,
|
||||||
|
@ -69,7 +69,7 @@ FormHead.propTypes = {
|
|||||||
apiToken: PropTypes.shape({
|
apiToken: PropTypes.shape({
|
||||||
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
type: PropTypes.string,
|
type: PropTypes.string,
|
||||||
lifespan: PropTypes.number,
|
lifespan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
accessKey: PropTypes.string,
|
accessKey: PropTypes.string,
|
||||||
permissions: PropTypes.array,
|
permissions: PropTypes.array,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user