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
903eef96
Commit
903eef96
authored
May 06, 2021
by
Paul Kaplan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow Enter key to submit curator and project adders
parent
37851083
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
18 deletions
+20
-18
src/views/studio/studio-curator-inviter.jsx
src/views/studio/studio-curator-inviter.jsx
+10
-9
src/views/studio/studio-project-adder.jsx
src/views/studio/studio-project-adder.jsx
+10
-9
No files found.
src/views/studio/studio-curator-inviter.jsx
View file @
903eef96
...
...
@@ -10,7 +10,14 @@ const StudioCuratorInviter = ({onSubmit}) => {
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
submitting
,
setSubmitting
]
=
useState
(
false
);
const
[
error
,
setError
]
=
useState
(
null
);
const
submit
=
()
=>
{
setSubmitting
(
true
);
setError
(
null
);
onSubmit
(
value
)
.
then
(()
=>
setValue
(
''
))
.
catch
(
e
=>
setError
(
e
))
.
then
(()
=>
setSubmitting
(
false
));
};
return
(
<
div
className=
"studio-adder-section"
>
<
h3
>
✦ Invite Curators
</
h3
>
...
...
@@ -19,6 +26,7 @@ const StudioCuratorInviter = ({onSubmit}) => {
type=
"text"
placeholder=
"<username>"
value=
{
value
}
onKeyDown=
{
e
=>
e
.
key
===
'
Enter
'
&&
submit
()
}
onChange=
{
e
=>
setValue
(
e
.
target
.
value
)
}
/>
<
button
...
...
@@ -26,14 +34,7 @@ const StudioCuratorInviter = ({onSubmit}) => {
'
mod-mutating
'
:
submitting
})
}
disabled=
{
submitting
}
onClick=
{
()
=>
{
setSubmitting
(
true
);
setError
(
null
);
onSubmit
(
value
)
.
then
(()
=>
setValue
(
''
))
.
catch
(
e
=>
setError
(
e
))
.
then
(()
=>
setSubmitting
(
false
));
}
}
onClick=
{
submit
}
>
Invite
</
button
>
{
error
&&
<
div
>
{
error
}
</
div
>
}
</
div
>
...
...
src/views/studio/studio-project-adder.jsx
View file @
903eef96
...
...
@@ -10,7 +10,14 @@ const StudioProjectAdder = ({onSubmit}) => {
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
submitting
,
setSubmitting
]
=
useState
(
false
);
const
[
error
,
setError
]
=
useState
(
null
);
const
submit
=
()
=>
{
setSubmitting
(
true
);
setError
(
null
);
onSubmit
(
value
)
.
then
(()
=>
setValue
(
''
))
.
catch
(
e
=>
setError
(
e
))
.
then
(()
=>
setSubmitting
(
false
));
};
return
(
<
div
className=
"studio-adder-section"
>
<
h3
>
✦ Add Projects
</
h3
>
...
...
@@ -19,6 +26,7 @@ const StudioProjectAdder = ({onSubmit}) => {
type=
"text"
placeholder=
"<project id>"
value=
{
value
}
onKeyDown=
{
e
=>
e
.
key
===
'
Enter
'
&&
submit
()
}
onChange=
{
e
=>
setValue
(
e
.
target
.
value
)
}
/>
<
button
...
...
@@ -26,14 +34,7 @@ const StudioProjectAdder = ({onSubmit}) => {
'
mod-mutating
'
:
submitting
})
}
disabled=
{
submitting
}
onClick=
{
()
=>
{
setSubmitting
(
true
);
setError
(
null
);
onSubmit
(
value
)
.
then
(()
=>
setValue
(
''
))
.
catch
(
e
=>
setError
(
e
))
.
then
(()
=>
setSubmitting
(
false
));
}
}
onClick=
{
submit
}
>
Add
</
button
>
{
error
&&
<
div
>
{
error
}
</
div
>
}
</
div
>
...
...
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