Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 200 Rev 856
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/dashboard/linkedin/feed-list/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));
-
 
37
        setIsFollower(!!vars.link_unfollow);
36
        dispatch(setTimelineUrl(vars.link_timeline))
38
        setBackendVars(vars);
37
        setIsFollower(!!vars.link_unfollow)
Línea 39... Línea 38...
39
      })
38
        setBackendVars(vars)
40
      .catch((err) => {
39
      })
41
        console.log(`Error: ${err}`);
40
      .catch((err) => {
Línea 42... Línea 41...
42
        throw new Error(err);
41
        console.log(`Error: ${err}`)
43
      });
42
      })
44
  };
43
  }
45
 
44
 
46
  useEffect(() => {
45
  useEffect(() => {
47
    getCompanyVars();
46
    getCompanyVars()
48
  }, []);
47
  }, [])
49
 
48
 
50
  return (
49
  return (
Línea 60... Línea 59...
60
            totalMembers={backendVars?.total_followers}
59
            totalMembers={backendVars?.total_followers}
61
            groupType={backendVars?.company_size}
60
            groupType={backendVars?.company_size}
62
            accessibility={backendVars?.industry}
61
            accessibility={backendVars?.industry}
63
          />
62
          />
64
        </div>
63
        </div>
65
        <div className="d-flex flex-column" style={{ gap: ".5rem" }}>
64
        <div className='d-flex flex-column' style={{ gap: '.5rem' }}>
66
          <CompanyActions
65
          <CompanyActions
67
            name={backendVars?.company_name}
66
            name={backendVars?.company_name}
68
            image={backendVars?.image}
67
            image={backendVars?.image}
69
            companyId={backendVars?.company_uuid}
68
            companyId={backendVars?.company_uuid}
70
            cover={backendVars?.cover}
69
            cover={backendVars?.cover}
Línea 75... Línea 74...
75
          {!isFollower ? (
74
          {!isFollower ? (
76
            <AboutCompany {...backendVars} />
75
            <AboutCompany {...backendVars} />
77
          ) : (
76
          ) : (
78
            <FeedList
77
            <FeedList
79
              image={`/storage/type/company/code/${backendVars?.companyId}/${
78
              image={`/storage/type/company/code/${backendVars?.companyId}/${
80
                backendVars?.image ? `filename/${backendVars?.image}` : ""
79
                backendVars?.image ? `filename/${backendVars?.image}` : ''
81
              }`}
80
              }`}
82
            />
81
            />
83
          )}
82
          )}
84
        </div>
83
        </div>
85
        <div className="d-flex flex-column" style={{ gap: ".5rem" }}>
84
        <div className='d-flex flex-column' style={{ gap: '.5rem' }}>
86
          <CompanyFollowers companyId={uuid} />
85
          <CompanyFollowers companyId={uuid} />
87
          <AboutCompany {...backendVars} />
86
          <AboutCompany {...backendVars} />
88
        </div>
87
        </div>
89
      </div>
88
      </div>
90
    </main>
89
    </main>
91
  );
90
  )
92
};
91
}
Línea 93... Línea 92...
93
 
92