diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2024-07-30 13:11:06 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-30 13:11:06 +0900 |
| commit | 738b3ea43b059b103deca0b1a33071ae256ef79f (patch) | |
| tree | b47248996be4aa737cedcb62bdc04aa7aa63fcd2 /packages/frontend/src/ui/deck/deck-store.ts | |
| parent | enhance: 管理画面でアーカイブにしたお知らせを表示・編... (diff) | |
| download | misskey-738b3ea43b059b103deca0b1a33071ae256ef79f.tar.gz misskey-738b3ea43b059b103deca0b1a33071ae256ef79f.tar.bz2 misskey-738b3ea43b059b103deca0b1a33071ae256ef79f.zip | |
enhance(frontend): デッキのアンテナ・リスト選択画面からそれぞれを新規作成できるように (#14104)
* enhance(frontend): デッキのアンテナ・リスト選択画面からそれぞれを新規作成できるように
* Update Changelog
* fix
* fix
* lint
* add story
* typo
ねぼけていた
* Update antenna-column.vue
---------
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/ui/deck/deck-store.ts')
| -rw-r--r-- | packages/frontend/src/ui/deck/deck-store.ts | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/packages/frontend/src/ui/deck/deck-store.ts b/packages/frontend/src/ui/deck/deck-store.ts index bb3c04cd5c..139621cf57 100644 --- a/packages/frontend/src/ui/deck/deck-store.ts +++ b/packages/frontend/src/ui/deck/deck-store.ts @@ -17,9 +17,24 @@ type ColumnWidget = { data: Record<string, any>; }; +export const columnTypes = [ + 'main', + 'widgets', + 'notifications', + 'tl', + 'antenna', + 'list', + 'channel', + 'mentions', + 'direct', + 'roleTimeline', +] as const; + +export type ColumnType = typeof columnTypes[number]; + export type Column = { id: string; - type: 'main' | 'widgets' | 'notifications' | 'tl' | 'antenna' | 'channel' | 'list' | 'mentions' | 'direct'; + type: ColumnType; name: string | null; width: number; widgets?: ColumnWidget[]; @@ -265,7 +280,7 @@ export function removeColumnWidget(id: Column['id'], widget: ColumnWidget) { const columns = deepClone(deckStore.state.columns); const columnIndex = deckStore.state.columns.findIndex(c => c.id === id); const column = deepClone(deckStore.state.columns[columnIndex]); - if (column == null) return; + if (column == null || column.widgets == null) return; column.widgets = column.widgets.filter(w => w.id !== widget.id); columns[columnIndex] = column; deckStore.set('columns', columns); @@ -287,7 +302,7 @@ export function updateColumnWidget(id: Column['id'], widgetId: string, widgetDat const columns = deepClone(deckStore.state.columns); const columnIndex = deckStore.state.columns.findIndex(c => c.id === id); const column = deepClone(deckStore.state.columns[columnIndex]); - if (column == null) return; + if (column == null || column.widgets == null) return; column.widgets = column.widgets.map(w => w.id === widgetId ? { ...w, data: widgetData, |