import { App, MarkdownRenderer, Modal } from "obsidian"; import ExcalidrawPlugin from "../../core/main"; import { Rank, SwordColors } from "src/constants/actionIcons"; export class RankMessage extends Modal { constructor(app: App, private plugin: ExcalidrawPlugin, private filecount: number, private rank: Rank, private color: string, private shield: string, private dark: string) { super(app); } onOpen(): void { //this.contentEl.classList.add("excalidraw-release"); this.containerEl.classList.add("excalidraw-release"); this.titleEl.setText("Congratulations, glorious knight!"); this.createForm(); } async onClose() { this.contentEl.empty(); this.plugin = null; } async createForm() { const { title} = SwordColors[this.rank]; this.contentEl.createDiv({ cls: "excalidraw-rank" }, (el) => { el.innerHTML = ``; }); await MarkdownRenderer.render( this.app, `You have ${this.filecount} Excalidraw drawings in your Vault earning you a new rank: **${this.rank}**! You've ascended to **${title}**!\n\nI've spent the past 3+ years building this plugin. If you appreciate my work, consider supporting me on [Ko-Fi](https://ko-fi.com/zsolt) or join the next [Visual Thinking Workshop](https://visual-thinking-workshop.com) cohort.`, this.contentEl, "", this.plugin, ); this.contentEl.createEl("p", { text: "" }, (el) => { //files manually follow one of two options: el.style.textAlign = "right"; const bOk = el.createEl("button", { text: "Close" }); bOk.onclick = () => this.close(); }); } }