Skip to content

Commit

Permalink
Release 2.0.108-b1
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Feb 15, 2025
1 parent 8802788 commit 380104f
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 41 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ledfx",
"version": "2.0.107-b8",
"version": "2.0.108-b1",
"description": "LedFx v2 - BladeMOD!",
"author": "YeonV aka Blade",
"private": true,
Expand Down
93 changes: 60 additions & 33 deletions src/store/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,64 @@ export const migrations: Migrations = {

16: (state) => ({ ...state }),
17: (state) => ({ ...state }),
18: (state) => ({
...state,
updateScene: async (
name: string,
id: string,
scene_image?: string | null,
scene_tags?: string | null,
scene_puturl?: string | null,
scene_payload?: string | null,
scene_midiactivate?: string | null,
virtuals?: Record<string, any>
) =>
virtuals
? await Ledfx('/api/scenes', 'POST', {
name,
id,
scene_image,
scene_tags,
scene_puturl,
scene_payload,
scene_midiactivate,
virtuals
})
: await Ledfx('/api/scenes', 'POST', {
name,
id,
scene_image,
scene_tags,
scene_puturl,
scene_payload,
scene_midiactivate
})
})
18: (state) => ({ ...state }),
19: (state) => {
const { variants, ...rest } = state.uiPersist.pixelGraphSettings
return {
...state,
uiPersist: {
...state.uiPersist,
pixelGraphSettings: {
...rest
}
}
}
},
20: (state) => {
return {
...state,
uiPersist: {
...state.uiPersist,
pixelGraphSettings: {
...state.uiPersist.pixelGraphSettings,
variants: 'canvas'
}
}
}
},
21: (state) => {
return {
...state,
updateScene: async (
name: string,
id: string,
scene_image?: string | null,
scene_tags?: string | null,
scene_puturl?: string | null,
scene_payload?: string | null,
scene_midiactivate?: string | null,
virtuals?: Record<string, any>
) =>
virtuals
? await Ledfx('/api/scenes', 'POST', {
name,
id,
scene_image,
scene_tags,
scene_puturl,
scene_payload,
scene_midiactivate,
virtuals
})
: await Ledfx('/api/scenes', 'POST', {
name,
id,
scene_image,
scene_tags,
scene_puturl,
scene_payload,
scene_midiactivate
})
}
}
}
2 changes: 1 addition & 1 deletion src/store/ui-persist/storeUIpersist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const PixelGraphVariants = [
]
type PixelGraphVariant = (typeof PixelGraphVariants)[number]

const storeUIPersist = (set: any) => ({
const storeUIPersist = () => ({
infoAlerts: {
scenes: true,
devices: true,
Expand Down
18 changes: 13 additions & 5 deletions src/store/useStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import storeVideo from './ui/storeVideo'
import storeUIPersist from './ui-persist/storeUIpersist'
import storeUIPersistActions from './ui-persist/storeUIpersistActions'
import storeSongDectector from './ui/storeSongDectector'
import { frontendConfig } from '../utils/helpers'
import { frontendConfig, log } from '../utils/helpers'
import { migrations, MigrationState } from './migrate'

const useStore = create(
Expand All @@ -42,7 +42,7 @@ const useStore = create(
},
(set, get) => ({
ui: storeUI(set),
uiPersist: storeUIPersist(set),
uiPersist: storeUIPersist(),
spotify: storeSpotify(),
qlc: storeQLC(),
user: storeUser(set),
Expand Down Expand Up @@ -77,10 +77,18 @@ const useStore = create(
name: 'ledfx-storage',
version: frontendConfig,
migrate: (persistedState, version) => {
if (version < frontendConfig) {
return migrations[frontendConfig](persistedState as MigrationState)
log(
'infoConfig Migrator',
`Migrating from version ${version} to ${frontendConfig}`
)
let state = persistedState as MigrationState
for (let i = version + 1; i <= frontendConfig; i++) {
if (migrations[i]) {
state = migrations[i](state)
}
}
return persistedState

return state
},
partialize: (state) =>
Object.fromEntries(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { IMCell } from '../pages/Devices/EditVirtuals/EditMatrix/M.utils'

export const drawerWidth = 240
export const frontendConfig = 18
export const frontendConfig = 21

export const formatTime = (dura: number) => {
let seconds: string | number
Expand Down

0 comments on commit 380104f

Please sign in to comment.