Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5366 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
4494 stevensc 1
/* eslint-disable react/prop-types */
4522 stevensc 2
import React, { useEffect, useState } from 'react'
3
import { useDispatch } from 'react-redux'
4
import { addNotification } from '../../../../../redux/notification/notification.actions'
5
import { axios } from '../../../../../utils'
5897 stevensc 6
 
7
import FeedSection from '../../../../../dashboard/templates/linkedin/Feed/FeedSection'
4500 stevensc 8
import AboutGroup from '../components/AboutGroup'
4522 stevensc 9
import GroupActions from '../components/GroupActions'
4497 stevensc 10
import GroupInfo from '../components/GroupInfo'
4513 stevensc 11
import Members from '../components/Members'
4494 stevensc 12
 
4495 stevensc 13
const View = ({ backendVars }) => {
5366 stevensc 14
  const [actionLinks, setActionLinks] = useState({})
15
  const dispatch = useDispatch()
4522 stevensc 16
 
5366 stevensc 17
  const load = () => {
5897 stevensc 18
    axios
19
      .get('')
5366 stevensc 20
      .then(({ data }) => {
21
        if (!data.success) {
22
          return dispatch(addNotification({ style: 'error', msg: data.data }))
23
        }
24
        setActionLinks(data.data)
25
      })
5897 stevensc 26
      .catch((err) => console.log('>>: err > ', err))
5366 stevensc 27
  }
4522 stevensc 28
 
5366 stevensc 29
  useEffect(() => {
30
    load()
31
  }, [])
4522 stevensc 32
 
5366 stevensc 33
  return (
5897 stevensc 34
    <main className="w-100">
35
      <div className="container p-0 app__body layout__content">
36
        <div className="d-flex flex-column">
37
          <GroupInfo
38
            cover={backendVars.cover}
39
            image={backendVars.image}
40
            name={backendVars.name}
41
            overview={backendVars.overview}
42
            groupId={backendVars.groupId}
43
            totalMembers={backendVars.totalMembers}
44
            groupType={backendVars.groupType}
45
            accessibility={backendVars.accessibility}
46
            type="group"
47
          />
48
        </div>
49
        <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
50
          <GroupActions {...backendVars} actionLinks={actionLinks} />
51
          {backendVars.withoutFeeds ? (
52
            <AboutGroup {...backendVars} />
53
          ) : (
54
            <FeedSection
55
              routeTimeline={backendVars.routeTimeline}
56
              backendVars={{
57
                ...backendVars,
58
                image: `/storage/type/group/code/${backendVars.groupId}/${
59
                  backendVars.image ? `filename/${backendVars.image}` : ''
60
                }`,
61
              }}
62
            />
63
          )}
64
        </div>
65
        <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
66
          <Members groupId={backendVars.groupId} />
67
          {!backendVars.withoutFeeds && <AboutGroup {...backendVars} />}
68
        </div>
69
      </div>
70
    </main>
5366 stevensc 71
  )
4494 stevensc 72
}
73
 
5366 stevensc 74
export default View