Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4537 | Rev 4539 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

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