PluginProbe
CryptX / 4.2.1
CryptX v4.2.1
4.2.1 4.2.0 4.1.1 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9 2.0 2.1 2.2 2.3 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 All 93 releases
← All changes | src/components/SettingsTab.js +24 -5 4.1.14.2.1 View file →
@@ -1,10 +1,11 @@
1 1 /**
2 2 * One settings tab: the fields that belong to it, grouped into sections.
3 3 *
4 - * The appearance tab additionally carries the preview, because that is the one
5 - * place where seeing the result answers the question faster than reading about
6 - * it.
4 + * Two tabs carry something that is not a setting: Appearance shows the preview,
5 + * because seeing the result answers the question faster than reading about it,
6 + * and Advanced offers to replace the encryption secrets, because that is an
7 + * action and belongs where somebody would look for it.
7 8 */
8 9
9 10 import { Card, CardBody, CardHeader } from '@wordpress/components';
10 11
@@ -9,12 +10,21 @@
9 10 import { Card, CardBody, CardHeader } from '@wordpress/components';
10 11
11 12 import Field, { isVisible } from './Field';
12 13 import Preview from './Preview';
14 +import Secrets from './Secrets';
13 15
14 16 const APPEARANCE_TAB = 'appearance';
17 +const ADVANCED_TAB = 'advanced';
15 18
16 -export default function SettingsTab( { tab, fields, values, onChange } ) {
19 +export default function SettingsTab( {
20 + tab,
21 + fields,
22 + values,
23 + onChange,
24 + rotatedAt,
25 + isNetwork = false,
26 +} ) {
17 27 const forThisTab = fields.filter(
18 28 ( field ) => field.tab === tab && isVisible( field, values )
19 29 );
20 30
@@ -39,9 +49,14 @@
39 49 role="tabpanel"
40 50 id={ `cryptx-panel-${ tab }` }
41 51 aria-labelledby={ `cryptx-tab-${ tab }` }
42 52 >
43 - { tab === APPEARANCE_TAB && <Preview values={ values } /> }
53 + { /* Neither belongs on the network defaults: the preview renders
54 + with THIS site's secret and settings, and the secrets are per
55 + site by design -- there is no network-wide one to replace. */ }
56 + { tab === APPEARANCE_TAB && ! isNetwork && (
57 + <Preview values={ values } />
58 + ) }
44 59
45 60 { sections.map( ( section ) => (
46 61 <Card key={ section.title } className="cryptx-section">
47 62 <CardHeader>
@@ -63,7 +78,11 @@
63 78 </div>
64 79 </CardBody>
65 80 </Card>
66 81 ) ) }
82 +
83 + { tab === ADVANCED_TAB && ! isNetwork && (
84 + <Secrets rotatedAt={ rotatedAt } />
85 + ) }
67 86 </div>
68 87 );
69 88 }