Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6956 Rev 7245
Línea 6... Línea 6...
6
 
6
 
7
import Chat from './Chat'
7
import Chat from './Chat'
8
import EmptySection from '../UI/EmptySection'
8
import EmptySection from '../UI/EmptySection'
9
import ConferenceModal from '../modals/ConferenceModal'
9
import ConferenceModal from '../modals/ConferenceModal'
-
 
10
import useMessages from '../../hooks/useMessages'
Línea 10... Línea 11...
10
import useMessages from '../../hooks/useMessages'
11
import ConfirmModal from '../modals/ConfirmModal'
11
 
12
 
12
const CHAT_TABS = {
13
const CHAT_TABS = {
13
  CHAT: 'CHAT',
14
  CHAT: 'CHAT',
Línea 31... Línea 32...
31
    url_delete, // Group url
32
    url_delete, // Group url
32
    url_get_contact_group_list, // Group url
33
    url_get_contact_group_list, // Group url
33
    url_leave, // Group url
34
    url_leave, // Group url
34
    name,
35
    name,
35
    profile,
36
    profile,
36
    type,
-
 
37
  } = entity
37
  } = entity
Línea 38... Línea 38...
38
 
38
 
39
  const { messages, loadMore, loading, reset } =
39
  const { messages, loadMore, loading, reset } =
40
    useMessages(url_get_all_messages)
40
    useMessages(url_get_all_messages)
-
 
41
  const [isShowConferenceModal, setisShowConferenceModal] = useState(false)
41
  const [isShowConferenceModal, setisShowConferenceModal] = useState(false)
42
  const [isShowConfirmModal, setisShowConfirmModal] = useState(false)
42
  const dispatch = useDispatch()
43
  const dispatch = useDispatch()
-
 
44
  const scrollRef = useRef(null)
-
 
45
  const options = useRef([])
-
 
46
  const actionUrl = useRef('')
-
 
47
 
-
 
48
  const toggleConfirmModal = () => {
-
 
49
    setisShowConfirmModal(!isShowConfirmModal)
Línea 43... Línea 50...
43
  const scrollRef = useRef(null)
50
  }
44
 
51
 
45
  const toggleConferenceModal = () => {
52
  const toggleConferenceModal = () => {
Línea 58... Línea 65...
58
 
65
 
59
      changeTab(CHAT_TABS.DEFAULT)
66
      changeTab(CHAT_TABS.DEFAULT)
60
    })
67
    })
Línea 61... Línea 68...
61
  }
68
  }
62
 
69
 
-
 
70
  useEffect(() => {
63
  const options = [
71
    if (url_leave) {
64
    {
72
      options.current.concat({
-
 
73
        url: url_leave,
65
      url: url_zoom,
74
        label: 'Dejar Grupo',
-
 
75
        action: () => {
66
      label: 'Crear Conferencia',
76
          toggleConfirmModal()
67
      action: toggleConferenceModal,
77
          actionUrl.current = url_leave
68
    },
78
        },
69
  ]
79
      })
70
 
80
    }
71
  const groupOptions = [
81
    if (url_delete) {
72
    {
82
      options.current.concat({
-
 
83
        url: url_delete,
73
      url: url_zoom,
84
        label: 'Eliminar Grupo',
-
 
85
        action: () => {
-
 
86
          toggleConfirmModal()
74
      label: 'Crear Conferencia',
87
          actionUrl.current = url_delete
75
      action: toggleConferenceModal,
88
        },
-
 
89
      })
-
 
90
    }
76
    },
91
    if (url_get_contact_group_list) {
77
    {
92
      options.current.concat({
78
      url: url_get_contact_group_list,
93
        url: url_get_contact_group_list,
79
      label: 'Integrantes',
94
        label: 'Integrantes',
80
      action: () => changeTab(CHAT_TABS.GROUP_MEMBERS),
95
        action: () => changeTab(CHAT_TABS.GROUP_MEMBERS),
-
 
96
      })
-
 
97
    }
81
    },
98
    if (url_add_user_to_group) {
82
    {
99
      options.current.concat({
83
      url: url_add_user_to_group,
100
        url: url_add_user_to_group,
84
      label: 'Agregar Contactos',
101
        label: 'Agregar Contactos',
85
      action: () => changeTab(CHAT_TABS.ADD_GROUP_MEMBER),
102
        action: () => changeTab(CHAT_TABS.ADD_GROUP_MEMBER),
-
 
103
      })
-
 
104
    }
86
    },
105
    if (url_zoom) {
87
    {
106
      options.current.concat({
88
      url: url_delete,
107
        url: url_zoom,
89
      label: 'Eliminar Grupo',
108
        label: 'Crear Conferencia',
90
      action: () => deleteGroup(url_delete),
109
        action: toggleConferenceModal,
-
 
110
      })
91
    },
111
    }
92
    {
112
  }, [
93
      url: url_leave,
113
    url_leave,
94
      label: 'Dejar Grupo',
114
    url_delete,
-
 
115
    url_add_user_to_group,
95
      action: () => deleteGroup(url_leave),
116
    url_zoom,
Línea 96... Línea 117...
96
    },
117
    url_get_contact_group_list,
97
  ]
118
  ])
98
 
119
 
99
  useEffect(() => {
120
  useEffect(() => {
Línea 105... Línea 126...
105
  return (
126
  return (
106
    <>
127
    <>
107
      <Chat>
128
      <Chat>
108
        <Chat.Header
129
        <Chat.Header
109
          onClose={() => changeTab(CHAT_TABS.DEFAULT)}
130
          onClose={() => changeTab(CHAT_TABS.DEFAULT)}
110
          options={type === 'group' ? groupOptions : options}
131
          options={options.current}
111
        >
132
        >
112
          <Chat.Title url={profile}>{name}</Chat.Title>
133
          <Chat.Title url={profile}>{name}</Chat.Title>
113
        </Chat.Header>
134
        </Chat.Header>
Línea 114... Línea 135...
114
 
135
 
Línea 136... Línea 157...
136
      <ConferenceModal
157
      <ConferenceModal
137
        show={isShowConferenceModal}
158
        show={isShowConferenceModal}
138
        zoomUrl={url_zoom}
159
        zoomUrl={url_zoom}
139
        onClose={toggleConferenceModal}
160
        onClose={toggleConferenceModal}
140
      />
161
      />
-
 
162
      <ConfirmModal
-
 
163
        show={isShowConfirmModal}
-
 
164
        onClose={toggleConfirmModal}
-
 
165
        onAccept={() => deleteGroup(actionUrl.current)}
-
 
166
      />
141
    </>
167
    </>
142
  )
168
  )
143
}
169
}
Línea 144... Línea 170...
144
 
170