mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
parent
c3ac281d59
commit
0820132fac
@ -9,15 +9,14 @@ import type { HotbarData } from "../common/hotbar";
|
|||||||
import type { HotbarItem } from "../common/types";
|
import type { HotbarItem } from "../common/types";
|
||||||
import v640HotbarStoreMigrationInjectable from "./welcome-page-migration.injectable";
|
import v640HotbarStoreMigrationInjectable from "./welcome-page-migration.injectable";
|
||||||
import { defaultHotbarCells } from "../common/types";
|
import { defaultHotbarCells } from "../common/types";
|
||||||
import { array } from "@k8slens/utilities";
|
|
||||||
|
|
||||||
function fillWithEmpties(items: (HotbarItem | null)[]) {
|
function fillWithEmpties(items: HotbarItem[]) {
|
||||||
const emptyHotBarItems = array.filled(defaultHotbarCells, null);
|
const emptyHotBarItems = new Array(defaultHotbarCells).fill(null);
|
||||||
|
|
||||||
return [...items, ...emptyHotBarItems.slice(items.length)];
|
return [...items, ...emptyHotBarItems.slice(items.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFirstHotbarItems(store: MigrationStore, items: (HotbarItem | null)[]) {
|
function setFirstHotbarItems(store: MigrationStore, items: HotbarItem[]) {
|
||||||
const oldHotbars = store.get("hotbars") as HotbarData[];
|
const oldHotbars = store.get("hotbars") as HotbarData[];
|
||||||
// empty hotbar items are nulls
|
// empty hotbar items are nulls
|
||||||
const itemsWithEmptyCells = fillWithEmpties(items);
|
const itemsWithEmptyCells = fillWithEmpties(items);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user