Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
f796093e
Commit
f796093e
authored
Mar 16, 2020
by
Paul Kaplan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revise comments to clarify functionality
parent
bc3a454f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
src/components/modal/report/form-step.jsx
src/components/modal/report/form-step.jsx
+2
-2
src/components/modal/report/modal.jsx
src/components/modal/report/modal.jsx
+13
-3
No files found.
src/components/modal/report/form-step.jsx
View file @
f796093e
...
@@ -34,8 +34,8 @@ class FormStep extends React.Component {
...
@@ -34,8 +34,8 @@ class FormStep extends React.Component {
}
}
render
()
{
render
()
{
const
{
onNext
,
children
,
isWaiting
,
nextLabel
}
=
this
.
props
;
const
{
onNext
,
children
,
isWaiting
,
nextLabel
}
=
this
.
props
;
//
Allow submit to be force-enabled by submitEnabled prop. Otherwise use form
validation,
//
Submit button is enabled if form isn't already submitting, and either the form passes
validation,
//
with default being not-submittable
.
//
or the submitEnabled prop is true. This lets submitEnabled prop override validation
.
const
submitEnabled
=
(
this
.
props
.
submitEnabled
||
this
.
state
.
valid
)
&&
!
isWaiting
;
const
submitEnabled
=
(
this
.
props
.
submitEnabled
||
this
.
state
.
valid
)
&&
!
isWaiting
;
const
submitDisabledParam
=
submitEnabled
?
{}
:
{
disabled
:
'
disabled
'
};
const
submitDisabledParam
=
submitEnabled
?
{}
:
{
disabled
:
'
disabled
'
};
return
(
return
(
...
...
src/components/modal/report/modal.jsx
View file @
f796093e
...
@@ -19,8 +19,8 @@ const {reportOptionsShape, REPORT_OPTIONS} = require('./report-options.js');
...
@@ -19,8 +19,8 @@ const {reportOptionsShape, REPORT_OPTIONS} = require('./report-options.js');
require
(
'
../../forms/button.scss
'
);
require
(
'
../../forms/button.scss
'
);
require
(
'
./modal.scss
'
);
require
(
'
./modal.scss
'
);
//
Progression component only addresses steps by number, but this flow
//
The Progression component uses numbers to track which step it's on, but that's
//
may skip steps so the code is easier to read with a map
.
//
hard to read. Make the code easier to read by giving each step number a label
.
const
STEPS
=
{
const
STEPS
=
{
category
:
0
,
category
:
0
,
textInput
:
1
,
textInput
:
1
,
...
@@ -66,6 +66,11 @@ class ReportModal extends React.Component {
...
@@ -66,6 +66,11 @@ class ReportModal extends React.Component {
const
contentLabel
=
intl
.
formatMessage
({
id
:
`report.
${
type
}
`
});
const
contentLabel
=
intl
.
formatMessage
({
id
:
`report.
${
type
}
`
});
const
categoryRequiredMessage
=
intl
.
formatMessage
({
id
:
'
report.reasonMissing
'
});
const
categoryRequiredMessage
=
intl
.
formatMessage
({
id
:
'
report.reasonMissing
'
});
const
category
=
reportOptions
.
find
(
o
=>
o
.
value
===
this
.
state
.
categoryValue
)
||
reportOptions
[
0
];
const
category
=
reportOptions
.
find
(
o
=>
o
.
value
===
this
.
state
.
categoryValue
)
||
reportOptions
[
0
];
// Confirmation step is shown if a report has been submitted, even if state is reset by closing the modal.
// This prevents multiple report submission within the same session because submission is stored in redux.
const
step
=
isConfirmed
?
STEPS
.
confirmation
:
this
.
state
.
step
;
return
(
return
(
<
Modal
<
Modal
useStandardSizes
useStandardSizes
...
@@ -85,7 +90,8 @@ class ReportModal extends React.Component {
...
@@ -85,7 +90,8 @@ class ReportModal extends React.Component {
<
FormattedMessage
id=
"report.error"
/>
<
FormattedMessage
id=
"report.error"
/>
</
div
>
</
div
>
)
}
)
}
<
Progression
step=
{
isConfirmed
?
STEPS
.
confirmation
:
this
.
state
.
step
}
>
<
Progression
step=
{
step
}
>
{
/* Category selection step */
}
<
FormStep
<
FormStep
nextLabel=
{
{
id
:
'
general.next
'
}
}
nextLabel=
{
{
id
:
'
general.next
'
}
}
onNext=
{
this
.
handleSetCategory
}
onNext=
{
this
.
handleSetCategory
}
...
@@ -118,6 +124,8 @@ class ReportModal extends React.Component {
...
@@ -118,6 +124,8 @@ class ReportModal extends React.Component {
}
}
}
}
/>
/>
</
FormStep
>
</
FormStep
>
{
/* Text input step */
}
<
FormStep
<
FormStep
isWaiting=
{
isWaiting
}
isWaiting=
{
isWaiting
}
nextLabel=
{
{
id
:
'
report.send
'
}
}
nextLabel=
{
{
id
:
'
report.send
'
}
}
...
@@ -147,6 +155,8 @@ class ReportModal extends React.Component {
...
@@ -147,6 +155,8 @@ class ReportModal extends React.Component {
}
}
}
}
/>
/>
</
FormStep
>
</
FormStep
>
{
/* Confirmation step */
}
<
FormStep
<
FormStep
submitEnabled
submitEnabled
nextLabel=
{
{
id
:
'
general.close
'
}
}
nextLabel=
{
{
id
:
'
general.close
'
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment