Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3047 Rev 3446
Línea 1... Línea 1...
1
import React, { useEffect, useState } from 'react'
1
import React, { useEffect, useState } from 'react';
2
import { useParams } from 'react-router-dom'
2
import { useParams } from 'react-router-dom';
3
import { useDispatch, useSelector } from 'react-redux'
3
import { useDispatch, useSelector } from 'react-redux';
4
import { getBackendVars } from '../../services/backendVars'
4
import { getBackendVars } from '../../services/backendVars';
5
 
5
 
6
import ProfileInfo from '../../components/ProfileInfo'
6
import ProfileInfo from '../../components/ProfileInfo';
7
import Cover from '../../components/UI/cover/Cover'
7
import Cover from '../../components/UI/cover/Cover';
8
import Skills from '../../components/profile/skills/SkillsCard'
8
import Skills from '../../components/profile/skills/SkillsCard';
9
import Location from '../../components/location/Location'
9
import Location from '../../components/location/Location';
10
import Overview from '../../components/overview/Overview'
10
import Overview from '../../components/overview/Overview';
11
import Aptitudes from '../../components/profile/aptitudes/AptitudesCard'
11
import Aptitudes from '../../components/profile/aptitudes/AptitudesCard';
12
import Languages from '../../components/profile/languages/LanguagesCard'
12
import Languages from '../../components/profile/languages/LanguagesCard';
13
import Educations from '../../components/educations/Educations'
13
import Educations from '../../components/educations/Educations';
14
import Experiences from '../../components/experiences/Experiences'
14
import Experiences from '../../components/experiences/Experiences';
15
import SuggestWidget from '../../components/widgets/default/SuggestWidget'
15
import SuggestWidget from '../../components/widgets/default/SuggestWidget';
16
import HobbiesAndInterests from '../../components/profile/hobbies/HobbiesCard.jsx'
16
import HobbiesAndInterests from '../../components/profile/hobbies/HobbiesCard.jsx';
17
import { addNotification } from '@app/redux/notification/notification.actions'
17
import { addNotification } from '@app/redux/notification/notification.actions';
Línea 18... Línea 18...
18
 
18
 
19
const ProfileView = () => {
19
const ProfileView = () => {
20
  const [profile, setProfile] = useState(null)
20
  const [profile, setProfile] = useState(null);
21
  const labels = useSelector(({ intl }) => intl.labels)
21
  const labels = useSelector(({ intl }) => intl.labels);
22
  const { uuid } = useParams()
22
  const { uuid } = useParams();
Línea 23... Línea 23...
23
  const dispatch = useDispatch()
23
  const dispatch = useDispatch();
24
 
24
 
25
  useEffect(() => {
25
  useEffect(() => {
26
    getBackendVars(`/profile/view/${uuid}`)
26
    getBackendVars(`/profile/view/${uuid}`)
27
      .then((vars) => {
27
      .then((vars) => {
28
        const adapters = [
28
        const adapters = [
29
          'user_hobbies_and_interests',
29
          'user_hobbies_and_interests',
30
          'user_skills',
30
          'user_skills',
31
          'user_aptitudes',
31
          'user_aptitudes',
Línea 32... Línea 32...
32
          'user_languages'
32
          'user_languages'
33
        ]
33
        ];
34
 
34
 
35
        adapters.forEach((adapter) => {
35
        adapters.forEach((adapter) => {
36
          vars[adapter] = Object.entries(vars[adapter]).map(([key, value]) => {
36
          vars[adapter] = Object.entries(vars[adapter]).map(([key, value]) => {
Línea 37... Línea 37...
37
            return { name: value, value: key }
37
            return { name: value, value: key };
38
          })
38
          });
39
        })
39
        });
40
 
40
 
41
        setProfile(vars)
41
        setProfile(vars);
42
      })
42
      })
Línea 43... Línea 43...
43
      .catch((error) => {
43
      .catch((error) => {
44
        dispatch(addNotification({ style: 'danger', msg: error.message }))
44
        dispatch(addNotification({ style: 'danger', msg: error.message }));
45
      })
45
      });
46
  }, [])
46
  }, []);
Línea 65... Línea 65...
65
          <Educations educations={profile?.user_educations} />
65
          <Educations educations={profile?.user_educations} />
66
          <Location address={profile?.formatted_address} />
66
          <Location address={profile?.formatted_address} />
67
          <Languages languages={profile?.user_languages} />
67
          <Languages languages={profile?.user_languages} />
68
          <Skills skills={profile?.user_skills} />
68
          <Skills skills={profile?.user_skills} />
69
          <Aptitudes aptitudes={profile?.user_aptitudes} />
69
          <Aptitudes aptitudes={profile?.user_aptitudes} />
70
          <HobbiesAndInterests
-
 
71
            hobbiesAndInterest={profile?.user_hobbies_and_interests}
70
          <HobbiesAndInterests hobbiesAndInterest={profile?.user_hobbies_and_interests} />
72
          />
-
 
73
        </section>
71
        </section>
74
        <SuggestWidget
72
        <SuggestWidget
75
          url={`/helpers/people-viewed-profile/${profile?.user_profile_id}`}
73
          url={`/helpers/people-viewed-profile/${profile?.user_profile_id}`}
76
          btnLabelAccept={labels.view_profile}
74
          btnLabelAccept={labels.view_profile}
77
          title={labels.who_has_seen_this_profile}
75
          title={labels.who_has_seen_this_profile}
78
        />
76
        />
79
      </main>
77
      </main>
80
    </>
78
    </>
81
  )
79
  );
82
}
80
};
Línea 83... Línea 81...
83
 
81