Skip to content

Commit b16faf3

Browse files
committed
Update Sync to Dashboard button styling to match Steam design
Changes to button: - Removed emojis (πŸ”„ ⏳ βœ… ❌) - Added proper SVG icons that match Steam's style - Uses Steam's native green btn_green_white_innerfade (no override) - Spinning sync icon animation during loading - Check icon on success, alert icon on error Changes to notifications: - Success: Uses Steam's green color #5c7e10 (instead of tailwind green) - Error: Uses dark red #8B0000 (instead of gradient) - Removed emoji from notification titles Result: βœ… Professional look matching Steam's UI βœ… Consistent green color throughout βœ… Proper icons instead of emojis βœ… Native Steam button styling
1 parent 0856a46 commit b16faf3

1 file changed

Lines changed: 40 additions & 17 deletions

File tree

β€Žsrc/transactionMonitor.jsβ€Ž

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -503,40 +503,59 @@ function addSyncToDashboardButton() {
503503
syncButton.id = 'cs2float-sync-to-dashboard-btn';
504504
syncButton.href = '#';
505505
syncButton.className = 'btn_green_white_innerfade btn_medium_wide';
506-
syncButton.style.cssText = `
507-
background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
508-
margin-right: 10px;
509-
`;
510-
syncButton.innerHTML = '<span>πŸ”„ Sync to Dashboard</span>';
506+
syncButton.style.cssText = `margin-right: 10px;`;
507+
508+
// SVG icon for sync (matches Steam's icon style)
509+
const syncIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style="vertical-align: middle; margin-right: 4px;">
510+
<path d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"/>
511+
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"/>
512+
</svg>`;
513+
514+
syncButton.innerHTML = `<span>${syncIcon}Sync to Dashboard</span>`;
511515

512516
// Add click handler
513517
syncButton.addEventListener('click', async (e) => {
514518
e.preventDefault();
515519

516520
// Disable button and show loading state
517-
syncButton.innerHTML = '<span>⏳ Syncing...</span>';
521+
const loadingIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style="vertical-align: middle; margin-right: 4px; animation: spin 1s linear infinite;">
522+
<path d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"/>
523+
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"/>
524+
</svg>`;
525+
syncButton.innerHTML = `<span>${loadingIcon}Syncing...</span>`;
518526
syncButton.style.pointerEvents = 'none';
519527
syncButton.style.opacity = '0.6';
520528

529+
// Add spin animation
530+
const style = document.createElement('style');
531+
style.textContent = '@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }';
532+
if (!document.querySelector('style[data-sync-animation]')) {
533+
style.setAttribute('data-sync-animation', 'true');
534+
document.head.appendChild(style);
535+
}
536+
521537
try {
522538
// Trigger both transaction and inventory sync
523539
await triggerFullSync();
524540

525541
// Success state
526-
syncButton.innerHTML = '<span>βœ… Synced!</span>';
542+
const checkIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style="vertical-align: middle; margin-right: 4px;">
543+
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
544+
</svg>`;
545+
syncButton.innerHTML = `<span>${checkIcon}Synced!</span>`;
527546

528-
// Show success notification
547+
// Show success notification (using Steam's green)
529548
showNotification(
530-
'βœ… Dashboard Synced',
549+
'Dashboard Synced',
531550
'Transaction and inventory synced successfully',
532-
'linear-gradient(135deg, #22c55e, #16a34a)',
551+
'#5c7e10', // Steam's green color
533552
null,
534553
3000
535554
);
536555

537556
// Reset button after 2 seconds
538557
setTimeout(() => {
539-
syncButton.innerHTML = '<span>πŸ”„ Sync to Dashboard</span>';
558+
syncButton.innerHTML = `<span>${syncIcon}Sync to Dashboard</span>`;
540559
syncButton.style.pointerEvents = '';
541560
syncButton.style.opacity = '1';
542561
}, 2000);
@@ -545,26 +564,30 @@ function addSyncToDashboardButton() {
545564
console.error('[Transaction Monitor] Sync failed:', error);
546565

547566
// Error state
548-
syncButton.innerHTML = '<span>❌ Sync Failed</span>';
549-
syncButton.style.background = 'linear-gradient(135deg, #ef4444, #dc2626) !important';
567+
const errorIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style="vertical-align: middle; margin-right: 4px;">
568+
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
569+
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/>
570+
</svg>`;
571+
syncButton.innerHTML = `<span>${errorIcon}Sync Failed</span>`;
572+
syncButton.className = 'btn_grey_white_innerfade btn_medium_wide'; // Change to grey for error
550573

551574
// Show error notification with appropriate message
552575
const errorMessage = error.message?.includes('invalidated')
553576
? 'Extension was reloaded. Please refresh this page and try again.'
554577
: 'Please try again or sync manually from the popup';
555578

556579
showNotification(
557-
'❌ Sync Failed',
580+
'Sync Failed',
558581
errorMessage,
559-
'linear-gradient(135deg, #ef4444, #dc2626)',
582+
'#8B0000', // Dark red
560583
null,
561584
5000
562585
);
563586

564587
// Reset button after 3 seconds
565588
setTimeout(() => {
566-
syncButton.innerHTML = '<span>πŸ”„ Sync to Dashboard</span>';
567-
syncButton.style.background = 'linear-gradient(135deg, #6366f1, #4f46e5) !important';
589+
syncButton.innerHTML = `<span>${syncIcon}Sync to Dashboard</span>`;
590+
syncButton.className = 'btn_green_white_innerfade btn_medium_wide'; // Back to green
568591
syncButton.style.pointerEvents = '';
569592
syncButton.style.opacity = '1';
570593
}, 3000);

0 commit comments

Comments
Β (0)