feat: move all frontend projects under the same Angular workspace (#1141)

* feat: move all frontend projects under the same Angular workspace

* Refactor/angular workspace (#1154)

* update frontend build steps

Co-authored-by: waterplea <alexander@inkin.ru>
Co-authored-by: Matt Hill <matthewonthemoon@gmail.com>
Co-authored-by: Lucy Cifferello <12953208+elvece@users.noreply.github.com>
This commit is contained in:
Aiden McClelland
2022-01-31 14:01:33 -07:00
committed by GitHub
parent 7e6c852ebd
commit 574539faec
504 changed files with 11569 additions and 78972 deletions

View File

@@ -0,0 +1,76 @@
import { Component, Input, ViewChild } from '@angular/core'
import { ModalController, IonicSafeString, IonInput } from '@ionic/angular'
import { getErrorMessage } from 'src/app/services/error-toast.service'
@Component({
selector: 'generic-input',
templateUrl: './generic-input.component.html',
styleUrls: ['./generic-input.component.scss'],
})
export class GenericInputComponent {
@ViewChild('mainInput') elem: IonInput
@Input() options: GenericInputOptions
value: string
unmasked = false
error: string | IonicSafeString
constructor (
private readonly modalCtrl: ModalController,
) { }
ngOnInit () {
const defaultOptions: Partial<GenericInputOptions> = {
buttonText: 'Submit',
placeholder: 'Enter value',
nullable: false,
useMask: false,
initialValue: '',
}
this.options = {
...defaultOptions,
...this.options,
}
this.value = this.options.initialValue
}
ngAfterViewInit () {
setTimeout(() => this.elem.setFocus(), 400)
}
toggleMask () {
this.unmasked = !this.unmasked
}
cancel () {
this.modalCtrl.dismiss()
}
async submit () {
const value = this.value.trim()
if (!value && !this.options.nullable) return
try {
await this.options.submitFn(value)
this.modalCtrl.dismiss(undefined, 'success')
} catch (e) {
this.error = getErrorMessage(e)
}
}
}
export interface GenericInputOptions {
// required
title: string
message: string
label: string
submitFn: (value: string) => Promise<any>
// optional
warning?: string
buttonText?: string
placeholder?: string
nullable?: boolean
useMask?: boolean
initialValue?: string
}