import { Link, useLoaderData, useNavigate } from "react-router";
import type { XCXProfile } from "../types/profile";
import { Avatar, Descriptions, Divider, Flex, FloatButton, Image, Typography } from "antd";
import { HomeOutlined } from "@ant-design/icons";
import User from "../components/User";
import React from "react";
import { ChangeBackground } from "../components/ChangeBackground";
import UserTags from "../components/Tags";
import { GameTable } from "../components/GameTable";
import { useTitle } from "ahooks";
function Honor(props: { honors?: XCXProfile['honors'] }) {
if (!props.honors?.length) return null;
return (
<>
荣誉
{props.honors?.map(honor => {
return (
{honor.subject}
);
})}
>
);
}
function Raket(props: { profile?: XCXProfile | null }) {
const {
qiupaitype = '',
zhengshoutype = '',
fanshoutype = '',
qiupai = '',
zhengshou = '',
fanshou = '',
} = props.profile || {};
if ([qiupaitype, zhengshoutype, fanshoutype].every(e => !e)) {
return null;
}
return (
<>
装备
{qiupaitype}
({qiupai})
{zhengshoutype}
({zhengshou})
{fanshoutype}
({fanshou})
>
);
}
function PlayerList(props: { title: string; names?: string[]; uids?: string[] }) {
if (!props.names?.length) return null;
return (
<>
{props.title}
{props.names.map((e, i) => (
))}
>
);
}
export default function ProfilePage() {
const profile = useLoaderData();
console.debug('profile', profile);
const navigate = useNavigate();
useTitle(`${profile?.username}${profile?.realname ? ` (${profile?.realname})` : ''} 个人详情`, { restoreOnUnmount: true });
return (
<>
} onClick={() => navigate('/')} />
{profile?.username}
姓名:{profile?.realname}
积分:{profile?.score}
{
([profile?.province, profile?.sex, profile?.bg ?? '', ...(profile?.allCities ?? [])] as React.ReactNode[])
.filter(Boolean)
.reduce((a, b) => (<>{a}{b}>))
}
简介
{profile?.description}
>
);
}