|
@@ -1,7 +1,8 @@
|
|
|
import React, { useEffect, useState } from 'react';
|
|
import React, { useEffect, useState } from 'react';
|
|
|
import { Layout, List, Card, Avatar, Button, Input, Space, Typography, Spin, Empty } from 'antd';
|
|
import { Layout, List, Card, Avatar, Button, Input, Space, Typography, Spin, Empty } from 'antd';
|
|
|
import { UserOutlined, MessageOutlined, HeartOutlined, SendOutlined } from '@ant-design/icons';
|
|
import { UserOutlined, MessageOutlined, HeartOutlined, SendOutlined } from '@ant-design/icons';
|
|
|
-import { useAuth } from '@/client/admin/hooks/AuthProvider';
|
|
|
|
|
|
|
+import { useAuth } from '@/client/home/hooks/AuthProvider';
|
|
|
|
|
+import { useNavigate } from 'react-router-dom';
|
|
|
import { postClient } from '@/client/api';
|
|
import { postClient } from '@/client/api';
|
|
|
import type { PostEntity } from '@/server/modules/posts/post.entity';
|
|
import type { PostEntity } from '@/server/modules/posts/post.entity';
|
|
|
|
|
|
|
@@ -13,6 +14,7 @@ const HomePage: React.FC = () => {
|
|
|
const [loading, setLoading] = useState(true);
|
|
const [loading, setLoading] = useState(true);
|
|
|
const [content, setContent] = useState('');
|
|
const [content, setContent] = useState('');
|
|
|
const { user } = useAuth();
|
|
const { user } = useAuth();
|
|
|
|
|
+ const navigate = useNavigate();
|
|
|
|
|
|
|
|
// 获取首页内容流
|
|
// 获取首页内容流
|
|
|
const fetchPosts = async () => {
|
|
const fetchPosts = async () => {
|
|
@@ -78,7 +80,13 @@ const HomePage: React.FC = () => {
|
|
|
<Header style={{ position: 'fixed', zIndex: 1, width: '100%', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
|
<Header style={{ position: 'fixed', zIndex: 1, width: '100%', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
|
|
<Title level={3} style={{ color: 'white', margin: 0 }}>社交媒体平台</Title>
|
|
<Title level={3} style={{ color: 'white', margin: 0 }}>社交媒体平台</Title>
|
|
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
- <Avatar icon={<UserOutlined />} style={{ marginRight: 16 }} />
|
|
|
|
|
|
|
+ <Button type="text" style={{ color: 'white', marginRight: 16 }} onClick={() => navigate('/follow?type=following')}>
|
|
|
|
|
+ 关注
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <Button type="text" style={{ color: 'white', marginRight: 16 }} onClick={() => navigate('/follow?type=followers')}>
|
|
|
|
|
+ 粉丝
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <Avatar icon={<UserOutlined />} style={{ marginRight: 16 }} onClick={() => navigate(`/users/${user?.id}`)} />
|
|
|
<Text style={{ color: 'white' }}>{user?.username}</Text>
|
|
<Text style={{ color: 'white' }}>{user?.username}</Text>
|
|
|
</div>
|
|
</div>
|
|
|
</Header>
|
|
</Header>
|