1
0
Fork 0
mirror of https://codeberg.org/beerbrawl/beerbrawl.git synced 2024-09-23 05:40:51 +02:00

feat(#142): remove ngx-time-picker

This commit is contained in:
Moritz Kepplinger 2024-06-19 22:05:02 +02:00
parent cf876f3c5c
commit 23c400ad3c
7 changed files with 70 additions and 577 deletions

File diff suppressed because it is too large Load diff

View file

@ -35,7 +35,6 @@
"core-js": "3.36.1", "core-js": "3.36.1",
"jquery": "3.7.1", "jquery": "3.7.1",
"jwt-decode": "4.0.0", "jwt-decode": "4.0.0",
"ngx-mat-timepicker": "^17.1.0",
"puppeteer": "^22.11.2", "puppeteer": "^22.11.2",
"replace-in-files-cli": "^2.2.0", "replace-in-files-cli": "^2.2.0",
"rxjs": "7.8.1", "rxjs": "7.8.1",

View file

@ -38,7 +38,6 @@ import { CopyLinkDialogComponent } from './components/copy-link-dialog/copy-link
import { TournamentOverviewComponent } from './components/tournament/tournament-overview/tournament-overview.component'; import { TournamentOverviewComponent } from './components/tournament/tournament-overview/tournament-overview.component';
import { TournamentTeamEditComponent } from './components/tournament-team-edit/tournament-team-edit.component'; import { TournamentTeamEditComponent } from './components/tournament-team-edit/tournament-team-edit.component';
import { MatTable } from '@angular/material/table'; import { MatTable } from '@angular/material/table';
import { NgxMatTimepickerComponent, NgxMatTimepickerDirective } from 'ngx-mat-timepicker';
import { MatDatepicker } from '@angular/material/datepicker'; import { MatDatepicker } from '@angular/material/datepicker';
import { HeaderCardComponent } from './components/header-card/header-card.component'; import { HeaderCardComponent } from './components/header-card/header-card.component';
@ -87,8 +86,6 @@ import { HeaderCardComponent } from './components/header-card/header-card.compon
MatToolbar, MatToolbar,
MatTooltipModule, MatTooltipModule,
ReactiveFormsModule, ReactiveFormsModule,
NgxMatTimepickerComponent,
NgxMatTimepickerDirective,
MatDatepicker, MatDatepicker,
HeaderCardComponent, HeaderCardComponent,
], ],

View file

@ -66,15 +66,11 @@
<mat-label>Registration end time</mat-label> <mat-label>Registration end time</mat-label>
<input <input
matInput matInput
type="time"
name="registrationEndTime" name="registrationEndTime"
formControlName="registrationEndTime" formControlName="registrationEndTime"
required required
format="24"
[ngxMatTimepicker]="timePicker"
placeholder="16:00"
readonly
/> />
<mat-icon matSuffix (click)="timePicker.open()"> watch_later</mat-icon>
@if ( @if (
tournamentForm.controls.registrationEndTime.invalid && tournamentForm.controls.registrationEndTime.invalid &&
tournamentForm.controls.maxParticipants.errors?.['required'] tournamentForm.controls.maxParticipants.errors?.['required']
@ -82,7 +78,6 @@
<mat-error> Registration end time is required.</mat-error> <mat-error> Registration end time is required.</mat-error>
} }
</mat-form-field> </mat-form-field>
<ngx-mat-timepicker color="primary" #timePicker></ngx-mat-timepicker>
<mat-form-field appearance="outline"> <mat-form-field appearance="outline">
<mat-label>Maximum Participants</mat-label> <mat-label>Maximum Participants</mat-label>

View file

@ -19,7 +19,6 @@ import { CreateTournamentDto, TournamentEndpointService } from 'openapi-generate
import { Router, RouterLink } from '@angular/router'; import { Router, RouterLink } from '@angular/router';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { NgxMatTimepickerComponent, NgxMatTimepickerDirective } from 'ngx-mat-timepicker';
import { isValidDate } from 'rxjs/internal/util/isDate'; import { isValidDate } from 'rxjs/internal/util/isDate';
import { CustomDateAdapter } from '../../../adapters/date-adapter'; import { CustomDateAdapter } from '../../../adapters/date-adapter';
@ -38,8 +37,6 @@ import { CustomDateAdapter } from '../../../adapters/date-adapter';
MatCardModule, MatCardModule,
FormsModule, FormsModule,
NgIf, NgIf,
NgxMatTimepickerComponent,
NgxMatTimepickerDirective,
ReactiveFormsModule, ReactiveFormsModule,
RouterLink, RouterLink,
], ],

View file

@ -63,15 +63,11 @@
<mat-label>Registration end time</mat-label> <mat-label>Registration end time</mat-label>
<input <input
matInput matInput
type="time"
name="registrationEndTime" name="registrationEndTime"
formControlName="registrationEndTime" formControlName="registrationEndTime"
required required
format="24"
[ngxMatTimepicker]="timePicker"
placeholder="16:00"
readonly
/> />
<mat-icon matSuffix (click)="timePicker.open()"> watch_later</mat-icon>
@if ( @if (
tournamentForm.controls.registrationEndTime.invalid && tournamentForm.controls.registrationEndTime.invalid &&
tournamentForm.controls.maxParticipants.errors?.['required'] tournamentForm.controls.maxParticipants.errors?.['required']
@ -79,7 +75,6 @@
<mat-error> Registration end time is required.</mat-error> <mat-error> Registration end time is required.</mat-error>
} }
</mat-form-field> </mat-form-field>
<ngx-mat-timepicker color="primary" #timePicker></ngx-mat-timepicker>
<mat-form-field appearance="outline"> <mat-form-field appearance="outline">
<mat-label>Maximum Participants</mat-label> <mat-label>Maximum Participants</mat-label>

View file

@ -19,7 +19,6 @@ import { MatListModule } from '@angular/material/list';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { Router, RouterLink } from '@angular/router'; import { Router, RouterLink } from '@angular/router';
import { TournamentEndpointService, TournamentOverviewDto, TournamentUpdateDto } from '@api'; import { TournamentEndpointService, TournamentOverviewDto, TournamentUpdateDto } from '@api';
import { NgxMatTimepickerComponent, NgxMatTimepickerDirective } from 'ngx-mat-timepicker';
import { isValidDate } from 'rxjs/internal/util/isDate'; import { isValidDate } from 'rxjs/internal/util/isDate';
import { CustomDateAdapter } from 'src/app/adapters/date-adapter'; import { CustomDateAdapter } from 'src/app/adapters/date-adapter';
@ -36,8 +35,6 @@ import { CustomDateAdapter } from 'src/app/adapters/date-adapter';
MatCardModule, MatCardModule,
FormsModule, FormsModule,
NgIf, NgIf,
NgxMatTimepickerComponent,
NgxMatTimepickerDirective,
ReactiveFormsModule, ReactiveFormsModule,
RouterLink, RouterLink,
], ],
@ -82,7 +79,7 @@ export class TournamentEditComponent implements OnInit {
this.tournamentForm.setValue({ this.tournamentForm.setValue({
name: data.name, name: data.name,
registrationEndDate: date, registrationEndDate: date,
registrationEndTime: `${date.getHours()}:${date.getMinutes()}`, // USe UTCHours ? registrationEndTime: `${this.getToDigitString(date.getHours())}:${this.getToDigitString(date.getMinutes())}`, // USe UTCHours ?
maxParticipants: data.maxParticipants, maxParticipants: data.maxParticipants,
description: data.description!, description: data.description!,
}); });
@ -169,4 +166,11 @@ export class TournamentEditComponent implements OnInit {
duration: 5000, duration: 5000,
}); });
} }
getToDigitString(value: number): string {
if (value < 10) {
return '0' + value;
}
return value.toString();
}
} }