| 6862 |
stevensc |
1 |
import React, { useEffect, useState } from 'react'
|
| 6865 |
stevensc |
2 |
import { camalize } from '../../utils'
|
| 6862 |
stevensc |
3 |
import { useParams } from 'react-router-dom'
|
|
|
4 |
import { useDispatch } from 'react-redux'
|
|
|
5 |
import { getBackendVars } from '../../services/backendVars'
|
|
|
6 |
import { setTimelineUrl } from '../../redux/feed/feed.actions'
|
|
|
7 |
import { addNotification } from '../../redux/notification/notification.actions'
|
|
|
8 |
|
|
|
9 |
import Members from '../../components/group/Members'
|
|
|
10 |
import FeedList from '../../components/feed/linkedin/FeedList'
|
|
|
11 |
import FeedShare from '../../components/feed/linkedin/FeedShare'
|
|
|
12 |
import InfoWidget from '../../components/widgets/linkedin/InfoWidget'
|
|
|
13 |
import AboutGroup from '../../components/group/AboutGroup'
|
|
|
14 |
import GroupActions from '../../components/group/GroupActions'
|
|
|
15 |
|
| 6869 |
stevensc |
16 |
import './styles/linkedin.scss'
|
|
|
17 |
|
| 6862 |
stevensc |
18 |
const View = () => {
|
|
|
19 |
const [backendVars, setBackendVars] = useState({})
|
|
|
20 |
const { uuid } = useParams()
|
|
|
21 |
const dispatch = useDispatch()
|
|
|
22 |
|
|
|
23 |
useEffect(() => {
|
| 6863 |
stevensc |
24 |
getBackendVars(`/group/view/${uuid}`)
|
| 6862 |
stevensc |
25 |
.then((vars) => {
|
|
|
26 |
const actions = {}
|
|
|
27 |
|
|
|
28 |
Object.entries(vars).forEach(([key, value]) => {
|
| 6865 |
stevensc |
29 |
const camelCaseKey = camalize(key)
|
|
|
30 |
actions[camelCaseKey] = value
|
| 6862 |
stevensc |
31 |
})
|
|
|
32 |
|
| 6883 |
stevensc |
33 |
dispatch(setTimelineUrl(`/feed/timeline/${vars.group_uuid}/group`))
|
| 6865 |
stevensc |
34 |
setBackendVars(actions)
|
| 6862 |
stevensc |
35 |
})
|
|
|
36 |
.catch((err) => {
|
|
|
37 |
dispatch(addNotification({ style: 'danger', msg: err }))
|
|
|
38 |
console.log(`Error: ${err}`)
|
|
|
39 |
throw new Error(err)
|
|
|
40 |
})
|
|
|
41 |
}, [])
|
|
|
42 |
|
|
|
43 |
return (
|
|
|
44 |
<main className="w-100">
|
|
|
45 |
<div className="container p-0 app__body layout__content">
|
|
|
46 |
<div className="d-flex flex-column">
|
| 6865 |
stevensc |
47 |
<InfoWidget {...backendVars} />
|
| 6862 |
stevensc |
48 |
</div>
|
|
|
49 |
<div className="d-flex flex-column" style={{ gap: '.5rem' }}>
|
| 6865 |
stevensc |
50 |
<GroupActions {...backendVars} />
|
| 6862 |
stevensc |
51 |
|
|
|
52 |
{backendVars.withoutFeeds ? (
|
|
|
53 |
<AboutGroup {...backendVars} />
|
|
|
54 |
) : (
|
|
|
55 |
<>
|
| 6865 |
stevensc |
56 |
<FeedShare
|
|
|
57 |
feedType="GROUP"
|
|
|
58 |
postUrl={`/feed/add/group/${uuid}`}
|
| 6891 |
stevensc |
59 |
image={`/storage/type/group/code/${uuid}${
|
|
|
60 |
backendVars.image ? `/filename/${backendVars.image}` : '/'
|
|
|
61 |
}`}
|
| 6865 |
stevensc |
62 |
/>
|
| 6862 |
stevensc |
63 |
<FeedList feed={backendVars.feed} image={backendVars.image} />
|
|
|
64 |
</>
|
|
|
65 |
)}
|
|
|
66 |
</div>
|
|
|
67 |
<div className="d-flex flex-column" style={{ gap: '.5rem' }}>
|
| 6868 |
stevensc |
68 |
<Members groupId={backendVars.groupUuid} />
|
| 6862 |
stevensc |
69 |
{!backendVars.withoutFeeds && <AboutGroup {...backendVars} />}
|
|
|
70 |
</div>
|
|
|
71 |
</div>
|
|
|
72 |
</main>
|
|
|
73 |
)
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
export default View
|