import { Card, CardBody, CardHeader } from '@heroui/card'; import { Button } from '@heroui/button'; import { Chip } from '@heroui/chip'; import { Spinner } from '@heroui/spinner'; import { Tooltip } from '@heroui/tooltip'; import { useRequest } from 'ahooks'; import { FaCircleInfo, FaInfo, FaQq } from 'react-icons/fa6'; import { IoLogoChrome, IoLogoOctocat } from 'react-icons/io'; import { RiMacFill } from 'react-icons/ri'; import { useState } from 'react'; import toast from 'react-hot-toast'; import WebUIManager from '@/controllers/webui_manager'; import useDialog from '@/hooks/use-dialog'; export interface SystemInfoItemProps { title: string; icon?: React.ReactNode; value?: React.ReactNode; endContent?: React.ReactNode; } const SystemInfoItem: React.FC = ({ title, value = '--', icon, endContent, }) => { return (
{icon}
{title}
{value}
{endContent}
); }; export interface NewVersionTipProps { currentVersion?: string; } // const NewVersionTip = (props: NewVersionTipProps) => { // const { currentVersion } = props; // const dialog = useDialog(); // const { data: releaseData, error } = useRequest(() => // request.get( // 'https://api.github.com/repos/NapNeko/NapCatQQ/releases' // ) // ); // if (error) { // return ( // // // // ); // } // const latestVersion = releaseData?.data?.[0]?.tag_name; // if (!latestVersion || !currentVersion) { // return null; // } // if (compareVersion(latestVersion, currentVersion) <= 0) { // return null; // } // const middleVersions: GithubRelease[] = []; // for (let i = 0; i < releaseData.data.length; i++) { // const versionInfo = releaseData.data[i]; // if (compareVersion(versionInfo.tag_name, currentVersion) > 0) { // middleVersions.push(versionInfo); // } else { // break; // } // } // const AISummaryComponent = () => { // const { // data: aiSummaryData, // loading: aiSummaryLoading, // error: aiSummaryError, // run: runAiSummary, // } = useRequest( // (version) => // request.get>( // `https://release.nc.152710.xyz/?version=${version}`, // { // timeout: 30000, // } // ), // { // manual: true, // } // ); // useEffect(() => { // runAiSummary(currentVersion); // }, [currentVersion, runAiSummary]); // if (aiSummaryLoading) { // return ( //
// //
// ); // } // if (aiSummaryError) { // return
AI 摘要获取失败
; // } // return {aiSummaryData?.data.data}; // }; // return ( // // // // ); // }; const NewVersionTip = (props: NewVersionTipProps) => { const { currentVersion } = props; const dialog = useDialog(); const { data: latestVersion, error } = useRequest(WebUIManager.getLatestTag); const [updating, setUpdating] = useState(false); if (error || !latestVersion || !currentVersion || latestVersion === currentVersion) { return null; } return ( ); }; const NapCatVersion = () => { const { data: packageData, loading: packageLoading, error: packageError, } = useRequest(WebUIManager.GetNapCatVersion); const currentVersion = packageData?.version; return ( } value={ packageError ? ( `错误:${packageError.message}` ) : packageLoading ? ( ) : ( currentVersion ) } endContent={} /> ); }; export interface SystemInfoProps { archInfo?: string; } const SystemInfo: React.FC = (props) => { const { archInfo } = props; const { data: qqVersionData, loading: qqVersionLoading, error: qqVersionError, } = useRequest(WebUIManager.getQQVersion); return ( 系统信息
} value={ qqVersionError ? ( `错误:${qqVersionError.message}` ) : qqVersionLoading ? ( ) : ( qqVersionData ) } /> } value='Next' /> } value={archInfo} />
); }; export default SystemInfo;