Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2885 Rev 2888
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React, { useState } from 'react'
2
import Button from '../UI/buttons/Buttons'
-
 
3
 
-
 
4
import { addNotification } from '../../redux/notification/notification.actions'
-
 
5
import { useDispatch, useSelector } from 'react-redux'
2
import { useDispatch, useSelector } from 'react-redux'
6
import EditIcon from '@mui/icons-material/Edit'
3
import { Box, Typography } from '@mui/material'
7
import DeleteIcon from '@mui/icons-material/Delete'
-
 
8
import ChatOutlinedIcon from '@mui/icons-material/ChatOutlined'
4
import { ChatOutlined, Edit, Delete } from '@mui/icons-material'
9
import styled from 'styled-components'
-
 
Línea 10... Línea -...
10
 
-
 
11
import { QuestionStats } from './QuestionCard'
-
 
12
import WidgetWrapper from '../widgets/WidgetLayout'
-
 
13
import CommentForm from '../dashboard/linkedin/comments/comment-form'
-
 
14
import CommentsList from '../dashboard/linkedin/comments/comment-list'
-
 
15
import { withReactions } from '@hocs'
-
 
16
import { Typography } from '@mui/material'
5
 
-
 
6
import { axios, parse } from '@utils'
-
 
7
import { withReactions } from '@hocs'
Línea 17... Línea 8...
17
import { axios, parse } from '@utils'
8
import { addNotification } from '@store/notification/notification.actions'
18
 
9
 
19
const StyledForm = styled(CommentForm)`
10
import { QuestionStats } from './QuestionCard'
20
  border: 1px solid lightgray;
-
 
21
  background-color: #fff;
-
 
22
  border-radius: 30px;
11
import Widget from '@components/UI/Widget'
23
  padding: 5px;
-
 
24
  padding-left: 1rem;
-
 
25
  flex: 1;
-
 
26
  cursor: pointer;
-
 
27
 
12
import Button from '@components/UI/buttons/Buttons'
28
  &:hover {
-
 
29
    background-color: rgba(0, 0, 0, 0.08);
-
 
Línea 30... Línea 13...
30
  }
13
import CommentForm from '@components/dashboard/linkedin/comments/comment-form'
31
`
14
import CommentsList from '@components/dashboard/linkedin/comments/comment-list'
32
 
15
 
33
const AnswerCard = ({
16
const AnswerCard = ({
Línea 117... Línea 100...
117
 
100
 
Línea 118... Línea 101...
118
  const ReactionsButton = withReactions(Button)
101
  const ReactionsButton = withReactions(Button)
119
 
102
 
-
 
103
  return (
120
  return (
104
    <>
-
 
105
      <Widget>
121
    <>
106
        <Widget.Header
-
 
107
          avatar={user_image}
122
      <WidgetWrapper>
108
          title={user_name}
123
        <WidgetWrapper.Header image={user_image} title={user_name}>
109
          renderAction={() => (
124
          <QuestionStats>
110
            <QuestionStats>
125
            <span>{`${labels.published} ${time_elapsed}`}</span>
111
              <span>{`${labels.published} ${time_elapsed}`}</span>
126
            <span>{`${totalReactions} ${labels.reactions}`}</span>
112
              <span>{`${totalReactions} ${labels.reactions}`}</span>
-
 
113
              <span>{`${totalComments} ${labels.comments}`}</span>
127
            <span>{`${totalComments} ${labels.comments}`}</span>
114
            </QuestionStats>
Línea 128... Línea 115...
128
          </QuestionStats>
115
          )}
129
        </WidgetWrapper.Header>
116
        />
130
 
117
 
Línea 131... Línea 118...
131
        <WidgetWrapper.Body>
118
        <Widget.Body>
132
          <Typography>{parse(text)}</Typography>
119
          <Typography>{parse(text)}</Typography>
133
        </WidgetWrapper.Body>
120
        </Widget.Body>
134
 
121
 
135
        <WidgetWrapper.Actions>
122
        <Widget.Actions>
136
          {link_save_reaction && (
123
          {link_save_reaction && (
Línea 146... Línea 133...
146
                updateReactions(total_reactions_question)
133
                updateReactions(total_reactions_question)
147
              }}
134
              }}
148
            />
135
            />
149
          )}
136
          )}
150
          {link_add_comment && (
137
          {link_add_comment && (
151
            <button onClick={() => setShowComments(!showComments)}>
138
            <Button onClick={() => setShowComments(!showComments)}>
152
              <ChatOutlinedIcon />
139
              <ChatOutlined />
153
              {labels.comment}
140
              {labels.comment}
154
            </button>
141
            </Button>
155
          )}
142
          )}
156
          {link_edit && (
143
          {link_edit && (
157
            <button onClick={() => onEdit(link_edit, text)}>
144
            <Button onClick={() => onEdit(link_edit, text)}>
158
              <EditIcon />
145
              <Edit />
159
              {labels.edit}
146
              {labels.edit}
160
            </button>
147
            </Button>
161
          )}
148
          )}
162
          {link_delete && (
149
          {link_delete && (
163
            <button onClick={() => onDelete(link_delete)}>
150
            <Button onClick={() => onDelete(link_delete)}>
164
              <DeleteIcon />
151
              <Delete />
165
              {labels.delete}
152
              {labels.delete}
166
            </button>
153
            </Button>
167
          )}
154
          )}
168
        </WidgetWrapper.Actions>
155
        </Widget.Actions>
Línea 169... Línea 156...
169
 
156
 
170
        <div className='px-1 pb-1'>
157
        <Box sx={{ padding: 0.5 }}>
171
          <StyledForm image={user_image} onSubmit={addComment} />
-
 
172
          {showComments && (
158
          <CommentForm onSubmit={addComment} />
173
            <CommentsList comments={comments} onDelete={deleteComment} />
-
 
174
          )}
159
          <CommentsList comments={comments} onDelete={deleteComment} />
175
        </div>
160
        </Box>
176
      </WidgetWrapper>
161
      </Widget>
177
    </>
162
    </>
178
  )
163
  )
Línea 179... Línea 164...
179
}
164
}