From ccd97c2fc7ea40d1769a7d1c208e0d86def41a32 Mon Sep 17 00:00:00 2001 From: Dozzy7528 Date: Tue, 3 Feb 2026 13:29:51 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B0=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0=20`OtherProfil?= =?UTF-8?q?e`,=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=20CSS=20=D0=BA=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5=20`OtherProfil?= =?UTF-8?q?e`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OtherProfile.js | 54 ++++++++++++++++++++++++++++++++-------- src/css/OtherProfile.css | 47 ++++++++++++++++++++++++++++++++++ src/setupProxy.js | 2 +- 3 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 src/css/OtherProfile.css diff --git a/src/OtherProfile.js b/src/OtherProfile.js index a74c49e..ec64dc7 100644 --- a/src/OtherProfile.js +++ b/src/OtherProfile.js @@ -1,19 +1,51 @@ -import React, { useState, useEffect } from 'react'; -import { useParams } from 'react-router-dom'; +import React, {useState, useEffect} from 'react'; +import './css/OtherProfile.css'; +import {useParams, useNavigate} from 'react-router-dom'; import axios from 'axios'; import Header from './Header'; const OtherProfile = () => { - const { id } = useParams(); + const {id} = useParams(''); const [user, setUser] = useState(null); + const [avatar, setAvatar] = useState(''); const [error, setError] = useState(''); - - return ( - <>
-
- -
- ); -} + const navigate = useNavigate(); + const [user_description, setUserDescription] = useState(''); + useEffect(() => { + const checkSession = async () => { + try { + const response = await axios.get('/api/users/' + id); + setUser(response.data.display_name); + setAvatar(response.data.avatar_url); + if (response.data.user_description === '') { + setUserDescription('Описание отсутствует') + } else { + setUserDescription(response.data.user_description); + } + } catch (err) { + setError('Вы не авторизованы'); + setTimeout(() => { + navigate('/login'); + }, 1500); + } + }; + checkSession(); + }, []); + + return ( + <>
+
+ {error &&
{error}
} +
+
+
{user}
+ +
+
{user_description}
+
+
+ + ); +} export default OtherProfile; \ No newline at end of file diff --git a/src/css/OtherProfile.css b/src/css/OtherProfile.css new file mode 100644 index 0000000..a88f74f --- /dev/null +++ b/src/css/OtherProfile.css @@ -0,0 +1,47 @@ +.profile-info { + margin: 0 0 0.5rem 0; +} + +.name-with-avatar { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; +} + +.user-name { + margin: 0; + font-size: 5rem; + font-weight: 600; + color: #CAD1D8; + flex: 1 1 auto; + word-break: break-word; + overflow-wrap: break-word; +} + +.profile-avatar { + width: 120px; + height: 120px; + border-radius: 50%; + object-fit: cover; + border: 4px solid #CAD1D8; + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); + margin-left: 1rem; +} + +.user-description { + padding: 1rem 1.5rem; + border: 3px solid #4A5568; + border-radius: 12px; + background-color: #2D3748; + font-size: 1.2rem; + font-weight: 450; + color: #CAD1D8; + text-align: start; + word-break: break-word; + word-wrap: break-word; + overflow-wrap: break-word; + max-width: 100%; + hyphens: auto; + margin-top: 1rem; +} \ No newline at end of file diff --git a/src/setupProxy.js b/src/setupProxy.js index f28ed7f..ad09b65 100644 --- a/src/setupProxy.js +++ b/src/setupProxy.js @@ -12,7 +12,7 @@ module.exports = function(app) { app.use( '/static/avatars', createProxyMiddleware({ - target: 'http://back.fool-stack.ru', + target: 'https://back.fool-stack.ru', changeOrigin: true, }) );