Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5475 | Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
5473 stevensc 1
import React, { useEffect, useState } from 'react'
2
import parse from 'html-react-parser'
3
import { useDispatch } from 'react-redux'
4
import { setIntlLabels } from '../../../../redux/intl/intl.action'
5
import EmptySection from '../../../../shared/empty-section/EmptySection'
6
import SuggestWidget from '../../../../shared/helpers/my-groups-helper/SuggestWidget'
7
import ProfileInfo from '../../../components/ProfileInfo'
8
import Overview from '../../../components/overview/Overview'
9
 
10
const View = ({
11
  userIdEncrypted,
12
  cover,
13
  overview,
14
  userExperiences,
15
  userEducations,
16
  formatted_address,
17
  months,
18
  userLanguages,
19
  userSkills,
20
  userAptitudes,
21
  userHobbiesAndInterests,
22
  CancelConnectionUrl,
23
  RequestConnectionUrl,
24
  profileId,
25
  labels,
26
  ...profileProps
27
}) => {
28
  const [monthOptions, setMonthOptions] = useState({})
29
  const dispatch = useDispatch()
30
 
31
  useEffect(() => {
32
    setMonthOptions(
33
      months.reduce((obj, item, i) => ({ ...obj, [i + 1]: item }), {})
34
    )
35
  }, [months])
36
 
37
  useEffect(() => {
38
    dispatch(setIntlLabels(labels))
39
  }, [])
40
 
41
  return (
42
    <>
43
      <section className="cover-sec">
44
        <img
45
          id="user-cover-img"
46
          src={`/storage/type/user-cover/code/${userIdEncrypted}/${
47
            cover ? `filename/${cover}` : ''
48
          }`}
49
          alt=""
50
        />
51
      </section>
52
      <main className="main-section-data container px-0">
53
        <ProfileInfo
54
          {...profileProps}
55
          id={userIdEncrypted}
56
          cancelUrl={CancelConnectionUrl}
57
          connectUrl={RequestConnectionUrl}
58
        />
59
        <section className="feed-section">
60
          <Overview overview={overview} userId={userIdEncrypted} />
61
          <div className="user-profile-extended-ov st2">
62
            <h3>Experiencia</h3>
63
            {!userExperiences.length ? (
64
              <EmptySection align="left" message={labels.EMPTY} />
65
            ) : (
66
              <span id="experience-records">
67
                {userExperiences.map(
68
                  (
69
                    {
70
                      company,
71
                      title,
72
                      from_month,
73
                      from_year,
74
                      to_month,
75
                      to_year,
76
                      industry,
77
                      size,
78
                      formatted_adress,
79
                      description,
80
                    },
81
                    id
82
                  ) => (
83
                    <div key={id}>
84
                      {id >= 1 ? <hr /> : ''}
85
                      <p>{company}</p>
86
                      <p>{title}</p>
87
                      <p>
88
                        {`${monthOptions[from_month]} ${from_year}`} -{' '}
89
                        {to_year
90
                          ? `${monthOptions[to_month]} ${to_year}`
91
                          : 'Actual'}
92
                      </p>
93
                      <p>{`${industry} / ${size}`}</p>
94
                      <p>{formatted_adress}</p>
95
                      {description && parse(description)}
96
                    </div>
97
                  )
98
                )}
99
              </span>
100
            )}
101
          </div>
102
          <div className="user-profile-extended-ov">
103
            <h3>{labels.EDUCATION}</h3>
104
            {!userEducations.length ? (
105
              <EmptySection align="left" message={labels.EMPTY} />
106
            ) : (
107
              <span id="education-records">
108
                {userEducations.map(
109
                  (
110
                    {
111
                      degree,
112
                      university,
113
                      from_year,
114
                      to_year,
115
                      field_of_study,
116
                      formatted_address,
117
                      description,
118
                    },
119
                    id
120
                  ) => (
121
                    <div key={id}>
122
                      {id >= 1 && <hr />}
123
                      <p>{degree}</p>
124
                      <p>{university}</p>
125
                      <p>{`${from_year} - ${to_year || 'Actual'}`}</p>
126
                      {field_of_study && <p>{field_of_study}</p>}
127
                      <p>{formatted_address}</p>
128
                      {description && <p>{parse(description)}</p>}
129
                    </div>
130
                  )
131
                )}
132
              </span>
133
            )}
134
          </div>
135
          <div className="user-profile-extended-ov">
136
            <h3>{labels.LOCATION}</h3>
137
            {!formatted_address ? (
138
              <EmptySection align="left" message={labels.EMPTY} />
139
            ) : (
140
              <p id="location-formatted_address">{formatted_address}</p>
141
            )}
142
          </div>
143
          <div className="user-profile-extended-ov">
144
            <h3>{labels.LANGUAGES}</h3>
145
            {!userLanguages.length ? (
146
              <EmptySection align="left" message={labels.EMPTY} />
147
            ) : (
148
              <ul id="list-languages">
149
                {userLanguages.map(({ name, value }) => (
150
                  <li key={value}>
151
                    <a href="#" title="">
152
                      {name}
153
                    </a>
154
                  </li>
155
                ))}
156
              </ul>
157
            )}
158
          </div>
159
          <div className="user-profile-extended-ov">
160
            <h3>{labels.SKILLS}</h3>
161
            {!userSkills.length ? (
162
              <EmptySection align="left" message={labels.EMPTY} />
163
            ) : (
164
              <ul id="list-skills">
165
                {userSkills.map(({ name, value }) => (
166
                  <li key={value}>
167
                    <a href="#" title="">
168
                      {name}
169
                    </a>
170
                  </li>
171
                ))}
172
              </ul>
173
            )}
174
          </div>
175
          <div className="user-profile-extended-ov">
176
            <h3>{labels.APTITUDES}</h3>
177
            {!userAptitudes.length ? (
178
              <EmptySection align="left" message={labels.EMPTY} />
179
            ) : (
180
              <ul id="list-skills">
181
                {userAptitudes.map(({ name, value }) => (
182
                  <li key={value}>
183
                    <a href="#" title="">
184
                      {name}
185
                    </a>
186
                  </li>
187
                ))}
188
              </ul>
189
            )}
190
          </div>
191
          <div className="user-profile-extended-ov">
192
            <h3>{labels.HOBBIES_AND_INTERESTS}</h3>
193
            {!userHobbiesAndInterests.length ? (
194
              <EmptySection align="left" message={labels.EMPTY} />
195
            ) : (
196
              <ul id="list-skills">
197
                {userHobbiesAndInterests.map(({ name, value }) => (
198
                  <li key={value}>
199
                    <a href="#" title="">
200
                      {name}
201
                    </a>
202
                  </li>
203
                ))}
204
              </ul>
205
            )}
206
          </div>
207
        </section>
208
        <SuggestWidget
209
          url={`/helpers/people-viewed-profile/${profileId}`}
210
          btnLabelAccept="Ver perfil"
211
          title="Quien ha visitado esta perfil"
212
        />
213
      </main>
214
    </>
215
  )
216
}
217
 
218
export default View