diff --git a/Logic/UIEventSource.ts b/Logic/UIEventSource.ts index 016d661..e82d7e8 100644 --- a/Logic/UIEventSource.ts +++ b/Logic/UIEventSource.ts @@ -1,5 +1,5 @@ export class UIEventSource{ - + public data: T; private _callbacks = []; @@ -7,7 +7,6 @@ export class UIEventSource{ this.data = data; } - public addCallback(callback: ((latestData: T) => void)): UIEventSource { if(callback === console.log){ // This ^^^ actually works! @@ -49,19 +48,19 @@ export class UIEventSource{ sink.setData(source.data?.data); }) } - + return sink; } - + public map(f: ((T) => J), extraSources: UIEventSource[] = [], g: ((J) => T) = undefined ): UIEventSource { const self = this; - + const newSource = new UIEventSource( f(this.data) ); - + const update = function () { newSource.setData(f(self.data)); } @@ -70,17 +69,17 @@ export class UIEventSource{ for (const extraSource of extraSources) { extraSource?.addCallback(update); } - + if(g !== undefined) { newSource.addCallback((latest) => { self.setData(g(latest)); }) } - + return newSource; } - + public syncWith(otherSource: UIEventSource, reverseOverride = false): UIEventSource { this.addCallback((latest) => otherSource.setData(latest)); const self = this; @@ -94,11 +93,11 @@ export class UIEventSource{ } return this; } - + public stabilized(millisToStabilize) : UIEventSource{ - + const newSource = new UIEventSource(this.data); - + let currentCallback = 0; this.addCallback(latestData => { currentCallback++; @@ -109,10 +108,10 @@ export class UIEventSource{ } }, millisToStabilize) }); - + return newSource; } - + public static Chronic(millis: number, asLong: () => boolean = undefined): UIEventSource { const source = new UIEventSource(undefined); @@ -125,7 +124,7 @@ export class UIEventSource{ run(); return source; - + } } \ No newline at end of file diff --git a/UI/Input/CheckBox.ts b/UI/Input/CheckBox.ts index 2f4bf98..e34707c 100644 --- a/UI/Input/CheckBox.ts +++ b/UI/Input/CheckBox.ts @@ -28,5 +28,5 @@ export default class CheckBox extends UIElement{ return Translations.W(this._showDisabled).Render(); } } - + } \ No newline at end of file diff --git a/UI/Input/RadioButton.ts b/UI/Input/RadioButton.ts index 773ce70..33a0f0b 100644 --- a/UI/Input/RadioButton.ts +++ b/UI/Input/RadioButton.ts @@ -11,7 +11,7 @@ export class RadioButton extends InputElement { private readonly value: UIEventSource; private readonly _elements: InputElement[] private readonly _selectFirstAsDefault: boolean; - + constructor(elements: InputElement[], selectFirstAsDefault = true) { super(undefined); diff --git a/UI/Popup/QuestionBox.ts b/UI/Popup/QuestionBox.ts index 0b7e85b..362d8bf 100644 --- a/UI/Popup/QuestionBox.ts +++ b/UI/Popup/QuestionBox.ts @@ -40,7 +40,6 @@ export default class QuestionBox extends UIElement { }) )); - this._skippedQuestionsButton = Translations.t.general.skippedQuestions.Clone() .onClick(() => { self._skippedQuestions.setData([]); @@ -64,19 +63,19 @@ export default class QuestionBox extends UIElement { } } } - + if (tagRendering.GetRenderValue(this._tags.data) !== undefined) { // This value is known and can be rendered return true; } - + return false; } InnerRender(): string { for (let i = 0; i < this._tagRenderingQuestions.length; i++) { let tagRendering = this._tagRenderings[i]; - + if(this.IsKnown(tagRendering)){ continue; } diff --git a/UI/Popup/TagRenderingQuestion.ts b/UI/Popup/TagRenderingQuestion.ts index b6ba2c3..6cbea10 100644 --- a/UI/Popup/TagRenderingQuestion.ts +++ b/UI/Popup/TagRenderingQuestion.ts @@ -78,7 +78,6 @@ export default class TagRenderingQuestion extends UIElement { if (csCount < Constants.userJourney.tagsVisibleAt) { return ""; } - if (tags === undefined) { return Translations.t.general.noTagsSelected.SetClass("subtle").Render(); } @@ -89,8 +88,8 @@ export default class TagRenderingQuestion extends UIElement { return tags.asHumanString(true, true); } ) - ) + ).AddClass("block") } private GenerateInputElement(): InputElement { @@ -268,7 +267,6 @@ export default class TagRenderingQuestion extends UIElement { } - InnerRender(): string { return new Combine([ this._question, diff --git a/UI/Reviews/ReviewForm.ts b/UI/Reviews/ReviewForm.ts index 55379b7..29a6af9 100644 --- a/UI/Reviews/ReviewForm.ts +++ b/UI/Reviews/ReviewForm.ts @@ -87,11 +87,11 @@ export default class ReviewForm extends InputElement { } InnerRender(): string { - + if(!this.userDetails.data.loggedIn){ return Translations.t.reviews.plz_login.Render(); } - + return new Combine([ new Combine([this._stars, this._postingAs]).SetClass("review-form-top"), this._comment,