Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 5870 Rev 5871
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React, { useEffect, useState } from 'react'
2
import EmptySection from '../../../../../shared/empty-section/EmptySection'
2
import EmptySection from '../../../../../shared/empty-section/EmptySection'
3
import EducationCard from '../../../../pages/view/templates/linkedin/components/cards/EducationCard'
3
import EducationCard from '../../../../pages/view/templates/linkedin/components/cards/EducationCard'
4
import ExperienceCard from '../../../../pages/view/templates/linkedin/components/cards/ExperienceCard'
4
import ExperienceCard from '../../../../pages/view/templates/linkedin/components/cards/ExperienceCard'
5
import ItemsList from '../../../../pages/view/templates/linkedin/components/cards/ItemsList'
5
import ItemsList from '../../../../pages/view/templates/linkedin/components/cards/ItemsList'
6
import ProfileCard from '../../../../pages/view/templates/linkedin/components/ProfileCard'
6
import ProfileCard from '../../../../pages/view/templates/linkedin/components/ProfileCard'
Línea 26... Línea 26...
26
    formatted_address,
26
    formatted_address,
27
  } = userInfo
27
  } = userInfo
Línea 28... Línea 28...
28
 
28
 
29
  const [experiences, setExperiences] = useState(userExperiences)
29
  const [experiences, setExperiences] = useState(userExperiences)
30
  const [educations, setEducations] = useState(userEducations)
30
  const [educations, setEducations] = useState(userEducations)
31
  const [languages, setLanguages] = useState(userLanguages)
31
  const [languages, setLanguages] = useState([])
32
  const [skills, setSkills] = useState(userSkills)
32
  const [skills, setSkills] = useState([])
33
  const [aptitudes, setAptitudes] = useState(userAptitudes)
33
  const [aptitudes, setAptitudes] = useState([])
34
  const [hobbiesAndInterests, setHobbiesAndInterests] = useState(
-
 
35
    userHobbiesAndInterests
-
 
36
  )
34
  const [hobbiesAndInterests, setHobbiesAndInterests] = useState([])
Línea 37... Línea 35...
37
  const [address, setAddress] = useState(formatted_address)
35
  const [address, setAddress] = useState(formatted_address)
38
 
36
 
39
  const [modalShow, setModalShow] = useState(null)
37
  const [modalShow, setModalShow] = useState(null)
Línea 85... Línea 83...
85
    Habilidades: (
83
    Habilidades: (
86
      <SkillsModal
84
      <SkillsModal
87
        closeModal={closeModal}
85
        closeModal={closeModal}
88
        setSkills={(newSkills) => setSkills(newSkills)}
86
        setSkills={(newSkills) => setSkills(newSkills)}
89
        show={modalShow === 'Habilidades'}
87
        show={modalShow === 'Habilidades'}
90
        skillsOptions={options.skills}
88
        skillsOptions={Object.entries(options.skills).map(([key, value]) => ({
-
 
89
          value: key,
-
 
90
          name: value,
-
 
91
        }))}
91
        userIdEncrypted={userInfo.userProfileIdEncrypted}
92
        userIdEncrypted={userInfo.userProfileIdEncrypted}
92
        userSkillsArray={skills}
93
        userSkillsArray={skills}
93
      />
94
      />
94
    ),
95
    ),
95
    Idiomas: (
96
    Idiomas: (
96
      <LanguagesModal
97
      <LanguagesModal
97
        show={modalShow === 'Idiomas'}
98
        show={modalShow === 'Idiomas'}
98
        closeModal={closeModal}
99
        closeModal={closeModal}
99
        userIdEncrypted={userInfo.userProfileIdEncrypted}
100
        userIdEncrypted={userInfo.userProfileIdEncrypted}
100
        languagesOptions={options.languages}
101
        languagesOptions={Object.entries(options.languages).map(
-
 
102
          ([key, value]) => ({ value: key, name: value })
-
 
103
        )}
101
        userLanguages={languages}
104
        userLanguages={languages}
102
        setLanguages={(newLanguages) => setLanguages(newLanguages)}
105
        setLanguages={(newLanguages) => setLanguages(newLanguages)}
103
      />
106
      />
104
    ),
107
    ),
105
    Aptitudes: (
108
    Aptitudes: (
106
      <AptitudesModal
109
      <AptitudesModal
107
        show={modalShow === 'Aptitudes'}
110
        show={modalShow === 'Aptitudes'}
108
        closeModal={closeModal}
111
        closeModal={closeModal}
109
        userIdEncrypted={userInfo.userProfileIdEncrypted}
112
        userIdEncrypted={userInfo.userProfileIdEncrypted}
110
        aptitudesOptions={options.aptitudes}
113
        aptitudesOptions={Object.entries(options.aptitudes).map(
-
 
114
          ([key, value]) => ({ value: key, name: value })
-
 
115
        )}
111
        userAptitudes={aptitudes}
116
        userAptitudes={aptitudes}
112
        setAptitudes={(newAptitudes) => setAptitudes(newAptitudes)}
117
        setAptitudes={(newAptitudes) => setAptitudes(newAptitudes)}
113
      />
118
      />
114
    ),
119
    ),
115
    'Hobbies e Intereses': (
120
    'Hobbies e Intereses': (
116
      <HobbiesModal
121
      <HobbiesModal
117
        show={modalShow === 'Hobbies e Intereses'}
122
        show={modalShow === 'Hobbies e Intereses'}
118
        closeModal={closeModal}
123
        closeModal={closeModal}
119
        userIdEncrypted={userInfo.userProfileIdEncrypted}
124
        userIdEncrypted={userInfo.userProfileIdEncrypted}
120
        hobbiesAndInterestsOptions={options.hobbiesAndInterests}
125
        hobbiesAndInterestsOptions={Object.entries(
-
 
126
          options.hobbiesAndInterests
-
 
127
        ).map(([key, value]) => ({ value: key, name: value }))}
121
        userHobbiesAndInterests={hobbiesAndInterests}
128
        userHobbiesAndInterests={hobbiesAndInterests}
122
        setUserHobbiesAndInterests={(newHobbiesAndInterests) =>
129
        setUserHobbiesAndInterests={(newHobbiesAndInterests) =>
123
          setHobbiesAndInterests(newHobbiesAndInterests)
130
          setHobbiesAndInterests(newHobbiesAndInterests)
124
        }
131
        }
125
      />
132
      />
Línea 132... Línea 139...
132
        userIdEncrypted={userInfo.userProfileIdEncrypted}
139
        userIdEncrypted={userInfo.userProfileIdEncrypted}
133
      />
140
      />
134
    ),
141
    ),
135
  }
142
  }
Línea -... Línea 143...
-
 
143
 
-
 
144
  useEffect(() => {
-
 
145
    const adapters = [
-
 
146
      {
-
 
147
        value: userSkills,
-
 
148
        setter: setSkills,
-
 
149
      },
-
 
150
      {
-
 
151
        value: userLanguages,
-
 
152
        setter: setLanguages,
-
 
153
      },
-
 
154
      {
-
 
155
        value: userAptitudes,
-
 
156
        setter: setAptitudes,
-
 
157
      },
-
 
158
      {
-
 
159
        value: userHobbiesAndInterests,
-
 
160
        setter: setHobbiesAndInterests,
-
 
161
      },
-
 
162
    ]
-
 
163
 
-
 
164
    adapters.map((adapter) => {
-
 
165
      const value = Object.entries(adapter.value).map(([key, value]) => ({
-
 
166
        value: key,
-
 
167
        name: value,
-
 
168
      }))
-
 
169
      adapter.setter(value)
-
 
170
    })
-
 
171
  }, [])
-
 
172
 
-
 
173
  return (
-
 
174
    <main className="w-100">
-
 
175
      <div className="container">
-
 
176
        <div className="main d-flex flex-column" style={{ gap: '.5rem' }}>
-
 
177
          <ProfileCard {...{ ...userInfo, formatted_address: address }} />
-
 
178
          <ProfileWidget
-
 
179
            title="Experiencia"
-
 
180
            onEdit={() => setIsEdit(!isEdit)}
-
 
181
            onAdd={handleAdd}
-
 
182
            addUrl={`/profile/my-profiles/experience/${userInfo.userProfileIdEncrypted}/operation/add`}
-
 
183
          >
-
 
184
            {experiences.map((experience, index) => {
-
 
185
              return (
-
 
186
                <ExperienceCard
-
 
187
                  key={index}
-
 
188
                  experience={experience}
-
 
189
                  months={userInfo.months}
-
 
190
                  isEdit={isEdit}
-
 
191
                  onEdit={handleEdit}
-
 
192
                  setExperiences={(newExperiences) =>
-
 
193
                    setExperiences(newExperiences)
-
 
194
                  }
-
 
195
                />
-
 
196
              )
-
 
197
            })}
-
 
198
          </ProfileWidget>
-
 
199
          <ProfileWidget
-
 
200
            title="Educación"
-
 
201
            onEdit={() => setIsEdit(!isEdit)}
-
 
202
            onAdd={handleAdd}
-
 
203
            addUrl={`/profile/my-profiles/education/${userInfo.userProfileIdEncrypted}/operation/add`}
-
 
204
          >
-
 
205
            {educations.map((education, index) => {
-
 
206
              return (
-
 
207
                <EducationCard
-
 
208
                  key={index}
-
 
209
                  education={education}
-
 
210
                  isEdit={isEdit}
-
 
211
                  onEdit={handleEdit}
-
 
212
                  setEducations={(newEducations) =>
-
 
213
                    setEducations(newEducations)
-
 
214
                  }
-
 
215
                />
-
 
216
              )
-
 
217
            })}
-
 
218
          </ProfileWidget>
-
 
219
          <ProfileWidget
-
 
220
            title="Ubicación"
-
 
221
            onEdit={() => setModalShow('Ubicación')}
-
 
222
            justEdit
-
 
223
          >
-
 
224
            <div className="card__items">
-
 
225
              <p>{address}</p>
-
 
226
            </div>
-
 
227
          </ProfileWidget>
-
 
228
          <ProfileWidget
-
 
229
            title="Idiomas"
-
 
230
            onEdit={() => setModalShow('Idiomas')}
-
 
231
            justEdit
-
 
232
          >
-
 
233
            {!languages.length ? (
-
 
234
              <EmptySection align="left" message="Sin información" />
-
 
235
            ) : (
-
 
236
              <ItemsList value={languages} />
-
 
237
            )}
-
 
238
          </ProfileWidget>
-
 
239
          <ProfileWidget
-
 
240
            title="Habilidades"
-
 
241
            onEdit={() => setModalShow('Habilidades')}
-
 
242
            justEdit
-
 
243
          >
-
 
244
            {!skills.length ? (
-
 
245
              <EmptySection align="left" message="Sin información" />
-
 
246
            ) : (
-
 
247
              <ItemsList value={skills} />
-
 
248
            )}
-
 
249
          </ProfileWidget>
-
 
250
          <ProfileWidget
-
 
251
            title="Aptitudes"
-
 
252
            onEdit={() => setModalShow('Aptitudes')}
-
 
253
            justEdit
-
 
254
          >
-
 
255
            {!aptitudes.length ? (
-
 
256
              <EmptySection align="left" message="Sin información" />
-
 
257
            ) : (
-
 
258
              <ItemsList value={aptitudes} />
-
 
259
            )}
136
 
260
          </ProfileWidget>
-
 
261
          <ProfileWidget
-
 
262
            title="Pasatiempos e intereses"
-
 
263
            onEdit={() => setModalShow('Hobbies e Intereses')}
-
 
264
            justEdit
-
 
265
          >
-
 
266
            {!hobbiesAndInterests.length ? (
-
 
267
              <EmptySection align="left" message="Sin información" />
-
 
268
            ) : (
-
 
269
              <ItemsList value={hobbiesAndInterests} />
-
 
270
            )}
-
 
271
          </ProfileWidget>
-
 
272
          {renderModal[modalShow]}
-
 
273
        </div>
-
 
274
      </div>
-
 
275
    </main>
137
  return <h1>Hello</h1>
276
  )
Línea 138... Línea 277...
138
}
277
}