From ff3f2bfb8d021ca769e39fa151d96d990afa1130 Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Tue, 7 Aug 2018 00:58:32 -0400 Subject: [PATCH] Added server status bar to the top of the mods tab. The user is also given the option to switch servers from this status bar. --- app/assets/css/launcher.css | 55 +++++++++++++++++++++++++++++++ app/assets/js/scripts/landing.js | 3 ++ app/assets/js/scripts/settings.js | 46 ++++++++++++++++++++++++-- app/overlay.ejs | 2 +- app/settings.ejs | 10 ++++++ 5 files changed, 112 insertions(+), 4 deletions(-) diff --git a/app/assets/css/launcher.css b/app/assets/css/launcher.css index 4ba9026..093cb3b 100644 --- a/app/assets/css/launcher.css +++ b/app/assets/css/launcher.css @@ -1409,6 +1409,7 @@ input:checked + .toggleSwitchSlider:before { display: flex; align-items: center; justify-content: space-between; + transition: opacity 0.25s ease; } .settingsModMainWrapper { @@ -1436,6 +1437,11 @@ input:checked + .toggleSwitchSlider:before { background-color: rgb(165, 195, 37); } +.settingsMod:not([enabled]) > .settingsSubModContainer .settingsModContent, +.settingsSubMod:not([enabled]) > .settingsSubModContainer .settingsModContent { + opacity: 0.5; +} + .settingsSubModContainer > .settingsSubMod:first-child { border-top-left-radius: 10px; } @@ -1453,6 +1459,55 @@ settingsSubModContainer > .settingsSubMod:only-child { margin-top: 10px; } +#settingsSelServContainer { + background: rgba(0, 0, 0, 0.25); + width: 75%; + border-radius: 3px; + display: flex; + justify-content: space-between; + margin: 15px 0px; +} + +#settingsSelServContent { + display: flex; + align-items: center; + justify-content: flex-start; + padding: 5px 0px; +} + +#settingsSwitchServerContainer { + display: flex; + align-items: center; + padding: 15px; +} + +#settingsSwitchServerButton { + opacity: 0; + border: 1px solid rgb(255, 255, 255); + color: rgb(255, 255, 255); + background: none; + font-size: 12px; + border-radius: 3px; + font-family: 'Avenir Medium'; + transition: 0.25s ease; + cursor: pointer; + outline: none; +} +#settingsSwitchServerButton:hover, +#settingsSwitchServerButton:focus { + box-shadow: 0px 0px 20px rgb(255, 255, 255); + background: rgba(255, 255, 255, 0.25); +} +#settingsSwitchServerButton:active { + box-shadow: 0px 0px 20px rgb(187, 187, 187); + background: rgba(187, 187, 187, 0.25); + border: 1px solid rgb(187, 187, 187); + color: rgb(187, 187, 187); +} +#settingsSelServContainer:hover #settingsSwitchServerButton { + opacity: 1; +} + /* * * * Settings View (Java Tab) * * */ diff --git a/app/assets/js/scripts/landing.js b/app/assets/js/scripts/landing.js index 51fae98..eef7826 100644 --- a/app/assets/js/scripts/landing.js +++ b/app/assets/js/scripts/landing.js @@ -139,6 +139,9 @@ function updateSelectedServer(serverName){ serverName = 'No Server Selected' } server_selection_button.innerHTML = '\u2022 ' + serverName + if(getCurrentView() === VIEWS.settings){ + animateModsTabRefresh() + } } // Real text is set in uibinder.js on distributionIndexDone. updateSelectedServer('Loading..') diff --git a/app/assets/js/scripts/settings.js b/app/assets/js/scripts/settings.js index e08bfd3..4fef65e 100644 --- a/app/assets/js/scripts/settings.js +++ b/app/assets/js/scripts/settings.js @@ -439,7 +439,7 @@ function resolveModsForUI(){ } -function parseModulesForUI(mdls, submodules = false, servConf){ +function parseModulesForUI(mdls, submodules, servConf){ let reqMods = '' let optMods = '' @@ -556,12 +556,52 @@ function _saveModConfiguration(modConf){ return modConf } +function loadSelectedServerOnModsTab(){ + + const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer()) + + document.getElementById('settingsSelServContent').innerHTML = ` + +
+ ${serv.getName()} + ${serv.getDescription()} +
+
${serv.getMinecraftVersion()}
+
${serv.getVersion()}
+ ${serv.isMainServer() ? `
+ + + + + + + + Main Server +
` : ''} +
+
+ ` +} + +document.getElementById("settingsSwitchServerButton").addEventListener('click', (e) => { + e.target.blur() + toggleServerSelection(true) +}) + +function animateModsTabRefresh(){ + $('#settingsTabMods').fadeOut(500, () => { + prepareModsTab() + $('#settingsTabMods').fadeIn(500) + }) +} + /** - * Prepare the Java tab for display. + * Prepare the Mods tab for display. */ -function prepareModsTab(){ +function prepareModsTab(first){ resolveModsForUI() bindModsToggleSwitch() + loadSelectedServerOnModsTab() } /** diff --git a/app/overlay.ejs b/app/overlay.ejs index f413874..03eb237 100644 --- a/app/overlay.ejs +++ b/app/overlay.ejs @@ -3,7 +3,7 @@ Available Servers
- +
diff --git a/app/settings.ejs b/app/settings.ejs index b7abb17..5b273f9 100644 --- a/app/settings.ejs +++ b/app/settings.ejs @@ -96,6 +96,16 @@ Mod Settings Enable or disable mods.
+
+
+ +
+
+
+ +
+
+
Required Mods