MCPcopy Create free account
hub / github.com/UNLINEARITY/Obsidian-CodeSpace / render

Method render

src/dashboard_view.ts:155–321  ·  view source on GitHub ↗
(_keepState = false)

Source from the content-addressed store, hash-verified

153 }
154
155 render(_keepState = false) {
156 const container = this.containerEl.children[1];
157 if (!container) return;
158 container.empty();
159
160 const root = container.createDiv({ cls: "code-dashboard-root" });
161
162 // Header Container
163 const headerContainer = root.createDiv({ cls: "code-dashboard-header-container" });
164
165 // Title Group (Title + Buttons)
166 const titleGroup = headerContainer.createDiv({ cls: "code-dashboard-title-group" });
167 titleGroup.createEl("h1", { text: t('VIEW_TITLE') });
168
169 // Settings Button
170 new ButtonComponent(titleGroup)
171 .setIcon("settings")
172 .setTooltip(t('BUTTON_OPEN_SETTINGS'))
173 .setClass("clickable-icon")
174 .onClick((e) => {
175 e.stopPropagation();
176 type AppWithSetting = App & { setting: { open(): void; openTabById(id: string): void } };
177 const appWithSetting = this.app as unknown as AppWithSetting;
178 appWithSetting.setting.open();
179 appWithSetting.setting.openTabById("code-space");
180 });
181
182 // Create File Button
183 new ButtonComponent(titleGroup)
184 .setIcon("plus-circle")
185 .setTooltip(t('BUTTON_CREATE_FILE'))
186 .setClass("clickable-icon")
187 .onClick((e) => {
188 e.stopPropagation();
189 type AppWithPlugins = App & { plugins: { getPlugin(id: string): CodeSpacePlugin | undefined } };
190 const plugin = (this.app as unknown as AppWithPlugins).plugins.getPlugin("code-space");
191 if (plugin) {
192 plugin.createCodeFile();
193 }
194 });
195
196 new ButtonComponent(titleGroup)
197 .setIcon("eye-off")
198 .setTooltip(t("BUTTON_MANAGE_IGNORED_FILES"))
199 .setClass("clickable-icon")
200 .onClick((e) => {
201 e.stopPropagation();
202 if (this.plugin) {
203 void this.plugin.openIgnoreManager();
204 }
205 });
206
207 const codeExtensions = this.getManagedExtensions();
208 let files = this.app.vault.getFiles().filter((file) =>
209 codeExtensions.includes(file.extension.toLowerCase()) &&
210 !this.plugin?.isIgnoredFile(file)
211 );
212

Callers 2

onOpenMethod · 0.95
showContextMenuMethod · 0.95

Calls 14

getManagedExtensionsMethod · 0.95
onChangeMethod · 0.95
setValueMethod · 0.95
refreshFileListMethod · 0.95
addOptionMethod · 0.95
setValuesMethod · 0.95
onChangeMethod · 0.95
addOptionMethod · 0.95
tFunction · 0.90
getPluginMethod · 0.80
createCodeFileMethod · 0.80
openIgnoreManagerMethod · 0.80

Tested by

no test coverage detected