Skip to content

Commit 04e2416

Browse files
svfcodeCopilot
andauthored
Mod. React. Continue switch auth block. (#640)
* Mod. React. Continue switch auth block. * Mod. React. Switch auth block. * fix eslint * fix psalm * upd * fix hints * upd hint again * Fix. Settings. Fix 2fa option switch. * ref by review * ref by review * fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Upd. Settings. Improve modal layout. * reminify * fix eslint --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9b701b0 commit 04e2416

35 files changed

Lines changed: 1460 additions & 930 deletions

css/spbc-settings.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/src/spbc-settings.css

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,32 @@
3939
100% { clip-path: polygon(50% 0%, 50% 0, 50% 0, 50% 0, 50% 0, 50% 0, 50% 0, 50% 50%, 50% 50%); }
4040
}
4141

42-
#confirmation-code--resend .circle{
42+
#confirmation-code--resend .circle,
43+
.spbc-2fa-confirmation-resend .circle{
4344
margin-left: 5px;
4445
display: inline-block;
4546
vertical-align: text-bottom;
4647
}
4748

49+
/** 2FA confirmation modal: input + Resend on one row (narrow dialog vs .regular-text 25em) */
50+
.spbc-2fa-confirmation-row{
51+
display: flex;
52+
flex-direction: row;
53+
align-items: center;
54+
gap: 10px;
55+
margin: 1em 0;
56+
}
57+
.spbc-2fa-confirmation-row .spbc-2fa-confirmation-input{
58+
flex: 1 1 auto;
59+
min-width: 0;
60+
width: auto !important;
61+
max-width: 100%;
62+
box-sizing: border-box;
63+
}
64+
.spbc-2fa-confirmation-row .spbc-2fa-confirmation-resend{
65+
flex-shrink: 0;
66+
}
67+
4868
.spbc---hidden{display: none;}
4969
.spbc---gray{color: gray;}
5070
.spbc---red{color: red;}

inc/spbc-settings.php

Lines changed: 8 additions & 231 deletions
Large diffs are not rendered by default.

js/public/spbct-react-bundle.js

Lines changed: 293 additions & 173 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/spbc-settings.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/spbc-settings.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/react/components/App.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, {createContext} from 'react';
22
import Header from '../pageElements/Header/Header';
33
import ServiceButtons from '../pageElements/ServiceButtons/ServiceButtons';
4-
import HiddenElements from '../pageElements/HiddenElements/HiddenElements';
54
import Tabs from '../pageElements/Tabs/Tabs';
65

76
export const DataRootContext = createContext(null);
@@ -27,7 +26,6 @@ export default function App({dataRoot, dataTabs}) {
2726
<DataTabsContext.Provider value={dataTabs}>
2827
<Header data={dataRoot} />
2928
<ServiceButtons />
30-
<HiddenElements data={dataRoot} />
3129
<Tabs data={dataTabs} />
3230
</DataTabsContext.Provider>
3331
</DataRootContext.Provider>

js/src/react/components/FormElements/InputRadioGroup.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useState} from 'react';
1+
import React, {useState, useEffect} from 'react';
22

33
/**
44
* InputRadioGroup component
@@ -24,6 +24,10 @@ export default function InputRadioGroup({
2424
}) {
2525
const [selectedValue, setSelectedValue] = useState(String(initialValue ?? ''));
2626

27+
useEffect(() => {
28+
setSelectedValue(String(initialValue ?? ''));
29+
}, [initialValue]);
30+
2731
const handleChange = (event) => {
2832
const newValue = event.target.value;
2933
setSelectedValue(newValue);

js/src/react/components/FormElements/Select.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,25 @@ export default function Select({
99
className = '',
1010
disabled = false,
1111
placeholder = '',
12+
multiple = false,
1213
...props
1314
}) {
14-
const [selectedValue, setSelectedValue] = useState(initialValue || '');
15+
const [selectedValue, setSelectedValue] = useState(
16+
initialValue !== undefined ?
17+
initialValue :
18+
(multiple ? [] : ''),
19+
);
1520

1621
useEffect(() => {
1722
if (initialValue !== undefined) {
1823
setSelectedValue(initialValue);
1924
}
20-
}, [initialValue]);
25+
}, [initialValue, multiple]);
2126

2227
const handleChange = (event) => {
23-
const newValue = event.target.value;
28+
const newValue = multiple ?
29+
Array.from(event.target.selectedOptions, (option) => option.value) :
30+
event.target.value;
2431
setSelectedValue(newValue);
2532

2633
// Call `onChange` from props, if exists
@@ -37,6 +44,7 @@ export default function Select({
3744
onChange={handleChange}
3845
className={className}
3946
disabled={disabled}
47+
multiple={multiple}
4048
{...props}
4149
>
4250
{placeholder && (

js/src/react/components/TabContent/TabSettingsGeneral/Settings.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,18 @@ import SettingsGroup from './SettingsGroup';
33
const {__} = wp.i18n;
44

55
export default function Settings(props) {
6-
const {settingsSlug, settings, keyIsOk} = props;
6+
const {
7+
settingsSlug,
8+
settings,
9+
keyIsOk,
10+
wpUserRolesOptions,
11+
verificationEmail,
12+
authLoginPageUrl,
13+
techSupportUrlPrefix,
14+
loginRenameNotifyAdminEmail,
15+
canActivatePlugins,
16+
shuffleSaltsUnlocked,
17+
} = props;
718

819
const settingKeys = Object.keys(settings || {});
920

@@ -24,6 +35,13 @@ export default function Settings(props) {
2435
settingsSlug={settingsSlug}
2536
settings={settings[sectionGroupId]}
2637
keyIsOk={keyIsOk}
38+
wpUserRolesOptions={wpUserRolesOptions}
39+
verificationEmail={verificationEmail}
40+
authLoginPageUrl={authLoginPageUrl}
41+
techSupportUrlPrefix={techSupportUrlPrefix}
42+
loginRenameNotifyAdminEmail={loginRenameNotifyAdminEmail}
43+
canActivatePlugins={canActivatePlugins}
44+
shuffleSaltsUnlocked={shuffleSaltsUnlocked}
2745
/>;
2846
}
2947
if (
@@ -37,6 +55,13 @@ export default function Settings(props) {
3755
settingsSlug={settingsSlug}
3856
settings={settings[sectionGroupId]}
3957
keyIsOk={keyIsOk}
58+
wpUserRolesOptions={wpUserRolesOptions}
59+
verificationEmail={verificationEmail}
60+
authLoginPageUrl={authLoginPageUrl}
61+
techSupportUrlPrefix={techSupportUrlPrefix}
62+
loginRenameNotifyAdminEmail={loginRenameNotifyAdminEmail}
63+
canActivatePlugins={canActivatePlugins}
64+
shuffleSaltsUnlocked={shuffleSaltsUnlocked}
4065
/>;
4166
}
4267
return null;

0 commit comments

Comments
 (0)