From 8aff15d5bf6b8dee32cd120e66ec2f7e589b9e8e Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 1 Oct 2025 15:13:01 +0530 Subject: [PATCH] remove: dismiss confirmation! --- src/lib/layout/progress.svelte | 8 -- src/lib/stores/navigation.ts | 3 - .../(suggestions)/empty.svelte | 83 ++----------------- .../(suggestions)/store.ts | 2 - .../database-[database]/subNavigation.svelte | 12 +-- 5 files changed, 7 insertions(+), 101 deletions(-) delete mode 100644 src/lib/stores/navigation.ts diff --git a/src/lib/layout/progress.svelte b/src/lib/layout/progress.svelte index a5b445fcc..8d34097f4 100644 --- a/src/lib/layout/progress.svelte +++ b/src/lib/layout/progress.svelte @@ -1,5 +1,4 @@ diff --git a/src/lib/stores/navigation.ts b/src/lib/stores/navigation.ts deleted file mode 100644 index f35211058..000000000 --- a/src/lib/stores/navigation.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { writable } from 'svelte/store'; - -export const navigationCancelled = writable(false); diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte index 100fdb384..87c37d0f0 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte @@ -25,23 +25,18 @@ tableColumnSuggestions, basicColumnOptions, mockSuggestions, - createTableRequest, showIndexesSuggestions } from './store'; import { addNotification, dismissNotification } from '$lib/stores/notifications'; import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; import { sleep } from '$lib/helpers/promises'; - import { invalidate, beforeNavigate, goto } from '$app/navigation'; - import { showCreateTable } from '../store'; - import { showSubNavigation } from '$lib/stores/layout'; - import { navigationCancelled } from '$lib/stores/navigation'; + import { invalidate } from '$app/navigation'; import { Dependencies } from '$lib/constants'; import { isWithinSafeRange } from '$lib/helpers/numbers'; import type { Columns } from '../table-[table]/store'; import { columnOptions } from '../table-[table]/columns/store'; import Options from './options.svelte'; import { InputSelect, InputText } from '$lib/elements/forms'; - import { Confirm } from '$lib/components'; import { isCloud, VARS } from '$lib/system'; import IconAINotification from './icon/aiNotification.svelte'; @@ -62,10 +57,6 @@ let hasTransitioned = $state(false); let scrollAnimationFrame: number | null = null; - let confirmDismiss = $state(false); - let confirmNavigation = $state(false); - let pendingNavigationUrl: string | null = null; - let creatingColumns = $state(false); const baseColProps = { draggable: false, resizable: false }; @@ -289,26 +280,6 @@ }); }; - // Handle create table requests from subNavigation - const unsubscribeCreateTable = createTableRequest.subscribe((requested) => { - if (requested) { - const hasRealColumns = customColumns.some((col) => !col.isPlaceholder); - if (hasRealColumns && !creatingColumns) { - confirmNavigation = true; - pendingNavigationUrl = 'create-table'; - } else { - executeCreateTable(); - } - - createTableRequest.set(false); - } - }); - - function executeCreateTable() { - $showCreateTable = true; - $showSubNavigation = false; - } - const customSuggestedColumns = $derived.by(() => { return customColumns.map((col: SuggestedColumnSchema) => { const columnOption = getColumnOption(col.type, col.format); @@ -405,16 +376,6 @@ await suggestColumns(); }); - beforeNavigate(({ cancel, to }) => { - const hasRealColumns = customColumns.some((col) => !col.isPlaceholder); - if (hasRealColumns && !creatingColumns) { - cancel(); - confirmNavigation = true; - $navigationCancelled = true; - pendingNavigationUrl = to?.url?.pathname || null; - } - }); - function resetSuggestionsStore(fullReset: boolean = true) { if ($tableColumnSuggestions.table?.id !== page.params.table) { return; @@ -740,7 +701,6 @@ customColumns = []; resetSuggestionsStore(); - unsubscribeCreateTable(); }); @@ -1023,7 +983,10 @@ size="xs" variant="text" disabled={creatingColumns} - on:click={() => (confirmDismiss = true)} + on:click={() => { + customColumns = []; + resetSuggestionsStore(); + }} style="opacity: {creatingColumns ? '0' : '1'}" >Dismiss @@ -1042,42 +1005,6 @@ {/if} - { - customColumns = []; - resetSuggestionsStore(); - }}> - Are you sure you want to dismiss these columns suggested by AI? This action is irreversible. - - - { - customColumns = []; - resetSuggestionsStore(); - confirmNavigation = false; - - if (pendingNavigationUrl) { - if (pendingNavigationUrl === 'create-table') { - executeCreateTable(); - } else { - goto(pendingNavigationUrl); - } - - pendingNavigationUrl = null; - } - }}> - You have unsaved column suggestions. If you leave this page, you'll lose these suggestions. Are - you sure you want to continue? - -