Skip to content

Commit 7c580f6

Browse files
authored
Merge pull request #132 from wdr-data/fix/more-app-regressions
Fix more app regressions
2 parents efcd7d2 + 34ae7e8 commit 7c580f6

6 files changed

Lines changed: 16 additions & 23 deletions

File tree

‎babel.config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ module.exports = {
2020
[
2121
'formatjs',
2222
{
23+
// No `ast: true`: react-intl 2 renders defaultMessage only as a string.
2324
idInterpolationPattern: '[sha512:contenthash:base64:6]',
24-
ast: true,
2525
},
2626
],
2727
],

‎src/components/menu/menu.jsx‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,7 @@ export const MenuComponent = (props) => {
148148
</TabPanel>
149149
<TabPanel className={tabClassNames.tabPanel}>
150150
<div className={styles.sectionBody}>
151-
<Link
152-
to={{
153-
pathname: '/projekt/neu',
154-
state: { isNewProject: true },
155-
}}
156-
className={styles.newButton}
157-
>
151+
<Link to="/projekt/neu" className={styles.newButton}>
158152
<InlineSVG Svg={ButtonNew} className={styles.newButtonIcon} />
159153
Neu
160154
</Link>

‎src/components/mobile-screen/mobile-screen.jsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const MobileScreenComponent = () => (
6969
</div>
7070

7171
<div className={styles.blockWrapper}>
72-
<Link className={styles.link} to="https://github.com/wdr-data/code4maus">
72+
<a className={styles.link} href="https://github.com/wdr-data/code4maus">
7373
<img
7474
role="Deko-Block"
7575
alt="Programmieren mit der Maus"
@@ -78,14 +78,14 @@ const MobileScreenComponent = () => (
7878
draggable={false}
7979
src={block2}
8080
/>
81-
</Link>
81+
</a>
8282

8383
<div className={classNames(styles.innerWrapper, styles.secondWrapper)}>
8484
<p>
8585
Das Ganze beruht auf der grafischen Programmiersprache{' '}
86-
<Link className={styles.link} to="https://scratch.mit.edu/">
86+
<a className={styles.link} href="https://scratch.mit.edu/">
8787
Scratch
88-
</Link>
88+
</a>
8989
, die am MIT, in den USA, entwickelt und von Kindern der ganzen Welt
9090
genutzt wird. Genau wie Scratch, ist auch Programmieren mit der Maus{' '}
9191
<span className={styles.boldOrange}>Open Source</span> – also frei

‎src/containers/gui.jsx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ const mapStateToProps = (state) => ({
150150
layoutmode: state.scratchGui.layoutMode,
151151
saveProjectVisible: state.scratchGui.modals.saveProject,
152152
eduLayerActive: state.scratchGui.eduLayer.enabled,
153-
isNewProject:
154-
state.router.location.state && !!state.router.location.state.isNewProject,
155153
})
156154

157155
const logPageDisplay = (eduId, isNewProject, tab) => {
@@ -181,7 +179,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
181179
onActivateTab: (tab) => {
182180
// react-tabs also fires onSelect for the already active tab
183181
if (tab !== stateProps.activeTabIndex) {
184-
logPageDisplay(eduId, stateProps.isNewProject, tab)
182+
logPageDisplay(eduId, ownProps.isNewProject, tab)
185183
}
186184
dispatchProps.onActivateTab(tab)
187185
},

‎src/containers/sound-tab.jsx‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ class SoundTab extends React.Component {
4848
if (!target || !target.sounds) {
4949
return
5050
}
51-
52-
if (prevProps.editingTarget !== this.props.editingTarget) {
53-
this.setState({ selectedSoundIndex: 0 })
54-
} else if (this.state.selectedSoundIndex > target.sounds.length - 1) {
55-
this.setState({
56-
selectedSoundIndex: Math.max(target.sounds.length - 1, 0),
57-
})
51+
52+
const { selectedSoundIndex } = this.state
53+
const nextIndex =
54+
prevProps.editingTarget !== editingTarget
55+
? 0
56+
: Math.min(selectedSoundIndex, Math.max(target.sounds.length - 1, 0))
57+
if (nextIndex !== selectedSoundIndex) {
58+
this.setState({ selectedSoundIndex: nextIndex })
5859
}
5960
}
6061

‎webpack.config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ module.exports = {
196196
},
197197
plugins: [
198198
new webpack.DefinePlugin({
199-
'process.env.DEBUG': 'process.env.DEBUG',
199+
'process.env.DEBUG': JSON.stringify(Boolean(process.env.DEBUG)),
200200
'process.env.BRANCH': JSON.stringify(branch),
201201
}),
202202
customHtmlPlugin({

0 commit comments

Comments
 (0)