Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3058 | Rev 3537 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React from 'react'
import { useParams } from 'react-router-dom'
import { useSelector } from 'react-redux'
import { Box, Grid } from '@mui/material'

import { useFetch } from '@hooks'
import { formatObjectToArray } from '@utils'

import ProfileCard from '@components/profile/ProfileCard'
import LocationCard from '@components/profile/location/LocationCard'
import LanguagesCard from '@components/profile/languages/LanguagesCard'
import SkillsCard from '@components/profile/skills/SkillsCard'
import AptitudesCard from '@components/profile/aptitudes/AptitudesCard'
import HobbiesCard from '@components/profile/hobbies/HobbiesCard'
import SuggestWidget from '@components/widgets/default/SuggestWidget'
import EducationsCard from '@components/profile/educations/educations-card'
import ExperiencesCard from '@components/profile/experiences/experiences-card'

const ProfileViewPage = () => {
  const labels = useSelector(({ intl }) => intl.labels)
  const { uuid } = useParams()

  const { data: profile } = useFetch(`/profile/view/${uuid}`)

  return (
    <Grid container spacing={1}>
      <Grid item xs md={8} spacing={1} direction='column'>
        <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
          <ProfileCard {...profile} />

          <ExperiencesCard
            experiences={profile?.user_experiences}
            uuid={uuid}
          />

          <EducationsCard educations={profile?.user_educations} uuid={uuid} />

          <LocationCard address={profile?.formatted_address} uuid={uuid} />

          <LanguagesCard
            languages={formatObjectToArray(profile?.user_languages)}
            uuid={uuid}
          />

          <SkillsCard
            skills={formatObjectToArray(profile?.user_skills)}
            uuid={uuid}
          />

          <AptitudesCard
            aptitudes={formatObjectToArray(profile?.user_aptitudes)}
            uuid={uuid}
          />

          <HobbiesCard
            hobbies={formatObjectToArray(profile?.user_hobbies_and_interests)}
            uuid={uuid}
          />
        </Box>
      </Grid>

      <Grid item xs md={4}>
        {profile?.user_profile_id && (
          <SuggestWidget
            url={`/helpers/people-viewed-profile/${profile?.user_profile_id}`}
            title={labels.who_has_seen_this_profile}
          />
        )}
      </Grid>
    </Grid>
  )
}

export default ProfileViewPage