mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 08:52:26 +00:00
fixed translations
This commit is contained in:
parent
c59cced54b
commit
324b1628f6
@ -147,7 +147,10 @@ export const BrowseStep = ({
|
|||||||
<Breadcrumbs
|
<Breadcrumbs
|
||||||
onChangeFolder={onChangeFolder}
|
onChangeFolder={onChangeFolder}
|
||||||
as="nav"
|
as="nav"
|
||||||
label="hello"
|
label={formatMessage({
|
||||||
|
id: getTrad('header.breadcrumbs.nav.label'),
|
||||||
|
defaultMessage: 'Folders navigation',
|
||||||
|
})}
|
||||||
breadcrumbs={breadcrumbs}
|
breadcrumbs={breadcrumbs}
|
||||||
currentFolderId={queryObject?.folder}
|
currentFolderId={queryObject?.folder}
|
||||||
/>
|
/>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
|
import { useIntl } from 'react-intl';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Crumb,
|
Crumb,
|
||||||
@ -10,49 +11,53 @@ import {
|
|||||||
import { CrumbSimpleMenuAsync } from './CrumbSimpleMenuAsync';
|
import { CrumbSimpleMenuAsync } from './CrumbSimpleMenuAsync';
|
||||||
import { BreadcrumbsDefinition } from '../../constants';
|
import { BreadcrumbsDefinition } from '../../constants';
|
||||||
|
|
||||||
export const Breadcrumbs = ({ breadcrumbs, onChangeFolder, currentFolderId, ...props }) => (
|
export const Breadcrumbs = ({ breadcrumbs, onChangeFolder, currentFolderId, ...props }) => {
|
||||||
<BaseBreadcrumbs {...props}>
|
const { formatMessage } = useIntl();
|
||||||
{breadcrumbs.map((crumb, index) => {
|
|
||||||
if (Array.isArray(crumb)) {
|
|
||||||
return (
|
|
||||||
<CrumbSimpleMenuAsync
|
|
||||||
parentsToOmit={[...breadcrumbs]
|
|
||||||
.splice(index + 1, breadcrumbs.length - 1)
|
|
||||||
.map(parent => parent.id)}
|
|
||||||
key={`breadcrumb-${crumb?.id ?? 'menu'}`}
|
|
||||||
currentFolderId={currentFolderId}
|
|
||||||
onChangeFolder={onChangeFolder}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const isCurrentFolderMediaLibrary = crumb.id === null && currentFolderId === undefined;
|
return (
|
||||||
|
<BaseBreadcrumbs {...props}>
|
||||||
|
{breadcrumbs.map((crumb, index) => {
|
||||||
|
if (Array.isArray(crumb)) {
|
||||||
|
return (
|
||||||
|
<CrumbSimpleMenuAsync
|
||||||
|
parentsToOmit={[...breadcrumbs]
|
||||||
|
.splice(index + 1, breadcrumbs.length - 1)
|
||||||
|
.map(parent => parent.id)}
|
||||||
|
key={`breadcrumb-${crumb?.id ?? 'menu'}`}
|
||||||
|
currentFolderId={currentFolderId}
|
||||||
|
onChangeFolder={onChangeFolder}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const isCurrentFolderMediaLibrary = crumb.id === null && currentFolderId === undefined;
|
||||||
|
|
||||||
|
if (currentFolderId !== crumb.id && !isCurrentFolderMediaLibrary) {
|
||||||
|
return (
|
||||||
|
<CrumbLink
|
||||||
|
key={`breadcrumb-${crumb?.id ?? 'root'}`}
|
||||||
|
as={onChangeFolder ? 'button' : NavLink}
|
||||||
|
type={onChangeFolder && 'button'}
|
||||||
|
to={onChangeFolder ? undefined : crumb.href}
|
||||||
|
onClick={onChangeFolder && (() => onChangeFolder(crumb.id))}
|
||||||
|
>
|
||||||
|
{crumb.label?.id ? formatMessage(crumb.label) : crumb.label}
|
||||||
|
</CrumbLink>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (currentFolderId !== crumb.id && !isCurrentFolderMediaLibrary) {
|
|
||||||
return (
|
return (
|
||||||
<CrumbLink
|
<Crumb
|
||||||
key={`breadcrumb-${crumb?.id ?? 'root'}`}
|
key={`breadcrumb-${crumb?.id ?? 'root'}`}
|
||||||
as={onChangeFolder ? 'button' : NavLink}
|
isCurrent={index + 1 === breadcrumbs.length}
|
||||||
type={onChangeFolder && 'button'}
|
|
||||||
to={onChangeFolder ? undefined : crumb.href}
|
|
||||||
onClick={onChangeFolder && (() => onChangeFolder(crumb.id))}
|
|
||||||
>
|
>
|
||||||
{crumb.label}
|
{crumb.label?.id ? formatMessage(crumb.label) : crumb.label}
|
||||||
</CrumbLink>
|
</Crumb>
|
||||||
);
|
);
|
||||||
}
|
})}
|
||||||
|
</BaseBreadcrumbs>
|
||||||
return (
|
);
|
||||||
<Crumb
|
};
|
||||||
key={`breadcrumb-${crumb?.id ?? 'root'}`}
|
|
||||||
isCurrent={index + 1 === breadcrumbs.length}
|
|
||||||
>
|
|
||||||
{crumb.label}
|
|
||||||
</Crumb>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</BaseBreadcrumbs>
|
|
||||||
);
|
|
||||||
|
|
||||||
Breadcrumbs.defaultProps = {
|
Breadcrumbs.defaultProps = {
|
||||||
currentFolderId: undefined,
|
currentFolderId: undefined,
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
import getTrad from './getTrad';
|
||||||
|
|
||||||
const getBreadcrumbDataML = folder => {
|
const getBreadcrumbDataML = folder => {
|
||||||
let data = [
|
let data = [
|
||||||
{
|
{
|
||||||
id: null,
|
id: null,
|
||||||
label: 'Media Library',
|
label: { id: getTrad('plugin.name'), defaultMessage: 'MediaLibrary' },
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
|
import getTrad from './getTrad';
|
||||||
import getFolderURL from './getFolderURL';
|
import getFolderURL from './getFolderURL';
|
||||||
|
|
||||||
const getBreadcrumbDataML = (folder, { pathname, query }) => {
|
const getBreadcrumbDataML = (folder, { pathname, query }) => {
|
||||||
let data = [
|
let data = [
|
||||||
{
|
{
|
||||||
id: null,
|
id: null,
|
||||||
label: 'Media Library',
|
label: { id: getTrad('plugin.name'), defaultMessage: 'MediaLibrary' },
|
||||||
href: folder ? getFolderURL(pathname, query) : undefined,
|
href: folder ? getFolderURL(pathname, query) : undefined,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user