v1.0.3(add quick launch, redesign shop, add new directory game)

This commit is contained in:
aurinex
2025-12-29 16:49:27 +05:00
parent 287116103d
commit b1f378c5a8
9 changed files with 375 additions and 146 deletions

View File

@ -96,8 +96,9 @@ export const BonusShopItem: React.FC<BonusShopItemProps> = ({
transition: 'transform 0.35s ease, box-shadow 0.35s ease',
'&:hover': {
transform: 'scale(1.01)',
boxShadow: '0 10px 20px rgba(242,113,33,0.1)',
// transform: 'scale(1.01)',
borderColor: 'rgba(200, 33, 242, 0.35)',
boxShadow: '0 1.2vw 3.2vw rgba(53, 3, 66, 0.75)',
},
}}
>
@ -107,8 +108,10 @@ export const BonusShopItem: React.FC<BonusShopItemProps> = ({
position: 'absolute',
inset: 0,
pointerEvents: 'none',
// background:
// 'radial-gradient(circle at top, rgba(242,113,33,0.25), transparent 60%)',
background:
'radial-gradient(circle at top, rgba(242,113,33,0.25), transparent 60%)',
'radial-gradient(circle at 10% 10%, rgba(242,113,33,0.10), transparent 55%), radial-gradient(circle at 90% 20%, rgba(233,64,205,0.16), transparent 55%)',
}}
/>

View File

@ -67,9 +67,9 @@ export default function CapeCard({
transition:
'transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease',
'&:hover': {
transform: 'scale(1.01)',
borderColor: 'rgba(242,113,33,0.35)',
boxShadow: '0 1.4vw 3.8vw rgba(0,0,0,0.60)',
// transform: 'scale(1.01)',
borderColor: 'rgba(200, 33, 242, 0.35)',
boxShadow: '0 1.2vw 3.2vw rgba(53, 3, 66, 0.75)',
},
}}
>
@ -135,8 +135,8 @@ export default function CapeCard({
{/* Здесь показываем ЛЕВУЮ половину текстуры (лицевую часть) */}
<Box
sx={{
width: '44vw',
height: '36vw',
width: '46.2vw',
height: '39.2vw',
minWidth: '462px',
minHeight: '380px',
imageRendering: 'pixelated',

View File

@ -70,8 +70,8 @@ export default function ShopItem({
transition: 'transform 0.35s ease, box-shadow 0.35s ease',
'&:hover': {
transform: 'scale(1.01)',
boxShadow: '0 20px 20px rgba(242,113,33,0.1)',
borderColor: 'rgba(200, 33, 242, 0.35)',
boxShadow: '0 1.2vw 3.2vw rgba(53, 3, 66, 0.75)',
},
}}
>
@ -82,7 +82,7 @@ export default function ShopItem({
inset: 0,
pointerEvents: 'none',
background:
'radial-gradient(circle at top, rgba(242,113,33,0.25), transparent 60%)',
'radial-gradient(circle at 10% 10%, rgba(242,113,33,0.10), transparent 55%), radial-gradient(circle at 90% 20%, rgba(233,64,205,0.16), transparent 55%)',
}}
/>
@ -243,6 +243,7 @@ export default function ShopItem({
fontFamily: 'Benzin-Bold',
borderRadius: '2.5vw',
fontSize: '0.85rem',
color: 'white',
'&:hover': {
transform: 'scale(1.02)',
},

View File

@ -24,6 +24,9 @@ import { useTheme } from '@mui/material/styles';
import InventoryIcon from '@mui/icons-material/Inventory';
import { RiCoupon3Fill } from 'react-icons/ri';
import type { NotificationPosition } from '../components/Notifications/CustomNotification';
import { isNotificationsEnabled, getNotifPositionFromSettings } from '../utils/notifications';
declare global {
interface Window {
electron: {
@ -75,10 +78,48 @@ export default function TopBar({ onRegister, username }: TopBarProps) {
null,
);
// ===== QUICK LAUNCH ===== \\
const [lastVersion, setLastVersion] = useState<null | any>(null);
useEffect(() => {
try {
const raw = localStorage.getItem('last_launched_version');
if (!raw) return;
setLastVersion(JSON.parse(raw));
} catch {
setLastVersion(null);
}
}, []);
// ===== QUICK LAUNCH ===== \\
const path = location.pathname || '';
const isAuthPage =
path.startsWith('/login') || path.startsWith('/registration');
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 showNotification = (
message: React.ReactNode,
severity: 'success' | 'info' | 'warning' | 'error' = 'info',
position: NotificationPosition = getNotifPositionFromSettings(),
) => {
if (!isNotificationsEnabled()) return;
setNotifMsg(message);
setNotifSeverity(severity);
setNotifPos(position);
setNotifOpen(true);
};
const TAB_ROUTES: Array<{
value: number;
match: (p: string) => boolean;
@ -267,6 +308,66 @@ export default function TopBar({ onRegister, username }: TopBarProps) {
window.removeEventListener('settings-updated', handler as EventListener);
}, [updateGradientVars]);
const handleQuickLaunch = async () => {
const raw = localStorage.getItem('last_launched_version');
if (!raw) {
showNotification('Вы не запускали ни одну из сборок!', 'warning');
return;
}
const ctx = JSON.parse(raw);
const savedConfig = JSON.parse(
localStorage.getItem('launcher_config') || '{}',
);
if (!savedConfig.accessToken) {
showNotification('Вы не авторизованы', 'error');
return;
}
await window.electron.ipcRenderer.invoke('launch-minecraft', {
accessToken: savedConfig.accessToken,
uuid: savedConfig.uuid,
username: savedConfig.username,
memory: ctx.memory,
baseVersion: ctx.baseVersion,
fabricVersion: ctx.fabricVersion,
packName: ctx.packName,
serverIp: ctx.serverIp,
isVanillaVersion: ctx.isVanillaVersion,
versionToLaunchOverride: ctx.versionToLaunchOverride,
});
};
const getLastLaunchLabel = (v: any) => {
if (!v) return '';
const title = v.isVanillaVersion
? `Minecraft ${v.versionId}`
: `Сборка ${v.packName}`;
const details = [
v.baseVersion ? `MC ${v.baseVersion}` : null,
v.memory ? `${v.memory} MB RAM` : null,
]
.filter(Boolean)
.join(' · ');
return (
<Box sx={{ display: 'flex', flexDirection: 'column', gap: '0.2vw' }}>
<Typography sx={{ fontSize: '0.9vw', fontWeight: 600 }}>
{title}
</Typography>
<Typography sx={{ fontSize: '0.75vw', opacity: 0.7 }}>
{details}
</Typography>
</Box>
);
};
return (
<Box
className={isAuthPage ? undefined : 'glass-ui'}
@ -435,6 +536,78 @@ export default function TopBar({ onRegister, username }: TopBarProps) {
marginRight: '1vw',
}}
>
{lastVersion &&
<CustomTooltip
title={getLastLaunchLabel(lastVersion)}
arrow
placement="bottom"
TransitionProps={{ timeout: 120 }}
>
<Button
onClick={handleQuickLaunch}
disableRipple
disableFocusRipple
sx={{
minWidth: 'unset',
width: '3vw',
height: '3vw',
borderRadius: '3vw',
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
overflow: 'hidden',
px: '0.8vw',
background:
'radial-gradient(circle at 10% 10%, rgba(242,113,33,0.20), transparent 55%), radial-gradient(circle at 90% 20%, rgba(233,64,205,0.16), transparent 55%), rgba(10,10,20,0.92)',
border: '1px solid rgba(255,255,255,0.10)',
boxShadow: '0 1.4vw 3.8vw rgba(0,0,0,0.55)',
color: 'white',
backdropFilter: 'blur(14px)',
transition: 'all 0.3s ease',
'& .quick-text': {
opacity: 0,
whiteSpace: 'nowrap',
marginRight: '0.6vw',
fontSize: '0.9vw',
fontFamily: 'Benzin-Bold',
transform: 'translateX(10px)',
transition: 'all 0.25s ease',
},
'&:hover': {
width: '16.5vw',
transform: 'scale(1.05)',
'& .quick-text': {
opacity: 1,
transform: 'translateX(0)',
},
},
'&:after': {
content: '""',
position: 'absolute',
left: '0%',
right: '0%',
bottom: 0,
height: '0.15vw',
borderRadius: '999px',
background:
'linear-gradient(71deg, #F27121 0%, #E940CD 70%, #8A2387 100%)',
opacity: 0.9,
},
}}
>
<span className="quick-text">Быстрый запуск</span>
<span style={{ fontSize: '1vw' }}></span>
</Button>
</CustomTooltip>
}
{!isLoginPage && !isRegistrationPage && username && (
<Box sx={{ display: 'flex', alignItems: 'center', gap: '1vw' }}>
<HeadAvatar