Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6864 Rev 6865
Línea 1... Línea 1...
1
import React, { useEffect, useState } from 'react'
1
import React, { useEffect, useState } from 'react'
-
 
2
import { camalize } from '../../utils'
2
import { useParams } from 'react-router-dom'
3
import { useParams } from 'react-router-dom'
3
import { useDispatch } from 'react-redux'
4
import { useDispatch } from 'react-redux'
4
import { getBackendVars } from '../../services/backendVars'
5
import { getBackendVars } from '../../services/backendVars'
5
import { setTimelineUrl } from '../../redux/feed/feed.actions'
6
import { setTimelineUrl } from '../../redux/feed/feed.actions'
6
import { addNotification } from '../../redux/notification/notification.actions'
7
import { addNotification } from '../../redux/notification/notification.actions'
Línea 12... Línea 13...
12
import AboutGroup from '../../components/group/AboutGroup'
13
import AboutGroup from '../../components/group/AboutGroup'
13
import GroupActions from '../../components/group/GroupActions'
14
import GroupActions from '../../components/group/GroupActions'
Línea 14... Línea 15...
14
 
15
 
15
const View = () => {
16
const View = () => {
16
  const [backendVars, setBackendVars] = useState({})
-
 
17
  const [actionsUrls, setActionsUrls] = useState({})
17
  const [backendVars, setBackendVars] = useState({})
18
  const { uuid } = useParams()
18
  const { uuid } = useParams()
Línea 19... Línea 19...
19
  const dispatch = useDispatch()
19
  const dispatch = useDispatch()
20
 
20
 
21
  useEffect(() => {
21
  useEffect(() => {
22
    getBackendVars(`/group/view/${uuid}`)
22
    getBackendVars(`/group/view/${uuid}`)
Línea 23... Línea 23...
23
      .then((vars) => {
23
      .then((vars) => {
24
        const actions = {}
24
        const actions = {}
25
 
-
 
26
        Object.entries(vars).forEach(([key, value]) => {
-
 
27
          if (!key.includes('link')) {
-
 
28
            return
25
 
29
          }
26
        Object.entries(vars).forEach(([key, value]) => {
Línea 30... Línea -...
30
 
-
 
31
          actions[key] = value
27
          const camelCaseKey = camalize(key)
32
        })
28
          actions[camelCaseKey] = value
33
 
29
        })
34
        setActionsUrls(actions)
30
 
35
        dispatch(setTimelineUrl(vars.link_timeline))
31
        // dispatch(setTimelineUrl(vars.link_timeline))
36
        setBackendVars(vars)
32
        setBackendVars(actions)
37
      })
33
      })
Línea 44... Línea 40...
44
 
40
 
45
  return (
41
  return (
46
    <main className="w-100">
42
    <main className="w-100">
47
      <div className="container p-0 app__body layout__content">
43
      <div className="container p-0 app__body layout__content">
48
        <div className="d-flex flex-column">
-
 
49
          <InfoWidget
-
 
50
            cover={backendVars.cover}
-
 
51
            image={backendVars.image}
44
        <div className="d-flex flex-column">
52
            name={backendVars.name}
-
 
53
            overview={backendVars.overview}
-
 
54
            totalMembers={backendVars.total_members}
-
 
55
            id={backendVars.group_uuid}
-
 
56
            groupType={backendVars.group_type}
-
 
57
            accessibility={backendVars.accessibility}
-
 
58
          />
45
          <InfoWidget {...backendVars} />
59
        </div>
46
        </div>
60
        <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
-
 
61
          <GroupActions
-
 
62
            groupId={backendVars.group_uuid}
-
 
63
            groupType={backendVars.group_type}
-
 
64
            linkInmail={backendVars.link_inmail}
47
        <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
65
            {...backendVars}
-
 
66
            actionLinks={actionsUrls}
-
 
Línea 67... Línea 48...
67
          />
48
          <GroupActions {...backendVars} />
68
 
49
 
69
          {backendVars.withoutFeeds ? (
50
          {backendVars.withoutFeeds ? (
70
            <AboutGroup {...backendVars} />
51
            <AboutGroup {...backendVars} />
-
 
52
          ) : (
-
 
53
            <>
71
          ) : (
54
              <FeedShare
-
 
55
                feedType="GROUP"
-
 
56
                postUrl={`/feed/add/group/${uuid}`}
72
            <>
57
                image={`/storage/type/group/code/${uuid}/filename/${backendVars.image}`}
73
              <FeedShare image={backendVars.image} postUrl="/feed/add" />
58
              />
74
              <FeedList feed={backendVars.feed} image={backendVars.image} />
59
              <FeedList feed={backendVars.feed} image={backendVars.image} />
75
            </>
60
            </>
76
          )}
61
          )}