Cleanup for error notifications

This commit is contained in:
Roman Krček
2025-07-14 14:34:38 +02:00
parent 06f2553b42
commit b9db3d22a3
4 changed files with 76 additions and 87 deletions

View File

@@ -111,7 +111,8 @@
'/auth/google',
'google-auth',
'width=500,height=600,scrollbars=yes,resizable=yes,left=' +
Math.round(window.screen.width / 2 - 250) + ',top=' +
Math.round(window.screen.width / 2 - 250) +
',top=' +
Math.round(window.screen.height / 2 - 300)
);
@@ -190,7 +191,6 @@
cleanUp();
}
}, 60 * 1000); // Reduced from 3min to 1min
} catch (error) {
console.error('Error connecting to Google:', error);
authData.error = 'Failed to connect to Google';
@@ -332,7 +332,7 @@
const response = await fetch('/private/api/google/sheets/recent', {
method: 'GET',
headers: {
'Authorization': `Bearer ${localStorage.getItem('google_refresh_token')}`
Authorization: `Bearer ${localStorage.getItem('google_refresh_token')}`
}
});
@@ -363,7 +363,7 @@
const response = await fetch(`/private/api/google/sheets/${sheet.id}/data`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${localStorage.getItem('google_refresh_token')}`
Authorization: `Bearer ${localStorage.getItem('google_refresh_token')}`
}
});
@@ -427,15 +427,13 @@
});
</script>
<div class="max-w-4xl mx-auto p-6">
<!-- Header -->
<StepNavigator {currentStep} {totalSteps} />
<!-- Step Content -->
<div class="rounded-lg border border-gray-300 bg-white p-6 mb-4">
<div class="mb-4 rounded border border-gray-300 bg-white p-6">
{#if currentStep === 0}
<GoogleAuthStep
bind:errors
onSuccess={(token) => {
authData.error = null;
authData.token = token;
@@ -450,15 +448,14 @@
{:else if currentStep === 1}
<EventDetailsStep bind:eventData />
{:else if currentStep === 2}
<GoogleSheetsStep bind:sheetsData bind:errors {loadRecentSheets} {selectSheet} {toggleSheetList} />
<GoogleSheetsStep
bind:sheetsData
{loadRecentSheets}
{selectSheet}
{toggleSheetList}
/>
{:else if currentStep === 3}
<EmailSettingsStep bind:emailData bind:errors />
{/if}
{#if errors.submit}
<div class="mt-4 p-3 bg-red-50 border border-red-200 rounded">
<p class="text-sm text-red-600">{errors.submit}</p>
</div>
<EmailSettingsStep bind:emailData />
{/if}
</div>
@@ -472,4 +469,3 @@
{nextStep}
{createEvent}
/>
</div>

View File

@@ -54,7 +54,6 @@
Detected templates: {bodyTemplatesDetected.map((v) => v.name).join(', ')}
</p>
{/if}
<!-- Errors now shown as toast notifications -->
</div>
<div>

View File

@@ -21,7 +21,5 @@
onSuccess={onSuccess}
onError={onError}
/>
<!-- Error messages are now shown as toast notifications -->
</div>
</div>

View File

@@ -255,8 +255,6 @@
{/if}
</div>
{/if}
<!-- Error messages are now shown as toast notifications -->
</div>
{#if sheetsData.selectedSheet && sheetsData.sheetData.length > 0}
@@ -370,8 +368,6 @@
<div class="text-gray-600">Loading sheet data...</div>
</div>
{/if}
<!-- Error messages are now shown as toast notifications -->
</div>