This commit is contained in:
2025-11-12 23:05:50 +01:00
parent 0f4e40383b
commit ae19d94fb2
3 changed files with 37 additions and 14 deletions
@@ -184,3 +184,16 @@ h1.align-center {
text-overflow: ellipsis;
max-width: 300px;
}
.no-games-message {
grid-column: 1 / -1;
text-align: center;
color: #8892b0;
font-size: 18px;
padding: 40px 20px;
margin: 20px 0;
background: linear-gradient(to bottom, rgba(0, 9, 56, 0.3), rgba(0, 9, 56, 0.1));
border: 1px solid #444;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}
+23 -14
View File
@@ -12,7 +12,7 @@ const GAME_DIR_KEY = 'game-directory';
// enum with install status
enum InstallStatus {
NotInstalled = 'NotInstalled',
CheckingServer = 'CheckingServer',
CheckingPeers = 'CheckingPeers',
Downloading = 'Downloading',
Unpacking = 'Unpacking',
Installed = 'Installed',
@@ -195,7 +195,7 @@ const App = () => {
console.log(`✅ Game install for id=${id} started...`);
// update install status in gameItems for this game
setGameItems(prev => prev.map(item => item.id === id
? { ...item, install_status: InstallStatus.CheckingServer }
? { ...item, install_status: InstallStatus.CheckingPeers }
: item));
} else {
// game is already being installed
@@ -214,7 +214,7 @@ const App = () => {
console.log(`✅ Game update for id=${id} started...`);
// update install status in gameItems for this game
setGameItems(prev => prev.map(item => item.id === id
? { ...item, install_status: InstallStatus.CheckingServer }
? { ...item, install_status: InstallStatus.CheckingPeers }
: item));
} else {
// game is already being installed/updated
@@ -228,20 +228,20 @@ const App = () => {
const needsUpdate = (game: Game): boolean => {
if (!game.installed) return false;
// Check if server has a version and we have a local version
const serverVersion = game.eti_game_version;
// Check if peers have a version and we have a local version
const peerVersion = game.eti_game_version;
const localVersion = game.local_version;
// If we don't have local version but server has one, we need update
if (!localVersion && serverVersion) {
// If we don't have local version but peers have one, we need update
if (!localVersion && peerVersion) {
return true;
}
// If we have both versions, compare them numerically
if (localVersion && serverVersion) {
if (localVersion && peerVersion) {
const localNum = parseInt(localVersion, 10);
const serverNum = parseInt(serverVersion, 10);
return serverNum > localNum;
const peerNum = parseInt(peerVersion, 10);
return peerNum > localNum;
}
return false;
@@ -264,7 +264,7 @@ const App = () => {
<div className="fixed-header">
<h1 className="align-center">SoftLAN Launcher</h1>
<div className="main-header">
{gameItems.length > 0 ? (
{gameDir ? (
<div className="search-settings-wrapper">
<div></div>
<div className="search-container">
@@ -283,12 +283,21 @@ const App = () => {
</div>
) : (
<div className="search-container">
Waiting for connection to server...
Please set a game directory to start scanning for games...
</div>
)}
</div>
</div>
<div className="grid-container">
{gameDir && filteredGames.length === 0 && gameItems.length === 0 ? (
<div className="no-games-message">
Scanning for games in your directory...
</div>
) : gameDir && filteredGames.length === 0 && gameItems.length > 0 ? (
<div className="no-games-message">
No games found matching your search.
</div>
) : null}
{filteredGames.map((item) => {
const uint8Array = new Uint8Array(item.thumbnail);
const binaryString = uint8Array.reduce((acc, byte) => acc + String.fromCharCode(byte), '');
@@ -312,12 +321,12 @@ const App = () => {
}
}}>
{!item.installed
? item.install_status === InstallStatus.CheckingServer ? 'Checking server...'
? item.install_status === InstallStatus.CheckingPeers ? 'Checking peers...'
: item.install_status === InstallStatus.Downloading ? 'Downloading...'
: item.install_status === InstallStatus.Unpacking ? 'Unpacking...'
: 'Install'
: needsUpdate(item)
? item.install_status === InstallStatus.CheckingServer ? 'Checking server...'
? item.install_status === InstallStatus.CheckingPeers ? 'Checking peers...'
: item.install_status === InstallStatus.Downloading ? 'Downloading...'
: item.install_status === InstallStatus.Unpacking ? 'Unpacking...'
: 'Update'