diff --git a/src/ui.ts b/src/ui.ts index f248569..6095473 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -90,8 +90,8 @@ class ExportHistoryModal extends Modal { constructor(app: App, private readonly class CompileLogsModal extends Modal { constructor(app: App, private readonly plugin: ManuscriptCompilerPlugin) { super(app); } onOpen(): void { this.titleEl.setText("Compile logs"); this.plugin.settings.compileLogs.forEach((log) => { const details = this.contentEl.createEl("details"); details.createEl("summary", { text: `${log.cancelled ? "Cancelled" : log.success ? "Success" : "Failure"} — ${new Date(log.timestamp).toLocaleString()} — ${log.profile}` }); const pre = details.createEl("pre"); pre.setText([`Compiler: ${log.compilerVersion}`, `Manuscript: ${log.manuscript}`, `Formats: ${log.exportFormats}`, `Outputs: ${log.outputFiles.join(", ") || "None"}`, `Duration: ${log.durationMs} ms`, `Warnings: ${log.warnings.join(" | ") || "None"}`, log.diagnostics ? `Diagnostics:\n${log.diagnostics}` : ""].filter(Boolean).join("\n")); }); new Setting(this.contentEl).addButton((button) => button.setButtonText("Close").onClick(() => this.close())); } } const SUPPORT_ACTIONS = [ - { label: "Report a bug", icon: "bug", url: "https://github.com/anthonyfitzpatrick/manuscript-compiler/issues/new?labels=bug" }, - { label: "Feature request", icon: "lightbulb", url: "https://github.com/anthonyfitzpatrick/manuscript-compiler/issues/new?labels=enhancement" }, + { label: "Report a bug", icon: "bug", url: "https://github.com/anthonyfitzpatrick/manuscript-compiler/issues/new?template=bug_report.yml" }, + { label: "Feature request", icon: "lightbulb", url: "https://github.com/anthonyfitzpatrick/manuscript-compiler/issues/new?template=feature_request.yml" }, { label: "wolf359.app", icon: "globe", url: "https://wolf359.app" }, { label: "Wolf 359 Press", icon: "book-open", url: "https://wolf359.press" }, { label: "Buy me a coffee", icon: "coffee", url: "https://buymeacoffee.com/wolf359pressab" } diff --git a/tests/run.ts b/tests/run.ts index 16c105d..841722a 100644 --- a/tests/run.ts +++ b/tests/run.ts @@ -389,7 +389,14 @@ test("settings end with an accessible responsive Support & Links panel", async ( const records = ui.indexOf('setName("Export records")'); const support = ui.indexOf("this.renderSupportPanel(container);"); assert.ok(records >= 0 && support > records, "support must render after every setting"); assert.match(ui, /container\.addClass\("manuscript-compiler-settings"\)/); assert.match(css, /\.manuscript-compiler-settings > \.setting-item:not\(\.setting-item-heading\)[\s\S]*padding-block: var\(--size-4-2\)/); assert.match(css, /\.manuscript-compiler-settings > details > \.setting-item/); assert.match(ui, /const SUPPORT_SECTION_TITLE = "Support & Links"/); assert.match(ui, /import pluginLogo from "\.\.\/logo\.svg"/); assert.match(ui, /manuscript-support-logo/); assert.match(ui, /text: `Version \$\{this\.plugin\.manifest\.version\}`/); assert.equal((ui.match(/\{ label: /g) ?? []).length, 5); - for (const value of ["Report a bug", "Feature request", "wolf359.app", "Wolf 359 Press", "Buy me a coffee", "https://github.com/anthonyfitzpatrick/manuscript-compiler/issues/new?labels=bug", "https://wolf359.app", "https://wolf359.press", "https://buymeacoffee.com/wolf359pressab"]) assert.ok(ui.includes(value), value); + for (const action of [ + '{ label: "Report a bug", icon: "bug", url: "https://github.com/anthonyfitzpatrick/manuscript-compiler/issues/new?template=bug_report.yml" }', + '{ label: "Feature request", icon: "lightbulb", url: "https://github.com/anthonyfitzpatrick/manuscript-compiler/issues/new?template=feature_request.yml" }', + '{ label: "wolf359.app", icon: "globe", url: "https://wolf359.app" }', + '{ label: "Wolf 359 Press", icon: "book-open", url: "https://wolf359.press" }', + '{ label: "Buy me a coffee", icon: "coffee", url: "https://buymeacoffee.com/wolf359pressab" }' + ]) assert.ok(ui.includes(action), action); + assert.doesNotMatch(ui, /Bug reporting portal coming soon|Feature request portal coming soon/); assert.match(ui, /new ButtonComponent\(actions\)/); assert.match(ui, /setIcon\(action\.icon\)/); assert.match(ui, /buyMeACoffeeArtwork/); assert.match(ui, /manuscript-support-bmc-icon/); assert.match(ui, /manuscript-support-button-label/); assert.match(ui, /setAttribute\("aria-label", action\.label\)/); assert.match(ui, /button\.buttonEl\.win\.open\(action\.url, "_blank", "noopener,noreferrer"\)/); assert.match(css, /\.manuscript-support-panel \{[^}]*width: 100%;[^}]*padding: var\(--size-4-3\);[^}]*var\(--background-modifier-border\)[^}]*var\(--background-secondary\)/s); assert.match(css, /\.manuscript-support-identity \{[^}]*display: flex;[^}]*align-items: center;/s); assert.match(css, /\.manuscript-support-logo \{[^}]*width: 48px;[^}]*height: 48px;/s); assert.match(css, /\.manuscript-support-identity p \{[^}]*font-size: var\(--font-ui-smaller\)/s); assert.match(css, /\.manuscript-support-actions \{[^}]*display: flex;[^}]*flex-wrap: wrap;[^}]*justify-content: center;/s); assert.match(css, /\.manuscript-support-button \{[^}]*display: inline-flex;[^}]*flex: 0 1 auto;[^}]*min-height: 36px;[^}]*border: 2px solid var\(--interactive-accent\);[^}]*box-shadow: var\(--shadow-s\);[^}]*font-size: var\(--font-ui-smaller\)/s); assert.match(css, /\.manuscript-support-bmc-icon \{[^}]*overflow: hidden;/s); assert.match(css, /\.manuscript-support-button:focus-visible/); assert.doesNotMatch(css, /\.manuscript-support-button \{ flex-basis: 100%; \}/); });