Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2844 Rev 2854
Línea 1... Línea 1...
1
import React, { useMemo } from 'react'
1
import React from 'react'
2
import { styled, Typography } from '@mui/material'
2
import { styled, Typography } from '@mui/material'
3
import { Link } from 'react-router-dom'
3
import { Link } from 'react-router-dom'
4
import Options from '@components/UI/Option'
4
import Options from '@components/UI/Option'
Línea 5... Línea 5...
5
 
5
 
Línea 33... Línea 33...
33
    comment: content,
33
    comment: content,
34
    link_delete,
34
    link_delete,
35
    link_abuse_report
35
    link_abuse_report
36
  } = comment
36
  } = comment
Línea 37... Línea -...
37
 
-
 
38
  const actions = useMemo(() => {
-
 
39
    const options = []
-
 
40
 
-
 
41
    if (link_delete) {
-
 
42
      options.push({
-
 
43
        label: 'Borrar',
-
 
44
        action: () => onDelete(comment)
-
 
45
      })
-
 
46
    }
-
 
47
 
-
 
48
    if (link_abuse_report) {
-
 
49
      options.push({
-
 
50
        label: 'Reportar',
-
 
51
        action: () => onReport(link_abuse_report)
-
 
52
      })
-
 
53
    }
-
 
54
 
-
 
55
    return options
-
 
56
  }, [link_delete, link_abuse_report])
-
 
57
 
37
 
58
  return (
38
  return (
59
    <CommentContainer>
39
    <CommentContainer>
60
      <CommentHeader>
40
      <CommentHeader>
61
        <CommentInfo to={user_url}>
41
        <CommentInfo to={user_url}>
62
          <Typography variant='h3'>{user_name}</Typography>
42
          <Typography variant='h3'>{user_name}</Typography>
63
          <Typography variant='body2'>{time_elapsed}</Typography>
43
          <Typography variant='body2'>{time_elapsed}</Typography>
Línea -... Línea 44...
-
 
44
        </CommentInfo>
-
 
45
 
-
 
46
        <Options>
-
 
47
          {link_delete ? (
64
        </CommentInfo>
48
            <Options.Item onClick={() => onReport(link_abuse_report)}>
-
 
49
              Reportar
-
 
50
            </Options.Item>
-
 
51
          ) : null}
-
 
52
          {link_abuse_report ? (
-
 
53
            <Options.Item onClick={() => onDelete(comment)}>
-
 
54
              Borrar
-
 
55
            </Options.Item>
65
 
56
          ) : null}
Línea 66... Línea 57...
66
        <Options options={actions} />
57
        </Options>
67
      </CommentHeader>
58
      </CommentHeader>
68
 
59