2026-03-09 21:29:03 +08:00
|
|
|
|
/**
|
2026-03-24 04:23:13 +08:00
|
|
|
|
* 用户主页 UserScreen
|
2026-03-09 21:29:03 +08:00
|
|
|
|
* 胡萝卜BBS - 查看其他用户资料
|
2026-03-24 04:23:13 +08:00
|
|
|
|
* 使用统一的 UserProfileScreen 组件,mode='other'
|
2026-03-09 21:29:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
2026-03-24 04:23:13 +08:00
|
|
|
|
import React from 'react';
|
|
|
|
|
|
import { useRoute, RouteProp } from '@react-navigation/native';
|
|
|
|
|
|
import UserProfileScreen from './UserProfileScreen';
|
|
|
|
|
|
import { HomeStackParamList } from '../../navigation/types';
|
2026-03-09 21:29:03 +08:00
|
|
|
|
import { useCurrentUser } from '../../stores/authStore';
|
|
|
|
|
|
|
|
|
|
|
|
type UserRouteProp = RouteProp<HomeStackParamList, 'UserProfile'>;
|
|
|
|
|
|
|
|
|
|
|
|
export const UserScreen: React.FC = () => {
|
|
|
|
|
|
const route = useRoute<UserRouteProp>();
|
|
|
|
|
|
const userId = route.params?.userId || '';
|
|
|
|
|
|
const currentUser = useCurrentUser();
|
2026-03-24 04:23:13 +08:00
|
|
|
|
const isSelfProfile = !!currentUser?.id && currentUser.id === userId;
|
2026-03-09 21:29:03 +08:00
|
|
|
|
|
|
|
|
|
|
return (
|
2026-03-24 04:23:13 +08:00
|
|
|
|
<UserProfileScreen
|
|
|
|
|
|
mode={isSelfProfile ? 'self' : 'other'}
|
|
|
|
|
|
userId={isSelfProfile ? undefined : userId}
|
|
|
|
|
|
/>
|
2026-03-09 21:29:03 +08:00
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default UserScreen;
|