linstrom/frontend-reactive/app/components/auth/post-registration-form.ts

77 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-10-28 15:33:17 +00:00
import { action } from '@ember/object'
import Component from '@glimmer/component'
import { tracked } from '@glimmer/tracking'
import isValidMail from 'frontend-reactive/helpers/is-valid-mail'
2024-10-28 07:36:11 +00:00
export interface AuthPostRegistrationFormSignature {
// The arguments accepted by the component
Args: {
2024-10-28 15:33:17 +00:00
username: string
}
// Any blocks yielded by the component
Blocks: {
2024-10-28 15:33:17 +00:00
default: []
}
// The element to which `...attributes` is applied in the component template
2024-10-28 15:33:17 +00:00
Element: null
}
2024-10-28 07:36:11 +00:00
export default class AuthPostRegistrationForm extends Component<AuthPostRegistrationFormSignature> {
2024-10-28 15:33:17 +00:00
@tracked displayname: string = this.args.username
@tracked description: string = ''
@tracked gender: Array<{ value: string }> = []
@tracked beingTypes: Array<{
2024-10-28 15:33:17 +00:00
name: string
checked: boolean
description: string
}> = [
{
name: 'Human',
description: 'Human',
checked: true,
},
{
name: 'Cat',
description: 'Cat',
checked: false,
},
{
name: 'Fox',
description: 'Fox',
checked: false,
},
{
name: 'Dog',
description: 'Dog',
checked: false,
},
{
name: 'Robot',
description: 'Robot',
checked: false,
},
{
name: 'Doll',
description: 'Doll',
checked: false,
},
2024-10-28 15:33:17 +00:00
]
@tracked defaultpostmode: string = 'Public'
@tracked followapproval: boolean = false
// Actual custom properties stored in here
2024-10-28 15:33:17 +00:00
@tracked customProperties: Array<{ key: string; value: string }> = []
@tracked indexable: boolean = true
@tracked mail = { mail: '', valid: false }
genderAddedHandler(newIndex: number) {
2024-10-28 15:33:17 +00:00
console.log('gender added')
}
genderRemovedHandler(removedIndex: number) {
2024-10-28 15:33:17 +00:00
console.log('gender removed')
}
@action test() {
console.log(this.mail)
}
}