mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-09 05:09:39 +00:00
Report UI improvements
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<i class="bi bi-exclamation-triangle text-sm text-secondary-content"></i> Report issue
|
<i class="bi bi-exclamation-triangle text-sm text-secondary-content"></i> Report issue
|
||||||
</button>
|
</button>
|
||||||
<dialog #reportModal class="modal">
|
<dialog #reportModal class="modal">
|
||||||
@if (reportSent) {
|
@if (reportState === 'sent') {
|
||||||
<div class="modal-box bg-base-100 text-base-content flex flex-col gap-2">
|
<div class="modal-box bg-base-100 text-base-content flex flex-col gap-2">
|
||||||
<form method="dialog">
|
<form method="dialog">
|
||||||
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">
|
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">
|
||||||
@@ -16,6 +16,10 @@
|
|||||||
</form>
|
</form>
|
||||||
<span class="text-xl text-center">{{ reportMessage }}</span>
|
<span class="text-xl text-center">{{ reportMessage }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
} @else if (reportState === 'sending') {
|
||||||
|
<div class="modal-box flex flex-col gap-2 bg-base-100 text-base-content">
|
||||||
|
<span class="loading loading-spinner loading-sm self-center"></span>
|
||||||
|
</div>
|
||||||
} @else {
|
} @else {
|
||||||
<div class="modal-box bg-base-100 text-base-content flex flex-col gap-2">
|
<div class="modal-box bg-base-100 text-base-content flex flex-col gap-2">
|
||||||
<form method="dialog">
|
<form method="dialog">
|
||||||
@@ -28,6 +32,14 @@
|
|||||||
<div
|
<div
|
||||||
[class.border-error]="reportOption.invalid && reportOption.touched"
|
[class.border-error]="reportOption.invalid && reportOption.touched"
|
||||||
[class.border]="reportOption.invalid && reportOption.touched">
|
[class.border]="reportOption.invalid && reportOption.touched">
|
||||||
|
<div class="form-control">
|
||||||
|
<label class="label cursor-pointer justify-normal gap-2">
|
||||||
|
<input type="radio" class="radio checked:bg-red-500" value="Doesn't follow Chorus guidelines" formControlName="reportOption" />
|
||||||
|
<span>
|
||||||
|
Doesn't follow <a class="link link-primary" (click)="openUrl('https://guidelines.enchor.us/')">Chorus guidelines</a>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
@for (option of reportOptions; track $index) {
|
@for (option of reportOptions; track $index) {
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label class="label cursor-pointer justify-normal gap-2">
|
<label class="label cursor-pointer justify-normal gap-2">
|
||||||
@@ -49,7 +61,13 @@
|
|||||||
placeholder="Please be specific. Vague reports may be ignored if the problem is not obvious."
|
placeholder="Please be specific. Vague reports may be ignored if the problem is not obvious."
|
||||||
formControlName="reportExtraInfo">
|
formControlName="reportExtraInfo">
|
||||||
</textarea>
|
</textarea>
|
||||||
<span *ngIf="reportExtraInfo.invalid && reportExtraInfo.touched" class="text-error">Please provide more details.</span>
|
<span *ngIf="reportExtraInfo.invalid && reportExtraInfo.touched" class="text-error">
|
||||||
|
@if (reportExtraInfo.value.length === 0) {
|
||||||
|
Please provide more details.
|
||||||
|
} @else {
|
||||||
|
Reports without a specific explanation will be ignored.
|
||||||
|
}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<span *ngIf="isFalseReportOption()" class="text-lg text-warning text-wrap">
|
<span *ngIf="isFalseReportOption()" class="text-lg text-warning text-wrap">
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ export class ChartSidebarMenutComponent implements OnInit {
|
|||||||
public selectedVersion: FormControl<ChartData>
|
public selectedVersion: FormControl<ChartData>
|
||||||
|
|
||||||
public reportOptions = [
|
public reportOptions = [
|
||||||
`Doesn't follow Chorus guidelines`,
|
|
||||||
`Doesn't meet chart quality standards`,
|
`Doesn't meet chart quality standards`,
|
||||||
'No notes / chart ends immediately',
|
'No notes / chart ends immediately',
|
||||||
`Download doesn't work`,
|
`Download doesn't work`,
|
||||||
@@ -27,7 +26,7 @@ export class ChartSidebarMenutComponent implements OnInit {
|
|||||||
'Other',
|
'Other',
|
||||||
] as const
|
] as const
|
||||||
public reportForm: ReturnType<this['getForm']>
|
public reportForm: ReturnType<this['getForm']>
|
||||||
public reportSent = false
|
public reportState: 'not-sent' | 'sending' | 'sent' = 'not-sent'
|
||||||
public reportMessage = ''
|
public reportMessage = ''
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -45,7 +44,7 @@ export class ChartSidebarMenutComponent implements OnInit {
|
|||||||
getForm() {
|
getForm() {
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
reportOption: this.fb.control(null as ChartSidebarMenutComponent['reportOptions'][number] | null, [Validators.required]),
|
reportOption: this.fb.control(null as ChartSidebarMenutComponent['reportOptions'][number] | null, [Validators.required]),
|
||||||
reportExtraInfo: this.fb.control('', [Validators.required]),
|
reportExtraInfo: this.fb.control('', [Validators.required, Validators.minLength(4)]),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,16 +105,18 @@ export class ChartSidebarMenutComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
report() {
|
report() {
|
||||||
if (this.reportExtraInfo.valid) {
|
if (this.reportForm.valid && this.reportState === 'not-sent') {
|
||||||
|
this.reportState = 'sending'
|
||||||
this.http.post(`${environment.apiUrl}/report`, {
|
this.http.post(`${environment.apiUrl}/report`, {
|
||||||
chartId: this.selectedVersion.value.chartId,
|
chartId: this.selectedVersion.value.chartId,
|
||||||
reason: this.reportOption.value,
|
reason: this.reportOption.value,
|
||||||
extraInfo: this.reportExtraInfo.value,
|
extraInfo: this.reportExtraInfo.value,
|
||||||
}).subscribe((response: { message: string }) => {
|
}).subscribe((response: { message: string }) => {
|
||||||
this.reportMessage = response.message
|
this.reportMessage = response.message
|
||||||
this.reportSent = true
|
this.reportState = 'sent'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
this.reportOption.markAsTouched()
|
||||||
this.reportExtraInfo.markAsTouched()
|
this.reportExtraInfo.markAsTouched()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="border-t border-t-neutral p-2 flex gap-2 items-center max-w-full">
|
<div class="border-t border-t-neutral p-2 flex gap-2 items-center max-w-full">
|
||||||
<div *ngIf="searchService.songsResponse" class="text-nowrap">
|
<div *ngIf="searchService.songsResponse" class="text-nowrap">
|
||||||
{{ searchService.songsResponse.found }} Result{{ searchService.songsResponse.found === 1 ? '' : 's' }}
|
{{ searchService.songsResponse.found | number: '1.0-0' }} Result{{ searchService.songsResponse.found === 1 ? '' : 's' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<button *ngIf="selectedGroupIds.length > 1" (click)="downloadSelected()" class="btn btn-sm btn-primary text-nowrap">
|
<button *ngIf="selectedGroupIds.length > 1" (click)="downloadSelected()" class="btn btn-sm btn-primary text-nowrap">
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { enableProdMode } from '@angular/core'
|
import { enableProdMode, LOCALE_ID } from '@angular/core'
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
||||||
|
|
||||||
import { AppModule } from './app/app.module'
|
import { AppModule } from './app/app.module.js'
|
||||||
import { environment } from './environments/environment'
|
import { environment } from './environments/environment.js'
|
||||||
|
|
||||||
window.electron.on.errorLog(data => console.error(data))
|
window.electron.on.errorLog(data => console.error(data))
|
||||||
|
|
||||||
@@ -10,5 +10,8 @@ if (environment.production) {
|
|||||||
enableProdMode()
|
enableProdMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
platformBrowserDynamic()
|
||||||
|
.bootstrapModule(AppModule, {
|
||||||
|
providers: [{ provide: LOCALE_ID, useValue: document.documentElement.lang || 'en-US' }],
|
||||||
|
})
|
||||||
.catch(err => console.error(err))
|
.catch(err => console.error(err))
|
||||||
|
|||||||
Reference in New Issue
Block a user