Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 5 Rev 200
Línea 1... Línea 1...
1
import React, { useEffect, useState } from 'react'
1
import React, { useEffect, useState } from "react";
2
import { useDispatch } from 'react-redux'
2
import { useDispatch } from "react-redux";
3
import { setTimelineUrl } from '../../redux/feed/feed.actions'
3
import { setTimelineUrl } from "../../redux/feed/feed.actions";
4
import { getBackendVars } from '../../services/backendVars'
4
import { getBackendVars } from "../../services/backendVars";
5
import { useParams } from 'react-router-dom'
5
import { useParams } from "react-router-dom";
6
 
6
 
7
import FeedList from '../../components/feed/linkedin/FeedList'
7
import FeedList from "../../components/dashboard/linkedin/feed-list/FeedList";
8
import GroupInfo from '../../components/widgets/linkedin/InfoWidget'
8
import GroupInfo from "../../components/widgets/linkedin/InfoWidget";
9
import AboutCompany from '../../components/company/AboutCompany'
9
import AboutCompany from "../../components/company/AboutCompany";
10
import CompanyFollowers from '../../components/company/CompanyFollowers'
10
import CompanyFollowers from "../../components/company/CompanyFollowers";
11
import CompanyActions from '../../components/company/CompanyActions'
11
import CompanyActions from "../../components/company/CompanyActions";
Línea 12... Línea 12...
12
 
12
 
Línea 13... Línea 13...
13
import './styles/linkedin.scss'
13
import "./styles/linkedin.scss";
14
 
14
 
15
const LinkedInCompany = () => {
15
const LinkedInCompany = () => {
16
  const [backendVars, setBackendVars] = useState(null)
16
  const [backendVars, setBackendVars] = useState(null);
17
  const [actionsUrls, setActionsUrls] = useState(null)
17
  const [actionsUrls, setActionsUrls] = useState(null);
18
  const [isFollower, setIsFollower] = useState(false)
18
  const [isFollower, setIsFollower] = useState(false);
Línea 19... Línea 19...
19
  const { uuid } = useParams()
19
  const { uuid } = useParams();
20
  const dispatch = useDispatch()
20
  const dispatch = useDispatch();
21
 
21
 
22
  const getCompanyVars = () => {
22
  const getCompanyVars = () => {
Línea 23... Línea 23...
23
    getBackendVars(`/company/view/${uuid}`)
23
    getBackendVars(`/company/view/${uuid}`)
24
      .then((vars) => {
24
      .then((vars) => {
25
        const actions = {}
25
        const actions = {};
26
 
26
 
Línea 27... Línea 27...
27
        Object.entries(vars).forEach(([key, value]) => {
27
        Object.entries(vars).forEach(([key, value]) => {
28
          if (!key.includes('link')) {
28
          if (!key.includes("link")) {
Línea 29... Línea 29...
29
            return
29
            return;
30
          }
30
          }
31
 
31
 
32
          actions[key] = value
32
          actions[key] = value;
33
        })
33
        });
34
 
34
 
35
        setActionsUrls(actions)
35
        setActionsUrls(actions);
36
        dispatch(setTimelineUrl(vars.link_timeline))
36
        dispatch(setTimelineUrl(vars.link_timeline));
37
        setIsFollower(!!vars.link_unfollow)
37
        setIsFollower(!!vars.link_unfollow);
38
        setBackendVars(vars)
38
        setBackendVars(vars);
Línea 39... Línea 39...
39
      })
39
      })
40
      .catch((err) => {
40
      .catch((err) => {
41
        console.log(`Error: ${err}`)
41
        console.log(`Error: ${err}`);
Línea 42... Línea 42...
42
        throw new Error(err)
42
        throw new Error(err);
43
      })
43
      });
44
  }
44
  };
45
 
45
 
Línea 60... Línea 60...
60
            totalMembers={backendVars?.total_followers}
60
            totalMembers={backendVars?.total_followers}
61
            groupType={backendVars?.company_size}
61
            groupType={backendVars?.company_size}
62
            accessibility={backendVars?.industry}
62
            accessibility={backendVars?.industry}
63
          />
63
          />
64
        </div>
64
        </div>
65
        <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
65
        <div className="d-flex flex-column" style={{ gap: ".5rem" }}>
66
          <CompanyActions
66
          <CompanyActions
67
            name={backendVars?.company_name}
67
            name={backendVars?.company_name}
68
            image={backendVars?.image}
68
            image={backendVars?.image}
69
            companyId={backendVars?.company_uuid}
69
            companyId={backendVars?.company_uuid}
70
            cover={backendVars?.cover}
70
            cover={backendVars?.cover}
Línea 75... Línea 75...
75
          {!isFollower ? (
75
          {!isFollower ? (
76
            <AboutCompany {...backendVars} />
76
            <AboutCompany {...backendVars} />
77
          ) : (
77
          ) : (
78
            <FeedList
78
            <FeedList
79
              image={`/storage/type/company/code/${backendVars?.companyId}/${
79
              image={`/storage/type/company/code/${backendVars?.companyId}/${
80
                backendVars?.image ? `filename/${backendVars?.image}` : ''
80
                backendVars?.image ? `filename/${backendVars?.image}` : ""
81
              }`}
81
              }`}
82
            />
82
            />
83
          )}
83
          )}
84
        </div>
84
        </div>
85
        <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
85
        <div className="d-flex flex-column" style={{ gap: ".5rem" }}>
86
          <CompanyFollowers companyId={uuid} />
86
          <CompanyFollowers companyId={uuid} />
87
          <AboutCompany {...backendVars} />
87
          <AboutCompany {...backendVars} />
88
        </div>
88
        </div>
89
      </div>
89
      </div>
90
    </main>
90
    </main>
91
  )
91
  );
92
}
92
};
Línea 93... Línea 93...
93
 
93