1
0

enhance(frontend): アンテナ、リスト等の名前をdeckのカラム名のデフォルト値にするように (#13992)

* refactor: remove type errors from deck.vue and deck-store.ts

* feat: アンテナ、リスト等の名前をカラム名のデフォルト値にするように

* docs: アンテナ、リスト等の名前をカラム名のデフォルト値にするように

* lint: fix

* chore: カラム名が指定されている場合にはチャンネル名を取得しないように

* chore: チャンネルについては投稿でも使用されてる channel 変数を使用するように

* docs: fix changelog

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com>
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
anatawa12
2025-02-07 15:57:14 +09:00
committed by GitHub
parent d008394eb7
commit 607bf60007
14 changed files with 85 additions and 25 deletions
+10 -4
View File
@@ -51,7 +51,7 @@ export type Column = {
withReplies?: boolean;
withSensitive?: boolean;
onlyFiles?: boolean;
soundSetting: SoundStore;
soundSetting?: SoundStore;
};
export const deckStore = markRaw(new Storage('deck', {
@@ -94,7 +94,7 @@ export const loadDeck = async () => {
key: deckStore.state.profile,
});
} catch (err) {
if (err.code === 'NO_SUCH_KEY') {
if (typeof err === 'object' && err != null && 'code' in err && err.code === 'NO_SUCH_KEY') {
// 後方互換性のため
if (deckStore.state.profile === 'default') {
saveDeck();
@@ -180,6 +180,7 @@ export function swapLeftColumn(id: Column['id']) {
}
return true;
}
return false;
});
saveDeck();
}
@@ -196,6 +197,7 @@ export function swapRightColumn(id: Column['id']) {
}
return true;
}
return false;
});
saveDeck();
}
@@ -216,6 +218,7 @@ export function swapUpColumn(id: Column['id']) {
}
return true;
}
return false;
});
saveDeck();
}
@@ -236,6 +239,7 @@ export function swapDownColumn(id: Column['id']) {
}
return true;
}
return false;
});
saveDeck();
}
@@ -286,7 +290,8 @@ 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 || column.widgets == null) return;
if (column == null) return;
if (column.widgets == null) column.widgets = [];
column.widgets = column.widgets.filter(w => w.id !== widget.id);
columns[columnIndex] = column;
deckStore.set('columns', columns);
@@ -308,7 +313,8 @@ 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 || column.widgets == null) return;
if (column == null) return;
if (column.widgets == null) column.widgets = [];
column.widgets = column.widgets.map(w => w.id === widgetId ? {
...w,
data: widgetData,