Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 5795 Rev 5796
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React, { useEffect, useState } from 'react'
2
import React, { useEffect, useState } from 'react'
3
import parse from 'html-react-parser'
3
import parse from 'html-react-parser'
4
import { axios } from '../../../utils'
-
 
5
import { setTimelineUrl } from '../../../redux/feed/feed.actions'
-
 
6
import { addNotification } from '../../../redux/notification/notification.actions'
-
 
7
import { feedTypes } from '../../../redux/feed/feed.types'
4
import { feedTypes } from '../../../redux/feed/feed.types'
8
import FeedSection from '../../../dashboard/components/feed-section/FeedSection'
-
 
9
import ShareFeed from '../../../dashboard/components/share-feed/ShareFeed'
-
 
10
import GroupMembersHelper from '../../../shared/helpers/group-members-helper/GroupMembersHelper'
-
 
11
import GroupAttr from './component/GroupAttr'
-
 
12
import Cover from '../../../shared/cover/Cover'
-
 
13
import SuggestWidget from '../../../shared/helpers/my-groups-helper/SuggestWidget'
-
 
14
import { useDispatch } from 'react-redux'
5
import { useDispatch } from 'react-redux'
15
import { setIntlLabels } from '../../../redux/intl/intl.action'
6
import { setIntlLabels } from '../../../redux/intl/intl.action'
-
 
7
import { setTimelineUrl } from '../../../redux/feed/feed.actions'
-
 
8
 
-
 
9
import Cover from '../../../shared/cover/Cover'
-
 
10
import GroupInfo from './component/GroupInfo'
-
 
11
import GroupAttr from './component/GroupAttr'
-
 
12
import ShareFeed from '../../../dashboard/components/share-feed/ShareFeed'
-
 
13
import FeedSection from '../../../dashboard/components/feed-section/FeedSection'
-
 
14
import SuggestWidget from '../../../shared/helpers/my-groups-helper/SuggestWidget'
-
 
15
import GroupMembersHelper from '../../../shared/helpers/group-members-helper/GroupMembersHelper'
Línea 16... Línea 16...
16
 
16
 
17
const View = ({
17
const View = ({
18
  routeTimeline,
18
  routeTimeline,
19
  groupId,
19
  groupId,
Línea 34... Línea 34...
34
  const groupTabs = {
34
  const groupTabs = {
35
    FEED_TAB: 'FEED_TAB',
35
    FEED_TAB: 'FEED_TAB',
36
    INFO_TAB: 'INFO_TAB',
36
    INFO_TAB: 'INFO_TAB',
37
  }
37
  }
Línea 38... Línea -...
38
 
-
 
39
  const [actionLinks, setActionLinks] = useState({})
-
 
40
  const [linkInvite, setLinkInvite] = useState('')
38
 
41
  const [currentTab, setCurrentTab] = useState(
39
  const [currentTab, setCurrentTab] = useState(
42
    withoutFeeds ? groupTabs.INFO_TAB : groupTabs.FEED_TAB
40
    withoutFeeds ? groupTabs.INFO_TAB : groupTabs.FEED_TAB
43
  )
41
  )
Línea 44... Línea -...
44
  const dispatch = useDispatch()
-
 
45
 
-
 
46
  const load = () => {
-
 
47
    axios
-
 
48
      .get('')
-
 
49
      .then(({ data }) => {
-
 
50
        if (!data.success) {
-
 
51
          dispatch(addNotification({ style: 'error', msg: data.data }))
-
 
52
          return
-
 
53
        }
-
 
54
        setActionLinks(data.data)
-
 
55
      })
-
 
56
      .catch((err) => console.log('>>: err > ', err))
-
 
57
  }
-
 
58
 
-
 
59
  useEffect(() => load(), [])
42
  const dispatch = useDispatch()
60
 
43
 
61
  useEffect(() => {
44
  useEffect(() => {
62
    dispatch(setTimelineUrl(routeTimeline))
45
    dispatch(setTimelineUrl(routeTimeline))
Línea 63... Línea -...
63
    dispatch(setIntlLabels(labels))
-
 
64
  }, [])
-
 
65
 
-
 
66
  const handleActionLink = (url) => {
-
 
67
    axios
-
 
68
      .post(url)
-
 
69
      .then(({ data }) => {
-
 
70
        if (!data.success) {
-
 
71
          dispatch(addNotification({ style: 'error', msg: data.data }))
-
 
72
          return
-
 
73
        }
-
 
74
        dispatch(addNotification({ style: 'success', msg: data.data }))
-
 
75
        window.location.reload()
-
 
76
      })
-
 
77
      .catch((err) => console.log('>>: err > ', err))
46
    dispatch(setIntlLabels(labels))
78
  }
47
  }, [])
79
 
48
 
80
  return (
49
  return (
81
    <>
50
    <>
82
      <Cover cover={cover} id={groupId} type="group" />
-
 
83
      <main className="main-section-data container px-0 mt-3">
-
 
84
        <div className="main-left-sidebar">
-
 
85
          <div className="user_profile">
-
 
86
            <div className="user-pro-img">
-
 
87
              <img
51
      <Cover cover={cover} id={groupId} type="group" />
88
                src={`/storage/type/group/code/${groupId}/${
-
 
89
                  image ? `filename/${image}` : ''
-
 
90
                }`}
-
 
91
                alt="profile-image"
-
 
92
              />
-
 
93
            </div>
-
 
94
            <div className="user_pro_status">
-
 
95
              <h1 className="font-weight-bold" style={{ fontSize: '1.5rem' }}>
-
 
96
                {name}
-
 
97
              </h1>
-
 
98
              <ul className="flw-status">
-
 
99
                <div className="container horizontal-list">
-
 
100
                  <div className="row ">
-
 
101
                    {linkInmail && (
-
 
102
                      <a href={linkInmail || '#'} className="btn btn-primary">
-
 
103
                        Contactar con el Administrador
-
 
104
                      </a>
-
 
105
                    )}
-
 
106
                    <div className="members_count">
-
 
107
                      <b style={{ fontSize: '1rem' }}>{totalMembers}</b>
-
 
108
                      <p>Miembros</p>
-
 
109
                    </div>
-
 
110
                    {actionLinks.link_accept && (
-
 
111
                      <button
-
 
112
                        onClick={() =>
-
 
113
                          handleActionLink(actionLinks.link_accept)
-
 
114
                        }
-
 
115
                        className="btn btn-primary"
-
 
116
                      >
-
 
117
                        Aceptar invitacion
-
 
118
                      </button>
-
 
119
                    )}
-
 
120
                    {actionLinks.link_cancel && (
-
 
121
                      <button
-
 
122
                        onClick={() =>
-
 
123
                          handleActionLink(actionLinks.link_cancel)
-
 
124
                        }
-
 
125
                        className="btn btn-primary"
-
 
126
                      >
-
 
127
                        Cancelar invitacion
-
 
128
                      </button>
-
 
129
                    )}
-
 
130
                    {!linkInvite && actionLinks.link_leave && (
-
 
131
                      <button
-
 
132
                        onClick={() => handleActionLink(actionLinks.link_leave)}
-
 
133
                        className="btn btn-primary"
-
 
134
                      >
-
 
135
                        Abandonar grupo
-
 
136
                      </button>
-
 
137
                    )}
-
 
138
                    {actionLinks.link_request && (
-
 
139
                      <button
-
 
140
                        onClick={() =>
-
 
141
                          handleActionLink(actionLinks.link_request)
-
 
142
                        }
52
      <main className="main-section-data container px-0 mt-3">
143
                        className="btn btn-primary"
-
 
144
                      >
-
 
145
                        {accessibility === 'Auto unirse'
-
 
146
                          ? 'Unirse'
-
 
147
                          : 'Solicitar membresia'}
-
 
148
                      </button>
-
 
149
                    )}
-
 
150
                  </div>
-
 
151
                </div>
-
 
152
              </ul>
-
 
153
            </div>
53
        <div className="main-left-sidebar">
-
 
54
          <GroupInfo
154
          </div>
55
            accessibility={accessibility}
-
 
56
            groupId={groupId}
-
 
57
            image={image}
155
          <GroupMembersHelper
58
            linkInmail={linkInmail}
-
 
59
            name={name}
156
            groupId={groupId}
60
            totalMembers={totalMembers}
157
            handleFirstLinkInvite={(link) => setLinkInvite(link)}
61
          />
158
          />
62
          <GroupMembersHelper groupId={groupId} />
159
        </div>
63
        </div>
160
        <div className="main-ws-sec">
64
        <div className="main-ws-sec">