diff --git a/5 lab/src/components/comment/form/comments.jsx b/5 lab/src/components/comment/form/comments.jsx
index 24a9b6a..c6fe478 100644
--- a/5 lab/src/components/comment/form/comments.jsx
+++ b/5 lab/src/components/comment/form/comments.jsx
@@ -5,7 +5,6 @@ import { ListGroup } from 'react-bootstrap';
import Comment from './comment';
const Comments = ({ coments }) => {
- console.log(coments);
if (coments.coments !== undefined) {
// eslint-disable-next-line no-param-reassign
coments = coments.coments;
@@ -13,7 +12,7 @@ const Comments = ({ coments }) => {
{
- coments.map((line) => )
+ coments.map((line) => )
}
diff --git a/5 lab/src/components/comment/hooks/CommsItemFormHook.js b/5 lab/src/components/comment/hooks/CommsItemFormHook.js
index 2697b78..8c33920 100644
--- a/5 lab/src/components/comment/hooks/CommsItemFormHook.js
+++ b/5 lab/src/components/comment/hooks/CommsItemFormHook.js
@@ -7,7 +7,7 @@ import useLines from './CommsHook';
const useLinesItemForm = (linesChangeHandle, postIdd, setComms) => {
const { item } = useLinesItem(-1);
const tmp = useLines();
- const id = tmp.comments.length + 1;
+ let id = tmp.comments.length;
const { comments } = useLines(postIdd);
const [validated, setValidated] = useState(false);
const resetValidity = () => {
@@ -18,14 +18,17 @@ const useLinesItemForm = (linesChangeHandle, postIdd, setComms) => {
const personId = parseInt(localStorage.getItem('UserId'), 10);
const commText = formData.commText.toString();
const postId = parseInt(postIdd, 10);
+ const time = `${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`;
return {
personId: personId.toString(),
commText: commText.toString(),
postId: postId.toString(),
+ time: time.toString(),
};
};
const handleSubmit = async (event, comment) => {
+ id += 1;
const form = event.currentTarget;
event.preventDefault();
event.stopPropagation();
diff --git a/5 lab/src/components/comment/hooks/CommsItemHook.js b/5 lab/src/components/comment/hooks/CommsItemHook.js
index da2a39c..b1a174b 100644
--- a/5 lab/src/components/comment/hooks/CommsItemHook.js
+++ b/5 lab/src/components/comment/hooks/CommsItemHook.js
@@ -7,6 +7,7 @@ const useLinesItem = (id) => {
id: '',
personId: '',
commText: '',
+ text: '',
postId: '',
};
const [item, setItem] = useState({ ...emptyItem });
diff --git a/5 lab/src/components/groups/hooks/GroupsHook.js b/5 lab/src/components/groups/hooks/GroupsHook.js
index 900763b..a686a9a 100644
--- a/5 lab/src/components/groups/hooks/GroupsHook.js
+++ b/5 lab/src/components/groups/hooks/GroupsHook.js
@@ -13,7 +13,6 @@ const useLines = (typeFilter) => {
useEffect(() => {
getLines();
- // eslint-disable-next-line react-hooks/exhaustive-deps
}, [linesRefresh, typeFilter]);
return {
diff --git a/5 lab/src/components/groups/table/Line.jsx b/5 lab/src/components/groups/table/Line.jsx
deleted file mode 100644
index b260198..0000000
--- a/5 lab/src/components/groups/table/Line.jsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import PropTypes from 'prop-types';
-import useLines from '../../users/hooks/UsersHook';
-
-const Line = ({
- index, personId, friendId,
-}) => {
- const { users } = useLines();
- let personNickname = null;
- users.map((line) => {
- if (line.id === personId) {
- personNickname = line.nickname;
- return '';
- }
- return '';
- });
- let friendNickname = null;
- users.map((line) => {
- if (line.id === friendId) {
- friendNickname = line.nickname;
- return '';
- }
- return '';
- });
- return (
-
- {index + 1} |
- {personNickname} |
- {friendNickname} |
-
- );
-};
-Line.propTypes = {
- index: PropTypes.number,
- personId: PropTypes.number,
- friendId: PropTypes.number,
- users: PropTypes.object,
-};
-export default Line;
diff --git a/5 lab/src/components/groups/table/Lines.jsx b/5 lab/src/components/groups/table/Lines.jsx
deleted file mode 100644
index b83bdc3..0000000
--- a/5 lab/src/components/groups/table/Lines.jsx
+++ /dev/null
@@ -1,29 +0,0 @@
-/* eslint-disable import/extensions */
-/* eslint-disable import/no-unresolved */
-import { Button, ButtonGroup } from 'react-bootstrap';
-import { Link } from 'react-router-dom';
-import useLines from '../hooks/GroupsHook';
-import LinesTable from './LinesTable.jsx';
-import Line from './Line';
-
-const Lines = () => {
- const { groups } = useLines();
- return (
- <>
-
-
-
-
- {
- groups.map((line, index) =>
- )
- }
-
- >
- );
-};
-
-export default Lines;
diff --git a/5 lab/src/components/groups/table/LinesTable.jsx b/5 lab/src/components/groups/table/LinesTable.jsx
deleted file mode 100644
index bd721e7..0000000
--- a/5 lab/src/components/groups/table/LinesTable.jsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import PropTypes from 'prop-types';
-import { Table } from 'react-bootstrap';
-
-const LinesTable = ({ children }) => {
- return (
-
-
-
- № |
- id человека |
- друг |
- |
- |
- |
- |
- |
-
-
-
- {children}
-
-
- );
-};
-
-LinesTable.propTypes = {
- children: PropTypes.node,
-};
-
-export default LinesTable;
diff --git a/5 lab/src/components/groups/table/LinesTableRow.jsx b/5 lab/src/components/groups/table/LinesTableRow.jsx
deleted file mode 100644
index 413232f..0000000
--- a/5 lab/src/components/groups/table/LinesTableRow.jsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import PropTypes from 'prop-types';
-
-const LinesTableRow = ({
- index, line,
-}) => {
- return (
-
- {index + 1} |
- {line.personId} |
- {line.friend} |
- {line.nickname} |
-
- );
-};
-
-LinesTableRow.propTypes = {
- index: PropTypes.number,
- line: PropTypes.object,
- onDelete: PropTypes.func,
- onEdit: PropTypes.func,
- onEditInPage: PropTypes.func,
-};
-
-export default LinesTableRow;
diff --git a/5 lab/src/components/help/form/Help.jsx b/5 lab/src/components/help/form/Help.jsx
index 580fd1b..ff7eb39 100644
--- a/5 lab/src/components/help/form/Help.jsx
+++ b/5 lab/src/components/help/form/Help.jsx
@@ -1,9 +1,9 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
-import { ListGroup, Modal, Button, Form } from 'react-bootstrap';
-import { useState } from 'react';
+import {
+ ListGroup, Modal, Button, Form,
+ } from 'react-bootstrap';
import useLines from '../../users/hooks/UsersHook';
-import ModalForm from '../../modal/ModalForm';
import useLinesFormModal from '../hooks/HelpFormModalHook';
import NickModal from './HelpModal';
@@ -19,7 +19,7 @@ const HelpForm = () => {
<>
-
+
Помощь
diff --git a/5 lab/src/components/help/form/HelpModal.jsx b/5 lab/src/components/help/form/HelpModal.jsx
index 05eff79..65f81bc 100644
--- a/5 lab/src/components/help/form/HelpModal.jsx
+++ b/5 lab/src/components/help/form/HelpModal.jsx
@@ -1,7 +1,6 @@
import PropTypes from 'prop-types';
-import Input from '../../input/Input.jsx';
-const NickModal = ({ password, setPassword }) => {
+const NickModal = () => {
return (
<>
Страница главная отображает посты и комментарии,
diff --git a/5 lab/src/components/help/hooks/HelpFormModalHook.js b/5 lab/src/components/help/hooks/HelpFormModalHook.js
index 379d3e4..720d5e1 100644
--- a/5 lab/src/components/help/hooks/HelpFormModalHook.js
+++ b/5 lab/src/components/help/hooks/HelpFormModalHook.js
@@ -4,6 +4,7 @@ import useLinesItemForm from '../../users/hooks/UsersItemFormHook';
const useLinesFormModal = (linesChangeHandle, password) => {
const { isModalShow, showModal, hideModal } = useModal();
+ // eslint-disable-next-line no-unused-vars
const [currentId, setCurrentId] = useState(0);
const id = localStorage.getItem('UserId');
const {
diff --git a/5 lab/src/components/information/index.jsx b/5 lab/src/components/information/index.jsx
deleted file mode 100644
index 33e867e..0000000
--- a/5 lab/src/components/information/index.jsx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* eslint-disable import/no-extraneous-dependencies */
-import { useState } from 'react';
-import Modal from 'react-modal';
-import { ListGroup } from 'react-bootstrap';
-
-const customStyles = {
- content: {
- top: '50%',
- left: '50%',
- right: 'auto',
- bottom: 'auto',
- marginRight: '-50%',
- transform: 'translate(-50%, -50%)',
- },
- };
-
-const Information = () => {
- const [modalIsOpen, setModalIsOpen] = useState(false);
-
-const openModal = () => {
- setModalIsOpen(true);
-};
-
-const closeModal = () => {
- setModalIsOpen(false);
-};
- const modalContent = (
-
-
Информация
-
Данный сделан специально для дисциплины интернет программирование
-
в 2023 году
-
-
- );
- return (
-
- );
-};
-
-export default Information;
diff --git a/5 lab/src/components/information/information.css b/5 lab/src/components/information/information.css
deleted file mode 100644
index 60fbc5a..0000000
--- a/5 lab/src/components/information/information.css
+++ /dev/null
@@ -1,21 +0,0 @@
-Modal {
-
- position: fixed;
-
- top: 0;
-
- left: 0;
-
- width: 30px;
-
- height: 100%;
-
- background-color: rgba(0, 0, 0, 0.75);
-
- overflow: hidden;
-
- overflow-y: auto;
-
- z-index: 999;
-
- }
\ No newline at end of file
diff --git a/5 lab/src/components/message/message.jsx b/5 lab/src/components/message/message.jsx
index 89f4754..6e38f8b 100644
--- a/5 lab/src/components/message/message.jsx
+++ b/5 lab/src/components/message/message.jsx
@@ -2,22 +2,20 @@
import PropTypes from 'prop-types';
import { Nav } from 'react-bootstrap';
import { Link } from 'react-router-dom';
-import { useState } from 'react';
import UseLinesItem from '../users/hooks/UsersItemHook';
import useLines from '../messages — копия/hooks/MessagesHook';
const chatMessage = ({
- id, groupId, setDialogID, setMessages,
+ line, setDialogID, setMessages,
}) => {
+ const id = line.friendId.toString();
+ const { groupId } = line;
const user = UseLinesItem(id);
const { nickname, image } = user.item;
const { messages } = useLines(groupId);
- const tmp = messages.at(messages.length - 1);
- const [lastmsg, setLastmsg] = useState('-');
const onSubmit = () => {
setDialogID({ dialogId: groupId });
setMessages({ message: messages });
- setLastmsg({ lastmsg: tmp });
};
return (
@@ -26,11 +24,11 @@ const chatMessage = ({
{nickname}