mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +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 },
|
||||
} = useConfigurations();
|
||||
|
||||
return <Img src={auth.custom} aria-hidden alt="" />;
|
||||
return <Img src={auth?.custom ?? auth.default} aria-hidden alt="" />;
|
||||
};
|
||||
|
||||
export default Logo;
|
||||
|
||||
@ -14,7 +14,7 @@ const render = (props) =>
|
||||
</ThemeProvider>
|
||||
);
|
||||
|
||||
describe('ApplicationInfosPage', () => {
|
||||
describe('ApplicationInfosPage | AddLogoDialog', () => {
|
||||
it('shoud render from computer tab and match snapshot', () => {
|
||||
const { container, getByText } = render();
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ const ApplicationInfosPage = () => {
|
||||
const {
|
||||
allowedActions: { canRead, canUpdate },
|
||||
} = useRBAC(adminPermissions.settings['project-settings']);
|
||||
const canSubmit = canRead && canUpdate;
|
||||
|
||||
const { data } = useQuery('project-settings', fetchProjectSettings);
|
||||
|
||||
@ -92,7 +93,7 @@ const ApplicationInfosPage = () => {
|
||||
<Layout>
|
||||
<SettingsPageTitle name="Application" />
|
||||
<Main>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<form onSubmit={canSubmit && handleSubmit}>
|
||||
<HeaderLayout
|
||||
title={formatMessage({ id: 'Settings.application.title', defaultMessage: 'Overview' })}
|
||||
subtitle={formatMessage({
|
||||
@ -100,16 +101,17 @@ const ApplicationInfosPage = () => {
|
||||
defaultMessage: 'Administration panel’s global information',
|
||||
})}
|
||||
primaryAction={
|
||||
canRead && canUpdate ? (
|
||||
canSubmit && (
|
||||
<Button type="submit" startIcon={<Check />}>
|
||||
{formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
|
||||
</Button>
|
||||
) : null
|
||||
)
|
||||
}
|
||||
/>
|
||||
<ContentLayout>
|
||||
<Stack spacing={6}>
|
||||
<Box
|
||||
<Stack
|
||||
spacing={5}
|
||||
hasRadius
|
||||
background="neutral0"
|
||||
shadow="tableShadow"
|
||||
@ -118,96 +120,94 @@ const ApplicationInfosPage = () => {
|
||||
paddingRight={7}
|
||||
paddingLeft={7}
|
||||
>
|
||||
<Stack spacing={5}>
|
||||
<Typography variant="delta" as="h3">
|
||||
{formatMessage({
|
||||
id: 'global.details',
|
||||
defaultMessage: 'Details',
|
||||
})}
|
||||
</Typography>
|
||||
<Typography variant="delta" as="h3">
|
||||
{formatMessage({
|
||||
id: 'global.details',
|
||||
defaultMessage: 'Details',
|
||||
})}
|
||||
</Typography>
|
||||
|
||||
<Grid paddingTop={1}>
|
||||
<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}>
|
||||
<Grid paddingTop={1}>
|
||||
<GridItem col={6} s={12}>
|
||||
<Typography variant="sigma" textColor="neutral600">
|
||||
{formatMessage({
|
||||
id: 'Settings.application.node-version',
|
||||
defaultMessage: 'node version',
|
||||
id: 'Settings.application.strapiVersion',
|
||||
defaultMessage: 'strapi version',
|
||||
})}
|
||||
</Typography>
|
||||
<Typography as="p">{appInfos.nodeVersion}</Typography>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Box>
|
||||
<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">
|
||||
{formatMessage({
|
||||
id: 'Settings.application.node-version',
|
||||
defaultMessage: 'node version',
|
||||
})}
|
||||
</Typography>
|
||||
<Typography as="p">{appInfos.nodeVersion}</Typography>
|
||||
</Box>
|
||||
</Stack>
|
||||
{canRead && data && (
|
||||
<Form canUpdate={canUpdate} ref={inputsRef} projectSettingsStored={data} />
|
||||
)}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user