diff --git a/AGENTS.md b/AGENTS.md index 2dbcbe3..95d6d53 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,2 +1,3 @@ - always check with `cargo clippy` and fix the issues - 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) diff --git a/crates/lanspread-tauri-deno-ts/src/App.css b/crates/lanspread-tauri-deno-ts/src/App.css index b76b6ee..002f7e8 100644 --- a/crates/lanspread-tauri-deno-ts/src/App.css +++ b/crates/lanspread-tauri-deno-ts/src/App.css @@ -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); +} diff --git a/crates/lanspread-tauri-deno-ts/src/App.tsx b/crates/lanspread-tauri-deno-ts/src/App.tsx index c7af9a4..e71fc45 100644 --- a/crates/lanspread-tauri-deno-ts/src/App.tsx +++ b/crates/lanspread-tauri-deno-ts/src/App.tsx @@ -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 = () => {

SoftLAN Launcher

- {gameItems.length > 0 ? ( + {gameDir ? (
@@ -283,12 +283,21 @@ const App = () => {
) : (
- Waiting for connection to server... + Please set a game directory to start scanning for games...
)}
+ {gameDir && filteredGames.length === 0 && gameItems.length === 0 ? ( +
+ Scanning for games in your directory... +
+ ) : gameDir && filteredGames.length === 0 && gameItems.length > 0 ? ( +
+ No games found matching your search. +
+ ) : 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'