Skip to content

Commit

Permalink
fix: Swap Footer pages
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSusa committed Sep 20, 2020
1 parent 900a98b commit a00f40e
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 57 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
"version": "1.3.39-alpha.9"
"version": "1.3.39-alpha.10"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "midi-bricks-mono",
"version": "1.3.39-alpha.9",
"version": "1.3.39-alpha.10",
"private": false,
"license": "MIT",
"repository": "https://github.com/TimSusa/midi-bricks-mono.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/midi-bricks-doc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "midi-bricks-doc",
"version": "1.3.39-alpha.9",
"version": "1.3.39-alpha.10",
"private": true,
"description": "Documentation for midi-bricks",
"author": "TimSusa <timsusa@altus-insight.de>",
Expand Down
2 changes: 1 addition & 1 deletion packages/midi-bricks-electron/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "midi-bricks-electron",
"productName": "MIDI-Bricks",
"version": "1.3.39-alpha.9",
"version": "1.3.39-alpha.10",
"main": "./app/electron.js",
"homepage": ".",
"repository": "https://github.com/TimSusa/midi-bricks-mono.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/midi-bricks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "midi-bricks",
"version": "1.3.39-alpha.9",
"version": "1.3.39-alpha.10",
"private": false,
"homepage": "https://midi-bricks.timsusa.now.sh",
"main": "./src/index.js",
Expand Down
24 changes: 16 additions & 8 deletions packages/midi-bricks/src/components/footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ function Footer() {
return (
<div key={`footer-button-${item.id}`}>
<IconButton
onClick={swapFooterPages.bind(this, {
srcIdx: item.id,
offset: -1
})}
onClick={() =>
dispatch(
swapFooterPages({
srcIdx: item.id,
offset: -1
})
)
}
className={classes.signButton}
color='inherit'
aria-label='Menu'
Expand All @@ -86,10 +90,14 @@ function Footer() {
/>

<IconButton
onClick={swapFooterPages.bind(this, {
srcIdx: item.id,
offset: 1
})}
onClick={() =>
dispatch(
swapFooterPages({
srcIdx: item.id,
offset: 1
})
)
}
className={classes.signButton}
color='inherit'
aria-label='Menu'
Expand Down
84 changes: 44 additions & 40 deletions packages/midi-bricks/src/global-state/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,40 @@ import { createSlice } from '@reduxjs/toolkit'
import { sliders, initId } from './reducers/slider-list'
import { viewSettings } from './reducers/view-settings'
import { undoRedo } from './reducers/undo-redo'

import { pages } from './reducers/pages'

//
// PAGES
//
export const pagesInit = {
[initId]: {
sliderList: [],
id: initId,
label: 'Page 1'
}
}

const {reducer: reducerPagess, actions: actionsPagess} = createSlice({
name: 'pages',
initialState: pagesInit,
reducers: pages

})

export const actionsPages = actionsPagess
export const reducerPages = reducerPagess

//
// ViewSettings
//
export const PAGE_TYPES = {
HOME_MODE: 'HOME_MODE',
GLOBAL_MODE: 'GLOBAL_MODE',
MIDI_DRIVER_MODE: 'MIDI_DRIVER_MODE',
// VIEW_SETTINGS_MODE: 'VIEW_SETTINGS_MODE'
}

const initState = {
export const viewSettingsInitState = {
columns: 18,
rowHeight: 40,
isAutoSize: false,
Expand Down Expand Up @@ -43,25 +66,7 @@ const initState = {
isAllowedDowngrade: false,
isWindowSizeLocked: true,
windowCoords: [0, 0, 600, 800]
}
}

export const pagesInit = {
[initId]: {
sliderList: [],
id: initId,
label: 'Page 1'
}
}

const slidersInitState = {
isMidiFailed: false,
midi: null,
sliderList: []
}

export const viewSettingsInitState = {
...initState,
},
isLiveMode: false,
isSettingsDialogMode: false,
isLayoutMode: false,
Expand All @@ -87,18 +92,24 @@ export const viewSettingsInitState = {
}
]
}

const {reducer: reducerPagess, actions: actionsPagess} = createSlice({
name: 'pages',
initialState: pagesInit,
reducers: pages
const {reducer: reducerViewSettingss, actions: actionsViewSettingss} = createSlice({
name: 'viewSettings',
initialState: viewSettingsInitState,
reducers: viewSettings

})

export const actionsPages = actionsPagess
export const reducerPages = reducerPagess

export const actionsViewSettings = actionsViewSettingss
export const reducerViewSettings = reducerViewSettingss

//
// SLIDERS
//
const slidersInitState = {
isMidiFailed: false,
midi: null,
sliderList: []
}
const {reducer: reducerSliderss, actions: actionsSliderss} = createSlice({
name: 'sliders',
initialState: slidersInitState,
Expand All @@ -109,16 +120,9 @@ const {reducer: reducerSliderss, actions: actionsSliderss} = createSlice({
export const actionsSliders = actionsSliderss
export const reducerSliders = reducerSliderss

const {reducer: reducerViewSettingss, actions: actionsViewSettingss} = createSlice({
name: 'viewSettings',
initialState: viewSettingsInitState,
reducers: viewSettings

})

export const actionsViewSettings = actionsViewSettingss
export const reducerViewSettings= reducerViewSettingss

//
// UNDO REDO
//
const {reducer: reducerUndoRedod, actions: actionsUndoRedod} = createSlice({
name: 'undoRedo',
initialState: {},
Expand All @@ -127,7 +131,7 @@ const {reducer: reducerUndoRedod, actions: actionsUndoRedod} = createSlice({
})

export const actionsUndoRedo = actionsUndoRedod
export const reducerUndoRedo= reducerUndoRedod
export const reducerUndoRedo = reducerUndoRedod

export const reducer = combineReducers({
sliders: reducerSliders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ export const viewSettings = {
newArray.push(item)
}
})

return Object.assign({}, state, {
pageTargets: newArray
})
state.pageTargets = newArray
// return Object.assign({}, state, {
// pageTargets: newArray
// })
},
toggleSettingsDialogMode(draftState, action) {
const { isSettingsDialogMode, i, lastFocusedPage } = action.payload
Expand Down

0 comments on commit a00f40e

Please sign in to comment.