mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 19:04:38 +00:00
feedback fixes: conditional logo, refactor Stack, canSubmit, test naming
This commit is contained in:
parent
c335d3d1ee
commit
4e52ca13a3
@ -11,7 +11,7 @@ const Logo = () => {
|
|||||||
logos: { auth },
|
logos: { auth },
|
||||||
} = useConfigurations();
|
} = useConfigurations();
|
||||||
|
|
||||||
return <Img src={auth.custom} aria-hidden alt="" />;
|
return <Img src={auth?.custom ?? auth.default} aria-hidden alt="" />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Logo;
|
export default Logo;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ const render = (props) =>
|
|||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
describe('ApplicationInfosPage', () => {
|
describe('ApplicationInfosPage | AddLogoDialog', () => {
|
||||||
it('shoud render from computer tab and match snapshot', () => {
|
it('shoud render from computer tab and match snapshot', () => {
|
||||||
const { container, getByText } = render();
|
const { container, getByText } = render();
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,7 @@ const ApplicationInfosPage = () => {
|
|||||||
const {
|
const {
|
||||||
allowedActions: { canRead, canUpdate },
|
allowedActions: { canRead, canUpdate },
|
||||||
} = useRBAC(adminPermissions.settings['project-settings']);
|
} = useRBAC(adminPermissions.settings['project-settings']);
|
||||||
|
const canSubmit = canRead && canUpdate;
|
||||||
|
|
||||||
const { data } = useQuery('project-settings', fetchProjectSettings);
|
const { data } = useQuery('project-settings', fetchProjectSettings);
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ const ApplicationInfosPage = () => {
|
|||||||
<Layout>
|
<Layout>
|
||||||
<SettingsPageTitle name="Application" />
|
<SettingsPageTitle name="Application" />
|
||||||
<Main>
|
<Main>
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={canSubmit && handleSubmit}>
|
||||||
<HeaderLayout
|
<HeaderLayout
|
||||||
title={formatMessage({ id: 'Settings.application.title', defaultMessage: 'Overview' })}
|
title={formatMessage({ id: 'Settings.application.title', defaultMessage: 'Overview' })}
|
||||||
subtitle={formatMessage({
|
subtitle={formatMessage({
|
||||||
@ -100,16 +101,17 @@ const ApplicationInfosPage = () => {
|
|||||||
defaultMessage: 'Administration panel’s global information',
|
defaultMessage: 'Administration panel’s global information',
|
||||||
})}
|
})}
|
||||||
primaryAction={
|
primaryAction={
|
||||||
canRead && canUpdate ? (
|
canSubmit && (
|
||||||
<Button type="submit" startIcon={<Check />}>
|
<Button type="submit" startIcon={<Check />}>
|
||||||
{formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
|
{formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
|
||||||
</Button>
|
</Button>
|
||||||
) : null
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<ContentLayout>
|
<ContentLayout>
|
||||||
<Stack spacing={6}>
|
<Stack spacing={6}>
|
||||||
<Box
|
<Stack
|
||||||
|
spacing={5}
|
||||||
hasRadius
|
hasRadius
|
||||||
background="neutral0"
|
background="neutral0"
|
||||||
shadow="tableShadow"
|
shadow="tableShadow"
|
||||||
@ -118,96 +120,94 @@ const ApplicationInfosPage = () => {
|
|||||||
paddingRight={7}
|
paddingRight={7}
|
||||||
paddingLeft={7}
|
paddingLeft={7}
|
||||||
>
|
>
|
||||||
<Stack spacing={5}>
|
<Typography variant="delta" as="h3">
|
||||||
<Typography variant="delta" as="h3">
|
{formatMessage({
|
||||||
{formatMessage({
|
id: 'global.details',
|
||||||
id: 'global.details',
|
defaultMessage: 'Details',
|
||||||
defaultMessage: 'Details',
|
})}
|
||||||
})}
|
</Typography>
|
||||||
</Typography>
|
|
||||||
|
|
||||||
<Grid paddingTop={1}>
|
<Grid paddingTop={1}>
|
||||||
<GridItem col={6} s={12}>
|
<GridItem col={6} s={12}>
|
||||||
<Typography variant="sigma" textColor="neutral600">
|
|
||||||
{formatMessage({
|
|
||||||
id: 'Settings.application.strapiVersion',
|
|
||||||
defaultMessage: 'strapi version',
|
|
||||||
})}
|
|
||||||
</Typography>
|
|
||||||
<Typography as="p">v{strapiVersion}</Typography>
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
appInfos.communityEdition
|
|
||||||
? 'https://discord.strapi.io'
|
|
||||||
: 'https://support.strapi.io/support/home'
|
|
||||||
}
|
|
||||||
isExternal
|
|
||||||
endIcon={<ExternalLink />}
|
|
||||||
>
|
|
||||||
{formatMessage({
|
|
||||||
id: 'Settings.application.get-help',
|
|
||||||
defaultMessage: 'Get help',
|
|
||||||
})}
|
|
||||||
</Link>
|
|
||||||
</GridItem>
|
|
||||||
<GridItem col={6} s={12}>
|
|
||||||
<Typography variant="sigma" textColor="neutral600">
|
|
||||||
{formatMessage({
|
|
||||||
id: 'Settings.application.edition-title',
|
|
||||||
defaultMessage: 'current plan',
|
|
||||||
})}
|
|
||||||
</Typography>
|
|
||||||
<Typography as="p">
|
|
||||||
{formatMessage({
|
|
||||||
id: currentPlan,
|
|
||||||
defaultMessage: `${
|
|
||||||
appInfos.communityEdition ? 'Community Edition' : 'Enterprise Edition'
|
|
||||||
}`,
|
|
||||||
})}
|
|
||||||
</Typography>
|
|
||||||
</GridItem>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid paddingTop={1}>
|
|
||||||
<GridItem col={6} s={12}>
|
|
||||||
{shouldUpdateStrapi && (
|
|
||||||
<Link
|
|
||||||
href={`https://github.com/strapi/strapi/releases/tag/${latestStrapiReleaseTag}`}
|
|
||||||
isExternal
|
|
||||||
endIcon={<ExternalLink />}
|
|
||||||
>
|
|
||||||
{formatMessage({
|
|
||||||
id: 'Settings.application.link-upgrade',
|
|
||||||
defaultMessage: 'Upgrade your admin panel',
|
|
||||||
})}
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
</GridItem>
|
|
||||||
<GridItem col={6} s={12}>
|
|
||||||
<Link
|
|
||||||
href="https://strapi.io/pricing-self-hosted"
|
|
||||||
isExternal
|
|
||||||
endIcon={<ExternalLink />}
|
|
||||||
>
|
|
||||||
{formatMessage({
|
|
||||||
id: 'Settings.application.link-pricing',
|
|
||||||
defaultMessage: 'See all pricing plans',
|
|
||||||
})}
|
|
||||||
</Link>
|
|
||||||
</GridItem>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Box paddingTop={1}>
|
|
||||||
<Typography variant="sigma" textColor="neutral600">
|
<Typography variant="sigma" textColor="neutral600">
|
||||||
{formatMessage({
|
{formatMessage({
|
||||||
id: 'Settings.application.node-version',
|
id: 'Settings.application.strapiVersion',
|
||||||
defaultMessage: 'node version',
|
defaultMessage: 'strapi version',
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography as="p">{appInfos.nodeVersion}</Typography>
|
<Typography as="p">v{strapiVersion}</Typography>
|
||||||
</Box>
|
<Link
|
||||||
</Stack>
|
href={
|
||||||
</Box>
|
appInfos.communityEdition
|
||||||
|
? 'https://discord.strapi.io'
|
||||||
|
: 'https://support.strapi.io/support/home'
|
||||||
|
}
|
||||||
|
isExternal
|
||||||
|
endIcon={<ExternalLink />}
|
||||||
|
>
|
||||||
|
{formatMessage({
|
||||||
|
id: 'Settings.application.get-help',
|
||||||
|
defaultMessage: 'Get help',
|
||||||
|
})}
|
||||||
|
</Link>
|
||||||
|
</GridItem>
|
||||||
|
<GridItem col={6} s={12}>
|
||||||
|
<Typography variant="sigma" textColor="neutral600">
|
||||||
|
{formatMessage({
|
||||||
|
id: 'Settings.application.edition-title',
|
||||||
|
defaultMessage: 'current plan',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
<Typography as="p">
|
||||||
|
{formatMessage({
|
||||||
|
id: currentPlan,
|
||||||
|
defaultMessage: `${
|
||||||
|
appInfos.communityEdition ? 'Community Edition' : 'Enterprise Edition'
|
||||||
|
}`,
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
</GridItem>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid paddingTop={1}>
|
||||||
|
<GridItem col={6} s={12}>
|
||||||
|
{shouldUpdateStrapi && (
|
||||||
|
<Link
|
||||||
|
href={`https://github.com/strapi/strapi/releases/tag/${latestStrapiReleaseTag}`}
|
||||||
|
isExternal
|
||||||
|
endIcon={<ExternalLink />}
|
||||||
|
>
|
||||||
|
{formatMessage({
|
||||||
|
id: 'Settings.application.link-upgrade',
|
||||||
|
defaultMessage: 'Upgrade your admin panel',
|
||||||
|
})}
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
</GridItem>
|
||||||
|
<GridItem col={6} s={12}>
|
||||||
|
<Link
|
||||||
|
href="https://strapi.io/pricing-self-hosted"
|
||||||
|
isExternal
|
||||||
|
endIcon={<ExternalLink />}
|
||||||
|
>
|
||||||
|
{formatMessage({
|
||||||
|
id: 'Settings.application.link-pricing',
|
||||||
|
defaultMessage: 'See all pricing plans',
|
||||||
|
})}
|
||||||
|
</Link>
|
||||||
|
</GridItem>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Box paddingTop={1}>
|
||||||
|
<Typography variant="sigma" textColor="neutral600">
|
||||||
|
{formatMessage({
|
||||||
|
id: 'Settings.application.node-version',
|
||||||
|
defaultMessage: 'node version',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
<Typography as="p">{appInfos.nodeVersion}</Typography>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
{canRead && data && (
|
{canRead && data && (
|
||||||
<Form canUpdate={canUpdate} ref={inputsRef} projectSettingsStored={data} />
|
<Form canUpdate={canUpdate} ref={inputsRef} projectSettingsStored={data} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user