Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2899 Rev 3694
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React, { useState } from 'react';
2
import { useSelector } from 'react-redux'
2
import { useSelector } from 'react-redux';
3
import { Box, Typography } from '@mui/material'
3
import { Box, Typography } from '@mui/material';
-
 
4
import SendOutlined from '@mui/icons-material/SendOutlined';
4
import { SendOutlined, ChatOutlined } from '@mui/icons-material'
5
import ChatOutlined from '@mui/icons-material/ChatOutlined';
5
 
6
 
6
import { parse } from '@utils'
7
import { parse } from '@utils';
7
import { withReactions } from '@hocs'
8
import { withReactions } from '@hocs';
8
import withExternalShare from '@components/dashboard/linkedin/withExternalShare'
9
import withExternalShare from '@components/dashboard/linkedin/withExternalShare';
9
 
10
 
10
import Button from '@components/UI/buttons/Buttons'
11
import Button from '@components/UI/buttons/Buttons';
11
import CommentForm from '../dashboard/linkedin/comments/comment-form'
12
import CommentForm from '../dashboard/linkedin/comments/comment-form';
12
import CommentsList from '../dashboard/linkedin/comments/comment-list'
13
import CommentsList from '../dashboard/linkedin/comments/comment-list';
13
import Widget from '../UI/Widget'
14
import Widget from '../UI/Widget';
14
import PostFile from './PostFile'
15
import PostFile from './PostFile';
15
import Reactions from '@components/dashboard/reactions/reactions'
16
import Reactions from '@components/dashboard/reactions/reactions';
16
 
17
 
17
function PostCard({
18
function PostCard({ post, addComment, updateReactions, updateMyReaction, updateTotalShare }) {
18
  post,
-
 
19
  addComment,
-
 
20
  updateReactions,
-
 
21
  updateMyReaction,
-
 
22
  updateTotalShare
-
 
23
}) {
-
 
24
  const {
19
  const {
25
    reactions,
20
    reactions,
26
    my_reaction,
21
    my_reaction,
27
    reactions_url,
22
    reactions_url,
28
    save_reaction_url,
23
    save_reaction_url,
Línea 34... Línea 29...
34
    file,
29
    file,
35
    type,
30
    type,
36
    comments,
31
    comments,
37
    share_external_url,
32
    share_external_url,
38
    share_increment_external_counter_url
33
    share_increment_external_counter_url
39
  } = post
34
  } = post;
40
  const [showComments, setShowComments] = useState(false)
35
  const [showComments, setShowComments] = useState(false);
41
  const labels = useSelector(({ intl }) => intl.labels)
36
  const labels = useSelector(({ intl }) => intl.labels);
Línea 42... Línea 37...
42
 
37
 
43
  const displayCommentSection = () => {
38
  const displayCommentSection = () => {
44
    setShowComments(!showComments)
39
    setShowComments(!showComments);
Línea 45... Línea 40...
45
  }
40
  };
Línea 46... Línea 41...
46
 
41
 
Línea 47... Línea 42...
47
  const ExternalShareButton = withExternalShare(Button, share_external_url)
42
  const ExternalShareButton = withExternalShare(Button, share_external_url);
48
 
43
 
49
  const ReactionButton = withReactions(Button)
44
  const ReactionButton = withReactions(Button);
Línea 79... Línea 74...
79
        <ReactionButton
74
        <ReactionButton
80
          currentReactionType={my_reaction}
75
          currentReactionType={my_reaction}
81
          saveUrl={save_reaction_url}
76
          saveUrl={save_reaction_url}
82
          deleteUrl={delete_reaction_url}
77
          deleteUrl={delete_reaction_url}
83
          onReaction={({ reactions }, currentReaction) => {
78
          onReaction={({ reactions }, currentReaction) => {
84
            updateReactions(reactions)
79
            updateReactions(reactions);
85
            updateMyReaction(currentReaction)
80
            updateMyReaction(currentReaction);
86
          }}
81
          }}
87
        />
82
        />
Línea 88... Línea 83...
88
 
83
 
89
        <Button onClick={displayCommentSection}>
84
        <Button onClick={displayCommentSection}>
Línea 109... Línea 104...
109
          <CommentForm onSubmit={addComment} />
104
          <CommentForm onSubmit={addComment} />
110
          <CommentsList comments={comments} />
105
          <CommentsList comments={comments} />
111
        </Box>
106
        </Box>
112
      ) : null}
107
      ) : null}
113
    </Widget>
108
    </Widget>
114
  )
109
  );
115
}
110
}
Línea 116... Línea 111...
116
 
111