andy-stack_vaultkeeper-ai/Modals/HelpModal.ts
Andrew Beal 7b6682f951 feat: implement help modal with topic navigation and content display
- Add HelpModal enum entries for titles and content
- Implement HelpModalSvelte component with sidebar navigation
- Add topic selection functionality with fade transitions
- Style help modal with grid layout and custom backgrounds
- Display plugin version in modal footer
- Apply consistent spacing with conversation history modal
2025-11-08 13:31:53 +00:00

41 lines
No EOL
1.1 KiB
TypeScript

import type AIAgentPlugin from "main";
import { Modal } from "obsidian";
import { Resolve } from "Services/DependencyService";
import { Services } from "Services/Services";
import HelpModalSvelte from './HelpModalSvelte.svelte';
import { mount, unmount } from 'svelte';
import { Selector } from 'Enums/Selector';
export class HelpModal extends Modal {
private component: Record<string, any> | null = null;
public constructor() {
const plugin = Resolve<AIAgentPlugin>(Services.AIAgentPlugin);
super(plugin.app);
}
onOpen() {
const { contentEl, modalEl, containerEl } = this;
containerEl.addClass(Selector.HelpModal);
modalEl.addClass(Selector.HelpModal);
this.component = mount(HelpModalSvelte, {
target: contentEl,
props: {
onClose: () => this.close()
}
});
}
onClose() {
if (this.component) {
unmount(this.component);
this.component = null;
}
const { contentEl } = this;
contentEl.empty();
}
}