minor fix marketplace + xyi ego znaet

This commit is contained in:
aurinex
2025-12-13 18:59:30 +05:00
parent 74a3e3c7cf
commit d9a3a1cd1f
16 changed files with 459 additions and 226 deletions

View File

@ -2,8 +2,6 @@ import {
Box,
Typography,
Button,
Snackbar,
Alert,
LinearProgress,
} from '@mui/material';
import { useEffect, useState } from 'react';
@ -13,6 +11,8 @@ import PopaPopa from '../components/popa-popa';
import SettingsIcon from '@mui/icons-material/Settings';
import React from 'react';
import SettingsModal from '../components/Settings/SettingsModal';
import CustomNotification from '../components/Notifications/CustomNotification';
import type { NotificationPosition } from '../components/Notifications/CustomNotification';
declare global {
interface Window {
@ -62,11 +62,16 @@ const LaunchPage = ({
const [progress, setProgress] = useState(0);
const [buffer, setBuffer] = useState(10);
const [installStatus, setInstallStatus] = useState('');
const [notification, setNotification] = useState<{
open: boolean;
message: string;
severity: 'success' | 'error' | 'info';
}>({ open: false, message: '', severity: 'info' });
const [notifOpen, setNotifOpen] = useState(false);
const [notifMsg, setNotifMsg] = useState<React.ReactNode>('');
const [notifSeverity, setNotifSeverity] = useState<
'success' | 'info' | 'warning' | 'error'
>('info');
const [notifPos, setNotifPos] = useState<NotificationPosition>({
vertical: 'bottom',
horizontal: 'center',
});
const [installStep, setInstallStep] = useState('');
const [installMessage, setInstallMessage] = useState('');
const [open, setOpen] = React.useState(false);
@ -223,14 +228,14 @@ const LaunchPage = ({
}, [versionId]);
const showNotification = (
message: string,
severity: 'success' | 'error' | 'info',
message: React.ReactNode,
severity: 'success' | 'info' | 'warning' | 'error' = 'info',
position: NotificationPosition = { vertical: 'bottom', horizontal: 'center' },
) => {
setNotification({ open: true, message, severity });
};
const handleCloseNotification = () => {
setNotification({ ...notification, open: false });
setNotifMsg(message);
setNotifSeverity(severity);
setNotifPos(position);
setNotifOpen(true);
};
// Функция для запуска игры с настройками выбранной версии
@ -522,19 +527,14 @@ const LaunchPage = ({
</Box>
)}
<Snackbar
open={notification.open}
autoHideDuration={6000}
onClose={handleCloseNotification}
>
<Alert
onClose={handleCloseNotification}
severity={notification.severity}
sx={{ width: '100%' }}
>
{notification.message}
</Alert>
</Snackbar>
<CustomNotification
open={notifOpen}
message={notifMsg}
severity={notifSeverity}
position={notifPos}
onClose={() => setNotifOpen(false)}
autoHideDuration={2500}
/>
<SettingsModal
open={open}