| 4531 |
stevensc |
1 |
/* eslint-disable react/prop-types */
|
| 4534 |
stevensc |
2 |
import React, { useEffect, useState } from 'react'
|
| 4539 |
stevensc |
3 |
import { axios } from '../../../../../utils';
|
|
|
4 |
import { useDispatch } from 'react-redux';
|
|
|
5 |
import { setTimelineUrl } from '../../../../../redux/feed/feed.actions';
|
| 4538 |
stevensc |
6 |
import FeedList from '../../../../../dashboard/templates/linkedin/Feed/FeedList';
|
| 4531 |
stevensc |
7 |
import GroupInfo from '../../../../../group/view/templates/linkedin/components/GroupInfo'
|
| 4537 |
stevensc |
8 |
import AboutCompany from '../components/AboutCompany';
|
| 4538 |
stevensc |
9 |
import CompanyFollowers from '../components/CompanyFollowers';
|
| 4531 |
stevensc |
10 |
|
|
|
11 |
const View = ({ backendVars }) => {
|
| 4534 |
stevensc |
12 |
|
|
|
13 |
const [authorizedLinks, setAuthorizedLinks] = useState(null);
|
|
|
14 |
const [isFollower, setIsFollower] = useState(false);
|
| 4539 |
stevensc |
15 |
const dispatch = useDispatch()
|
| 4534 |
stevensc |
16 |
|
|
|
17 |
useEffect(() => {
|
| 4539 |
stevensc |
18 |
dispatch(setTimelineUrl(backendVars.timeline))
|
| 4534 |
stevensc |
19 |
fetchAuthorizedLinks();
|
|
|
20 |
}, []);
|
|
|
21 |
|
|
|
22 |
const fetchAuthorizedLinks = async () => {
|
| 4539 |
stevensc |
23 |
const { data: response } = await axios.get(`/company/view/${backendVars.companyId}`);
|
|
|
24 |
if (response.success) {
|
|
|
25 |
setAuthorizedLinks(response.data);
|
|
|
26 |
if (response.data.link_unfollow) {
|
| 4534 |
stevensc |
27 |
setIsFollower(true);
|
|
|
28 |
} else {
|
|
|
29 |
setIsFollower(false);
|
|
|
30 |
}
|
|
|
31 |
}
|
|
|
32 |
};
|
|
|
33 |
|
| 4531 |
stevensc |
34 |
return (
|
|
|
35 |
<main className="w-100">
|
|
|
36 |
<div className="container p-0 app__body layout__content">
|
|
|
37 |
<div className="d-flex flex-column">
|
|
|
38 |
<GroupInfo
|
|
|
39 |
cover={backendVars.cover}
|
|
|
40 |
image={backendVars.image}
|
|
|
41 |
name={backendVars.companyName}
|
|
|
42 |
overview={backendVars.overview}
|
|
|
43 |
groupId={backendVars.companyId}
|
|
|
44 |
totalMembers={backendVars.totalFollowers}
|
|
|
45 |
groupType={backendVars.companySize}
|
|
|
46 |
accessibility={backendVars.industry}
|
| 4533 |
stevensc |
47 |
type='company'
|
| 4531 |
stevensc |
48 |
/>
|
|
|
49 |
</div>
|
|
|
50 |
<div className="d-flex flex-column" style={{ gap: '.5rem' }}>
|
| 4536 |
stevensc |
51 |
{!isFollower
|
| 4537 |
stevensc |
52 |
? <AboutCompany {...backendVars} />
|
| 4539 |
stevensc |
53 |
: <FeedList image={`/storage/type/company/code/${backendVars.companyId}/${backendVars.image ? `filename/${backendVars.image}` : ""}`} />
|
| 4534 |
stevensc |
54 |
}
|
| 4531 |
stevensc |
55 |
</div>
|
|
|
56 |
<div className="d-flex flex-column" style={{ gap: '.5rem' }}>
|
| 4538 |
stevensc |
57 |
<CompanyFollowers companyId={backendVars.companyId} />
|
| 4537 |
stevensc |
58 |
<AboutCompany {...backendVars} />
|
| 4531 |
stevensc |
59 |
</div>
|
|
|
60 |
</div>
|
|
|
61 |
</main>
|
|
|
62 |
)
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
export default View
|