add: server status

This commit is contained in:
2025-07-07 02:53:21 +05:00
parent 2eda1d7806
commit 261b9ac253
6 changed files with 208 additions and 36 deletions

View File

@ -8,6 +8,7 @@ import {
} from '@mui/material';
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import ServerStatus from '../components/ServerStatus/ServerStatus';
declare global {
interface Window {
@ -21,19 +22,21 @@ declare global {
}
}
const launchOptions = {
downloadUrl:
'https://github.com/DIKER0K/Comfort/releases/latest/download/Comfort.zip',
apiReleaseUrl: 'https://api.github.com/repos/DIKER0K/Comfort/releases/latest',
versionFileName: 'comfort_version.txt',
packName: 'Comfort',
memory: 4096,
baseVersion: '1.21.4',
serverIp: 'popa-popa.ru',
fabricVersion: 'fabric0.16.14',
};
// Определяем тип для props
interface LaunchPageProps {
launchOptions: {
downloadUrl: string;
apiReleaseUrl: string;
versionFileName: string;
packName: string;
memory: number;
baseVersion: string;
serverIp: string;
fabricVersion: string;
};
}
const LaunchPage = (launchOptions: any) => {
const LaunchPage = ({ launchOptions }: LaunchPageProps) => {
const navigate = useNavigate();
const [isDownloading, setIsDownloading] = useState(false);
const [downloadProgress, setDownloadProgress] = useState(0);
@ -181,11 +184,15 @@ const LaunchPage = (launchOptions: any) => {
Добро пожаловать в лаунчер
</Typography>
<Box sx={{ mb: 3 }}>
<ServerStatus
serverIp={launchOptions.serverIp}
refreshInterval={30000}
/>
</Box>
{isDownloading ? (
<Box sx={{ mb: 3, width: '100%' }}>
{/* <Typography sx={{ mb: 1 }}>
Загрузка и установка: {downloadProgress}%
</Typography> */}
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress
@ -201,16 +208,6 @@ const LaunchPage = (launchOptions: any) => {
>{`${Math.round(downloadProgress)}%`}</Typography>
</Box>
</Box>
{/* {installMessage && (
<Typography variant="body1" sx={{ mt: 1, color: 'white' }}>
{installMessage}
</Typography>
)}
{installStep && (
<Typography variant="body2" sx={{ color: 'white' }}>
Шаг: {installStep}
</Typography>
)} */}
</Box>
) : (
<Button