Implement the actual tab rearrangement on setup
This commit is contained in:
parent
58803cb60f
commit
a682048852
1 changed files with 25 additions and 1 deletions
|
|
@ -32,8 +32,32 @@ export function rearrangeSidebarTabs() {
|
||||||
// #endregion Registration
|
// #endregion Registration
|
||||||
|
|
||||||
// #region Implementation
|
// #region Implementation
|
||||||
// TODO: do this
|
updateTabOrder();
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
status[key] = SettingStatusEnum.Registered;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function updateTabOrder() {
|
||||||
|
const order = game.settings.get(__ID__, `${key}User`)
|
||||||
|
?? game.settings.get(__ID__, `${key}World`)
|
||||||
|
?? null;
|
||||||
|
if (!order) { return };
|
||||||
|
|
||||||
|
const tabs = CONFIG.ui.sidebar.TABS;
|
||||||
|
const replaced = {};
|
||||||
|
|
||||||
|
// Sort all of the tabs that are provided
|
||||||
|
for (const tabID of order) {
|
||||||
|
if (!tabs[tabID]) { continue };
|
||||||
|
replaced[tabID] = tabs[tabID];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add any tabs that are not in the ordering yet
|
||||||
|
for (const tabID in tabs) {
|
||||||
|
if (replaced[tabID] != null) { continue };
|
||||||
|
replaced[tabID] = tabs[tabID];
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG.ui.sidebar.TABS = replaced;
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue