Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

Support redux-devtools #191

Merged
merged 1 commit into from Dec 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/delir/browser.js
Expand Up @@ -58,8 +58,12 @@ const install = async () => {
const devtron = require('devtron')
devtron.install()

const {default: installExtension, REACT_DEVELOPER_TOOLS} = require('electron-devtools-installer')
await installExtension(REACT_DEVELOPER_TOOLS)
const {default: installExtension, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS} = require('electron-devtools-installer')

await Promise.all([
installExtension(REACT_DEVELOPER_TOOLS),
installExtension(REDUX_DEVTOOLS),
])
}

app.on('window-all-closed', () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/delir/domain/Editor/actions.ts
@@ -1,10 +1,10 @@
import * as Delir from '@ragg/delir-core'
import { action } from '@ragg/fleur'
import { action, actions } from '@ragg/fleur'

import { DragEntity } from './operations'
import { ClipboardEntry, ParameterTarget } from './types'

export const EditorActions = {
export const EditorActions = actions('Editor', {
setActiveProjectAction: action<{ project: Delir.Entity.Project, path?: string | null }>(),
clearActiveProjectAction: action<{}>(),
setDragEntityAction: action<DragEntity>(),
Expand All @@ -21,4 +21,4 @@ export const EditorActions = {
seekPreviewFrameAction: action<{ frame: number }>(),
setClipboardEntry: action<{ entry: ClipboardEntry }>(),
changePreferenceOpenStateAction: action<{ open: boolean }>()
}
})
6 changes: 3 additions & 3 deletions packages/delir/domain/History/actions.ts
@@ -1,9 +1,9 @@
import { action } from '@ragg/fleur'
import { action, actions } from '@ragg/fleur'

import { Command } from './HistoryStore'

export const HistoryActions = {
export const HistoryActions = actions('History', {
pushHistory: action<{ command: Command }>(),
undoing: action<{}>(),
redoing: action<{}>(),
}
})
6 changes: 3 additions & 3 deletions packages/delir/domain/Preference/actions.ts
@@ -1,8 +1,8 @@
import { action } from '@ragg/fleur'
import { action, actions } from '@ragg/fleur'

import { Preference } from './PreferenceStore'

export const PreferenceActions = {
export const PreferenceActions = actions('Preference', {
restorePreference: action<{ preference: Preference }>(),
changePreference: action<{ patch: Partial<Preference> }>(),
}
})
6 changes: 3 additions & 3 deletions packages/delir/domain/Project/actions.ts
@@ -1,7 +1,7 @@
import * as Delir from '@ragg/delir-core'
import { action } from '@ragg/fleur'
import { action, actions } from '@ragg/fleur'

export const ProjectActions = {
export const ProjectActions = actions('Project', {
createCompositionAction: action<{
composition: Delir.Entity.Composition
}>(),
Expand Down Expand Up @@ -113,4 +113,4 @@ export const ProjectActions = {
holderClipId: string,
targetEffectId: string,
}>(),
}
})
6 changes: 3 additions & 3 deletions packages/delir/domain/Renderer/actions.ts
@@ -1,6 +1,6 @@
import { action } from '@ragg/fleur'
import { action, actions } from '@ragg/fleur'

export const RendererActions = {
export const RendererActions = actions('Renderer', {
addPlugins: action<{ plugins: any[] }>(),
setPreviewCanvas: action<{ canvas: HTMLCanvasElement }>(),
}
})
3 changes: 2 additions & 1 deletion packages/delir/main.ts
Expand Up @@ -3,6 +3,7 @@ import Fleur from '@ragg/fleur'
import { createElementWithContext } from '@ragg/fleur-react'
import * as os from 'os'
import * as ReactDOM from 'react-dom'
import { fleurReduxDevTools } from './utils/fleurReduxDevtools'

import * as EditorOps from './domain/Editor/operations'
import * as PreferenceOps from './domain/Preference/operations'
Expand Down Expand Up @@ -39,7 +40,7 @@ window.addEventListener('DOMContentLoaded', async () => {
}

const app = new Fleur({ stores: [ EditorStore, ProjectStore, RendererStore, PreferenceStore, HistoryStore ] })
const context = window.delir = app.createContext()
const context = window.delir = fleurReduxDevTools(app.createContext())

// console.log(createElementWithContext)
// ReactDOM.unstable_deferredUpdates(() => {
Expand Down