wip
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
- always check with `cargo clippy` and fix the issues
|
- always check with `cargo clippy` and fix the issues
|
||||||
- always do a final `cargo +nightly fmt` after you're done with all changes
|
- always do a final `cargo +nightly fmt` after you're done with all changes
|
||||||
|
- use `cargo tauri build --debug --no-bundle` if you need to build the frontend (a.k.a. `lanspread-tauri-deno-ts` crate)
|
||||||
|
|||||||
@@ -184,3 +184,16 @@ h1.align-center {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
max-width: 300px;
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const GAME_DIR_KEY = 'game-directory';
|
|||||||
// enum with install status
|
// enum with install status
|
||||||
enum InstallStatus {
|
enum InstallStatus {
|
||||||
NotInstalled = 'NotInstalled',
|
NotInstalled = 'NotInstalled',
|
||||||
CheckingServer = 'CheckingServer',
|
CheckingPeers = 'CheckingPeers',
|
||||||
Downloading = 'Downloading',
|
Downloading = 'Downloading',
|
||||||
Unpacking = 'Unpacking',
|
Unpacking = 'Unpacking',
|
||||||
Installed = 'Installed',
|
Installed = 'Installed',
|
||||||
@@ -195,7 +195,7 @@ const App = () => {
|
|||||||
console.log(`✅ Game install for id=${id} started...`);
|
console.log(`✅ Game install for id=${id} started...`);
|
||||||
// update install status in gameItems for this game
|
// update install status in gameItems for this game
|
||||||
setGameItems(prev => prev.map(item => item.id === id
|
setGameItems(prev => prev.map(item => item.id === id
|
||||||
? { ...item, install_status: InstallStatus.CheckingServer }
|
? { ...item, install_status: InstallStatus.CheckingPeers }
|
||||||
: item));
|
: item));
|
||||||
} else {
|
} else {
|
||||||
// game is already being installed
|
// game is already being installed
|
||||||
@@ -214,7 +214,7 @@ const App = () => {
|
|||||||
console.log(`✅ Game update for id=${id} started...`);
|
console.log(`✅ Game update for id=${id} started...`);
|
||||||
// update install status in gameItems for this game
|
// update install status in gameItems for this game
|
||||||
setGameItems(prev => prev.map(item => item.id === id
|
setGameItems(prev => prev.map(item => item.id === id
|
||||||
? { ...item, install_status: InstallStatus.CheckingServer }
|
? { ...item, install_status: InstallStatus.CheckingPeers }
|
||||||
: item));
|
: item));
|
||||||
} else {
|
} else {
|
||||||
// game is already being installed/updated
|
// game is already being installed/updated
|
||||||
@@ -228,20 +228,20 @@ const App = () => {
|
|||||||
const needsUpdate = (game: Game): boolean => {
|
const needsUpdate = (game: Game): boolean => {
|
||||||
if (!game.installed) return false;
|
if (!game.installed) return false;
|
||||||
|
|
||||||
// Check if server has a version and we have a local version
|
// Check if peers have a version and we have a local version
|
||||||
const serverVersion = game.eti_game_version;
|
const peerVersion = game.eti_game_version;
|
||||||
const localVersion = game.local_version;
|
const localVersion = game.local_version;
|
||||||
|
|
||||||
// If we don't have local version but server has one, we need update
|
// If we don't have local version but peers have one, we need update
|
||||||
if (!localVersion && serverVersion) {
|
if (!localVersion && peerVersion) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have both versions, compare them numerically
|
// If we have both versions, compare them numerically
|
||||||
if (localVersion && serverVersion) {
|
if (localVersion && peerVersion) {
|
||||||
const localNum = parseInt(localVersion, 10);
|
const localNum = parseInt(localVersion, 10);
|
||||||
const serverNum = parseInt(serverVersion, 10);
|
const peerNum = parseInt(peerVersion, 10);
|
||||||
return serverNum > localNum;
|
return peerNum > localNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -264,7 +264,7 @@ const App = () => {
|
|||||||
<div className="fixed-header">
|
<div className="fixed-header">
|
||||||
<h1 className="align-center">SoftLAN Launcher</h1>
|
<h1 className="align-center">SoftLAN Launcher</h1>
|
||||||
<div className="main-header">
|
<div className="main-header">
|
||||||
{gameItems.length > 0 ? (
|
{gameDir ? (
|
||||||
<div className="search-settings-wrapper">
|
<div className="search-settings-wrapper">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div className="search-container">
|
<div className="search-container">
|
||||||
@@ -283,12 +283,21 @@ const App = () => {
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="search-container">
|
<div className="search-container">
|
||||||
Waiting for connection to server...
|
Please set a game directory to start scanning for games...
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid-container">
|
<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) => {
|
{filteredGames.map((item) => {
|
||||||
const uint8Array = new Uint8Array(item.thumbnail);
|
const uint8Array = new Uint8Array(item.thumbnail);
|
||||||
const binaryString = uint8Array.reduce((acc, byte) => acc + String.fromCharCode(byte), '');
|
const binaryString = uint8Array.reduce((acc, byte) => acc + String.fromCharCode(byte), '');
|
||||||
@@ -312,12 +321,12 @@ const App = () => {
|
|||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
{!item.installed
|
{!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.Downloading ? 'Downloading...'
|
||||||
: item.install_status === InstallStatus.Unpacking ? 'Unpacking...'
|
: item.install_status === InstallStatus.Unpacking ? 'Unpacking...'
|
||||||
: 'Install'
|
: 'Install'
|
||||||
: needsUpdate(item)
|
: 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.Downloading ? 'Downloading...'
|
||||||
: item.install_status === InstallStatus.Unpacking ? 'Unpacking...'
|
: item.install_status === InstallStatus.Unpacking ? 'Unpacking...'
|
||||||
: 'Update'
|
: 'Update'
|
||||||
|
|||||||
Reference in New Issue
Block a user