fix: link dependency coming from react-router-dom

This commit is contained in:
Christian Capeans 2024-04-10 10:59:56 +02:00
parent 316e5189a5
commit 6bf0ee33b0
5 changed files with 28 additions and 9 deletions

View File

@ -9,6 +9,7 @@ import { ContentLayout, EmptyStateLayout, HeaderLayout } from '@strapi/design-sy
import { LinkButton } from '@strapi/design-system/v2';
import { ArrowRight, EmptyPictures } from '@strapi/icons';
import { useIntl } from 'react-intl';
import { Link } from 'react-router-dom';
import { Page } from '../components/PageHelpers';
@ -27,7 +28,8 @@ export const InternalErrorPage = () => {
<ContentLayout>
<EmptyStateLayout
action={
<LinkButton variant="secondary" endIcon={<ArrowRight />} href="/">
// @ts-expect-error We need to accept the props of the component passed in the `as` prop
<LinkButton as={Link} variant="secondary" endIcon={<ArrowRight />} to="/">
{formatMessage({
id: 'app.components.NotFoundPage.back',
defaultMessage: 'Back to homepage',

View File

@ -8,6 +8,7 @@ import { ContentLayout, EmptyStateLayout, HeaderLayout } from '@strapi/design-sy
import { LinkButton } from '@strapi/design-system/v2';
import { ArrowRight, EmptyPictures } from '@strapi/icons';
import { useIntl } from 'react-intl';
import { Link } from 'react-router-dom';
import { Page } from '../components/PageHelpers';
@ -26,7 +27,8 @@ export const NotFoundPage = () => {
<ContentLayout>
<EmptyStateLayout
action={
<LinkButton variant="secondary" endIcon={<ArrowRight />} href="/">
// @ts-expect-error We need to accept the props of the component passed in the `as` prop
<LinkButton as={Link} variant="secondary" endIcon={<ArrowRight />} to="/">
{formatMessage({
id: 'app.components.NotFoundPage.back',
defaultMessage: 'Back to homepage',

View File

@ -6,7 +6,7 @@ import { EmptyDocuments, Plus } from '@strapi/icons';
import { Data } from '@strapi/types';
import * as qs from 'qs';
import { useIntl } from 'react-intl';
import { useNavigate } from 'react-router-dom';
import { Link, useNavigate } from 'react-router-dom';
import { useGuidedTour } from '../../../../components/GuidedTour/Provider';
import { Page } from '../../../../components/PageHelpers';
@ -147,6 +147,7 @@ export const ListView = () => {
primaryAction={
canCreate && (
<LinkButton
as={Link}
data-testid="create-api-token-button"
startIcon={<Plus />}
size="S"
@ -155,7 +156,8 @@ export const ListView = () => {
tokenType: API_TOKEN_TYPE,
})
}
href="api-tokens/create"
// @ts-expect-error We need to accept the props of the component passed in the `as` prop
to="/settings/api-tokens/create"
>
{formatMessage({
id: 'Settings.apiTokens.create',
@ -188,7 +190,13 @@ export const ListView = () => {
defaultMessage: 'Add your first API Token',
})}
action={
<LinkButton variant="secondary" startIcon={<Plus />} href="api-tokens/create">
<LinkButton
as={Link}
variant="secondary"
startIcon={<Plus />}
// @ts-expect-error We need to accept the props of the component passed in the `as` prop
to="/settings/api-tokens/create"
>
{formatMessage({
id: 'Settings.apiTokens.addNewToken',
defaultMessage: 'Add new API Token',

View File

@ -6,7 +6,7 @@ import { EmptyDocuments, Plus } from '@strapi/icons';
import { Data } from '@strapi/types';
import * as qs from 'qs';
import { useIntl } from 'react-intl';
import { useNavigate } from 'react-router-dom';
import { Link, useNavigate } from 'react-router-dom';
import { Page } from '../../../../components/PageHelpers';
import { useTypedSelector } from '../../../../core/store/hooks';
@ -160,6 +160,7 @@ const ListView = () => {
primaryAction={
canCreate ? (
<LinkButton
forwardedAs={Link}
data-testid="create-transfer-token-button"
startIcon={<Plus />}
size="S"
@ -168,7 +169,8 @@ const ListView = () => {
tokenType: TRANSFER_TOKEN_TYPE,
})
}
href="transfer-tokens/create"
// @ts-expect-error We need to accept the props of the component passed in the `as` prop
to="/settings/transfer-tokens/create"
>
{formatMessage({
id: 'Settings.transferTokens.create',
@ -197,9 +199,11 @@ const ListView = () => {
<EmptyStateLayout
action={
<LinkButton
as={Link}
variant="secondary"
startIcon={<Plus />}
href="transfer-tokens/create"
// @ts-expect-error We need to accept the props of the component passed in the `as` prop
to="/settings/transfer-tokens/create"
>
{formatMessage({
id: 'Settings.transferTokens.addNewToken',

View File

@ -3,6 +3,7 @@ import { LinkButton } from '@strapi/design-system/v2';
import { EmptyDocuments, Plus } from '@strapi/icons';
import * as qs from 'qs';
import { useIntl } from 'react-intl';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import { getTrad } from '../../utils';
@ -60,7 +61,9 @@ export const EmptyAttributes = () => {
</Box>
</Box>
<LinkButton
href={`/admin/marketplace?${qs.stringify({ categories: ['Custom fields'] })}`}
as={Link}
// @ts-expect-error We need to accept the props of the component passed in the `as` prop
to={`/marketplace?${qs.stringify({ categories: ['Custom fields'] })}`}
variant="secondary"
startIcon={<Plus />}
>