More notifications in participants table

This commit is contained in:
Roman Krček
2025-07-14 21:37:05 +02:00
parent 396d29c76b
commit 5d957b18ee
3 changed files with 34 additions and 17 deletions

View File

@@ -74,10 +74,7 @@
event = eventData;
} catch (err) {
console.error('Error loading event:', err);
toast.add({
message: 'Failed to load event',
type: 'error'
});
toast.error('Failed to load event');
} finally {
loading = false;
}
@@ -98,25 +95,22 @@
participants = participantsData || [];
} catch (err) {
console.error('Error loading participants:', err);
toast.add({
message: 'Failed to load participants',
type: 'error'
});
toast.error('Failed to load participants');
} finally {
participantsLoading = false;
}
}
async function syncParticipants() {
if (!event || !event.sheet_id) return;
if (!event || !event.sheet_id) {
toast.error('Cannot sync participants: No Google Sheet is connected to this event');
return;
}
// Check if user has Google authentication
const refreshToken = localStorage.getItem('google_refresh_token');
if (!refreshToken) {
toast.add({
message: 'Please connect your Google account first to sync participants',
type: 'error'
});
toast.error('Please connect your Google account first to sync participants');
return;
}
@@ -183,12 +177,19 @@
// Reload participants
await loadParticipants();
// Show success message with count of synced participants
const previousCount = participants.length;
const newCount = names.length;
const addedCount = Math.max(0, participants.length - previousCount);
toast.success(
`Successfully synced participants. ${newCount} entries processed, ${addedCount} new participants added.`,
5000
);
} catch (err) {
console.error('Error syncing participants:', err);
toast.add({
message: 'Failed to sync participants',
type: 'error'
});
toast.error(`Failed to sync participants: ${err instanceof Error ? err.message : 'Unknown error'}`);
} finally {
syncingParticipants = false;
}