Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3610 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3610 Rev 3619
Línea 1... Línea 1...
1
import React, { useEffect } from 'react'
1
import React, { useEffect } from 'react';
2
import { Box } from '@mui/material'
2
import { Box } from '@mui/material';
3
import { Inbox } from '@mui/icons-material'
3
import { Inbox } from '@mui/icons-material';
4
 
4
 
5
import { useNearScreen } from '@hooks'
5
import { useNearScreen } from '@hooks';
6
 
6
 
7
import Message from './Message'
7
import Message from './messages/Message';
8
import Spinner from '@components/UI/Spinner'
8
import Spinner from '@components/UI/Spinner';
9
import EmptySection from '@components/UI/EmptySection'
9
import EmptySection from '@components/UI/EmptySection';
Línea 10... Línea 10...
10
 
10
 
11
export default function MessagesList({
11
export default function MessagesList({
12
  messages = [],
12
  messages = [],
13
  onPagination,
13
  onPagination,
Línea 16... Línea 16...
16
  loading
16
  loading
17
}) {
17
}) {
18
  const [isIntercepting, ref] = useNearScreen({
18
  const [isIntercepting, ref] = useNearScreen({
19
    once: false,
19
    once: false,
20
    rootMargin: '0px'
20
    rootMargin: '0px'
21
  })
21
  });
Línea 22... Línea 22...
22
 
22
 
23
  useEffect(() => {
23
  useEffect(() => {
24
    if (isIntercepting) {
24
    if (isIntercepting) {
25
      onPagination()
25
      onPagination();
26
    }
26
    }
Línea 27... Línea 27...
27
  }, [isIntercepting])
27
  }, [isIntercepting]);
28
 
28
 
29
  if (!messages.length) {
29
  if (!messages.length) {
30
    return (
30
    return (
31
      <EmptySection
31
      <EmptySection
32
        Icon={<Inbox />}
32
        Icon={<Inbox />}
33
        message='No hay mensajes en esta conversación'
33
        message='No hay mensajes en esta conversación'
34
        align='center'
34
        align='center'
35
      />
35
      />
Línea 36... Línea 36...
36
    )
36
    );
37
  }
37
  }
38
 
38
 
Línea 56... Línea 56...
56
          onReport={onReport}
56
          onReport={onReport}
57
        />
57
        />
58
      ))}
58
      ))}
59
      <div ref={ref}>{loading && <Spinner />}</div>
59
      <div ref={ref}>{loading && <Spinner />}</div>
60
    </Box>
60
    </Box>
61
  )
61
  );
62
}
62
}