Skip to content

Commit 992fad0

Browse files
authored
Dashboard v2: Update Notice's in defensive mode settings (#103872)
1 parent 3c1493f commit 992fad0

File tree

1 file changed

+38
-36
lines changed
  • client/dashboard/sites/settings-defensive-mode

1 file changed

+38
-36
lines changed

client/dashboard/sites/settings-defensive-mode/index.tsx

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {
99
__experimentalVStack as VStack,
1010
__experimentalText as Text,
1111
Button,
12-
Notice,
1312
} from '@wordpress/components';
1413
import { useDispatch } from '@wordpress/data';
1514
import { createInterpolateElement } from '@wordpress/element';
1615
import { __, sprintf } from '@wordpress/i18n';
1716
import { store as noticesStore } from '@wordpress/notices';
1817
import { useState } from 'react';
1918
import { siteQuery, siteDefensiveModeQuery, siteDefensiveModeMutation } from '../../app/queries';
19+
import Notice from '../../components/notice';
2020
import PageLayout from '../../components/page-layout';
2121
import SettingsPageHeader from '../settings-page-header';
2222
import type { DefensiveModeSettingsUpdate, Site } from '../../data/types';
@@ -120,42 +120,46 @@ export default function DefensiveModeSettings( { siteSlug }: { siteSlug: string
120120
};
121121

122122
return (
123-
<Notice status="success" isDismissible={ false }>
124-
<Text as="p">{ __( 'Defensive mode is enabled' ) }</Text>
123+
<Notice
124+
variant="success"
125+
title={ __( 'Defensive mode is enabled' ) }
126+
actions={
127+
! enabled_by_a11n && (
128+
<Button
129+
variant="primary"
130+
type="submit"
131+
isBusy={ isPending }
132+
disabled={ isPending }
133+
onClick={ handleDisable }
134+
>
135+
{ __( 'Disable' ) }
136+
</Button>
137+
)
138+
}
139+
>
140+
<VStack>
141+
{ enabled_by_a11n && (
142+
<Text as="p">
143+
{ createInterpolateElement(
144+
__(
145+
'We’ve enabled defensive mode to protect your site. <link>Contact a Happiness Engineer</link> if you need assistance.'
146+
),
147+
{
148+
// @ts-expect-error children prop is injected by createInterpolateElement
149+
link: <ExternalLink href="/help/contact" />,
150+
}
151+
) }
152+
</Text>
153+
) }
125154

126-
{ enabled_by_a11n && (
127155
<Text as="p">
128-
{ createInterpolateElement(
129-
__(
130-
'We’ve enabled defensive mode to protect your site. <link>Contact a Happiness Engineer</link> if you need assistance.'
131-
),
132-
{
133-
// @ts-expect-error children prop is injected by createInterpolateElement
134-
link: <ExternalLink href="/help/contact" />,
135-
}
156+
{ sprintf(
157+
// translators: %s: timestamp, e.g. May 27, 2025 11:02 AM
158+
__( 'This will be automatically disabled on %s.' ),
159+
enabledUntil
136160
) }
137161
</Text>
138-
) }
139-
140-
<Text as="p">
141-
{ sprintf(
142-
// translators: %s: timestamp, e.g. May 27, 2025 11:02 AM
143-
__( 'This will be automatically disabled on %s.' ),
144-
enabledUntil
145-
) }
146-
</Text>
147-
148-
{ ! enabled_by_a11n && (
149-
<Button
150-
variant="primary"
151-
type="submit"
152-
isBusy={ isPending }
153-
disabled={ isPending }
154-
onClick={ handleDisable }
155-
>
156-
{ __( 'Disable' ) }
157-
</Button>
158-
) }
162+
</VStack>
159163
</Notice>
160164
);
161165
};
@@ -171,9 +175,7 @@ export default function DefensiveModeSettings( { siteSlug }: { siteSlug: string
171175

172176
return (
173177
<VStack spacing={ 8 }>
174-
<Notice status="info" isDismissible={ false }>
175-
<Text>{ __( 'Defensive mode is disabled' ) }</Text>
176-
</Notice>
178+
<Notice>{ __( 'Defensive mode is disabled.' ) }</Notice>
177179
<Card>
178180
<CardBody>
179181
<VStack spacing={ 8 } style={ { padding: '8px 0' } }>

0 commit comments

Comments
 (0)