File size: 667 Bytes
c1f12bf
083ce88
c1f12bf
 
 
083ce88
c1f12bf
 
083ce88
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use client'

import { ClapMeta } from '@aitube/clap'
import { create } from 'zustand'
import { ProjectEditorStore } from '@aitube/clapper-services'

import { getDefaultProjectEditorState } from './getDefaultProjectEditorState'
import { TimelineStore, useTimeline } from '@aitube/timeline'

export const useProjectEditor = create<ProjectEditorStore>((set, get) => ({
  ...getDefaultProjectEditorState(),
  setCurrent: (current?: ClapMeta) => {
    const timeline: TimelineStore = useTimeline.getState()
    set({ current })
    if (current && timeline?.clap?.meta) {
      Object.assign(timeline.clap.meta, current)
    }
  },
  undo: () => {},
  redo: () => {},
}))