Skip to content

Commit

Permalink
Merge pull request #131 from sakihet/refactor-state
Browse files Browse the repository at this point in the history
refactor state
  • Loading branch information
sakihet authored Mar 31, 2024
2 parents ef95788 + 00e68dd commit b9c1088
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/appState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Theme } from "./types/theme"
export function createAppState() {
const appState: Signal<State> = signal<State>({ boards: [] })
const appTheme: Signal<Theme> = signal<Theme>(getTheme())
const showCommandPalette = signal(false)
const showBoardDialog = signal(false)

return { appState, appTheme }
return { appState, appTheme, showCommandPalette, showBoardDialog }
}
6 changes: 1 addition & 5 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ import { applyTheme } from './utils.ts'
import { State } from './types/state.ts'
import PageSandbox from './components/PageSandbox.tsx'
import TheCommandPalette from './components/TheCommandPalette.tsx'
import { signal } from '@preact/signals'

const { appState, appTheme } = createAppState()

export const showCommandPalette = signal(false)
export const showBoardDialog = signal(false)
export const { appState, appTheme, showCommandPalette, showBoardDialog } = createAppState()

function Main() {
const repository = new RepositoryLocalStorage()
Expand Down

0 comments on commit b9c1088

Please sign in to comment.