Compare commits

7 Commits

9 changed files with 300 additions and 41 deletions

View File

@ -24,6 +24,7 @@ body {
align-items: center; align-items: center;
padding: 0; padding: 0;
margin: 0; margin: 0;
user-select: none;
} }
p { p {

View File

@ -11,7 +11,7 @@ import {
Box, Box,
Chip, Chip,
} from '@mui/material'; } from '@mui/material';
import CustomTooltip from './CustomTooltip';
// Тип для плаща с необязательными полями для обоих вариантов использования // Тип для плаща с необязательными полями для обоих вариантов использования
export interface CapeCardProps { export interface CapeCardProps {
cape: { cape: {
@ -60,13 +60,14 @@ export default function CapeCard({
const capeDescription = cape.cape_description || cape.description || ''; const capeDescription = cape.cape_description || cape.description || '';
return ( return (
<Tooltip arrow title={capeDescription}> <CustomTooltip arrow title={capeDescription}>
<Card <Card
sx={{ sx={{
bgcolor: 'rgba(255, 255, 255, 0.05)', bgcolor: 'rgba(255, 255, 255, 0.05)',
width: 200, width: 200,
overflow: 'hidden', overflow: 'hidden',
position: 'relative', // для позиционирования ценника position: 'relative', // для позиционирования ценника
borderRadius: '1vw',
}} }}
> >
{/* Ценник для магазина */} {/* Ценник для магазина */}
@ -97,7 +98,13 @@ export default function CapeCard({
}} }}
/> />
<CardContent sx={{ bgcolor: 'rgba(255, 255, 255, 0.05)', pt: '9vh' }}> <CardContent
sx={{
bgcolor: 'rgba(255, 255, 255, 0.05)',
pt: '6vw',
minHeight: '5vw',
}}
>
<Typography sx={{ color: 'white' }}>{capeName}</Typography> <Typography sx={{ color: 'white' }}>{capeName}</Typography>
</CardContent> </CardContent>
@ -108,8 +115,8 @@ export default function CapeCard({
onClick={() => onAction(capeId)} onClick={() => onAction(capeId)}
disabled={actionDisabled} disabled={actionDisabled}
sx={{ sx={{
borderRadius: '20px', borderRadius: '2vw',
p: '5px 25px', p: '0.5vw 2.5vw',
color: 'white', color: 'white',
backgroundColor: 'rgb(0, 134, 0)', backgroundColor: 'rgb(0, 134, 0)',
'&:hover': { '&:hover': {
@ -122,6 +129,6 @@ export default function CapeCard({
</Button> </Button>
</CardActions> </CardActions>
</Card> </Card>
</Tooltip> </CustomTooltip>
); );
} }

View File

@ -0,0 +1,38 @@
/* eslint-disable react/jsx-props-no-spreading */
import { styled } from '@mui/material/styles';
import Tooltip, { tooltipClasses, TooltipProps } from '@mui/material/Tooltip';
// Создаем кастомный стилизованный Tooltip с правильной типизацией
const CustomTooltip = styled(({ className, ...props }: TooltipProps) => (
<Tooltip {...props} classes={{ popper: className }} />
))(({ theme }) => ({
[`& .${tooltipClasses.tooltip}`]: {
backgroundColor: 'rgba(0, 0, 0, 1)',
color: 'white',
maxWidth: 300,
fontSize: '0.9vw',
border: '1px solid rgba(255, 77, 77, 0.5)',
borderRadius: '1vw',
padding: '1vw',
boxShadow:
'0 0 1vw rgba(255, 77, 77, 0.3), inset 0.8vw -0.8vw 2vw rgba(255, 77, 77, 0.15)',
fontFamily: 'Benzin-Bold',
'&::before': {
content: '""',
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
borderRadius: '1vw',
// background: 'linear-gradient(45deg, rgba(255, 77, 77, 0.1), transparent)',
zIndex: -1,
},
},
[`& .${tooltipClasses.arrow}`]: {
color: 'rgba(255, 77, 77, 0.5)',
},
}));
export default CustomTooltip;

View File

@ -33,7 +33,9 @@ export default function SkinViewer({
canvas: canvasRef.current, canvas: canvasRef.current,
width, width,
height, height,
skin: skinUrl || undefined, skin:
skinUrl ||
'https://static.planetminecraft.com/files/resource_media/skin/original-steve-15053860.png',
model: 'auto-detect', model: 'auto-detect',
cape: capeUrl || undefined, cape: capeUrl || undefined,
}); });

View File

@ -5,7 +5,7 @@ import ArrowBackRoundedIcon from '@mui/icons-material/ArrowBackRounded';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Tooltip } from '@mui/material'; import { Tooltip } from '@mui/material';
import { fetchCoins } from '../api'; import { fetchCoins } from '../api';
import CustomTooltip from './CustomTooltip';
declare global { declare global {
interface Window { interface Window {
electron: { electron: {
@ -102,6 +102,11 @@ export default function TopBar({ onRegister, username }: TopBarProps) {
} }
}, [username]); }, [username]);
const logout = () => {
localStorage.removeItem('launcher_config');
navigate('/login');
};
return ( return (
<Box <Box
sx={{ sx={{
@ -274,11 +279,34 @@ export default function TopBar({ onRegister, username }: TopBarProps) {
marginRight: '1vw', marginRight: '1vw',
}} }}
> >
{!isLoginPage && !isRegistrationPage && username && (
<Button
variant="outlined"
color="primary"
onClick={() => logout()}
sx={{
width: '10em',
height: '3em',
borderRadius: '1.5vw',
color: 'white',
backgroundImage: 'linear-gradient(to right, #7BB8FF, #FFB7ED)',
border: 'unset',
'&:hover': {
backgroundImage: 'linear-gradient(to right, #6AA8EE, #EEA7DD)',
},
boxShadow: '0.5em 0.5em 0.5em 0px #00000040 inset',
}}
>
Выйти
</Button>
)}
{/* Кнопка регистрации, если на странице логина */} {/* Кнопка регистрации, если на странице логина */}
{username && ( {!isLoginPage && !isRegistrationPage && username && (
<Tooltip <CustomTooltip
title="Попы — внутриигровая валюта, начисляемая за время игры на серверах." title="Попы — внутриигровая валюта, начисляемая за время игры на серверах."
arrow arrow
placement="bottom"
TransitionProps={{ timeout: 300 }}
> >
<Box <Box
sx={{ sx={{
@ -313,7 +341,7 @@ export default function TopBar({ onRegister, username }: TopBarProps) {
{coins} {coins}
</Typography> </Typography>
</Box> </Box>
</Tooltip> </CustomTooltip>
)} )}
{isLoginPage && ( {isLoginPage && (
<Button <Button

View File

@ -317,6 +317,21 @@ export default function Marketplace() {
transition: 'all 0.3s ease', transition: 'all 0.3s ease',
}} }}
/> />
<Tab
label="Мои товары"
disableRipple={true}
sx={{
fontFamily: 'Benzin-Bold',
color: 'white',
'&.Mui-selected': {
color: 'rgba(255, 77, 77, 1)',
},
'&:hover': {
color: 'rgba(255, 77, 77, 1)',
},
transition: 'all 0.3s ease',
}}
/>
</Tabs> </Tabs>
</Box> </Box>

View File

@ -41,6 +41,9 @@ export default function Profile() {
const [uuid, setUuid] = useState<string>(''); const [uuid, setUuid] = useState<string>('');
const [loading, setLoading] = useState<boolean>(false); const [loading, setLoading] = useState<boolean>(false);
const [viewerWidth, setViewerWidth] = useState(500);
const [viewerHeight, setViewerHeight] = useState(600);
useEffect(() => { useEffect(() => {
const savedConfig = localStorage.getItem('launcher_config'); const savedConfig = localStorage.getItem('launcher_config');
if (savedConfig) { if (savedConfig) {
@ -54,6 +57,25 @@ export default function Profile() {
} }
}, []); }, []);
useEffect(() => {
// Функция для обновления размеров
const updateDimensions = () => {
setViewerWidth(window.innerWidth * 0.4); // 25vw
setViewerHeight(window.innerWidth * 0.5); // 30vw
};
// Вызываем один раз при монтировании
updateDimensions();
// Добавляем слушатель изменения размера окна
window.addEventListener('resize', updateDimensions);
// Очистка при размонтировании
return () => {
window.removeEventListener('resize', updateDimensions);
};
}, []);
const loadPlayerData = async (uuid: string) => { const loadPlayerData = async (uuid: string) => {
try { try {
setLoading(true); setLoading(true);
@ -182,7 +204,6 @@ export default function Profile() {
p: 0, p: 0,
borderRadius: 2, borderRadius: 2,
overflow: 'hidden', overflow: 'hidden',
mb: 4,
bgcolor: 'transparent', bgcolor: 'transparent',
}} }}
> >
@ -193,17 +214,20 @@ export default function Profile() {
alignSelf: 'center', alignSelf: 'center',
justifySelf: 'center', justifySelf: 'center',
textAlign: 'center', textAlign: 'center',
width: '100%', mb: '2vw',
mb: '5vw',
fontSize: '3vw', fontSize: '3vw',
color: 'white', color: 'white',
borderRadius: '3vw',
p: '0.5vw 5vw',
bgcolor: 'rgb(255, 77, 77)',
boxShadow: '0 0 1vw 0 rgba(0, 0, 0, 0.5)',
}} }}
> >
{username} {username}
</Typography> </Typography>
<SkinViewer <SkinViewer
width={300} width={viewerWidth}
height={400} height={viewerHeight}
skinUrl={skin} skinUrl={skin}
capeUrl={cape} capeUrl={cape}
walkingSpeed={walkingSpeed} walkingSpeed={walkingSpeed}
@ -215,25 +239,26 @@ export default function Profile() {
sx={{ sx={{
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
gap: 2, gap: '1vw',
}} }}
> >
<Box <Box
sx={{ sx={{
width: '100%', width: '40vw',
maxWidth: '500px', maxWidth: '40vw',
bgcolor: 'rgba(255, 255, 255, 0.05)', bgcolor: 'rgba(255, 255, 255, 0.05)',
padding: '3vw', padding: '3vw',
borderRadius: '1vw', borderRadius: '1vw',
flexShrink: 0,
}} }}
> >
<Box <Box
sx={{ sx={{
border: '2px dashed', border: '2px dashed',
borderColor: isDragOver ? 'primary.main' : 'grey.400', borderColor: isDragOver ? 'primary.main' : 'grey.400',
borderRadius: 2, borderRadius: '1vw',
p: 3, p: '1.5vw',
mb: 2, mb: '1vw',
textAlign: 'center', textAlign: 'center',
cursor: 'pointer', cursor: 'pointer',
bgcolor: isDragOver bgcolor: isDragOver
@ -266,24 +291,83 @@ export default function Profile() {
<FormControl <FormControl
color="primary" color="primary"
fullWidth fullWidth
sx={{ mb: 2, color: 'white' }} sx={{
mb: '1vw',
color: 'white',
'&:hover .MuiInputLabel-root': {
color: 'rgb(255, 77, 77)',
transition: 'all 0.3s ease-in-out',
},
}}
> >
<InputLabel sx={{ color: 'white' }}>Модель скина</InputLabel> <InputLabel
sx={{
fontFamily: 'Benzin-Bold',
color: 'white',
'&.Mui-focused': {
color: 'rgb(255, 77, 77)',
transition: 'all 0.3s ease-in-out',
},
transform: 'translate(14px, -9px) scale(0.75)',
'&.MuiInputLabel-shrink': {
transform: 'translate(14px, -9px) scale(0.75)',
transition: 'all 0.3s ease-in-out',
},
}}
>
Модель скина
</InputLabel>
<Select <Select
value={skinModel} value={skinModel}
label="Модель скина" label="Модель скина"
onChange={(e) => setSkinModel(e.target.value)} onChange={(e) => setSkinModel(e.target.value)}
displayEmpty
sx={{ sx={{
border: 'none',
'& .MuiSelect-select': {
fontFamily: 'Benzin-Bold',
color: 'white', color: 'white',
borderColor: 'white', paddingTop: '1vw',
'& .MuiInputBase-input': { paddingBottom: '1vw',
border: '1px solid white', transition: 'all 0.3s ease-in-out',
transition: 'unset',
}, },
'&:focus': { '&:hover': {
borderRadius: 4, '& .MuiSelect-select': {
borderColor: '#80bdff', color: 'rgb(255, 77, 77)',
boxShadow: '0 0 0 0.2rem rgba(0,123,255,.25)', transition: 'all 0.3s ease-in-out',
},
},
'&.Mui-focused': {
'& .MuiSelect-select': {
color: 'rgb(255, 77, 77)',
transition: 'all 0.3s ease-in-out',
},
},
'& .MuiOutlinedInput-notchedOutline': {
borderRadius: '5vw',
borderColor: 'rgb(255, 255, 255)',
transition: 'all 0.3s ease-in-out',
},
'&:hover .MuiOutlinedInput-notchedOutline': {
borderColor: 'rgb(255, 77, 77)',
transition: 'all 0.3s ease-in-out',
},
'&.Mui-focused .MuiOutlinedInput-notchedOutline': {
borderColor: 'rgb(255, 77, 77)',
borderWidth: '2px',
transition: 'all 0.3s ease-in-out',
},
'& .MuiSelect-icon': {
color: 'white',
transition: 'all 0.3s ease-in-out',
},
'&:hover .MuiSelect-icon': {
color: 'rgb(255, 77, 77)',
transition: 'all 0.3s ease-in-out',
},
'&.Mui-focused .MuiSelect-icon': {
color: 'rgb(255, 77, 77)',
transition: 'all 0.3s ease-in-out',
}, },
}} }}
> >
@ -340,7 +424,7 @@ export default function Profile() {
display: 'flex', display: 'flex',
justifyContent: 'center', justifyContent: 'center',
flexDirection: 'column', flexDirection: 'column',
gap: 2, gap: '2vw',
}} }}
> >
<Typography>Ваши плащи</Typography> <Typography>Ваши плащи</Typography>
@ -348,7 +432,7 @@ export default function Profile() {
sx={{ sx={{
display: 'flex', display: 'flex',
flexDirection: 'row', flexDirection: 'row',
gap: 2, gap: '2vw',
flexWrap: 'wrap', flexWrap: 'wrap',
}} }}
> >

View File

@ -217,6 +217,12 @@ export const Registration = () => {
}, },
}); });
newQrCode.update({
data: `https://t.me/popa_popa_popa_bot?start=${username}`,
});
setUrl(`https://t.me/popa_popa_popa_bot?start=${username}`);
newQrCode.append(ref.current); newQrCode.append(ref.current);
const intervalId = setInterval(() => { const intervalId = setInterval(() => {

View File

@ -25,14 +25,20 @@ interface VersionCardProps {
imageUrl: string; imageUrl: string;
version: string; version: string;
onSelect: (id: string) => void; onSelect: (id: string) => void;
isHovered: boolean;
onHover: (id: string | null) => void;
hoveredCardId: string | null;
} }
const VersionCard: React.FC<VersionCardProps> = ({ export const VersionCard: React.FC<VersionCardProps> = ({
id, id,
name, name,
imageUrl, imageUrl,
version, version,
onSelect, onSelect,
isHovered,
onHover,
hoveredCardId,
}) => { }) => {
return ( return (
<Card <Card
@ -47,11 +53,19 @@ const VersionCard: React.FC<VersionCardProps> = ({
flexDirection: 'column', flexDirection: 'column',
borderRadius: '16px', borderRadius: '16px',
boxShadow: '0 8px 32px rgba(0, 0, 0, 0.3)', boxShadow: '0 8px 32px rgba(0, 0, 0, 0.3)',
transition: 'transform 0.3s, box-shadow 0.3s', transition: 'transform 0.3s, box-shadow 0.3s, filter 0.3s',
overflow: 'hidden', overflow: 'hidden',
cursor: 'pointer', cursor: 'pointer',
filter: hoveredCardId && !isHovered ? 'blur(5px)' : 'blur(0px)',
transform: isHovered ? 'scale(1.03)' : 'scale(1)',
zIndex: isHovered ? 10 : 1,
'&:hover': {
boxShadow: '0 12px 40px rgba(0, 0, 0, 0.5)',
},
}} }}
onClick={() => onSelect(id)} onClick={() => onSelect(id)}
onMouseEnter={() => onHover(id)}
onMouseLeave={() => onHover(null)}
> >
<CardContent <CardContent
sx={{ sx={{
@ -125,6 +139,7 @@ export const VersionsExplorer = () => {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [modalOpen, setModalOpen] = useState(false); const [modalOpen, setModalOpen] = useState(false);
const [downloadLoading, setDownloadLoading] = useState<string | null>(null); const [downloadLoading, setDownloadLoading] = useState<string | null>(null);
const [hoveredCardId, setHoveredCardId] = useState<string | null>(null);
const navigate = useNavigate(); const navigate = useNavigate();
useEffect(() => { useEffect(() => {
@ -220,13 +235,21 @@ export const VersionsExplorer = () => {
flexDirection: 'column', flexDirection: 'column',
borderRadius: '16px', borderRadius: '16px',
boxShadow: '0 8px 32px rgba(0, 0, 0, 0.3)', boxShadow: '0 8px 32px rgba(0, 0, 0, 0.3)',
transition: 'transform 0.3s, box-shadow 0.3s', transition: 'transform 0.3s, box-shadow 0.3s, filter 0.3s',
overflow: 'hidden', overflow: 'hidden',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
cursor: 'pointer', cursor: 'pointer',
filter: hoveredCardId && hoveredCardId !== 'add' ? 'blur(5px)' : 'blur(0)',
transform: hoveredCardId === 'add' ? 'scale(1.03)' : 'scale(1)',
zIndex: hoveredCardId === 'add' ? 10 : 1,
'&:hover': {
boxShadow: '0 12px 40px rgba(0, 0, 0, 0.5)',
},
}} }}
onClick={handleAddVersion} onClick={handleAddVersion}
onMouseEnter={() => setHoveredCardId('add')}
onMouseLeave={() => setHoveredCardId(null)}
> >
<AddIcon sx={{ fontSize: 60, color: '#fff' }} /> <AddIcon sx={{ fontSize: 60, color: '#fff' }} />
<Typography <Typography
@ -256,8 +279,27 @@ export const VersionsExplorer = () => {
alignItems: 'center', alignItems: 'center',
paddingLeft: '5vw', paddingLeft: '5vw',
paddingRight: '5vw', paddingRight: '5vw',
position: 'relative',
flexGrow: 1,
height: 'calc(100vh - 64px)',
overflow: 'hidden',
}} }}
> >
{/* Глобальный фоновый слой для размытия всего интерфейса */}
<Box
sx={{
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
backdropFilter: hoveredCardId ? 'blur(10px)' : 'blur(0)',
transition: 'backdrop-filter 0.3s ease-in-out',
zIndex: 5,
pointerEvents: 'none',
}}
/>
{loading ? ( {loading ? (
<Box display="flex" justifyContent="center" my={5}> <Box display="flex" justifyContent="center" my={5}>
<CircularProgress /> <CircularProgress />
@ -268,8 +310,13 @@ export const VersionsExplorer = () => {
spacing={3} spacing={3}
sx={{ sx={{
width: '100%', width: '100%',
height: '100%',
overflowY: 'auto', overflowY: 'auto',
justifyContent: 'center', justifyContent: 'center',
alignContent: 'center',
position: 'relative',
zIndex: 6,
padding: '2vh 0',
}} }}
> >
{/* Показываем установленные версии или дефолтную, если она есть */} {/* Показываем установленные версии или дефолтную, если она есть */}
@ -277,7 +324,15 @@ export const VersionsExplorer = () => {
installedVersions.map((version) => ( installedVersions.map((version) => (
<Grid <Grid
key={version.id} key={version.id}
size={{ xs: 'auto', sm: 'auto', md: 'auto' }} item
xs={12}
sm={6}
md={4}
sx={{
display: 'flex',
justifyContent: 'center',
marginBottom: '2vh',
}}
> >
<VersionCard <VersionCard
id={version.id} id={version.id}
@ -288,19 +343,42 @@ export const VersionsExplorer = () => {
} }
version={version.version} version={version.version}
onSelect={() => handleSelectVersion(version)} onSelect={() => handleSelectVersion(version)}
isHovered={hoveredCardId === version.id}
onHover={setHoveredCardId}
hoveredCardId={hoveredCardId}
/> />
</Grid> </Grid>
)) ))
) : ( ) : (
// Если нет ни одной версии, показываем карточку добавления // Если нет ни одной версии, показываем карточку добавления
<Grid size={{ xs: 'auto', sm: 'auto', md: 'auto' }}> <Grid
item
xs={12}
sm={6}
md={4}
sx={{
display: 'flex',
justifyContent: 'center',
marginBottom: '2vh',
}}
>
<AddVersionCard /> <AddVersionCard />
</Grid> </Grid>
)} )}
{/* Всегда добавляем карточку для добавления новых версий */} {/* Всегда добавляем карточку для добавления новых версий */}
{installedVersions.length > 0 && ( {installedVersions.length > 0 && (
<Grid size={{ xs: 'auto', sm: 'auto', md: 'auto' }}> <Grid
item
xs={12}
sm={6}
md={4}
sx={{
display: 'flex',
justifyContent: 'center',
marginBottom: '2vh',
}}
>
<AddVersionCard /> <AddVersionCard />
</Grid> </Grid>
)} )}