Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import deepEqual from 'deep-equal';
import { addNotification } from '$lib/stores/notifications';
import { type Columns, columnsOrder, databaseColumnSheetOptions } from '../store';
import { columnOptions, type Option } from './store';
import { columnOptions, STRING_COLUMN_NAME, type Option } from './store';
import { onMount } from 'svelte';
import { Layout } from '@appwrite.io/pink-svelte';
import { preferences } from '$lib/stores/preferences';
Expand All @@ -34,14 +34,21 @@
}
});

$: option = columnOptions.find((option) => {
if (selectedColumn) {
if ('format' in selectedColumn && selectedColumn.format) {
return option?.format === selectedColumn?.format;
} else {
return option?.type === selectedColumn?.type;
}
$: option = columnOptions.find((opt) => {
if (!selectedColumn) return false;

// format match when present
if ('format' in selectedColumn && selectedColumn.format) {
return opt?.format === selectedColumn.format;
}

// Legacy string columns (no format)
if (selectedColumn.type === 'string') {
return opt.name === STRING_COLUMN_NAME;
}

// Fallback: match by type
return opt.type === selectedColumn.type;
}) as Option;

export async function submit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export type Option = {
icon: ComponentType;
};

export const STRING_COLUMN_NAME = 'String (deprecated)';

export const columnOptions: Option[] = [
{
name: 'Text',
Expand Down Expand Up @@ -235,7 +237,7 @@ export const columnOptions: Option[] = [
icon: IconRelationship
},
{
name: 'String (deprecated)',
name: STRING_COLUMN_NAME,
sentenceName: 'string',
component: String,
type: 'string',
Expand Down