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
e79b56d6
Unverified
Commit
e79b56d6
authored
6 years ago
by
Karishma Chadha
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2935 from kchadha/restore-sound
Restore the last deleted sound.
parents
b0118cd1
a9b1f857
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/menu-bar/menu-bar.jsx
+27
-13
27 additions, 13 deletions
src/components/menu-bar/menu-bar.jsx
src/containers/sound-tab.jsx
+9
-1
9 additions, 1 deletion
src/containers/sound-tab.jsx
with
36 additions
and
14 deletions
src/components/menu-bar/menu-bar.jsx
+
27
−
13
View file @
e79b56d6
...
...
@@ -137,7 +137,8 @@ class MenuBar extends React.Component {
super
(
props
);
bindAll
(
this
,
[
'
handleLanguageMouseUp
'
,
'
handleRestoreOption
'
'
handleRestoreOption
'
,
'
restoreOptionMessage
'
]);
}
handleLanguageMouseUp
(
e
)
{
...
...
@@ -151,6 +152,30 @@ class MenuBar extends React.Component {
this
.
props
.
onRequestCloseEdit
();
};
}
restoreOptionMessage
(
deletedItem
)
{
switch
(
deletedItem
)
{
case
'
Sprite
'
:
return
(<
FormattedMessage
defaultMessage
=
"Restore Sprite"
description
=
"Menu bar item for restoring the last deleted sprite."
id
=
"gui.menuBar.restoreSprite"
/>);
case
'
Sound
'
:
return
(<
FormattedMessage
defaultMessage
=
"Restore Sound"
description
=
"Menu bar item for restoring the last deleted sound."
id
=
"gui.menuBar.restoreSound"
/>);
case
'
Costume
'
:
default
:
{
return
(<
FormattedMessage
defaultMessage
=
"Restore"
description
=
"Menu bar item for restoring the last deleted item in its disabled state."
/* eslint-disable-line max-len */
id
=
"gui.menuBar.restore"
/>);
}
}
}
render
()
{
return
(
<
Box
className
=
{
styles
.
menuBar
}
>
...
...
@@ -286,18 +311,7 @@ class MenuBar extends React.Component {
className
=
{
classNames
({[
styles
.
disabled
]:
!
restorable
})
}
onClick
=
{
this
.
handleRestoreOption
(
handleRestore
)
}
>
{
deletedItem
===
'
Sprite
'
?
<
FormattedMessage
defaultMessage
=
"Restore Sprite"
description
=
"Menu bar item for restoring the last deleted sprite."
id
=
"gui.menuBar.restoreSprite"
/>
:
<
FormattedMessage
defaultMessage
=
"Restore"
description
=
"Menu bar item for restoring the last deleted item in its disabled state."
/* eslint-disable-line max-len */
id
=
"gui.menuBar.restore"
/>
}
{
this
.
restoreOptionMessage
(
deletedItem
)
}
</
MenuItem
>
)
}
</
DeletionRestorer
>
<
MenuSection
>
...
...
This diff is collapsed.
Click to expand it.
src/containers/sound-tab.jsx
+
9
−
1
View file @
e79b56d6
...
...
@@ -34,6 +34,8 @@ import {
COSTUMES_TAB_INDEX
}
from
'
../reducers/editor-tab
'
;
import
{
setRestore
}
from
'
../reducers/restore-deletion
'
;
class
SoundTab
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -76,10 +78,11 @@ class SoundTab extends React.Component {
}
handleDeleteSound
(
soundIndex
)
{
this
.
props
.
vm
.
deleteSound
(
soundIndex
);
const
restoreFun
=
this
.
props
.
vm
.
deleteSound
(
soundIndex
);
if
(
soundIndex
>=
this
.
state
.
selectedSoundIndex
)
{
this
.
setState
({
selectedSoundIndex
:
Math
.
max
(
0
,
soundIndex
-
1
)});
}
this
.
props
.
dispatchUpdateRestore
({
restoreFun
,
deletedItem
:
'
Sound
'
});
}
handleDuplicateSound
(
soundIndex
)
{
...
...
@@ -153,6 +156,7 @@ class SoundTab extends React.Component {
render
()
{
const
{
dispatchUpdateRestore
,
// eslint-disable-line no-unused-vars
intl
,
vm
,
onNewSoundFromLibraryClick
,
...
...
@@ -252,6 +256,7 @@ class SoundTab extends React.Component {
}
SoundTab
.
propTypes
=
{
dispatchUpdateRestore
:
PropTypes
.
func
,
editingTarget
:
PropTypes
.
string
,
intl
:
intlShape
,
onActivateCostumesTab
:
PropTypes
.
func
.
isRequired
,
...
...
@@ -294,6 +299,9 @@ const mapDispatchToProps = dispatch => ({
},
onRequestCloseSoundLibrary
:
()
=>
{
dispatch
(
closeSoundLibrary
());
},
dispatchUpdateRestore
:
restoreState
=>
{
dispatch
(
setRestore
(
restoreState
));
}
});
...
...
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