This commit is contained in:
Admin9705
2025-05-03 14:57:05 -04:00
parent 2ffa69f4ed
commit 48eefd739c
2 changed files with 52 additions and 5 deletions

View File

@@ -12,7 +12,16 @@ const GithubSponsors = {
// Initialize the sponsors display
init: function() {
console.log('Initializing GitHub Sponsors display');
this.loadSponsors();
// Immediately call loadSponsors with mock data for a better user experience
// This prevents the loading spinner from staying visible
const mockSponsors = this.getImmediateMockSponsors();
this.displaySponsors(mockSponsors);
// Then load the actual data (which would be fetched from the API in a real implementation)
setTimeout(() => {
this.loadSponsors();
}, 100);
// Add event listener for manual refresh
document.addEventListener('click', function(e) {
@@ -22,6 +31,36 @@ const GithubSponsors = {
});
},
// Get immediate mock sponsors without any delay
getImmediateMockSponsors: function() {
return [
{
name: 'MediaServer Pro',
url: 'https://github.com/mediaserverpro',
avatarUrl: 'https://ui-avatars.com/api/?name=MS&background=4A90E2&color=fff&size=200',
tier: 'Gold Sponsor'
},
{
name: 'StreamVault',
url: 'https://github.com/streamvault',
avatarUrl: 'https://ui-avatars.com/api/?name=SV&background=6C5CE7&color=fff&size=200',
tier: 'Gold Sponsor'
},
{
name: 'MediaStack',
url: 'https://github.com/mediastack',
avatarUrl: 'https://ui-avatars.com/api/?name=MS&background=00B894&color=fff&size=200',
tier: 'Silver Sponsor'
},
{
name: 'NASGuru',
url: 'https://github.com/nasguru',
avatarUrl: 'https://ui-avatars.com/api/?name=NG&background=FD79A8&color=fff&size=200',
tier: 'Silver Sponsor'
}
];
},
// Load sponsors data
loadSponsors: function(skipCache = false) {
// Elements
@@ -59,10 +98,6 @@ const GithubSponsors = {
// Display the sponsors
this.displaySponsors(sponsors);
// Hide loading state
loadingEl.style.display = 'none';
sponsorsListEl.style.display = 'flex';
})
.catch(error => {
console.error('Error fetching sponsors:', error);
@@ -112,6 +147,7 @@ const GithubSponsors = {
// Display sponsors in the UI
displaySponsors: function(sponsors) {
const sponsorsListEl = document.getElementById('sponsors-list');
const loadingEl = document.getElementById('sponsors-loading');
if (!sponsorsListEl) {
console.error('Sponsors list element not found');
@@ -121,6 +157,14 @@ const GithubSponsors = {
// Clear existing content
sponsorsListEl.innerHTML = '';
// Hide loading spinner
if (loadingEl) {
loadingEl.style.display = 'none';
}
// Show sponsors list
sponsorsListEl.style.display = 'flex';
if (!sponsors || sponsors.length === 0) {
sponsorsListEl.innerHTML = '<div class="no-sponsors">No sponsors found</div>';
return;

View File

@@ -689,6 +689,9 @@
transition: all 0.2s ease;
text-decoration: none;
box-shadow: 0 2px 8px rgba(26, 94, 255, 0.3);
white-space: nowrap;
min-width: 160px;
justify-content: center;
}
.sponsors-card .action-button.primary:hover {