列番を並び替え、列車リンク表示機能等を実装

This commit is contained in:
harukin-expo-dev-env
2025-08-19 15:32:39 +00:00
parent d15d7c74fb
commit f16fe6c994
3 changed files with 64 additions and 22 deletions

View File

@@ -31,7 +31,14 @@ export const AllTrainDiagramProvider = ({ children }) => {
const keys = Object.keys(d);
data[keys] = d[keys];
});
return data;
//dataのkeyで並び替え
const sortedData = Object.keys(data)
.sort((a, b) => a.replace(/[D,M]/, "") - b.replace(/[D,M]/, ""))
.reduce((acc, key) => {
acc[key] = data[key];
return acc;
}, {});
return sortedData;
})
.then((res) => {
setAllTrainDiagram(res);