Minor fixes and new warning for outdated "app" version.

This commit is contained in:
Scott Idem
2024-06-26 14:06:38 -04:00
parent 7faa9d0459
commit dd9c48e801
4 changed files with 45 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ import type { key_val } from '$lib/ae_stores';
// Longer-term app data. This should be stored to *local* storage.
// Updated 2024-03-06
let events_local_data_struct: key_val = {
'ver': '2024-06-11_11',
'ver': '2024-06-26_12',
// Shared
'name': 'Aether - Events (SvelteKit 2.x Svelte 4.x)',
'title': `OSIT's Æ Events`, // - Dev SvelteKit`, // Æ

View File

@@ -36,7 +36,7 @@ export type key_val = {
// *** BEGIN *** Longer-term app data. This should be stored to local storage.
export let ae_app_local_data_struct: key_val = {
'ver': '2024-06-25_14',
'ver': '2024-06-26_12',
'name': 'Aether - App Hub (SvelteKit 2.x Svelte 4.x)',
'theme': 'light',
'iframe': false,

View File

@@ -229,7 +229,8 @@ function dispatch_something_changed() {
}}
>
<span class="fas fa-sync mx-1"></span>
Reload and
Reload
&amp;
<span class="fas fa-trash mx-1"></span>
Clear Cache
</button>
@@ -237,14 +238,24 @@ function dispatch_something_changed() {
class="btn btn-sm variant-glass-warning"
title="Clear the browser storage for this page"
on:click={() => {
// $ae_loc.
if (!confirm('Are you sure you want to clear the local and session storage?')) {
return false;
}
// Clear the local and session storage
localStorage.clear();
sessionStorage.clear();
alert('Local and Session Storage cleared. You will probably want to refresh the page.');
// Clear Indexed DB as well
indexedDB.deleteDatabase('ae_core_db');
indexedDB.deleteDatabase('ae_events_db');
window.location.reload();
// alert('Local and Session Storage cleared and Indexed DBs deleted. You will probably want to refresh the page.');
}}
>
<span class="fas fa-eraser mx-1"></span>
Clear Storage
Clear Storage &amp; DB
</button>
</div>

View File

@@ -111,5 +111,33 @@ $: if ($events_trigger == 'load__event_session_obj_id' && $events_trig_kv['event
</section>
{/if}
{#if $ae_loc.ver < '2024-06-26_12'}
<div class="flex flex-col items-center justify-center bg-error-100 text-error-800 p-4 rounded-lg shadow-lg my-4 w-full">
<p>There is a new version of the app. Please use the button to clear the page cache and reload the page.</p>
<button
class="btn btn-xl variant-ghost-error"
on:click={() => {
if (!confirm('Are you sure you want to clear the local and session storage?')) {
return false;
}
// Clear the local and session storage
localStorage.clear();
sessionStorage.clear();
// Clear Indexed DB as well
indexedDB.deleteDatabase('ae_core_db');
indexedDB.deleteDatabase('ae_events_db');
window.location.reload();
// alert('Local and Session Storage cleared and Indexed DBs deleted. You will probably want to refresh the page.');
}}
title="New Version: Clear the browser storage for this page"
>
<span class="fas fa-eraser mx-1"></span>
Clear Storage &amp; DB &amp; Reload
</button>
</div>
{/if}
<slot></slot>