mirror of
https://git.sanhost.net/sanasol/hytale-f2p.git
synced 2026-03-01 08:11:52 -03:00
v2.4.8: UI improvements, update popup fixes, per-profile branch tracking
- Fix auto-update popup: indeterminate progress fallback when no download events, show 100% on complete - Remove macOS auto-update warning (app is now signed) - Disable update popup pulse animation - Remove news tab and news section from home screen - Center play section vertically, add community links with colored icons - Add game version + branch display on play page (from manifest) - Add last played timestamp tracking - Version badge links to git.sanhost.net releases - Profiles now store version_branch and version_client per-configuration - Profile switch restores branch/version and refreshes settings UI - DevTools enabled in dev mode (electron . --dev) - Reorder community links: Chat, Discord, TG Channel, TG Group, Source Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
59
GUI/js/ui.js
59
GUI/js/ui.js
@@ -138,6 +138,7 @@ function showLauncherOrInstall(isInstalled) {
|
||||
if (gameTitle) gameTitle.style.display = '';
|
||||
showPage('play-page');
|
||||
setActiveNav('play');
|
||||
loadGameInfoBar();
|
||||
} else {
|
||||
if (launcher) launcher.style.display = 'none';
|
||||
if (install) {
|
||||
@@ -738,13 +739,69 @@ async function checkGameInstallation() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadGameInfoBar() {
|
||||
try {
|
||||
const info = await window.electronAPI.getGameInfo();
|
||||
const bar = document.getElementById('game-info-bar');
|
||||
if (!bar) return;
|
||||
|
||||
const versionEl = document.getElementById('game-version-info');
|
||||
const branchEl = document.getElementById('game-branch-info');
|
||||
const lastPlayedEl = document.getElementById('game-last-played');
|
||||
|
||||
if (versionEl) {
|
||||
versionEl.classList.remove('game-info-loading');
|
||||
if (info.version) {
|
||||
const display = info.readableVersion
|
||||
? `${info.version} - ${info.readableVersion}`
|
||||
: info.version;
|
||||
versionEl.textContent = display;
|
||||
} else {
|
||||
versionEl.textContent = 'Not installed';
|
||||
}
|
||||
}
|
||||
if (branchEl) {
|
||||
branchEl.classList.remove('game-info-loading');
|
||||
const isPreRelease = info.branch === 'pre-release';
|
||||
branchEl.textContent = isPreRelease ? 'Pre-Release' : 'Release';
|
||||
branchEl.style.color = isPreRelease ? '#f59e0b' : '';
|
||||
}
|
||||
|
||||
if (lastPlayedEl && info.lastPlayed) {
|
||||
lastPlayedEl.style.display = '';
|
||||
if (!lastPlayedEl.previousElementSibling?.classList?.contains('game-info-sep')) {
|
||||
const sep = document.createElement('span');
|
||||
sep.className = 'game-info-sep';
|
||||
lastPlayedEl.before(sep);
|
||||
}
|
||||
lastPlayedEl.textContent = formatTimeAgo(info.lastPlayed);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Could not load game info:', e);
|
||||
}
|
||||
}
|
||||
|
||||
function formatTimeAgo(timestamp) {
|
||||
const diff = Date.now() - timestamp;
|
||||
const minutes = Math.floor(diff / 60000);
|
||||
const hours = Math.floor(diff / 3600000);
|
||||
const days = Math.floor(diff / 86400000);
|
||||
|
||||
if (minutes < 1) return 'Just played';
|
||||
if (minutes < 60) return `Played ${minutes}m ago`;
|
||||
if (hours < 24) return `Played ${hours}h ago`;
|
||||
if (days < 30) return `Played ${days}d ago`;
|
||||
return `Played ${Math.floor(days / 30)}mo ago`;
|
||||
}
|
||||
|
||||
window.LauncherUI = {
|
||||
showPage,
|
||||
setActiveNav,
|
||||
showLauncherOrInstall,
|
||||
showProgress,
|
||||
hideProgress,
|
||||
updateProgress
|
||||
updateProgress,
|
||||
loadGameInfoBar
|
||||
};
|
||||
|
||||
// Make installation effects globally available
|
||||
|
||||
Reference in New Issue
Block a user