This commit is contained in:
Xoconoch
2025-06-05 10:42:08 -06:00
parent 3c55de631a
commit 95e30fd041
2 changed files with 31 additions and 0 deletions

View File

@@ -65,6 +65,10 @@ let credentialsFormCard: HTMLElement | null = null;
let showAddAccountFormBtn: HTMLElement | null = null;
let cancelAddAccountBtn: HTMLElement | null = null;
// Hint element references
let spotifyRegionHint: HTMLElement | null = null;
let deezerRegionHint: HTMLElement | null = null;
// Ensure this is defined, typically at the top with other DOM element getters if used frequently
let spotifyApiConfigStatusDiv: HTMLElement | null = null;
@@ -172,6 +176,10 @@ document.addEventListener('DOMContentLoaded', async () => {
showAddAccountFormBtn = document.getElementById('showAddAccountFormBtn');
cancelAddAccountBtn = document.getElementById('cancelAddAccountBtn');
// Get hint elements
spotifyRegionHint = document.getElementById('spotifyRegionHint');
deezerRegionHint = document.getElementById('deezerRegionHint');
if (credentialsFormCard && showAddAccountFormBtn) {
// Initially hide form, show add button (default state handled by setFormVisibility if called)
credentialsFormCard.style.display = 'none';
@@ -681,6 +689,21 @@ function updateFormFields() {
toggleSearchFieldsVisibility(false);
isEditingSearch = false;
// Show/hide region hints based on current service
if (spotifyRegionHint && deezerRegionHint) {
if (currentService === 'spotify') {
spotifyRegionHint.style.display = 'block';
deezerRegionHint.style.display = 'none';
} else if (currentService === 'deezer') {
spotifyRegionHint.style.display = 'none';
deezerRegionHint.style.display = 'block';
} else {
// Fallback: hide both if service is unrecognized
spotifyRegionHint.style.display = 'none';
deezerRegionHint.style.display = 'none';
}
}
}
function populateFormFields(service: string, data: Record<string, string>) {

View File

@@ -362,6 +362,14 @@
<h2 id="formTitle" class="section-title">Add New Spotify Account</h2>
<form id="credentialForm">
<div id="serviceFields"></div>
<!-- Region Hints START -->
<div id="spotifyRegionHint" class="setting-description" style="display:none; margin-left: 10px; margin-top: -5px; margin-bottom:15px; font-size: 0.9em;">
<small>Region not matching your account may lead to issues. Check it <a href="https://www.spotify.com/mx/account/profile/" target="_blank" rel="noopener noreferrer">here</a>.</small>
</div>
<div id="deezerRegionHint" class="setting-description" style="display:none; margin-left: 10px; margin-top: -5px; margin-bottom:15px; font-size: 0.9em;">
<small>Region not matching your account may lead to issues. Check it <a href="https://www.deezer.com/account/country_selector" target="_blank" rel="noopener noreferrer">here</a>.</small>
</div>
<!-- Region Hints END -->
<div id="searchFields" style="display: none;"></div>
<button type="submit" id="submitCredentialBtn" class="btn btn-primary save-btn">Save Account</button>
<button type="button" id="cancelAddAccountBtn" class="btn btn-secondary cancel-btn btn-cancel-icon" style="margin-left: 10px;" title="Cancel">