Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4536 | Rev 4538 | 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'
3
import FeedSection from '../../../../../dashboard/templates/linkedin/Feed/FeedSection';
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';
4531 stevensc 8
 
9
const View = ({ backendVars }) => {
4534 stevensc 10
 
11
    const [authorizedLinks, setAuthorizedLinks] = useState(null);
4535 stevensc 12
    const [followers, setFollowers] = useState(backendVars.totalFollowers);
4534 stevensc 13
    const [isFollower, setIsFollower] = useState(false);
14
 
15
    useEffect(() => {
16
        setTimelineUrl(backendVars.timeline);
17
        fetchAuthorizedLinks();
18
    }, []);
19
 
20
    const fetchAuthorizedLinks = async () => {
21
        const response = await axios.get(`/company/view/${backendVars.companyId}`);
22
        const resData = response.data;
23
        if (resData.success) {
24
            setAuthorizedLinks(resData.data);
25
            setFollowers(resData.data.total_followers);
26
            if (resData.data.link_unfollow) {
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} />
4534 stevensc 53
                        : <FeedSection
54
                            routeTimeline={backendVars.timeline}
55
                            backendVars={{
56
                                ...backendVars,
4537 stevensc 57
                                image: `/storage/type/company/code/${backendVars.companyId}/${backendVars.image ? `filename/${backendVars.image}` : ""}`
4534 stevensc 58
                            }}
59
                        />
60
                    }
4531 stevensc 61
                </div>
62
                <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
4537 stevensc 63
                    <AboutCompany {...backendVars} />
4531 stevensc 64
                </div>
65
            </div>
66
        </main>
67
    )
68
}
69
 
70
export default View