mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix(messaging): localize the topics columns
When it was global, the state (show values) would persist when switching between different projects rather than resetting back to the default.
This commit is contained in:
3 files changed
+26
-17
No files matched your search
@@ -16,14 +16,33 @@
|
||||
import { base } from '$app/paths';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import type { PageData } from './$types';
|
||||
import { columns, showCreate } from './store';
|
||||
import { showCreate } from './store';
|
||||
import { View } from '$lib/helpers/load';
|
||||
import { Filters, hasPageQueries } from '$lib/components/filters';
|
||||
import Table from './table.svelte';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
const project = $page.params.project;
|
||||
const columns = writable<Column[]>([
|
||||
{ id: '$id', title: 'Topic ID', type: 'string', show: true, width: 140 },
|
||||
{ id: 'name', title: 'Name', type: 'string', show: true, width: 140 },
|
||||
{ id: 'emailTotal', title: 'Email Subscribers', type: 'integer', show: false, width: 140 },
|
||||
{ id: 'smsTotal', title: 'SMS Subscribers', type: 'integer', show: false, width: 140 },
|
||||
{ id: 'pushTotal', title: 'Push Subscribers', type: 'integer', show: false, width: 140 },
|
||||
{
|
||||
id: 'total',
|
||||
title: 'Subscribers',
|
||||
type: 'integer',
|
||||
show: true,
|
||||
filter: false,
|
||||
width: 140
|
||||
},
|
||||
{ id: '$createdAt', title: 'Created', type: 'datetime', show: true, width: 140 }
|
||||
]);
|
||||
|
||||
const topicCreated = async (event: CustomEvent<Models.Team<Record<string, unknown>>>) => {
|
||||
await goto(`${base}/console/project-${project}/messaging/topics/topic-${event.detail.$id}`);
|
||||
};
|
||||
@@ -73,7 +92,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{#if data.topics.total}
|
||||
<Table {data} />
|
||||
<Table columns={$columns} {data} />
|
||||
|
||||
<PaginationWithLimit
|
||||
name="Topics"
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export const showCreate = writable(false);
|
||||
|
||||
export const columns = writable<Column[]>([
|
||||
{ id: '$id', title: 'Topic ID', type: 'string', show: true, width: 140 },
|
||||
{ id: 'name', title: 'Name', type: 'string', show: true, width: 140 },
|
||||
{ id: 'emailTotal', title: 'Email Subscribers', type: 'integer', show: false, width: 140 },
|
||||
{ id: 'smsTotal', title: 'SMS Subscribers', type: 'integer', show: false, width: 140 },
|
||||
{ id: 'pushTotal', title: 'Push Subscribers', type: 'integer', show: false, width: 140 },
|
||||
{ id: 'total', title: 'Subscribers', type: 'integer', show: true, filter: false, width: 140 },
|
||||
{ id: '$createdAt', title: 'Created', type: 'datetime', show: true, width: 140 }
|
||||
]);
|
||||
@@ -16,13 +16,14 @@
|
||||
} from '$lib/elements/table';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import type { PageData } from './$types';
|
||||
import { columns } from './store';
|
||||
import { project } from '$routes/console/project-[project]/store';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
|
||||
export let columns: Column[];
|
||||
export let data: PageData;
|
||||
|
||||
let selectedIds: string[] = [];
|
||||
@@ -62,7 +63,7 @@
|
||||
<TableCellHeadCheck
|
||||
bind:selected={selectedIds}
|
||||
pageItemsIds={data.topics.topics.map((d) => d.$id)} />
|
||||
{#each $columns as column}
|
||||
{#each columns as column}
|
||||
{#if column.show}
|
||||
<TableCellHead width={column.width}>{column.title}</TableCellHead>
|
||||
{/if}
|
||||
@@ -74,10 +75,10 @@
|
||||
href={`${base}/console/project-${$project.$id}/messaging/topics/topic-${topic.$id}`}>
|
||||
<TableCellCheck bind:selectedIds id={topic.$id} />
|
||||
|
||||
{#each $columns as column (column.id)}
|
||||
{#each columns as column (column.id)}
|
||||
{#if column.show}
|
||||
{#if column.id === '$id'}
|
||||
{#key $columns}
|
||||
{#key column.id}
|
||||
<TableCell title={column.title} width={column.width}>
|
||||
<Id value={topic.$id}>{topic.$id}</Id>
|
||||
</TableCell>
|
||||
|
||||
Reference in new issue
Block a user