Skip to content

Commit

Permalink
chore: Update language files and settings UI
Browse files Browse the repository at this point in the history
- Added new translation for "closeLauncherOnLaunch" in language files
- Updated settings UI to include checkbox for "closeLauncherOnLaunch" option
  • Loading branch information
LaeDev committed Jul 8, 2024
1 parent 04fb9f7 commit 42975b8
Show file tree
Hide file tree
Showing 9 changed files with 331 additions and 89 deletions.
258 changes: 222 additions & 36 deletions app/assets/css/launcher.css

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions app/assets/js/configmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,25 @@ exports.setFullscreen = function(fullscreen){
config.settings.game.fullscreen = fullscreen
}

/**
* Check if the launcher should be closed when the game is launched.
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {boolean} Whether or not the launcher should be closed when the game is launched.
*/
exports.getCloseOnLaunch = function(def = true){
return !def ? config.settings.game.closeOnLaunch : DEFAULT_CONFIG.settings.game.closeOnLaunch
}
/**
* Change the status of if the launcher should be closed when the game is launched.
*
* @param {boolean} closeOnLaunch Whether or not the launcher should be closed when the game is launched.
*/
exports.setCloseOnLaunch = function(closeOnLaunch){
config.settings.game.closeOnLaunch = closeOnLaunch
}


/**
* Check if the game should auto connect to servers.
*
Expand Down
7 changes: 7 additions & 0 deletions app/assets/js/processbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ const { getMojangOS, isLibraryCompatible, mcVersionAtLeast } = require('helios-
const { Type } = require('helios-distribution-types')
const os = require('os')
const path = require('path')
const remote = require('@electron/remote')
const win = remote.getCurrentWindow()

const ConfigManager = require('./configmanager')
const { config } = require('process')

const logger = LoggerUtil.getLogger('ProcessBuilder')

Expand Down Expand Up @@ -82,6 +85,10 @@ class ProcessBuilder {
child.unref()
}

if(ConfigManager.getCloseOnLaunch()){
win.close();
}

child.stdout.setEncoding('utf8')
child.stderr.setEncoding('utf8')

Expand Down
13 changes: 13 additions & 0 deletions app/assets/js/scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ bindFileSelectors()
* will be disabled until the value is corrected. This is an automated
* process. More complex UI may need to be bound separately.
*/

closeOnLaunchCheckbox = document.querySelector('input[cValue="CloseOnLaunch"]')
launchDetachedCheckbox = document.querySelector('input[cValue="LaunchDetached"]')

closeOnLaunchCheckbox.addEventListener('change', function() {
if (this.checked) {
launchDetachedCheckbox.disabled = true
launchDetachedCheckbox.checked = true
} else {
launchDetachedCheckbox.disabled = false
}
})

function initSettingsValidators(){
const sEls = document.getElementById('settingsContainer').querySelectorAll('[cValue]')
Array.from(sEls).map((v, index, arr) => {
Expand Down
109 changes: 56 additions & 53 deletions app/login.ejs
Original file line number Diff line number Diff line change
@@ -1,65 +1,68 @@
<div id="loginContainer" style="display: none;">
<div id="loginCancelContainer" style="display: none;">
<button id="loginCancelButton">
<div id="loginCancelIcon">X</div>
<div id="loginCancelIcon"></div>
<span id="loginCancelText"><%- lang('login.loginCancelText') %></span>
</button>
</div>
<div id="loginContent">
<form id="loginForm">
<img id="loginImageSeal" src="assets/images/SealCircle.png"/>
<span id="loginSubheader"><%- lang('login.loginSubheader') %></span>
<div class="loginFieldContainer">
<svg id="profileSVG" class="loginSVG" viewBox="40 37 65.36 61.43">
<g>
<path d="M86.77,58.12A13.79,13.79,0,1,0,73,71.91,13.79,13.79,0,0,0,86.77,58.12M97,103.67a3.41,3.41,0,0,0,3.39-3.84,27.57,27.57,0,0,0-54.61,0,3.41,3.41,0,0,0,3.39,3.84Z"/>
</g>
</svg>
<span class="loginErrorSpan" id="loginEmailError"><%- lang('login.loginEmailError') %></span>
<input id="loginUsername" class="loginField" type="text" placeholder="<%- lang('login.loginEmailPlaceholder') %>"/>
</div>
<div class="loginFieldContainer">
<svg id="lockSVG" class="loginSVG" viewBox="40 32 60.36 70.43">
<g>
<path d="M86.16,54a16.38,16.38,0,1,0-32,0H44V102.7H96V54Zm-25.9-3.39a9.89,9.89,0,1,1,19.77,0A9.78,9.78,0,0,1,79.39,54H60.89A9.78,9.78,0,0,1,60.26,50.59ZM70,96.2a6.5,6.5,0,0,1-6.5-6.5,6.39,6.39,0,0,1,3.1-5.4V67h6.5V84.11a6.42,6.42,0,0,1,3.39,5.6A6.5,6.5,0,0,1,70,96.2Z"/>
</g>
</svg>
<span class="loginErrorSpan" id="loginPasswordError"><%- lang('login.loginPasswordError') %></span>
<input id="loginPassword" class="loginField" type="password" placeholder="<%- lang('login.loginPasswordPlaceholder') %>"/>
</div>
<div id="loginOptions">
<span class="loginSpanDim">
<a href="<%- lang('login.loginForgotPasswordLink') %>"><%- lang('login.loginForgotPasswordText') %></a>
</span>
<label id="checkmarkContainer">
<input id="loginRememberOption" type="checkbox" checked>
<span id="loginRememberText" class="loginSpanDim"><%- lang('login.loginRememberMeText') %></span>
<span class="loginCheckmark"></span>
</label>
</div>
<button id="loginButton" disabled>
<div id="loginButtonContent">
<%- lang('login.loginButtonText') %>
<svg id="loginSVG" viewBox="0 0 24.87 13.97">
<defs>
<style>.arrowLine{fill:none;stroke:#FFF;stroke-width:2px;transition: 0.25s ease;}</style>
</defs>
<polyline class="arrowLine" points="0.71 13.26 12.56 1.41 24.16 13.02"/>
<div class="formlogoContainer">
<img id="loginImageSeal" src="assets/images/SealCircle.png"/>
<div id="loginContent">
<form id="loginForm">
<span id="loginSubheader"><%- lang('login.loginSubheader') %></span>
<div class="loginFieldContainer">
<svg id="profileSVG" class="loginSVG" viewBox="40 37 65.36 61.43">
<g>
<path d="M86.77,58.12A13.79,13.79,0,1,0,73,71.91,13.79,13.79,0,0,0,86.77,58.12M97,103.67a3.41,3.41,0,0,0,3.39-3.84,27.57,27.57,0,0,0-54.61,0,3.41,3.41,0,0,0,3.39,3.84Z"/>
</g>
</svg>
<div class="circle-loader">
<div class="checkmark draw"></div>
<span class="loginErrorSpan" id="loginEmailError"><%- lang('login.loginEmailError') %></span>
<input id="loginUsername" class="loginField" type="text" placeholder="<%- lang('login.loginEmailPlaceholder') %>"/>
</div>
<div class="loginFieldContainer">
<svg id="lockSVG" class="loginSVG" viewBox="40 32 60.36 70.43">
<g>
<path d="M86.16,54a16.38,16.38,0,1,0-32,0H44V102.7H96V54Zm-25.9-3.39a9.89,9.89,0,1,1,19.77,0A9.78,9.78,0,0,1,79.39,54H60.89A9.78,9.78,0,0,1,60.26,50.59ZM70,96.2a6.5,6.5,0,0,1-6.5-6.5,6.39,6.39,0,0,1,3.1-5.4V67h6.5V84.11a6.42,6.42,0,0,1,3.39,5.6A6.5,6.5,0,0,1,70,96.2Z"/>
</g>
</svg>
<span class="loginErrorSpan" id="loginPasswordError"><%- lang('login.loginPasswordError') %></span>
<input id="loginPassword" class="loginField" type="password" placeholder="<%- lang('login.loginPasswordPlaceholder') %>"/>
</div>
<div id="loginOptions">
<label id="checkmarkContainer">
<input id="loginRememberOption" type="checkbox" checked>
<span id="loginRememberText" class="loginSpanDim"><%- lang('login.loginRememberMeText') %></span>
<span class="loginCheckmark"></span>
</label>
</div>
<button id="loginButton" class="glow-on-hover" disabled>
<div id="loginButtonContent">
<%- lang('login.loginButtonText') %>
<svg id="loginSVG" viewBox="0 0 24.87 13.97">
<defs>
<style>.arrowLine{fill:none;stroke:#FFF;stroke-width:2px;transition: 0.25s ease;}</style>
</defs>
<polyline class="arrowLine" points="0.71 13.26 12.56 1.41 24.16 13.02"/>
</svg>
<div class="circle-loader">
<div class="checkmark draw"></div>
</div>
</div>
<!--<div class="spinningCircle" id="loginSpinner"></div>-->
</button>
<div class="loginButton" style="margin: 10px; transform: translateY(-20px);">
<span class="loginSpanDim" style="margin-right: 30px;">
<a href="<%- lang('login.loginForgotPasswordLink') %>"><%- lang('login.loginForgotPasswordText') %></a>
</span>
<span class="loginSpanDim" id="loginRegisterSpan" style="margin-left: 30px;">
<a href="<%- lang('login.loginNeedAccountLink') %>"><%- lang('login.loginNeedAccountText') %></a>
</span>
</div>
</button>
<div id="loginDisclaimer">
<span class="loginSpanDim" id="loginRegisterSpan">
<a href="<%- lang('login.loginNeedAccountLink') %>"><%- lang('login.loginNeedAccountText') %></a>
</span>
<p class="loginDisclaimerText"><%- lang('login.loginPasswordDisclaimer1') %></p>
<p class="loginDisclaimerText"><%- lang('login.loginPasswordDisclaimer2', { appName: lang('app.title') }) %></p>
</div>
</form>
</form>
</div>
</div>
<div id="loginDisclaimer">
<p class="loginDisclaimerText"><%- lang('login.loginPasswordDisclaimer1') %></p>
<p class="loginDisclaimerText"><%- lang('login.loginPasswordDisclaimer2', { appName: lang('app.title') }) %></p>
</div>
<script src="./assets/js/scripts/login.js"></script>
</div>
11 changes: 11 additions & 0 deletions app/settings.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@
</label>
</div>
</div>
<div class="settingsFieldContainer">
<div class="settingsFieldLeft">
<span class="settingsFieldTitle"><%- lang('settings.closeLauncherOnLaunch') %></span>
</div>
<div class="settingsFieldRight">
<label class="toggleSwitch">
<input type="checkbox" cValue="CloseOnLaunch">
<span class="toggleSwitchSlider"></span>
</label>
</div>
</div>
<div class="settingsFieldContainer">
<div class="settingsFieldLeft">
<span class="settingsFieldTitle"><%- lang('settings.autoConnectTitle') %></span>
Expand Down
1 change: 1 addition & 0 deletions lang/en_US.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ accountSelectConfirm = "Select"
accountSelectCancel = "Cancel"

[ejs.settings]
closeLauncherOnLaunch = "Close the launcher when the game is launched."
navHeaderText = "Settings"
navAccount = "Account"
navMinecraft = "Minecraft"
Expand Down
1 change: 1 addition & 0 deletions lang/ja_JP.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ accountSelectConfirm = "選択"
accountSelectCancel = "キャンセル"

[ejs.settings]
closeLauncherOnLaunch = "ゲームが起動したらランチャーを閉じます。"
navHeaderText = "設定"
navAccount = "アカウント"
navMinecraft = "Minecraft"
Expand Down
1 change: 1 addition & 0 deletions lang/ko_KR.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ accountSelectConfirm = "선택"
accountSelectCancel = "취소"

[ejs.settings]
closeLauncherOnLaunch = "게임 실행 시 런처 닫기"
navHeaderText = "설정"
navAccount = "계정"
navMinecraft = "마인크래프트"
Expand Down

0 comments on commit 42975b8

Please sign in to comment.