diff --git a/src/app/app.component.html b/src/app/app.component.html index 50d2f21..d791396 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -9,7 +9,6 @@ (inpaint_mask)="onInpaintMaskChange($event)" (imageExpandedChange)="onImageExpandedChange($event)" > - diff --git a/src/app/home/index.ts b/src/app/home/index.ts index 4d94f12..944c81d 100644 --- a/src/app/home/index.ts +++ b/src/app/home/index.ts @@ -1,4 +1,3 @@ export * from "./image-grid/image-grid.component"; export * from "./options/options.component"; export * from "./faq/faq.component"; -export * from "./user-rating/user-rating.component"; diff --git a/src/app/home/options/options.component.ts b/src/app/home/options/options.component.ts index 05d851d..a3a2d08 100644 --- a/src/app/home/options/options.component.ts +++ b/src/app/home/options/options.component.ts @@ -63,7 +63,6 @@ export class OptionsComponent { @Output() aspectRatioChange = new EventEmitter(); @Output() inpaintingChange = new EventEmitter(); @Output() queuePositionChange = new EventEmitter(); - @Output() ratingButtonsEligibilityChange = new EventEmitter(); @Output() imageModalOpen = new EventEmitter(); readonly VAPID_PUBLIC_KEY = "BDrvd3soyvIOUEp5c-qXV-833C8hJvO-6wE1GZquvs9oqWQ70j0W4V9RCa_el8gIpOBeCKkuyVwmnAdalvOMfLg"; diff --git a/src/app/home/user-rating/user-rating.component.css b/src/app/home/user-rating/user-rating.component.css deleted file mode 100644 index d59419a..0000000 --- a/src/app/home/user-rating/user-rating.component.css +++ /dev/null @@ -1,12 +0,0 @@ -.button-container { - height: 1000px; /* for example */ - display: flex; - flex-direction: column; - justify-content: space-around; - } - - .rating-button { - width: 50%; - border-radius: 0; - } - \ No newline at end of file diff --git a/src/app/home/user-rating/user-rating.component.html b/src/app/home/user-rating/user-rating.component.html deleted file mode 100644 index 28251d5..0000000 --- a/src/app/home/user-rating/user-rating.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- - -
diff --git a/src/app/home/user-rating/user-rating.component.ts b/src/app/home/user-rating/user-rating.component.ts deleted file mode 100644 index c9450f7..0000000 --- a/src/app/home/user-rating/user-rating.component.ts +++ /dev/null @@ -1,125 +0,0 @@ -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { Subscription } from 'rxjs'; -import { GenerationRequest } from 'src/_shared/generation-request.interface'; -import { SharedService } from 'src/app/shared.service'; -import { StableDiffusionService } from 'src/app/stable-diffusion.service'; -import { MessageService } from 'primeng/api'; -import { MobiansImage } from 'src/_shared/mobians-image.interface'; - -@Component({ - selector: 'app-user-rating', - templateUrl: './user-rating.component.html', - styleUrls: ['./user-rating.component.css'], -}) -export class UserRatingComponent implements OnInit, OnDestroy { - generationRequest: GenerationRequest | null = null; - imageDetails?: MobiansImage; - imageIndex?: number; - showButtons: boolean = false; - referenceImage?: string; - allImages: MobiansImage[] = []; - - private generationRequestSubscription: Subscription | null = null; - private imagesSubscription: Subscription | null = null; - private referenceImageSubscription: Subscription | null = null; - - constructor( - private stableDiffusionService: StableDiffusionService, - private sharedService: SharedService, - private messageService: MessageService - ) { } - - ngOnInit() { - this.generationRequestSubscription = this.sharedService.getGenerationRequest().subscribe(request => { - this.generationRequest = request; - }); - - this.imagesSubscription = this.sharedService.getImages().subscribe(images => { - this.allImages = images; - }); - - this.referenceImageSubscription = this.sharedService.getReferenceImage().subscribe(image => { - const currentRefImage = this.allImages.find(image => image.base64 === this.generationRequest?.image); - if (currentRefImage) { - this.imageDetails = currentRefImage; - this.imageIndex = this.allImages.indexOf(currentRefImage!); - this.showButtons = true; - } - else { - this.showButtons = false; - } - }); - } - - ngOnDestroy() { - if (this.generationRequestSubscription) { - this.generationRequestSubscription.unsubscribe(); - this.generationRequestSubscription = null; - } - } - - rateGood() { - if (this.imageDetails) { - const ratingRequest = { - ...this.generationRequest, - image_UUID: this.imageDetails.UUID, - rating: true, - seed: -1, - - } - this.rateImage(ratingRequest); - } - } - - rateBad() { - if (this.imageDetails) { - const ratingRequest = { - ...this.generationRequest, - image_UUID: this.imageDetails.UUID, - rating: false, - seed: -1, - - } - this.rateImage(ratingRequest); - } - } - - rateImage(ratingRequest: any) { - if (this.imageDetails?.rating !== undefined) { - ratingRequest.rating = undefined; - } - - this.stableDiffusionService.rateImage(ratingRequest) - .subscribe( - response => { - console.log(response); // handle the response - - if (response.message == 'deleted') { - this.imageDetails!.rating = undefined; - - // Display the undo toast - this.messageService.add({ - severity: 'Success', - summary: 'Success Message', - detail: "Rating undone!", - life: 1000 // Here is the addition. - }); - } - else { - this.imageDetails!.rating = ratingRequest.rating; - // Display the thank you toast - this.messageService.add({ - severity: 'Success', - summary: 'Success Message', - detail: "Thank you for rating!", - life: 1000 // Here is the addition. - }); - } - this.sharedService.updateImage(this.imageIndex!, this.imageDetails!); - }, - error => { - console.error(error); // handle error - } - ); - } -} diff --git a/src/modules/home.module.ts b/src/modules/home.module.ts index 166e55d..31da2af 100644 --- a/src/modules/home.module.ts +++ b/src/modules/home.module.ts @@ -5,7 +5,6 @@ import { FormsModule } from '@angular/forms'; import { ImageGridComponent } from 'src/app/home/image-grid/image-grid.component'; import { OptionsComponent } from 'src/app/home/options/options.component'; import { FaqComponent } from 'src/app/home/faq/faq.component'; -import { UserRatingComponent } from 'src/app/home/user-rating/user-rating.component'; import { ImageModalComponent } from 'src/app/home/image-modal/image-modal.component'; import { GligenDisplayComponent } from 'src/app/home/gligen-display/gligen-display.component'; import { InpaintingDisplayComponent } from 'src/app/home/inpainting-display/inpainting-display.component'; @@ -25,7 +24,6 @@ import { ToggleButtonModule } from 'primeng/togglebutton'; ImageGridComponent, OptionsComponent, FaqComponent, - UserRatingComponent, ImageModalComponent, GligenDisplayComponent, InpaintingDisplayComponent, @@ -46,7 +44,6 @@ import { ToggleButtonModule } from 'primeng/togglebutton'; ImageGridComponent, OptionsComponent, FaqComponent, - UserRatingComponent, ImageModalComponent, GligenDisplayComponent, InpaintingDisplayComponent,