Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 527 Rev 535
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React, { useState } from 'react'
2
import { axios } from '../../utils'
2
import { axios } from '../../utils'
3
import { Link } from 'react-router-dom'
-
 
4
import { Avatar } from '@mui/material'
-
 
5
import { addNotification } from '../../redux/notification/notification.actions'
3
import { addNotification } from '../../redux/notification/notification.actions'
6
import { useDispatch, useSelector } from 'react-redux'
4
import { useDispatch, useSelector } from 'react-redux'
7
import parse from 'html-react-parser'
-
 
8
import styled from 'styled-components'
-
 
9
import EditIcon from '@mui/icons-material/Edit'
5
import EditIcon from '@mui/icons-material/Edit'
10
import DeleteIcon from '@mui/icons-material/Delete'
6
import DeleteIcon from '@mui/icons-material/Delete'
Línea 11... Línea -...
11
 
-
 
12
import {
-
 
13
  QuestionActions,
-
 
14
  QuestionDetails,
-
 
15
  QuestionStats,
-
 
16
  QuestionUserInfo,
7
 
17
  StyledQuestionCard,
8
import StyledContainer from '../widgets/WidgetLayout'
18
} from './QuestionCard'
9
import { QuestionStats } from './QuestionCard'
19
import { CommentForm, CommentsList } from '../feed/CommentSection'
10
import { CommentForm, CommentsList } from '../feed/CommentSection'
20
import ReactionsButton from '../UI/buttons/ReactionsButton'
-
 
21
 
11
import ReactionsButton from '../UI/buttons/ReactionsButton'
22
const AnswerActions = styled(QuestionActions)`
-
 
23
  margin-bottom: 0.5rem;
-
 
Línea 24... Línea 12...
24
`
12
import Paraphrase from '../UI/Paraphrase'
25
 
-
 
26
const AnswerCard = ({
-
 
27
  // unique = '',
-
 
28
  // uuid = '',
13
 
29
  // question_uuid = '',
14
const AnswerCard = ({
30
  time_elapsed = '',
15
  time_elapsed = '',
31
  user_image = '',
16
  user_image = '',
32
  user_url = '',
17
  user_url = '',
Línea 122... Línea 107...
122
      })
107
      })
123
  }
108
  }
Línea 124... Línea 109...
124
 
109
 
125
  return (
110
  return (
126
    <>
111
    <>
127
      <StyledQuestionCard>
-
 
128
        <QuestionDetails>
-
 
129
          <QuestionUserInfo>
-
 
130
            <Link to={user_url}>
-
 
131
              <Avatar
-
 
132
                src={user_image}
112
      <StyledContainer>
133
                alt={`${user_name} profile image`}
-
 
134
                sx={{ width: '50px', height: '50px' }}
-
 
135
              />
-
 
136
            </Link>
-
 
137
            <p>{user_name}</p>
-
 
138
          </QuestionUserInfo>
-
 
139
 
113
        <StyledContainer.Header image={user_image} title={user_name}>
140
          <QuestionStats className="mb-2">
114
          <QuestionStats className="mb-2">
141
            <span>{`${labels.published} ${time_elapsed}`}</span>
115
            <span>{`${labels.published} ${time_elapsed}`}</span>
142
            <span>{`${totalReactions} ${labels.reactions}`}</span>
116
            <span>{`${totalReactions} ${labels.reactions}`}</span>
143
            <span>{`${totalComments} ${labels.comments}`}</span>
117
            <span>{`${totalComments} ${labels.comments}`}</span>
144
          </QuestionStats>
118
          </QuestionStats>
-
 
119
        </StyledContainer.Header>
145
        </QuestionDetails>
120
 
-
 
121
        <StyledContainer.Body>
-
 
122
          <Paraphrase>{text}</Paraphrase>
Línea 146... Línea 123...
146
        {text && parse(text)}
123
        </StyledContainer.Body>
147
 
124
 
148
        <AnswerActions>
125
        <StyledContainer.Actions>
149
          {link_save_reaction && (
-
 
150
            <ReactionsButton
126
          {link_save_reaction && (
151
              className="btn feed__share-option"
127
            <ReactionsButton
152
              currentReaction={reaction}
128
              currentReaction={reaction}
153
              saveUrl={link_save_reaction}
129
              saveUrl={link_save_reaction}
154
              deleteUrl={link_reaction_delete}
130
              deleteUrl={link_reaction_delete}
Línea 158... Línea 134...
158
              }}
134
              }}
159
              withLabel
135
              withLabel
160
            />
136
            />
161
          )}
137
          )}
162
          {link_edit && (
138
          {link_edit && (
163
            <button
-
 
164
              className="btn feed__share-option"
-
 
165
              onClick={() => onEdit(link_edit, text)}
139
            <button onClick={() => onEdit(link_edit, text)}>
166
            >
-
 
167
              <EditIcon />
140
              <EditIcon />
168
              {labels.edit}
141
              {labels.edit}
169
            </button>
142
            </button>
170
          )}
143
          )}
171
          {link_delete && (
144
          {link_delete && (
172
            <button
-
 
173
              className="btn feed__share-option"
-
 
174
              onClick={() => onDelete(link_delete)}
145
            <button onClick={() => onDelete(link_delete)}>
175
            >
-
 
176
              <DeleteIcon />
146
              <DeleteIcon />
177
              {labels.delete}
147
              {labels.delete}
178
            </button>
148
            </button>
179
          )}
149
          )}
180
        </AnswerActions>
150
        </StyledContainer.Actions>
181
        <CommentForm onSubmit={addComment} />
151
        <CommentForm onSubmit={addComment} />
182
        <CommentsList comments={comments} onDelete={deleteComment} />
152
        <CommentsList comments={comments} onDelete={deleteComment} />
183
      </StyledQuestionCard>
153
      </StyledContainer>
184
    </>
154
    </>
185
  )
155
  )
186
}
156
}
Línea 187... Línea 157...
187
 
157