-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from StephanieHhnbrg/main
adds prompt customization and criteria creation features
- Loading branch information
Showing
24 changed files
with
377 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/app/components/edit-prompting-link/prompt-customization.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.edit-prompting:hover { | ||
color: cyan; | ||
cursor: pointer; | ||
} | ||
|
||
.edit-prompting mat-icon { | ||
transform: scale(0.6) translateY(13px); | ||
} | ||
|
||
.hidden { | ||
visibility: hidden; | ||
} | ||
|
||
mat-form-field { | ||
width: 100%; | ||
padding-top: 20px; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/app/components/edit-prompting-link/prompt-customization.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div> | ||
<span *ngIf="!editingPrompt" class="edit-prompting" (click)="editingPrompt=true"><mat-icon>edit</mat-icon> Adapt prompting</span> | ||
<div [ngClass]="{'hidden': !editingPrompt}"> | ||
<mat-form-field> | ||
<mat-label>Prompt</mat-label> | ||
<textarea #promptUpdated matInput [value]="defaultPrompt" (change)='onChange(promptUpdated.value)'></textarea> | ||
</mat-form-field> | ||
</div> | ||
</div> |
23 changes: 23 additions & 0 deletions
23
src/app/components/edit-prompting-link/prompt-customization.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PromptCustomizationComponent } from './prompt-customization.component'; | ||
|
||
describe('EditPromptingLinkComponent', () => { | ||
let component: PromptCustomizationComponent; | ||
let fixture: ComponentFixture<PromptCustomizationComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [PromptCustomizationComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(PromptCustomizationComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
src/app/components/edit-prompting-link/prompt-customization.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {Component, EventEmitter, Input, Output} from '@angular/core'; | ||
import {FormsModule} from "@angular/forms"; | ||
import {MatFormFieldModule} from "@angular/material/form-field"; | ||
import {MatInputModule} from "@angular/material/input"; | ||
import {MatIconModule} from "@angular/material/icon"; | ||
import {CommonModule} from "@angular/common"; | ||
|
||
@Component({ | ||
selector: 'app-prompt-customization', | ||
standalone: true, | ||
imports: [CommonModule, FormsModule, MatFormFieldModule, MatInputModule, MatIconModule], | ||
templateUrl: './prompt-customization.component.html', | ||
styleUrl: './prompt-customization.component.css' | ||
}) | ||
export class PromptCustomizationComponent { | ||
|
||
@Output() updatedPrompt = new EventEmitter<string>(); | ||
|
||
|
||
@Input({ required: true }) public defaultPrompt: string = ""; | ||
editingPrompt = false; | ||
|
||
onChange(prompt: string) { | ||
this.updatedPrompt.emit(prompt); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/app/dialog/criteria-dialog/criteria-dialog.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
form { | ||
padding-top: 10px; | ||
min-width: 150px; | ||
max-width: 500px; | ||
width: 100%; | ||
} | ||
|
||
mat-form-field { | ||
width: 100%; | ||
} | ||
|
||
.add-criteria:hover { | ||
color: cyan; | ||
cursor: pointer; | ||
} | ||
|
||
.add-criteria mat-icon { | ||
transform: scale(0.6) translateY(13px); | ||
} | ||
|
||
.hidden { | ||
visibility: hidden; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/app/dialog/criteria-dialog/criteria-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<h2 mat-dialog-title>Criteria</h2> | ||
<mat-dialog-content> | ||
|
||
<div *ngFor="let c of criteria"> | ||
<p>Criteria: {{c.name}}</p> | ||
<small>{{ c.desc }}</small> | ||
<p> </p> | ||
</div> | ||
|
||
<div> | ||
<div [ngClass]="{'hidden': !addingCriteria}"> | ||
<form> | ||
<mat-form-field> | ||
<mat-label>Name</mat-label> | ||
<input matInput #criteriaName> | ||
</mat-form-field> | ||
<mat-form-field> | ||
<mat-label>Description</mat-label> | ||
<textarea matInput #criteriaDesc></textarea> | ||
</mat-form-field> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
</mat-dialog-content> | ||
<mat-dialog-actions> | ||
<button mat-button | ||
[disabled]="addingCriteria && (criteriaName.value.length == 0 || criteriaDesc.value.length == 0)" | ||
(click)="addingCriteria ? addCriteria(criteriaName.value, criteriaDesc.value) : addingCriteria = true" | ||
><mat-icon>add</mat-icon> Add Criteria</button> | ||
<button mat-button mat-dialog-close>Close</button> | ||
</mat-dialog-actions> |
23 changes: 23 additions & 0 deletions
23
src/app/dialog/criteria-dialog/criteria-dialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CriteriaDialogComponent } from './criteria-dialog.component'; | ||
|
||
describe('CriteriaDialogComponent', () => { | ||
let component: CriteriaDialogComponent; | ||
let fixture: ComponentFixture<CriteriaDialogComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [CriteriaDialogComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(CriteriaDialogComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
36 changes: 36 additions & 0 deletions
36
src/app/dialog/criteria-dialog/criteria-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import {CommonModule} from "@angular/common"; | ||
import {MatButtonModule} from "@angular/material/button"; | ||
import {MatDialogActions, MatDialogClose, MatDialogContent, MatDialogTitle} from "@angular/material/dialog"; | ||
import {FormsModule} from "@angular/forms"; | ||
import {MatFormFieldModule} from "@angular/material/form-field"; | ||
import {MatInputModule} from "@angular/material/input"; | ||
import {MatIconModule} from "@angular/material/icon"; | ||
import { CriteriaService } from '../../services/criteria.service'; | ||
import { Criteria } from '../../data/criteria.data'; | ||
|
||
@Component({ | ||
selector: 'app-criteria-dialog', | ||
standalone: true, | ||
imports: [CommonModule, MatButtonModule, MatDialogActions, MatDialogClose, MatDialogTitle, MatDialogContent, FormsModule, MatFormFieldModule, MatInputModule, MatIconModule], | ||
templateUrl: './criteria-dialog.component.html', | ||
styleUrl: './criteria-dialog.component.css' | ||
}) | ||
export class CriteriaDialogComponent implements OnInit { | ||
|
||
public criteria: Criteria[] = []; | ||
addingCriteria = false; | ||
|
||
constructor(private criteriaService: CriteriaService) {} | ||
|
||
public ngOnInit() { | ||
this.criteria = this.criteriaService.getCriteria(); | ||
} | ||
|
||
public addCriteria(name: string, desc: string) { | ||
this.criteriaService.addCriteria(name, desc); | ||
this.addingCriteria = false; | ||
// TODO: clear input fields! | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ mat-tab-group mat-form-field { | |
width: 100%; | ||
padding-top: 20px; | ||
} | ||
|
Oops, something went wrong.