From 80803f78a63866dc4604da7abb3201f0b514db74 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Fri, 18 Jun 2021 14:17:36 +0300 Subject: [PATCH] Adding Catalog initially to first hotbar Signed-off-by: Alex Andreev --- src/common/hotbar-store.ts | 9 ++- src/main/catalog-sources/general.ts | 76 ++++++++++--------- .../components/hotbar/hotbar-icon.scss | 1 + 3 files changed, 49 insertions(+), 37 deletions(-) diff --git a/src/common/hotbar-store.ts b/src/common/hotbar-store.ts index 6d15ace11e..fd888c6194 100644 --- a/src/common/hotbar-store.ts +++ b/src/common/hotbar-store.ts @@ -26,6 +26,7 @@ import * as uuid from "uuid"; import isNull from "lodash/isNull"; import { toJS } from "./utils"; import { CatalogEntity } from "./catalog"; +import { catalogEntity } from "../main/catalog-sources/general"; export interface HotbarItem { entity: { @@ -92,7 +93,13 @@ export class HotbarStore extends BaseStore { } get initialItems() { - return [...Array.from(Array(defaultHotbarCells).fill(null))]; + const { metadata: { uid, name, source } } = catalogEntity; + const initialItem = { entity: { uid, name, source }}; + + return [ + initialItem, + ...Array.from(Array(defaultHotbarCells - 1).fill(null)) + ]; } @action protected async fromStore(data: Partial = {}) { diff --git a/src/main/catalog-sources/general.ts b/src/main/catalog-sources/general.ts index 1f42e69ac9..20ad16d331 100644 --- a/src/main/catalog-sources/general.ts +++ b/src/main/catalog-sources/general.ts @@ -24,43 +24,47 @@ import { GeneralEntity } from "../../common/catalog-entities/general"; import { catalogURL, preferencesURL } from "../../common/routes"; import { catalogEntityRegistry } from "../catalog"; +export const catalogEntity = new GeneralEntity({ + metadata: { + uid: "catalog-entity", + name: "Catalog", + source: "app", + labels: {} + }, + spec: { + path: catalogURL(), + icon: { + material: "view_list", + background: "#3d90ce" + } + }, + status: { + phase: "active", + } +}); + +const preferencesEntity = new GeneralEntity({ + metadata: { + uid: "preferences-entity", + name: "Preferences", + source: "app", + labels: {} + }, + spec: { + path: preferencesURL(), + icon: { + material: "settings", + background: "#3d90ce" + } + }, + status: { + phase: "active", + } +}); + const generalEntities = observable([ - new GeneralEntity({ - metadata: { - uid: "catalog-entity", - name: "Catalog", - source: "local", - labels: {} - }, - spec: { - path: catalogURL(), - icon: { - material: "view_list", - background: "#3d90ce" - } - }, - status: { - phase: "active", - } - }), - new GeneralEntity({ - metadata: { - uid: "preferences-entity", - name: "Preferences", - source: "local", - labels: {} - }, - spec: { - path: preferencesURL(), - icon: { - material: "settings", - background: "#3d90ce" - } - }, - status: { - phase: "active", - } - }) + catalogEntity, + preferencesEntity ]); export function addGeneralEntities() { diff --git a/src/renderer/components/hotbar/hotbar-icon.scss b/src/renderer/components/hotbar/hotbar-icon.scss index e7bc4d04ba..26cc9b4e1e 100644 --- a/src/renderer/components/hotbar/hotbar-icon.scss +++ b/src/renderer/components/hotbar/hotbar-icon.scss @@ -130,5 +130,6 @@ margin-left: 1px; margin-top: 1px; text-shadow: none; + font-size: 180%; } }