diff --git a/src/App.js b/src/App.js
index f92b53c..f24aed4 100644
--- a/src/App.js
+++ b/src/App.js
@@ -7,6 +7,7 @@ import Footer from './components/Footer';
import Register from './components/Register';
import Login from './components/Login';
import Profile from './components/Profile';
+import Messages from './components/Messages';
import styles from './App.module.css';
const App = () => {
@@ -29,6 +30,7 @@ const App = () => {
} />
: } />
: } />
+ : } />
} /> {/* Главная страница */}
diff --git a/src/components/Header.js b/src/components/Header.js
index 088d338..f410b02 100644
--- a/src/components/Header.js
+++ b/src/components/Header.js
@@ -15,7 +15,10 @@ const Header = ({ isAuthenticated, onLogout }) => {
{!isAuthenticated && Зарегистрироваться}
{isAuthenticated && (
-
+ <>
+ Перейти к сообщениям
+
+ >
)}
);
diff --git a/src/components/Header.module.css b/src/components/Header.module.css
index fcad573..7de70a1 100644
--- a/src/components/Header.module.css
+++ b/src/components/Header.module.css
@@ -30,6 +30,16 @@
text-decoration: underline; /* Подчеркивание при наведении */
}
+.messagesLink {
+ color: #ff4500; /* Оранжевый цвет ссылки */
+ text-decoration: none;
+ margin-right: 16px;
+}
+
+.messagesLink:hover {
+ text-decoration: underline; /* Подчеркивание при наведении */
+}
+
.logoutButton {
background-color: #ff4500; /* Оранжевая кнопка */
color: #ffffff;
diff --git a/src/components/Messages.js b/src/components/Messages.js
new file mode 100644
index 0000000..6027dc5
--- /dev/null
+++ b/src/components/Messages.js
@@ -0,0 +1,15 @@
+// src/components/Messages.js
+
+import React from 'react';
+import styles from './Messages.module.css';
+
+const Messages = () => {
+ return (
+
+
Сообщения
+
Здесь будут ваши сообщения.
+
+ );
+};
+
+export default Messages;
\ No newline at end of file
diff --git a/src/components/Messages.module.css b/src/components/Messages.module.css
new file mode 100644
index 0000000..cbe7446
--- /dev/null
+++ b/src/components/Messages.module.css
@@ -0,0 +1,20 @@
+/* src/components/Messages.module.css */
+
+.messagesContainer {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ background-color: #1a1a1a; /* Темный фон */
+ color: #ffffff; /* Белый текст */
+ padding: 16px; /* Добавляем отступы */
+ min-height: 100vh;
+}
+
+.messagesContainer h2 {
+ margin-bottom: 16px;
+}
+
+.messagesContainer p {
+ font-size: 18px;
+}
\ No newline at end of file
diff --git a/src/components/Profile.js b/src/components/Profile.js
index 465bb7d..00fd550 100644
--- a/src/components/Profile.js
+++ b/src/components/Profile.js
@@ -1,13 +1,128 @@
// src/components/Profile.js
-import React from 'react';
+import React, { useState, useEffect } from 'react';
import styles from './Profile.module.css';
const Profile = () => {
+ const [profilePicture, setProfilePicture] = useState(null);
+ const [posts, setPosts] = useState([]);
+ const [newPostText, setNewPostText] = useState('');
+ const [newPostMusic, setNewPostMusic] = useState(null);
+ const [newPostImage, setNewPostImage] = useState(null);
+
+ useEffect(() => {
+ // Загружаем посты из localStorage при монтировании компонента
+ const savedPosts = JSON.parse(localStorage.getItem('posts')) || [];
+ setPosts(savedPosts);
+ }, []);
+
+ useEffect(() => {
+ // Сохраняем посты в localStorage при изменении
+ localStorage.setItem('posts', JSON.stringify(posts));
+ }, [posts]);
+
+ const handleProfilePictureChange = (e) => {
+ const file = e.target.files[0];
+ if (file) {
+ const reader = new FileReader();
+ reader.onloadend = () => {
+ setProfilePicture(reader.result);
+ };
+ reader.readAsDataURL(file);
+ }
+ };
+
+ const handleNewPostMusicChange = (e) => {
+ const file = e.target.files[0];
+ if (file) {
+ const reader = new FileReader();
+ reader.onloadend = () => {
+ setNewPostMusic(reader.result);
+ };
+ reader.readAsDataURL(file);
+ }
+ };
+
+ const handleNewPostImageChange = (e) => {
+ const file = e.target.files[0];
+ if (file) {
+ const reader = new FileReader();
+ reader.onloadend = () => {
+ setNewPostImage(reader.result);
+ };
+ reader.readAsDataURL(file);
+ }
+ };
+
+ const addPost = () => {
+ if (!newPostText || !newPostMusic) {
+ alert('Пожалуйста, заполните текст и добавьте музыку.');
+ return;
+ }
+
+ const newPost = {
+ id: posts.length + 1,
+ musicUrl: newPostMusic,
+ text: newPostText,
+ image: newPostImage
+ };
+
+ setPosts([...posts, newPost]);
+ setNewPostText('');
+ setNewPostMusic(null);
+ setNewPostImage(null);
+ };
+
+ const deletePost = (id) => {
+ const updatedPosts = posts.filter(post => post.id !== id);
+ setPosts(updatedPosts);
+ };
+
return (
-
Профиль
-
Добро пожаловать в ваш профиль!
+
+
+ {profilePicture ? (
+

+ ) : (
+
+ Фото
+
+ )}
+
+
+
+
Имя Пользователя
+
+
+
+
+
Посты
+
+ {posts.map((post) => (
+
+ {post.image &&

}
+
+
{post.text}
+
+
+ ))}
+
);
};
diff --git a/src/components/Profile.module.css b/src/components/Profile.module.css
index 49f17b8..34f0ca0 100644
--- a/src/components/Profile.module.css
+++ b/src/components/Profile.module.css
@@ -5,16 +5,162 @@
flex-direction: column;
align-items: center;
justify-content: center;
- height: 100vh;
background-color: #1a1a1a; /* Темный фон */
color: #ffffff; /* Белый текст */
padding: 16px; /* Добавляем отступы */
+ min-height: 100vh;
}
-.profileContainer h2 {
+.profileHeader {
+ display: flex;
+ align-items: center;
+ margin-bottom: 32px;
+}
+
+.profilePicture {
+ position: relative;
+ margin-right: 32px;
+}
+
+.profilePicture img {
+ width: 100px;
+ height: 100px;
+ border-radius: 50%;
+ object-fit: cover;
+}
+
+.profilePicture .defaultPicture {
+ width: 100px;
+ height: 100px;
+ border-radius: 50%;
+ background-color: #444;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: #ffffff;
+ font-weight: bold;
+}
+
+.profilePicture .fileInput {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ opacity: 0;
+ cursor: pointer;
+}
+
+.profileInfo h2 {
+ margin-bottom: 8px;
+}
+
+.editButton {
+ background-color: #ff4500; /* Оранжевая кнопка */
+ color: #ffffff;
+ border: none;
+ padding: 8px 16px;
+ cursor: pointer;
+ border-radius: 4px;
+}
+
+.editButton:hover {
+ background-color: #e63900; /* Тёмная оранжевая кнопка при наведении */
+}
+
+.postsContainer {
+ width: 100%;
+ max-width: 600px;
+}
+
+.postsContainer h3 {
margin-bottom: 16px;
}
-.profileContainer p {
- font-size: 18px;
+.newPostForm {
+ background-color: #282828; /* Средний темный фон */
+ padding: 16px;
+ border-radius: 8px;
+ margin-bottom: 16px;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
+}
+
+.postTextarea {
+ width: 100%;
+ height: 100px;
+ padding: 8px;
+ border: 1px solid #444;
+ border-radius: 4px;
+ background-color: #1a1a1a; /* Темный фон для инпутов */
+ color: #ffffff; /* Белый текст */
+ margin-bottom: 16px;
+ resize: vertical;
+}
+
+.fileInputs {
+ display: flex;
+ gap: 16px;
+ margin-bottom: 16px;
+}
+
+.fileInput {
+ background-color: #ff4500; /* Оранжевая кнопка */
+ color: #ffffff;
+ border: none;
+ padding: 8px 16px;
+ cursor: pointer;
+ border-radius: 4px;
+}
+
+.fileInput:hover {
+ background-color: #e63900; /* Тёмная оранжевая кнопка при наведении */
+}
+
+.addPostButton {
+ background-color: #ff4500; /* Оранжевая кнопка */
+ color: #ffffff;
+ border: none;
+ padding: 8px 16px;
+ cursor: pointer;
+ border-radius: 4px;
+}
+
+.addPostButton:hover {
+ background-color: #e63900; /* Тёмная оранжевая кнопка при наведении */
+}
+
+.post {
+ background-color: #282828; /* Средний темный фон */
+ padding: 16px;
+ border-radius: 8px;
+ margin-bottom: 16px;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
+}
+
+.post img {
+ width: 100%;
+ height: auto;
+ margin-bottom: 16px;
+}
+
+.post audio {
+ width: 100%;
+ margin-bottom: 16px;
+}
+
+.post p {
+ margin-bottom: 16px;
+}
+
+.deletePostButton {
+ background-color: #ff4500; /* Оранжевая кнопка */
+ color: #ffffff;
+ border: none;
+ padding: 8px 16px;
+ cursor: pointer;
+ border-radius: 4px;
+}
+
+.deletePostButton:hover {
+ background-color: #e63900; /* Тёмная оранжевая кнопка при наведении */
}
\ No newline at end of file