Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
dff72b62
Commit
dff72b62
authored
7 years ago
by
kchadha
Browse files
Options
Downloads
Patches
Plain Diff
Trigger loading animation and loading error states from load button.
parent
a7a02608
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/containers/gui.jsx
+3
-1
3 additions, 1 deletion
src/containers/gui.jsx
src/containers/load-button.jsx
+28
-2
28 additions, 2 deletions
src/containers/load-button.jsx
src/reducers/modals.js
+11
-0
11 additions, 0 deletions
src/reducers/modals.js
with
42 additions
and
3 deletions
src/containers/gui.jsx
+
3
−
1
View file @
dff72b62
...
...
@@ -70,7 +70,7 @@ class GUI extends React.Component {
}
=
this
.
props
;
return
(
<
GUIComponent
loading
=
{
fetchingProject
||
this
.
state
.
loading
}
loading
=
{
fetchingProject
||
this
.
state
.
loading
||
this
.
props
.
loadingStateVisible
}
vm
=
{
vm
}
{
...
componentProps
}
>
...
...
@@ -85,6 +85,7 @@ GUI.propTypes = {
feedbackFormVisible
:
PropTypes
.
bool
,
fetchingProject
:
PropTypes
.
bool
,
importInfoVisible
:
PropTypes
.
bool
,
loadingStateVisible
:
PropTypes
.
bool
,
previewInfoVisible
:
PropTypes
.
bool
,
projectData
:
PropTypes
.
string
,
vm
:
PropTypes
.
instanceOf
(
VM
)
...
...
@@ -98,6 +99,7 @@ const mapStateToProps = state => ({
costumesTabVisible
:
state
.
editorTab
.
activeTabIndex
===
COSTUMES_TAB_INDEX
,
feedbackFormVisible
:
state
.
modals
.
feedbackForm
,
importInfoVisible
:
state
.
modals
.
importInfo
,
loadingStateVisible
:
state
.
modals
.
loadingProject
,
previewInfoVisible
:
state
.
modals
.
previewInfo
,
soundsTabVisible
:
state
.
editorTab
.
activeTabIndex
===
SOUNDS_TAB_INDEX
});
...
...
This diff is collapsed.
Click to expand it.
src/containers/load-button.jsx
+
28
−
2
View file @
dff72b62
...
...
@@ -5,6 +5,11 @@ import {connect} from 'react-redux';
import
LoadButtonComponent
from
'
../components/load-button/load-button.jsx
'
;
import
{
openLoadingProject
,
closeLoadingProject
}
from
'
../reducers/modals
'
;
class
LoadButton
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -13,10 +18,21 @@ class LoadButton extends React.Component {
'
handleChange
'
,
'
handleClick
'
]);
this
.
state
=
{
loadingError
:
false
,
errorMessage
:
''
};
}
handleChange
(
e
)
{
this
.
props
.
openLoadingState
();
const
reader
=
new
FileReader
();
reader
.
onload
=
()
=>
this
.
props
.
vm
.
loadProjectLocal
(
reader
.
result
);
reader
.
onload
=
()
=>
this
.
props
.
vm
.
loadProjectLocal
(
reader
.
result
)
.
then
(()
=>
{
this
.
props
.
closeLoadingState
();
})
.
catch
(
error
=>
{
this
.
setState
({
loadingError
:
true
,
errorMessage
:
error
});
});
reader
.
readAsArrayBuffer
(
e
.
target
.
files
[
0
]);
}
handleClick
()
{
...
...
@@ -26,7 +42,10 @@ class LoadButton extends React.Component {
this
.
fileInput
=
input
;
}
render
()
{
if
(
this
.
state
.
loadingError
)
throw
new
Error
(
`Failed to load project:
${
this
.
state
.
errorMessage
}
`
);
const
{
closeLoadingState
,
// eslint-disable-line no-unused-vars
openLoadingState
,
// eslint-disable-line no-unused-vars
vm
,
// eslint-disable-line no-unused-vars
...
props
}
=
this
.
props
;
...
...
@@ -42,6 +61,8 @@ class LoadButton extends React.Component {
}
LoadButton
.
propTypes
=
{
closeLoadingState
:
PropTypes
.
func
,
openLoadingState
:
PropTypes
.
func
,
vm
:
PropTypes
.
shape
({
loadProjectLocal
:
PropTypes
.
func
})
...
...
@@ -51,7 +72,12 @@ const mapStateToProps = state => ({
vm
:
state
.
vm
});
const
mapDispatchToProps
=
dispatch
=>
({
closeLoadingState
:
()
=>
dispatch
(
closeLoadingProject
()),
openLoadingState
:
()
=>
dispatch
(
openLoadingProject
())
});
export
default
connect
(
mapStateToProps
,
()
=>
({})
// omit d
ispatch
p
rop
mapD
ispatch
ToP
rop
s
)(
LoadButton
);
This diff is collapsed.
Click to expand it.
src/reducers/modals.js
+
11
−
0
View file @
dff72b62
...
...
@@ -8,6 +8,7 @@ const MODAL_COSTUME_LIBRARY = 'costumeLibrary';
const
MODAL_EXTENSION_LIBRARY
=
'
extensionLibrary
'
;
const
MODAL_FEEDBACK_FORM
=
'
feedbackForm
'
;
const
MODAL_IMPORT_INFO
=
'
importInfo
'
;
const
MODAL_LOADING_PROJECT
=
'
loadingProject
'
;
const
MODAL_PREVIEW_INFO
=
'
previewInfo
'
;
const
MODAL_SOUND_LIBRARY
=
'
soundLibrary
'
;
const
MODAL_SPRITE_LIBRARY
=
'
spriteLibrary
'
;
...
...
@@ -20,6 +21,7 @@ const initialState = {
[
MODAL_EXTENSION_LIBRARY
]:
false
,
[
MODAL_FEEDBACK_FORM
]:
false
,
[
MODAL_IMPORT_INFO
]:
false
,
[
MODAL_LOADING_PROJECT
]:
false
,
[
MODAL_PREVIEW_INFO
]:
true
,
[
MODAL_SOUND_LIBRARY
]:
false
,
[
MODAL_SPRITE_LIBRARY
]:
false
,
...
...
@@ -73,6 +75,10 @@ const openImportInfo = function () {
analytics
.
pageview
(
'
modals/import
'
);
return
openModal
(
MODAL_IMPORT_INFO
);
};
const
openLoadingProject
=
function
()
{
analytics
.
pageview
(
'
modals/loading
'
);
return
openModal
(
MODAL_LOADING_PROJECT
);
};
const
openPreviewInfo
=
function
()
{
analytics
.
pageview
(
'
/modals/preview
'
);
return
openModal
(
MODAL_PREVIEW_INFO
);
...
...
@@ -104,6 +110,9 @@ const closeFeedbackForm = function () {
const
closeImportInfo
=
function
()
{
return
closeModal
(
MODAL_IMPORT_INFO
);
};
const
closeLoadingProject
=
function
()
{
return
closeModal
(
MODAL_LOADING_PROJECT
);
};
const
closePreviewInfo
=
function
()
{
return
closeModal
(
MODAL_PREVIEW_INFO
);
};
...
...
@@ -123,6 +132,7 @@ export {
openExtensionLibrary
,
openFeedbackForm
,
openImportInfo
,
openLoadingProject
,
openPreviewInfo
,
openSoundLibrary
,
openSpriteLibrary
,
...
...
@@ -132,6 +142,7 @@ export {
closeExtensionLibrary
,
closeFeedbackForm
,
closeImportInfo
,
closeLoadingProject
,
closePreviewInfo
,
closeSpriteLibrary
,
closeSoundLibrary
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment