Proyectos de Subversion LeadersLinked - SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3736 stevensc 1
import React from 'react';
2
import Edit from '@mui/icons-material/Edit';
3
import { IconButton, Typography } from '@mui/material';
4
 
5
import { useModal } from '@shared/hooks';
6
import { parse } from '@shared/utils';
7
 
8
import { Card, CardContent, CardHeader } from '@shared/components';
9
import { OverviewForm } from './OverviewForm';
10
 
11
export function Overview({ uuid, description, updateGroup, edit }) {
12
  const { showModal, closeModal } = useModal();
13
 
14
  const handleEdit = () => {
15
    showModal(
16
      'Visión general',
17
      <OverviewForm
18
        uuid={uuid}
19
        description={description}
20
        onSubmit={(data) => {
21
          updateGroup((prev) => ({ ...prev, overview: data }));
22
          closeModal();
23
        }}
24
      />
25
    );
26
  };
27
 
28
  return (
29
    <Card>
30
      <CardHeader
31
        title='Visión general'
32
        renderAction={() => {
33
          if (!edit) return;
34
          return (
35
            <IconButton onClick={handleEdit}>
36
              <Edit />
37
            </IconButton>
38
          );
39
        }}
40
      />
41
 
42
      <CardContent>
43
        <Typography>{parse(description ?? 'No hay descripción')}</Typography>
44
      </CardContent>
45
    </Card>
46
  );
47
}