mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-21 19:22:13 -08:00
Rename view method to type and integrate athShield in settings
Renamed the `view` method to `type` in parserAthShield.js to better reflect its purpose. Removed unused `athShield` import from landing.js and added it to settings.js. Added a manageModCategory function in settings.js to manage the display and interaction state of the Mods tab based on the type of `athShield`.
This commit is contained in:
parent
ae9e7b54b0
commit
fc5a2d4b8d
@ -22,7 +22,7 @@ class AthenaShield {
|
||||
}
|
||||
|
||||
// Récupérer la visibilité du menu
|
||||
get view() {
|
||||
get type() {
|
||||
return this.config.menuVisibility
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ const {
|
||||
const DiscordWrapper = require('./assets/js/discordwrapper')
|
||||
const ProcessBuilder = require('./assets/js/processbuilder')
|
||||
const dataPath = require('./assets/js/configmanager')
|
||||
const athShield = require('./assets/athshield/parserAthShield')
|
||||
const fs = require('fs')
|
||||
|
||||
// Launch Elements
|
||||
|
@ -1,8 +1,9 @@
|
||||
// Requirements
|
||||
const os = require('os')
|
||||
const semver = require('semver')
|
||||
const os = require('os')
|
||||
const semver = require('semver')
|
||||
|
||||
const DropinModUtil = require('./assets/js/dropinmodutil')
|
||||
const DropinModUtil = require('./assets/js/dropinmodutil')
|
||||
const athShield = require('./assets/athshield/parserAthShield')
|
||||
const { MSFT_OPCODE, MSFT_REPLY_TYPE, MSFT_ERROR } = require('./assets/js/ipcconstants')
|
||||
|
||||
const settingsState = {
|
||||
@ -707,6 +708,29 @@ document.getElementById('settingsGameHeight').addEventListener('keydown', (e) =>
|
||||
|
||||
const settingsModsContainer = document.getElementById('settingsModsContainer')
|
||||
|
||||
/**
|
||||
* Manages the display and interaction state of the Mods tab and its buttons based on the type of `athShield`.
|
||||
*
|
||||
* The function performs the following:
|
||||
* - If `athShield.type` is 'hidden': hides the Mods button entirely.
|
||||
* - If `athShield.type` is 'blocked': shows the Mods button, displays the Mods tab, and disables all buttons within the Mods tab.
|
||||
* - Otherwise: shows and enables all components (Mods button and buttons within the Mods tab) normally.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function manageModCategory() {
|
||||
const modsButton = document.querySelector('button[rSc="settingsTabMods"]')
|
||||
const dropInMods = document.getElementById('settingsDropinModsContainer')
|
||||
|
||||
if (athShield.type === 'hidden') {
|
||||
// Hide the Mods navigation button
|
||||
modsButton.style.display = 'none'
|
||||
} else if (athShield.type === 'blocked') {
|
||||
// Hide the drop-in mods elements
|
||||
dropInMods.style.display = 'none'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve and update the mods on the UI.
|
||||
*/
|
||||
@ -1130,6 +1154,7 @@ function animateSettingsTabRefresh(){
|
||||
* Prepare the Mods tab for display.
|
||||
*/
|
||||
async function prepareModsTab(first){
|
||||
manageModCategory()
|
||||
await resolveModsForUI()
|
||||
await resolveDropinModsForUI()
|
||||
await resolveShaderpacksForUI()
|
||||
|
Loading…
Reference in New Issue
Block a user