Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1133 | Rev 1151 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1133 Rev 1146
Línea 10... Línea 10...
10
}
10
}
Línea 11... Línea 11...
11
 
11
 
12
const topicsReducer = (state = initialState, { type, payload }) => {
12
const topicsReducer = (state = initialState, { type, payload }) => {
13
  switch (type) {
13
  switch (type) {
14
    case TOPIC_ACTIONS.ADD_TOPIC: {
14
    case TOPIC_ACTIONS.ADD_TOPIC: {
Línea 15... Línea 15...
15
      const { uuid, ...topic } = payload
15
      const topic = payload
Línea 16... Línea 16...
16
 
16
 
17
      const topicsIds = new Set([...state.topicsAllIds, uuid])
17
      const topicsIds = new Set([...state.topicsAllIds, topic.uuid])
18
 
18
 
19
      return {
19
      return {
20
        ...state,
20
        ...state,
21
        topicById: {
21
        topicById: {
22
          ...state.topicById,
22
          ...state.topicById,
23
          [uuid]: { ...topic, uuid }
23
          [topic.uuid]: topic
24
        },
24
        },
Línea 25... Línea 25...
25
        topicsAllIds: Array.from(topicsIds)
25
        topicsAllIds: Array.from(topicsIds)
26
      }
26
      }
27
    }
-
 
28
 
27
    }
Línea 29... Línea 28...
29
    case TOPIC_ACTIONS.ADD_CAPSULE: {
28
 
30
      const { topicId, capsule } = payload
29
    case TOPIC_ACTIONS.ADD_CAPSULE: {
31
 
30
      const capsule = payload
32
      const capsulesIds = new Set([...state.capsulesAllIds, capsule.uuid])
31
      const capsulesIds = new Set([...state.capsulesAllIds, capsule.uuid])
33
 
32
 
34
      return {
33
      return {
35
        ...state,
34
        ...state,
36
        capsuleById: {
35
        capsuleById: {
37
          ...state.capsuleById,
36
          ...state.capsuleById,
Línea 38... Línea 37...
38
          [capsule.uuid]: { ...capsule, topicId }
37
          [capsule.uuid]: capsule
39
        },
38
        },
40
        capsulesAllIds: Array.from(capsulesIds)
-
 
41
      }
-
 
42
    }
39
        capsulesAllIds: Array.from(capsulesIds)
Línea 43... Línea 40...
43
 
40
      }
44
    case TOPIC_ACTIONS.ADD_SLIDE: {
41
    }
45
      const { capsuleId, slide } = payload
42
 
46
 
43
    case TOPIC_ACTIONS.ADD_SLIDE: {
47
      const topicId = state.capsuleById[capsuleId].topicId
44
      const slide = payload
48
      const slidesIds = new Set([...state.slidesAllIds, slide.uuid])
45
      const slidesIds = new Set([...state.slidesAllIds, slide.uuid])
49
 
46
 
50
      return {
47
      return {
51
        ...state,
48
        ...state,
Línea 52... Línea -...
52
        slideById: {
-
 
53
          ...state.slideById,
-
 
54
          [slide.uuid]: { ...slide, capsuleId, topicId }
-
 
55
        },
-
 
56
        slidesAllIds: Array.from(slidesIds)
-
 
57
      }
-
 
58
    }
-
 
59
 
-
 
60
    case TOPIC_ACTIONS.COMPLETE_TOPIC: {
-
 
61
      const uuid = payload
-
 
62
      const completedTopic = { ...state.topicById[uuid], completed: 1 }
-
 
63
 
-
 
64
      return {
-
 
65
        ...state,
-
 
66
        topicById: {
-
 
67
          ...state.topicById,
-
 
68
          [uuid]: completedTopic
-
 
69
        }
-
 
70
      }
-
 
71
    }
-
 
72
 
-
 
73
    case TOPIC_ACTIONS.COMPLETE_CAPSULE: {
-
 
74
      const uuid = payload
-
 
75
      const completedCapsule = { ...state.capsuleById[uuid], completed: 1 }
-
 
76
 
-
 
77
      return {
-
 
78
        ...state,
-
 
79
        capsuleById: {
-
 
80
          ...state.capsuleById,
-
 
81
          [uuid]: completedCapsule
-
 
82
        }
-
 
83
      }
-
 
84
    }
-
 
85
 
-
 
86
    case TOPIC_ACTIONS.COMPLETE_SLIDE: {
-
 
87
      const uuid = payload
-
 
88
      const completedSlide = { ...state.slideById[uuid], completed: 1 }
-
 
89
 
-
 
90
      return {
-
 
91
        ...state,
49
        slideById: {
92
        slideById: {
50
          ...state.slideById,
93
          ...state.slideById,
51
          [slide.uuid]: slide
94
          [uuid]: completedSlide
52
        },