feedback fixes: conditional logo, refactor Stack, canSubmit, test naming

This commit is contained in:
Julie Plantey 2023-01-12 16:37:18 +01:00
parent c335d3d1ee
commit 4e52ca13a3
3 changed files with 91 additions and 91 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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 panels 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,7 +120,6 @@ const ApplicationInfosPage = () => {
paddingRight={7}
paddingLeft={7}
>
<Stack spacing={5}>
<Typography variant="delta" as="h3">
{formatMessage({
id: 'global.details',
@ -207,7 +208,6 @@ const ApplicationInfosPage = () => {
<Typography as="p">{appInfos.nodeVersion}</Typography>
</Box>
</Stack>
</Box>
{canRead && data && (
<Form canUpdate={canUpdate} ref={inputsRef} projectSettingsStored={data} />
)}