2026-04-22 16:54:51 +08:00
|
|
|
|
/**
|
2026-03-24 04:23:13 +08:00
|
|
|
|
* 用户主页 UserScreen
|
2026-04-22 16:54:51 +08:00
|
|
|
|
* 威友 - 查看其他用户资料
|
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';
|
2026-05-03 22:01:43 +08:00
|
|
|
|
import { useLocalSearchParams, useRouter } from 'expo-router';
|
|
|
|
|
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
2026-03-24 04:23:13 +08:00
|
|
|
|
import UserProfileScreen from './UserProfileScreen';
|
2026-04-13 04:56:58 +08:00
|
|
|
|
import { useCurrentUser } from '../../stores/auth';
|
2026-05-03 22:01:43 +08:00
|
|
|
|
import { SimpleHeader } from '../../components/common';
|
2026-03-09 21:29:03 +08:00
|
|
|
|
|
|
|
|
|
|
export const UserScreen: React.FC = () => {
|
2026-03-24 14:21:31 +08:00
|
|
|
|
const { userId: userIdParam } = useLocalSearchParams<{ userId?: string }>();
|
2026-05-03 22:01:43 +08:00
|
|
|
|
const router = useRouter();
|
2026-03-24 14:21:31 +08:00
|
|
|
|
const userId = userIdParam || '';
|
2026-03-09 21:29:03 +08:00
|
|
|
|
const currentUser = useCurrentUser();
|
2026-03-24 04:23:13 +08:00
|
|
|
|
const isSelfProfile = !!currentUser?.id && currentUser.id === userId;
|
2026-05-03 22:01:43 +08:00
|
|
|
|
|
2026-03-09 21:29:03 +08:00
|
|
|
|
return (
|
2026-05-03 22:01:43 +08:00
|
|
|
|
<SafeAreaView style={{ flex: 1 }} edges={['top', 'bottom']}>
|
|
|
|
|
|
<SimpleHeader title="用户主页" onBack={() => router.back()} />
|
|
|
|
|
|
<UserProfileScreen
|
|
|
|
|
|
mode={isSelfProfile ? 'self' : 'other'}
|
|
|
|
|
|
userId={isSelfProfile ? undefined : userId}
|
2026-06-07 10:37:19 +08:00
|
|
|
|
hasHeader
|
2026-05-03 22:01:43 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</SafeAreaView>
|
2026-03-09 21:29:03 +08:00
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default UserScreen;
|