Refactoring: Remove some unused or deprecated classes

This commit is contained in:
Pieter Vander Vennet 2024-08-01 19:42:32 +02:00
parent ee1ef81f48
commit 2822eafef6
6 changed files with 1 additions and 72 deletions

View file

@ -1,25 +0,0 @@
import Translations from "../i18n/Translations"
import BaseUIElement from "../BaseUIElement"
export class Button extends BaseUIElement {
private _text: BaseUIElement
constructor(text: string | BaseUIElement, onclick: () => void | Promise<void>) {
super()
this._text = Translations.W(text)
this.onClick(onclick)
}
protected InnerConstructElement(): HTMLElement {
const el = this._text.ConstructElement()
if (el === undefined) {
return undefined
}
const form = document.createElement("form")
const button = document.createElement("button")
button.type = "button"
button.appendChild(el)
form.appendChild(button)
return form
}
}

View file

@ -1,19 +0,0 @@
import BaseUIElement from "../BaseUIElement"
/**
* Introduces a new element which has an ID
* Mostly a workaround for the import viewer
*/
export default class DivContainer extends BaseUIElement {
private readonly _id: string
constructor(id: string) {
super()
this._id = id
}
protected InnerConstructElement(): HTMLElement {
const e = document.createElement("div")
e.id = this._id
return e
}
}

View file

@ -1,12 +1,6 @@
import { Utils } from "../../Utils"
import Combine from "./Combine"
import BaseUIElement from "../BaseUIElement"
import Title from "./Title"
import Table from "./Table"
import { Store, UIEventSource } from "../../Logic/UIEventSource"
import { VariableUiElement } from "./VariableUIElement"
import { UIEventSource } from "../../Logic/UIEventSource"
import { Translation } from "../i18n/Translation"
import { FixedUiElement } from "./FixedUiElement"
import Translations from "../i18n/Translations"
import MarkdownUtils from "../../Utils/MarkdownUtils"
import Locale from "../i18n/Locale"

View file

@ -2,7 +2,6 @@ import BaseUIElement from "../BaseUIElement"
import List from "./List"
import { marked } from "marked"
import { parse as parse_html } from "node-html-parser"
import { default as turndown } from "turndown"
import { Utils } from "../../Utils"
export default class TableOfContents {

View file

@ -1,7 +1,6 @@
import { Store, UIEventSource } from "../../Logic/UIEventSource"
import BaseUIElement from "../BaseUIElement"
import { VariableUiElement } from "../Base/VariableUIElement"
import Lazy from "../Base/Lazy"
/**
* The 'Toggle' is a UIElement showing either one of two elements, depending on the state.
@ -19,12 +18,6 @@ export default class Toggle extends VariableUiElement {
this.isEnabled = isEnabled
}
public static If(condition: Store<boolean>, constructor: () => BaseUIElement): BaseUIElement {
if (constructor === undefined) {
return undefined
}
return new Toggle(new Lazy(constructor), undefined, condition)
}
}
/**
@ -42,11 +35,4 @@ export class ClickableToggle extends Toggle {
this.isEnabled = isEnabled
}
public ToggleOnClick(): ClickableToggle {
const self = this
this.onClick(() => {
self.isEnabled.setData(!self.isEnabled.data)
})
return this
}
}

View file

@ -34,12 +34,6 @@ export default class Translations {
return s
}
const v = JSON.stringify(s)
if (v.length > 100) {
const shortened = v.substring(0, 100) + "..."
return new ClickableToggle(v, shortened)
.ToggleOnClick()
.SetClass("literal-code button")
}
return new FixedUiElement(v).SetClass("literal-code")
}
return s