mirror of
https://github.com/jacobtread/obsidian-timekeep.git
synced 2026-07-22 10:10:27 +00:00
36 lines
804 B
TypeScript
36 lines
804 B
TypeScript
import { Component } from "obsidian";
|
|
|
|
export class TimesheetLoadError extends Component {
|
|
/** Parent container element */
|
|
#containerEl: HTMLElement;
|
|
|
|
/** Wrapper container element */
|
|
#wrapperEl: HTMLElement | undefined;
|
|
|
|
/** The load error message */
|
|
error: string;
|
|
|
|
constructor(containerEl: HTMLElement, error: string) {
|
|
super();
|
|
|
|
this.#containerEl = containerEl;
|
|
|
|
this.error = error;
|
|
}
|
|
|
|
onload(): void {
|
|
super.onload();
|
|
|
|
const wrapperEl = this.#containerEl.createDiv({
|
|
cls: "timekeep-container",
|
|
});
|
|
wrapperEl.createEl("p", {
|
|
text: `Failed to load timekeep: ${this.error}`,
|
|
});
|
|
}
|
|
|
|
onunload(): void {
|
|
super.onunload();
|
|
this.#wrapperEl?.remove();
|
|
}
|
|
}
|