unoffical wafrn mirror wafrn.net
atproto social-network activitypub
at development 86 lines 3.2 kB view raw
1@let settingData = data[setting().key]; 2@let settingTranslation = setting().translationKey; 3@let settingTranslationDescription = setting().translationDescriptionKey; 4@switch (settingData.type) { 5 @case ('checkbox') { 6 @let settingValues = values()[setting().key]; 7 <div [class.has-dependency]="hasDependency()" [class.has-description]="settingTranslationDescription"> 8 <mat-checkbox 9 [class.mat-checkbox-top]="settingTranslationDescription !== undefined" 10 (change)="updateCheckbox(setting().key, $event)" 11 [checked]="(settingValues ?? setting().default) === true" 12 [disabled]="isDisabled()" 13 >{{ settingTranslation | translate }} 14 @if (settingTranslationDescription) { 15 <div class="setting-description">{{ settingTranslationDescription | translate }}</div> 16 } 17 </mat-checkbox> 18 </div> 19 } 20 @case ('select') { 21 @if (settingData.variants) { 22 <mat-form-field class="block mb-3 w-full mat-form-field-no-padding" [class.has-dependency]="hasDependency()"> 23 <mat-label>{{ settingTranslation | translate }}</mat-label> 24 <mat-select 25 [(value)]="values()[setting().key]" 26 (selectionChange)="updateSelect(setting().key, $event)" 27 [disabled]="isDisabled()" 28 > 29 @for (variant of settingData.variants | KeyValue; track $index) { 30 <mat-option [value]="variant.key">{{ variant.value | translate }}</mat-option> 31 } 32 </mat-select> 33 </mat-form-field> 34 @if (settingTranslationDescription) { 35 <div class="setting-description">{{ settingTranslationDescription | translate }}</div> 36 } 37 } @else { 38 No variants set 39 } 40 } 41 @case ('input') { 42 <div class="mb-3" [class.has-dependency]="hasDependency()"> 43 <mat-form-field class="w-full mat-form-field-no-padding"> 44 <mat-label>{{ settingTranslation | translate }}</mat-label> 45 <input 46 matNativeControl 47 [value]="values()[setting().key]" 48 (input)="updateInput(setting().key, $event)" 49 [disabled]="isDisabled()" 50 spellcheck="false" 51 /> 52 </mat-form-field> 53 @if (settingTranslationDescription) { 54 <div class="setting-description">{{ settingTranslationDescription | translate }}</div> 55 } 56 </div> 57 } 58 @case ('textarea') { 59 <div class="mb-3" [class.has-dependency]="hasDependency()"> 60 <mat-form-field class="w-full mat-form-field-no-padding"> 61 <mat-label>{{ settingTranslation | translate }}</mat-label> 62 <textarea 63 matNativeControl 64 [value]="values()[setting().key]" 65 (input)="updateInput(setting().key, $event)" 66 [disabled]="isDisabled()" 67 spellcheck="false" 68 cdkTextareaAutosize 69 cdkAutosizeMinRows="5" 70 ></textarea> 71 </mat-form-field> 72 @if (settingTranslationDescription) { 73 <div class="setting-description">{{ settingTranslationDescription | translate }}</div> 74 } 75 </div> 76 } 77 @case ('user') { 78 <app-user-selector 79 [controlText]="settingTranslation | translate" 80 (optionSelected)="updateUserInput($event)" 81 ></app-user-selector> 82 } 83 @default { 84 <p>Something went very wrong</p> 85 } 86}