Merge branch 'main' into revamp-designs

This commit is contained in:
Darshan committed 2025-10-06 12:12:27 +05:30
commit 6af5d1a266
36 files changed
+366 -160

No files matched your search

+18 -17
View File
@@ -4,7 +4,7 @@
export let id: string;
export let label: string = '';
export let value: string;
export let value: string | null;
export let required = false;
export let nullable = false;
export let disabled = false;
@@ -17,6 +17,7 @@
let error: string;
let element: HTMLInputElement;
let previousValue: string | null = null;
onMount(() => {
if (element && autofocus) {
@@ -24,14 +25,16 @@
}
});
let prevValue = '';
function handleNullChange(e: CustomEvent<boolean>) {
const isNull = e.detail;
if (isNull) {
prevValue = value;
if (value !== null) {
previousValue = value;
}
value = null;
} else {
value = prevValue;
value = previousValue;
}
}
@@ -39,9 +42,7 @@
error = null;
}
function onChange(event: CustomEvent) {
value = (event.target as HTMLInputElement).value;
}
$: isValueNull = value === null;
</script>
<Layout.Stack gap="s" direction="row">
@@ -51,20 +52,20 @@
{disabled}
{readonly}
{required}
{value}
bind:value
{step}
{type}
helper={error}
{leadingIcon}
on:change={onChange}
autocomplete={autocomplete ? 'on' : 'off'}>
{#if nullable}
<Selector.Checkbox
size="s"
slot="end"
label="NULL"
checked={value === null}
on:change={handleNullChange} />
{/if}
<svelte:fragment slot="end">
{#if nullable}
<Selector.Checkbox
size="s"
label="NULL"
checked={isValueNull}
on:change={handleNullChange} />
{/if}
</svelte:fragment>
</Input.DateTime>
</Layout.Stack>
+1 -5
View File
@@ -12,11 +12,7 @@
const handleInvalid = (event: Event & { currentTarget: EventTarget & HTMLInputElement }) => {
event.preventDefault();
if (event.currentTarget.validity.patternMismatch) {
error = true;
return;
}
error = true; // show on any error
};
$: if (value) {
+1 -5
View File
@@ -12,11 +12,7 @@
const handleInvalid = (event: Event & { currentTarget: EventTarget & HTMLInputElement }) => {
event.preventDefault();
if (event.currentTarget.validity.patternMismatch) {
error = true;
return;
}
error = true; // show on any error
};
$: if (value) {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 KiB

After

Width:  |  Height:  |  Size: 449 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 KiB

After

Width:  |  Height:  |  Size: 266 KiB

+2
View File
@@ -224,6 +224,8 @@ function createPreferences() {
delete teamPreferences?.displayNames?.[tableId];
delete teamPreferences?.columnOrder?.[tableId];
delete teamPreferences?.columnWidths?.[tableId];
delete teamPreferences?.columnWidths?.[tableId + '#columns'];
delete teamPreferences?.columnWidths?.[tableId + '#indexes'];
const removeTablePreferences = sdk.forConsole.teams.updatePrefs({
teamId: orgId,
@@ -3,7 +3,7 @@
import { onMount } from 'svelte';
import { CardGrid, PaginationInline } from '$lib/components';
import { Button } from '$lib/elements/forms';
import { toLocaleDate } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { formatCurrency } from '$lib/helpers/numbers';
import type { Invoice, InvoiceList } from '$lib/sdk/billing';
import { getApiEndpoint, sdk } from '$lib/stores/sdk';
@@ -112,8 +112,9 @@
{#each invoiceList?.invoices as invoice (invoice.$id)}
{@const status = invoice.status}
<Table.Row.Base {root}>
<Table.Cell column="dueDate" {root}
>{toLocaleDate(invoice.dueAt)}</Table.Cell>
<Table.Cell column="dueDate" {root}>
<DualTimeView time={invoice.dueAt} />
</Table.Cell>
<Table.Cell column="status" {root}>
{@const isDanger =
status === 'overdue' ||
@@ -4,7 +4,7 @@
import { EmptySearch, PaginationWithLimit, ViewSelector } from '$lib/components/index.js';
import { Button } from '$lib/elements/forms';
import Link from '$lib/elements/link.svelte';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import Container from '$lib/layout/container.svelte';
import { protocol } from '$routes/(console)/store.js';
import {
@@ -103,9 +103,13 @@
{:else if column.id === 'nameservers'}
{domain.nameservers || '-'}
{:else if column.id === 'expiry_date'}
{domain?.expire ? toLocaleDateTime(domain.expire) : '-'}
{#if domain?.expire}
<DualTimeView time={domain.expire} />
{:else}-{/if}
{:else if column.id === 'renewal'}
{domain?.renewal ? toLocaleDateTime(domain.renewal) : '-'}
{#if domain?.renewal}
<DualTimeView time={domain.renewal} />
{:else}-{/if}
{:else if column.id === 'auto_renewal'}
{domain?.autoRenewal ? 'On' : 'Off'}
{/if}
@@ -15,7 +15,7 @@
SearchQuery
} from '$lib/components';
import { Button } from '$lib/elements/forms';
import { toLocaleDate, toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { Container } from '$lib/layout';
import type { Models } from '@appwrite.io/console';
import { writable } from 'svelte/store';
@@ -196,9 +196,13 @@
{user.labels.join(', ')}
</Typography.Text>
{:else if id === 'joined'}
{toLocaleDateTime(user.registration)}
<DualTimeView time={user.registration} />
{:else if id === 'lastActivity'}
{user.accessedAt ? toLocaleDate(user.accessedAt) : 'never'}
{#if user.accessedAt}
<DualTimeView time={user.accessedAt} />
{:else}
never
{/if}
{:else}
{user[id]}
{/if}
@@ -6,7 +6,7 @@
import type { Models } from '@appwrite.io/console';
import { invalidate } from '$app/navigation';
import { base } from '$app/paths';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import type { PageData } from './$types';
import CreateMember from '../createMembership.svelte';
import DeleteMembership from '../deleteMembership.svelte';
@@ -117,7 +117,7 @@
{membership.roles}
</Table.Cell>
<Table.Cell column="joined" {root}>
{toLocaleDateTime(membership.joined)}
<DualTimeView time={membership.joined} />
</Table.Cell>
<Table.Cell column="actions" {root}>
<button
@@ -54,7 +54,7 @@
</p>
{#if error}
<Alert.Inline status="warning">{error}</Alert.Inline>
<Alert.Inline status="warning" title={error} />
{/if}
</Layout.Stack>
@@ -2,7 +2,7 @@
import { Id } from '$lib/components';
import { Button } from '$lib/elements/forms';
import type { PageData } from './$types';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { sdk } from '$lib/stores/sdk';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { Dependencies } from '$lib/constants';
@@ -87,7 +87,7 @@
{#if !identity[column.id]}
-
{:else}
{toLocaleDateTime(identity[column.id])}
<DualTimeView time={identity[column.id]} />
{/if}
{:else}
{identity[column.id]}
@@ -7,7 +7,7 @@
import DeleteMembership from '../deleteMembership.svelte';
import type { Models } from '@appwrite.io/console';
import { trackEvent, Submit, trackError } from '$lib/actions/analytics';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import {
Table,
Layout,
@@ -108,7 +108,7 @@
{membership.roles}
</Table.Cell>
<Table.Cell column="joined" {root}>
{toLocaleDateTime(membership.joined)}
<DualTimeView time={membership.joined} />
</Table.Cell>
<Table.Cell column="actions" {root}>
<button
@@ -3,7 +3,7 @@
import { Button } from '$lib/elements/forms';
import type { PageData } from './$types';
import { columns } from './store';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import ProviderType from '$routes/(console)/project-[region]-[project]/messaging/providerType.svelte';
import Provider from '$routes/(console)/project-[region]-[project]/messaging/provider.svelte';
import { sdk } from '$lib/stores/sdk';
@@ -83,7 +83,7 @@
<Provider provider={provider.provider} />
{/if}
{:else if column.id === '$createdAt'}
{toLocaleDateTime(target[column.id])}
<DualTimeView time={target[column.id]} />
{:else}
{target[column.id]}
{/if}
@@ -31,7 +31,10 @@
</script>
<svelte:head>
<title>Databases - Appwrite</title>
<!-- svelte bug, the table header just stays! -->
{#key page.url.pathname}
<title>Databases - Appwrite</title>
{/key}
</svelte:head>
<slot />
@@ -685,7 +685,7 @@
setTimeout(() => {
const notifId = addNotification({
isHtml: true,
title: '<b>Next step: Add indexes</b>',
title: '<b>Next step: add indexes</b>',
message: 'See suggested indexes based on your columns',
dismissible: true,
icon: IconAINotification,
@@ -1327,6 +1327,7 @@
position: fixed;
overflow: visible;
scrollbar-width: none;
--columns-range-pink-border-color: rgba(253, 54, 110, 0.24);
&.custom-columns {
width: unset;
@@ -1336,19 +1337,19 @@
display: none;
}
&:not(:has(.columns-range-overlay.thinking)) {
&:has(.columns-range-overlay) {
&
:global(
[role='cell']:has(.column-resizer-disabled):not([data-column-id^='$']):not(
[data-column-id='actions']
)
) {
box-shadow: 0 -1px 0 0 rgba(253, 54, 110, 0.24) inset !important;
box-shadow: 0 -1px 0 0 var(--columns-range-pink-border-color) inset !important;
transition: box-shadow 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
& :global([role='cell']:not([data-column-id='actions']) .column-resizer-disabled) {
border-left: var(--border-width-s, 1px) solid rgba(253, 54, 110, 0.24) !important;
border-left: var(--border-width-s, 1px) solid var(--columns-range-pink-border-color) !important;
transition: border-color 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
}
@@ -1438,7 +1439,7 @@
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.08),
rgba(255, 255, 255, 0.8),
transparent
);
animation: inner-shimmer 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
@@ -1542,7 +1543,7 @@
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.855) 21%,
rgba(255, 255, 255, 0.86) 32.25%,
#fff 100%
);
z-index: 20; /* under overlay */
@@ -1556,10 +1557,9 @@
:global(.theme-dark) .spreadsheet-fade-bottom {
background: linear-gradient(
180deg,
rgba(25, 25, 28, 0.38) 13%,
rgba(25, 25, 28, 0.7) 21%,
rgba(25, 25, 28, 0.95) 38%,
var(--bgcolor-neutral-default, #19191c) 100%
rgba(29, 29, 33, 0) 0%,
rgba(29, 29, 33, 0.86) 21%,
#1d1d21 100%
);
}
@@ -1580,6 +1580,10 @@
}
}
:global(.theme-dark) .spreadsheet-container-outer {
--columns-range-pink-border-color: rgba(253, 54, 110, 0.12) !important;
}
:global(.theme-dark) .columns-range-overlay.thinking {
&::before {
background: linear-gradient(
@@ -398,9 +398,7 @@
}
}}>
{#if modalError}
<Alert.Inline status="error">
{modalError}
</Alert.Inline>
<Alert.Inline status="error" title={modalError} />
{/if}
{#await loadIndexSuggestions()}
@@ -138,7 +138,10 @@
</script>
<svelte:head>
<title>Database - Appwrite</title>
<!-- svelte bug, the table header just stays! -->
{#key page.url.pathname}
<title>Database - Appwrite</title>
{/key}
</svelte:head>
<slot />
@@ -8,7 +8,7 @@
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { database } from './store';
import { toLocaleDate } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { type Models, Query } from '@appwrite.io/console';
import { Spinner, Table } from '@appwrite.io/pink-svelte';
@@ -126,7 +126,9 @@
{#each tableItems as table}
<Table.Row.Base {root}>
<Table.Cell {root}>{table.name}</Table.Cell>
<Table.Cell {root}>{toLocaleDate(table.updatedAt)}</Table.Cell>
<Table.Cell {root}>
<DualTimeView time={table.updatedAt} />
</Table.Cell>
</Table.Row.Base>
{/each}
</Table.Root>
@@ -6,7 +6,7 @@
import { Container } from '$lib/layout';
import { preferences } from '$lib/stores/preferences';
import { canWriteTables, canWriteRows } from '$lib/stores/roles';
import { Icon, Layout, Divider } from '@appwrite.io/pink-svelte';
import { Icon, Layout, Divider, Tooltip } from '@appwrite.io/pink-svelte';
import type { PageData } from './$types';
import {
table,
@@ -121,21 +121,31 @@
<Layout.Stack direction="column" gap="xl">
<Layout.Stack direction="row" justifyContent="space-between">
<Layout.Stack direction="row" gap="s">
<ViewSelector
onlyIcon
ui="new"
view={data.view}
columns={tableColumns}
hideView
showAnyway
isCustomTable />
<Tooltip>
<div>
<ViewSelector
onlyIcon
ui="new"
view={data.view}
columns={tableColumns}
hideView
showAnyway
isCustomTable />
</div>
<Filters
onlyIcon
query={data.query}
columns={filterColumns}
disabled={!(hasColumns && hasValidColumns)}
analyticsSource="database_rows" />
<svelte:fragment slot="tooltip">Columns</svelte:fragment>
</Tooltip>
<Tooltip>
<Filters
onlyIcon
query={data.query}
columns={filterColumns}
disabled={!(hasColumns && hasValidColumns)}
analyticsSource="database_tables" />
<svelte:fragment slot="tooltip">Filters</svelte:fragment>
</Tooltip>
</Layout.Stack>
<Layout.Stack direction="row" alignItems="center" justifyContent="flex-end">
<Button
@@ -199,7 +209,7 @@
queries.clearAll();
queries.apply();
trackEvent(Submit.FilterClear, {
source: 'database_rows'
source: 'database_tables'
});
}
}
@@ -20,6 +20,7 @@
import {
columns,
type Columns,
type ColumnsWidth,
indexes,
isCsvImportInProgress,
reorderItems,
@@ -51,7 +52,14 @@
import { type Models } from '@appwrite.io/console';
import { preferences } from '$lib/stores/preferences';
import { page } from '$app/state';
import { formatName } from '$lib/helpers/string';
import { debounce } from '$lib/helpers/debounce';
import type { PageData } from './$types';
const {
data
}: {
data: PageData;
} = $props();
const updatedColumnsForSheet = $derived.by(() => {
const baseAttrs = [
@@ -105,8 +113,11 @@
let selectedColumn: Columns = $state(null);
let columnIndexMap: Record<string, boolean> = $state({});
let columnsOrder = $state([]);
let columnsOrder = $state<string[]>([]);
let columnsWidth = $state<ColumnsWidth | null>(null);
const tableId = page.params.table;
const organizationId = data.organization.$id ?? data.project.teamId;
let showEdit = $state(false);
let editColumn: EditColumn;
@@ -127,6 +138,7 @@
onMount(() => {
columnsOrder = preferences.getColumnOrder(tableId);
columnsWidth = preferences.getColumnWidths(tableId + '#columns');
});
function getColumnStatusBadge(status: string): ComponentProps<Badge>['type'] {
@@ -187,8 +199,70 @@
return column.key.startsWith('$');
}
function getColumnWidth(columnId: string, defaultWidth: number): number {
const savedWidth = columnsWidth?.[columnId];
if (!savedWidth) return defaultWidth;
return savedWidth.resized;
}
function saveColumnsWidth({ columnId, newWidth }: { columnId: string; newWidth: number }) {
const existing = columnsWidth?.[columnId];
const fixed = existing
? typeof existing?.fixed === 'number'
? existing.fixed
: existing?.fixed?.min
: newWidth;
columnsWidth = {
...(columnsWidth ?? {}),
[columnId]: {
fixed,
resized: Math.ceil(newWidth)
}
};
saveColumnWidthsToPreferences({ columnId, newWidth, fixedWidth: fixed });
}
const saveColumnWidthsToPreferences = debounce(
(column: { columnId: string; newWidth: number; fixedWidth: number }) => {
if (!organizationId) return;
preferences.saveColumnWidths(organizationId, tableId + '#columns', {
[column.columnId]: {
fixed: column.fixedWidth,
resized: Math.ceil(column.newWidth)
}
});
},
1000
);
onDestroy(() => ($showCreateColumnSheet.show = false));
const spreadsheetColumns = $derived([
{
id: 'key',
width: getColumnWidth('key', 300),
minimumWidth: 300,
resizable: true
},
{
id: 'indexed',
width: getColumnWidth('indexed', 150),
minimumWidth: 150,
resizable: true
},
{
id: 'default',
width: getColumnWidth('default', 200),
minimumWidth: 200,
resizable: true
},
{ id: 'actions', width: 40, isAction: true, resizable: false }
]);
$effect(() => {
if (!$showCreateIndexSheet.show && $showCreateIndexSheet.column) {
const columnKey = $showCreateIndexSheet.column;
@@ -229,14 +303,9 @@
height="100%"
emptyCells={emptyCellsCount}
bind:selectedRows={selectedColumns}
columns={[
// more size until we decide if we want a new column!
{ id: 'key', width: { min: 300 }, resizable: false },
{ id: 'indexed', width: { min: 150 }, resizable: false },
{ id: 'default', width: { min: 200 }, resizable: false },
{ id: 'actions', width: 40, isAction: true }
]}
bottomActionClick={() => ($showCreateColumnSheet.show = true)}>
columns={spreadsheetColumns}
bottomActionClick={() => ($showCreateColumnSheet.show = true)}
on:columnsResize={(resize) => saveColumnsWidth(resize.detail)}>
<svelte:fragment slot="header" let:root>
<Spreadsheet.Header.Cell column="key" {root}>Column name</Spreadsheet.Header.Cell>
<Spreadsheet.Header.Cell column="indexed" {root}>Indexed</Spreadsheet.Header.Cell>
@@ -251,8 +320,17 @@
column['system'] || column.type === 'relationship' ? 'disabled' : true}
<Spreadsheet.Row.Base {root} select={isSelectable} id={column.key}>
<Spreadsheet.Cell column="key" {root} isEditable={false}>
<Layout.Stack direction="row" justifyContent="space-between">
<Layout.Stack direction="row" alignItems="center" inline>
<Layout.Stack
direction="row"
alignItems="center"
justifyContent="space-between"
style="min-width:0">
<Layout.Stack
gap="s"
inline
direction="row"
alignItems="center"
style="min-width:0; flex:1 1 auto;">
{#if isRelationship(column)}
<Icon
size="s"
@@ -268,33 +346,35 @@
<Icon icon={option.icon} size="s" />
{/if}
<Layout.Stack direction="row" alignItems="center" gap="s">
<Layout.Stack
inline
direction="row"
alignItems="center"
gap="xxs">
<Typography.Text truncate>
{#if isSystemColumnKey(column)}
{column.key}
{:else}
{@const key = !column.required
? column.key
: formatName(column.key, 6)}
{key}
{column.array ? '[]' : undefined}
{/if}
</Typography.Text>
{#if isString(column) && column.encrypt}
<Tooltip>
<Icon
size="s"
icon={IconLockClosed}
color="--fgcolor-neutral-tertiary" />
<div slot="tooltip">Encrypted</div>
</Tooltip>
<Layout.Stack
gap="s"
inline
direction="row"
alignItems="center"
style="min-width:0; flex:1 1 auto; overflow:hidden;">
<Typography.Text truncate>
{#if isSystemColumnKey(column)}
{column.key}
{:else}
{column.key}{column.array ? '[]' : undefined}
{/if}
</Layout.Stack>
</Typography.Text>
{#if isString(column) && column.encrypt}
<Tooltip>
<Icon
size="s"
icon={IconLockClosed}
color="--fgcolor-neutral-tertiary" />
<div slot="tooltip">Encrypted</div>
</Tooltip>
{/if}
</Layout.Stack>
<Layout.Stack
gap="s"
inline
direction="row"
alignItems="center"
style="flex:0 0 auto; white-space:nowrap;">
{#if column.status !== 'available'}
<Badge
size="s"
@@ -68,6 +68,7 @@
array: false,
...data
});
$: listen(data);
$: handleDefaultState($required || $array);
@@ -85,14 +85,14 @@
label="Min"
placeholder="Enter size"
bind:value={data.min}
step="any"
step={0.1}
required={editing} />
<InputNumber
id="max"
label="Max"
placeholder="Enter size"
bind:value={data.max}
step="any"
step={0.1}
required={editing} />
</Layout.Stack>
<InputNumber
@@ -104,7 +104,7 @@
bind:value={data.default}
disabled={data.required || data.array}
nullable={!data.required && !data.array}
step="any" />
step={0.1} />
<Selector.Checkbox
size="s"
id="required"
@@ -1,6 +1,6 @@
<script lang="ts">
import { Container } from '$lib/layout';
import { table } from '../store';
import { table, type ColumnsWidth } from '../store';
import Delete from './deleteIndex.svelte';
import CreateIndex from './createIndex.svelte';
import Overview from './overviewIndex.svelte';
@@ -8,6 +8,8 @@
import { Button } from '$lib/elements/forms';
import FailedModal from '../failedModal.svelte';
import { canWriteTables } from '$lib/stores/roles';
import { preferences } from '$lib/stores/preferences';
import { debounce } from '$lib/helpers/debounce';
import {
ActionMenu,
Badge,
@@ -26,7 +28,7 @@
IconPlus,
IconTrash
} from '@appwrite.io/pink-icons-svelte';
import { type ComponentProps, onDestroy } from 'svelte';
import { type ComponentProps, onDestroy, onMount } from 'svelte';
import { Click, trackEvent } from '$lib/actions/analytics';
import EmptySheet from '../layout/emptySheet.svelte';
import SpreadsheetContainer from '../layout/spreadsheet.svelte';
@@ -34,6 +36,7 @@
import type { PageData } from './$types';
import { showCreateColumnSheet } from '../store';
import { isSmallViewport } from '$lib/stores/viewport';
import { page } from '$app/state';
let {
data
@@ -52,15 +55,49 @@
let showDelete = $state(false);
let showOverview = $state(false);
let columns = $derived([
{ id: 'key', width: { min: $isSmallViewport ? 250 : 200 }, resizable: false },
{ id: 'type', width: 120, resizable: false },
{ id: 'columns', width: { min: 200 }, resizable: false },
let columnsWidth = $state<ColumnsWidth | null>(null);
const tableId = page.params.table;
const organizationId = data.organization.$id ?? data.project.teamId;
const spreadsheetColumns = $derived([
{
id: 'key',
width: getColumnWidth('key', $isSmallViewport ? 250 : 200),
minimumWidth: $isSmallViewport ? 250 : 200,
resizable: true
},
{
id: 'type',
width: getColumnWidth('type', 120),
minimumWidth: 120,
resizable: true
},
{
id: 'columns',
width: getColumnWidth('columns', 200),
minimumWidth: 200,
resizable: true
},
// { id: 'orders' }, // design doesn't have orders atm
{ id: 'lengths', width: { min: 180 }, resizable: false },
{ id: 'actions', width: 40, isAction: true }
{
id: 'lengths',
width: getColumnWidth('lengths', 180),
minimumWidth: 180,
resizable: true
},
{
id: 'actions',
width: 40,
isAction: true,
resizable: false
}
]);
onMount(() => {
columnsWidth = preferences.getColumnWidths(tableId + '#indexes');
});
function getColumnStatusBadge(status: string): ComponentProps<Badge>['type'] {
switch (status) {
case 'processing':
@@ -74,6 +111,46 @@
}
}
function getColumnWidth(columnId: string, defaultWidth: number): number {
const savedWidth = columnsWidth?.[columnId];
if (!savedWidth) return defaultWidth;
return savedWidth.resized;
}
function saveColumnsWidth({ columnId, newWidth }: { columnId: string; newWidth: number }) {
const existing = columnsWidth?.[columnId];
const fixed = existing
? typeof existing?.fixed === 'number'
? existing.fixed
: existing?.fixed?.min
: newWidth;
columnsWidth = {
...(columnsWidth ?? {}),
[columnId]: {
fixed,
resized: Math.ceil(newWidth)
}
};
saveColumnWidthsToPreferences({ columnId, newWidth, fixedWidth: fixed });
}
const saveColumnWidthsToPreferences = debounce(
(column: { columnId: string; newWidth: number; fixedWidth: number }) => {
if (!organizationId) return;
preferences.saveColumnWidths(organizationId, tableId + '#indexes', {
[column.columnId]: {
fixed: column.fixedWidth,
resized: Math.ceil(column.newWidth)
}
});
},
1000
);
onDestroy(() => ($showCreateColumnSheet.show = false));
const emptyCellsLimit = $derived($isSmallViewport ? 14 : 17);
@@ -108,12 +185,13 @@
<SpreadsheetContainer>
<Spreadsheet.Root
let:root
{columns}
columns={spreadsheetColumns}
height="100%"
allowSelection
emptyCells={emptyCellsCount}
bind:selectedRows={selectedIndexes}
bottomActionClick={() => (showCreateIndex = true)}>
bottomActionClick={() => (showCreateIndex = true)}
on:columnsResize={(resize) => saveColumnsWidth(resize.detail)}>
<svelte:fragment slot="header" let:root>
<Spreadsheet.Header.Cell column="key" {root}>Key</Spreadsheet.Header.Cell>
<Spreadsheet.Header.Cell column="type" {root}>Type</Spreadsheet.Header.Cell>
@@ -402,7 +402,7 @@
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.855) 21%,
rgba(255, 255, 255, 0.86) 32.25%,
#ffffff 100%
);
z-index: 20;
@@ -428,10 +428,9 @@
:global(.theme-dark) .spreadsheet-fade-bottom {
background: linear-gradient(
180deg,
rgba(25, 25, 28, 0.38) 13%,
rgba(25, 25, 28, 0.7) 21%,
rgba(25, 25, 28, 0.95) 38%,
var(--bgcolor-neutral-default, #19191c) 100%
rgba(29, 29, 33, 0) 0%,
rgba(29, 29, 33, 0.86) 21%,
#1d1d21 100%
);
}
@@ -58,7 +58,7 @@
},
{} as Record<string, unknown>
),
permissions: [],
permissions: existingData?.$permissions ?? [],
columns: availableColumns
};
}
@@ -1154,7 +1154,7 @@
</Table.Root>
<Layout.Stack direction="column" gap="m">
<Alert.Inline>To change the selection edit the relationship settings.</Alert.Inline>
<Alert.Inline title="To change the selection edit the relationship settings." />
</Layout.Stack>
{:else}
<p class="u-bold">This action is irreversible.</p>
@@ -1218,6 +1218,10 @@
padding-inline: 8px !important;
}
& :global(.input:has([type^='date'])) {
padding: 12px !important;
}
& :global(.input:focus-within) {
top: 0 !important;
}
@@ -33,9 +33,12 @@ export const tableColumns = writable<Column[]>([]);
export const isCsvImportInProgress = writable(false);
export const columnsOrder = writable<string[]>([]);
export const columnsWidth = writable<{
export type ColumnsWidth = {
[columnId: string]: { fixed: number | { min: number }; resized: number };
}>();
};
export const columnsWidth = writable<ColumnsWidth>();
type DatabaseSheetOptions = {
show: boolean;
@@ -6,7 +6,7 @@
import { Id } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button } from '$lib/elements/forms';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { addNotification } from '$lib/stores/notifications';
import { canWriteTables } from '$lib/stores/roles';
import { sdk } from '$lib/stores/sdk';
@@ -78,7 +78,7 @@
{:else if column.id === 'name'}
{table.name}
{:else}
{toLocaleDateTime(table[column.id])}
<DualTimeView time={table[column.id]} />
{/if}
</Table.Cell>
{/each}
@@ -86,10 +86,11 @@
</svelte:fragment>
</Alert.Inline>
{:else}
<Alert.Inline status="info" dismissible on:dismiss={() => (showAlert = false)}>
Some configuration changes are not live yet. Your function is redeploying —
changes will be applied once the build is complete.
</Alert.Inline>
<Alert.Inline
status="info"
dismissible
on:dismiss={() => (showAlert = false)}
title="Some configuration changes are not live yet. Your function is redeploying — changes will be applied once the build is complete." />
{/if}
{/if}
<Layout.Stack gap="xxxl">
@@ -4,7 +4,7 @@
import { Empty, EmptyFilter, EmptySearch, Id, PaginationWithLimit } from '$lib/components';
import { hasPageQueries } from '$lib/components/filters';
import { Button } from '$lib/elements/forms';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { Container, ResponsiveContainerHeader } from '$lib/layout';
import { MessagingProviderType } from '@appwrite.io/console';
import CreateMessageDropdown from './createMessageDropdown.svelte';
@@ -208,7 +208,7 @@
{#if !message[column.id]}
-
{:else}
{toLocaleDateTime(message[column.id])}
<DualTimeView time={message[column.id]} />
{/if}
{:else}
{message[column.id]}
@@ -8,7 +8,7 @@
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { sdk } from '$lib/stores/sdk';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import type { Column } from '$lib/helpers/types';
import { page } from '$app/state';
import { canWriteTopics } from '$lib/stores/roles';
@@ -72,7 +72,9 @@
<Id value={topic.$id}>{topic.$id}</Id>
{/key}
{:else if column.type === 'datetime'}
{topic[column.id] ? toLocaleDateTime(topic[column.id]) : '-'}
{#if topic[column.id]}
<DualTimeView time={topic[column.id]} />
{:else}-{/if}
{:else if column.id === 'total'}
{topic.emailTotal + topic.smsTotal + topic.pushTotal}
{:else}
@@ -8,7 +8,7 @@
import { addNotification } from '$lib/stores/notifications';
import type { PageData } from './$types';
import ProviderType from '../../providerType.svelte';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { project } from '$routes/(console)/project-[region]-[project]/store';
import { sdk } from '$lib/stores/sdk';
import { page } from '$app/state';
@@ -109,7 +109,7 @@
{:else if column.id === 'type'}
<ProviderType type={subscriber.target.providerType} size="xs" />
{:else if column.id === '$createdAt'}
{toLocaleDateTime(subscriber[column.id])}
<DualTimeView time={subscriber[column.id]} />
{:else}
{subscriber[column.id]}
{/if}
@@ -6,7 +6,8 @@
import { Button } from '$lib/elements/forms';
import { canWriteKeys } from '$lib/stores/roles';
import type { Models } from '@appwrite.io/console';
import { diffDays, toLocaleDate, toLocaleDateTime } from '$lib/helpers/date';
import { diffDays } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { devKeyColumns, keyColumns, showDevKeysCreateModal } from '../store';
import { Badge, FloatingActionBar, Layout, Table } from '@appwrite.io/pink-svelte';
import DeleteBatch from './deleteBatch.svelte';
@@ -69,12 +70,20 @@
{key.name}
</Table.Cell>
<Table.Cell {root}>
{key.accessedAt ? toLocaleDate(key.accessedAt) : 'never'}
{#if key.accessedAt}
<DualTimeView time={key.accessedAt} />
{:else}
never
{/if}
</Table.Cell>
<Table.Cell {root}>
{@const expiration = getExpiryDetails(key)}
<Layout.Stack gap="s" direction="row">
{key.expire ? toLocaleDateTime(key.expire) : 'never'}
{#if key.expire}
<DualTimeView time={key.expire} />
{:else}
never
{/if}
{#if expiration.status}
<Badge
@@ -89,9 +89,12 @@
</svelte:fragment>
</Alert.Inline>
{:else}
<Alert.Inline status="info" dismissible on:dismiss={() => (showAlert = false)}>
Some configuration changes are not live yet. Your site is redeploying — changes
will be applied once the build is complete.
<Alert.Inline
status="info"
title="Some configuration changes are not live yet. Your site is redeploying — changes
will be applied once the build is complete."
dismissible
on:dismiss={() => (showAlert = false)}>
</Alert.Inline>
{/if}
{/if}
@@ -92,11 +92,11 @@
</script>
<Wizard
title="Create file"
href={`${base}/project-${page.params.region}-${page.params.project}/storage/bucket-${page.params.bucket}/`}
bind:showExitModal
column
confirmExit>
confirmExit
title="Create file"
bind:showExitModal
href={`${base}/project-${page.params.region}-${page.params.project}/storage/bucket-${page.params.bucket}/`}>
<Form bind:this={formComponent} onSubmit={create} bind:isSubmitting>
<Layout.Stack gap="xxl">
<Fieldset legend="Data">
@@ -115,6 +115,7 @@
>.
</Alert.Inline>
{/if}
<Upload.Dropzone
bind:files
required
@@ -123,6 +124,7 @@
<Typography.Text variant="l-500"
>Drag and drop files here or click to upload</Typography.Text>
</Upload.Dropzone>
{#if files}
<Upload.List
files={Array.from(files).map((f) => {