Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4624 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

/* eslint-disable react/prop-types */
import React, { useEffect, useState } from 'react'
import { useDispatch } from 'react-redux'
import FeedSection from '../../../../../dashboard/templates/linkedin/Feed/FeedSection'
import { addNotification } from '../../../../../redux/notification/notification.actions'
import { axios } from '../../../../../utils'
import AboutGroup from '../components/AboutGroup'
import GroupActions from '../components/GroupActions'
import GroupInfo from '../components/GroupInfo'
import Members from '../components/Members'

const View = ({ backendVars }) => {
  const [actionLinks, setActionLinks] = useState({})
  const dispatch = useDispatch()

  const load = () => {
    axios.get('')
      .then(({ data }) => {
        if (!data.success) {
          return dispatch(addNotification({ style: 'error', msg: data.data }))
        }
        setActionLinks(data.data)
      })
      .catch(err => console.log('>>: err > ', err))
  }

  useEffect(() => {
    load()
  }, [])

  return (
        <main className="w-100">
            <div className="container p-0 app__body layout__content">
                <div className="d-flex flex-column">
                    <GroupInfo
                        cover={backendVars.cover}
                        image={backendVars.image}
                        name={backendVars.name}
                        overview={backendVars.overview}
                        groupId={backendVars.groupId}
                        totalMembers={backendVars.totalMembers}
                        groupType={backendVars.groupType}
                        accessibility={backendVars.accessibility}
                        type='group'
                    />
                </div>
                <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
                    <GroupActions {...backendVars} actionLinks={actionLinks} />
                    {backendVars.withoutFeeds
                      ? <AboutGroup {...backendVars} />
                      : <FeedSection
                            routeTimeline={backendVars.routeTimeline}
                            backendVars={{
                              ...backendVars,
                              image: `/storage/type/group/code/${backendVars.groupId}/${backendVars.image ? `filename/${backendVars.image}` : ''}`
                            }}
                        />
                    }
                </div>
                <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
                    <Members groupId={backendVars.groupId} />
                    {!backendVars.withoutFeeds && <AboutGroup {...backendVars} />}
                </div>
            </div>
        </main>
  )
}

export default View