diff --git a/components/konstitisyon/comments-list.js b/components/konstitisyon/comments-list.js index 044d8df..ae4b596 100644 --- a/components/konstitisyon/comments-list.js +++ b/components/konstitisyon/comments-list.js @@ -1,5 +1,5 @@ /* eslint-disable camelcase */ -import React, {useEffect, useState} from 'react' +import React, {useEffect, useState, useRef} from 'react' import PropTypes from 'prop-types' import List from '@mui/material/List' import ListItem from '@mui/material/ListItem' @@ -11,12 +11,14 @@ import Pagination from '@mui/material/Pagination' import Divider from '@mui/material/Divider' import Box from '@mui/material/Box' import {readItems, withToken} from '@directus/sdk' +import LogoutCountdown from '../session/logout-countdown.js' import {directusClient} from '@/lib/directus.js' import {formatDate} from '@/lib/format.js' const commentsPerPage = process.env.NEXT_PUBLIC_COMMENTS_PER_PAGE || 2 export default function CommentsList({session, selectedTitre, isOpen, setIsOpen, setError, setIsErrorAlertOpen}) { + const countdownRef = useRef() const [comments, setComments] = useState([]) const [page, setPage] = useState(1) @@ -60,44 +62,47 @@ export default function CommentsList({session, selectedTitre, isOpen, setIsOpen, } return ( - - Commentaires - - {selectedComments && selectedComments.length > 0 ? selectedComments.map(({id, date_created, text, user_created}) => ( - - - - {user_created.split('-')[0]} - - } - secondary={ - <> - - {text} + <> + + Commentaires + + {selectedComments && selectedComments.length > 0 ? selectedComments.map(({id, date_created, text, user_created}) => ( + + + + {user_created.split('-')[0]} - {` — ${formatDate(date_created, 'PPPPpppp')}`} - - } - /> - + } + secondary={ + <> + + {text} + + {` — ${formatDate(date_created, 'PPPPpppp')}`} + + } + /> + - - - )) : ( - Aucun commentaire - )} - - - - - + + + )) : ( + Aucun commentaire + )} + + + + + + + ) }