Saving more entity data to HotbarItem

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2021-05-06 11:48:31 +03:00
1 parent 8fff064e0c
commit e25f7fc655
2 files changed
+14 -2

No files matched your search

+9 -1
View File
@@ -8,6 +8,8 @@ import isNull from "lodash/isNull";
export interface HotbarItem {
entity: {
uid: string;
name: string;
source: string;
};
params?: {
[key: string]: string;
@@ -123,9 +125,14 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
}
}
@action
addToHotbar(item: CatalogEntityItem, cellIndex = -1) {
const hotbar = this.getActive();
const newItem = { entity: { uid: item.id }};
const newItem = { entity: {
uid: item.id,
name: item.name,
source: item.source
}};
if (hotbar.items.find(i => i?.entity.uid === item.id)) {
return;
@@ -146,6 +153,7 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
}
}
@action
removeFromHotbar(uid: string) {
const hotbar = this.getActive();
const index = hotbar.items.findIndex((i) => i?.entity.uid === uid);
+5 -1
View File
@@ -22,7 +22,11 @@ export default migration({
}
hotbar.items.push({
entity: { uid: cluster.id },
entity: {
uid: cluster.id,
name: cluster.name,
source: cluster.source
},
params: {}
});
});