-
Notifications
You must be signed in to change notification settings - Fork 13
/
project.js
60 lines (56 loc) · 2.04 KB
/
project.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { createSlice } from '@reduxjs/toolkit'
export const productTypes = {
image: { name: 'image', icon: 'imagesmode' },
render: { name: 'render', icon: 'photo_library' },
plate: { name: 'plate', icon: 'camera_roll' },
camera: { name: 'camera', icon: 'videocam' },
model: { name: 'model', icon: 'language' },
texture: { name: 'texture', icon: 'texture' },
look: { name: 'look', icon: 'ev_shadow' },
rig: { name: 'rig', icon: 'accessibility' },
animation: { name: 'animation', icon: 'directions_run' },
cache: { name: 'cache', icon: 'animation' },
layout: { name: 'layout', icon: 'nature_people' },
setdress: { name: 'setdress', icon: 'forest' },
groom: { name: 'groom', icon: 'content_cut' },
matchmove: { name: 'matchmove', icon: 'switch_video' },
vdb: { name: 'vdb', icon: 'local_fire_department' },
lightrig: { name: 'lightrig', icon: 'wb_incandescent' },
lut: { name: 'lut', icon: 'opacity' },
workfile: { name: 'workfile', icon: 'home_repair_service' },
}
const projectSlice = createSlice({
name: 'project',
initialState: {
name: null,
folders: {},
foldersOrder: [],
tasks: {},
tasksOrder: [],
statuses: {},
statusesOrder: [],
tags: {},
tagsOrder: [],
attrib: {},
},
reducers: {
selectProject: (state, action) => {
window.localStorage.setItem('currentProject', action.name)
state.name = action.payload
},
setProjectData: (state, action) => {
state.folders = action.payload.folders || {}
state.tasks = action.payload.tasks || {}
state.statuses = action.payload.statuses || {}
state.tags = action.payload.tags || {}
state.foldersOrder = action.payload.order?.folders || []
state.tasksOrder = action.payload.order?.tasks || []
state.statusesOrder = action.payload.order?.statuses || []
state.tagsOrder = action.payload.order?.tags || []
// other project data
state.attrib = action.payload.attrib
},
},
})
export const { selectProject, setProjectData } = projectSlice.actions
export default projectSlice.reducer