Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4540 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

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