MCPcopy Create free account
hub / github.com/chieapp/chie / constructor

Method constructor

src/view/dashboard-window.ts:52–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 #welcomeBoard?: WelcomeBoard;
51
52 constructor() {
53 super({showMenuBar: true, useClassicBackground: true});
54
55 this.window.setTitle('Dashboard');
56 this.window.onFocus = () => this.selectedView?.mainView.onFocus();
57 this.contentView.setStyle({flexDirection: 'row'});
58
59 this.#sidebar = new SortableList({padding: basicStyle.padding});
60 this.#sidebar.view.onDraw = this.#onDraw.bind(this);
61 this.#sidebar.view.setStyle({width: style.buttonSize + 2 * basicStyle.padding});
62 this.#sidebar.setBackgroundColor(style.light.bgColor, style.dark.bgColor);
63 this.#sidebar.onReorder.connect(assistantManager.reorderAssistant.bind(assistantManager));
64 this.#sidebar.onDragging.connect(this.#sidebar.view.schedulePaint.bind(this.#sidebar.view));
65 this.contentView.addChildView(this.#sidebar.view);
66
67 this.#addButton = new IconButton('add');
68 this.#addButton.view.setTooltip('Add new assistant');
69 this.#addButton.onClick = () => windowManager.showNewAssistantWindowOrError();
70 this.#sidebar.view.addChildView(this.#addButton.view);
71
72 // Create views for assistants.
73 for (const assistant of assistantManager.getAssistants())
74 this.#createViewForAssistant(assistant);
75 this.connections.add(assistantManager.onNewAssistant.connect((assistant, index) => {
76 this.#createViewForAssistant(assistant);
77 this.switchTo(index);
78 }));
79 this.connections.add(assistantManager.onRemoveAssistant.connect(
80 this.#removeViewForAssistant.bind(this)));
81 this.connections.add(assistantManager.onReorderAssistant.connect(
82 this.#reorderViewForAssistant.bind(this)));
83
84 // Show welcome board if there is no assistant.
85 if (this.views.length == 0)
86 this.#createWelcomeBoard();
87 }
88
89 destructor() {
90 super.destructor();

Callers

nothing calls this directly

Calls 8

switchToMethod · 0.95
#createWelcomeBoardMethod · 0.95
onFocusMethod · 0.80
setBackgroundColorMethod · 0.80
getAssistantsMethod · 0.80
setTitleMethod · 0.45

Tested by

no test coverage detected