add confirmModal + float format pipe + moved a component
This commit is contained in:
1 parent
49f8cd601b
commit
1361fc7b18
12 files changed
+109
-28
No files matched your search
@@ -4,9 +4,10 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { EntryPageComponent } from './entry-page/entry-page.component';
|
||||
import { EntriesRoutingModule } from './entries-routing.module';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { SeasonMainCardComponent } from './season-main-card/season-main-card.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [EntryPageComponent],
|
||||
declarations: [EntryPageComponent, SeasonMainCardComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
SharedModule,
|
||||
|
||||
File renamed without changes.
+1
-8
@@ -1,5 +1,3 @@
|
||||
<!-- TODO mark season as seen > check box-->
|
||||
|
||||
<div class="d-flex align-items-start gap-2 list-line" @fadeInOut>
|
||||
<img [src]="posterPath" width="70" height="105" class="" alt="Episode poster">
|
||||
<div class="flex-grow-1 list-item-1">
|
||||
@@ -11,7 +9,7 @@
|
||||
<div class="progress-bar" role="progressbar" [style]="'width:'+ episodesWatchedPercentage + '%'"
|
||||
[attr.aria-valuenow]="episodesWatchedPercentage" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
<div style="margin-right: 5px;">
|
||||
<div style="margin-right: 5px; min-width: 35px;">
|
||||
{{episodesWatchedCount}}/{{this.season.episode_count}}
|
||||
</div>
|
||||
<button *ngIf="episodesWatchedCount < this.season.episode_count" type="button"
|
||||
@@ -19,11 +17,6 @@
|
||||
style="height: 30px; width: 40px; margin-right: 5px;" (click)="episodeMarkSeenClick()">
|
||||
<span class="material-symbols-outlined">check</span>
|
||||
</button>
|
||||
<!-- <div class="form-check" style="margin-right: 5px;" *ngIf="episodesWatchedCount < this.season.episode_count">
|
||||
<input class="form-check-input" type="checkbox" style="height: 20px; width: 20px;" [checked]="isChecked"
|
||||
(change)="handleCheckChange()">
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- <p class="mb-0 overview">{{season.overview}}</p> -->
|
||||
</div>
|
||||
</div>
|
||||
File renamed without changes.
+3
-3
@@ -1,5 +1,5 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Season } from '../../models/season.model';
|
||||
import { Season } from '../../../shared/models/season.model';
|
||||
import { SeasonService } from '../../../core/services/season.service';
|
||||
import {
|
||||
trigger,
|
||||
@@ -8,10 +8,10 @@ import {
|
||||
transition,
|
||||
animate,
|
||||
} from '@angular/animations';
|
||||
import { Episode } from '../../models/episode.models';
|
||||
import { Episode } from '../../../shared/models/episode.models';
|
||||
import { EpisodeSeenService } from '../../../core/services/episode-seen.service';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { SeenModalComponent } from '../../components/modals/seen-modal/seen-modal.component';
|
||||
import { SeenModalComponent } from '../../../shared/components/modals/seen-modal/seen-modal.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-season-main-card',
|
||||
Whitespace-only changes.
@@ -0,0 +1,19 @@
|
||||
<div class="card border-top border-3 border-{{type}} rounded-0" style="margin-bottom: 0 !important;">
|
||||
<div class="modal-header card-header py-3 px-4">
|
||||
<h5 class="mb-0 text-{{type}}">{{title}}</h5>
|
||||
<button type="button" class="btn-close" (click)="onClose()" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
<form class="row g-3">
|
||||
<div class="col-md-12">
|
||||
<p style="text-align: justify;">{{message}}</p>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="d-flex justify-content-end gap-3">
|
||||
<button type="button" class="btn btn-{{type}} px-4 rounded-0" (click)="onConfirm()">Confirm</button>
|
||||
<button type="button" class="btn btn-secondary px-4 rounded-0" (click)="onClose()">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ConfirmModalComponent } from './confirm-modal.component';
|
||||
|
||||
describe('ConfirmModalComponent', () => {
|
||||
let component: ConfirmModalComponent;
|
||||
let fixture: ComponentFixture<ConfirmModalComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ConfirmModalComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ConfirmModalComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { FormBuilder } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-confirm-modal',
|
||||
templateUrl: './confirm-modal.component.html',
|
||||
styleUrl: './confirm-modal.component.css',
|
||||
})
|
||||
export class ConfirmModalComponent implements OnInit {
|
||||
title: string = 'Confirm your action';
|
||||
message: string = 'Are you sure?';
|
||||
type: string = 'dangger';
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ConfirmModalComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.data == null) return;
|
||||
this.title = this.data.title;
|
||||
this.message = this.data.message;
|
||||
this.type = this.data.type;
|
||||
}
|
||||
|
||||
onConfirm(): void {
|
||||
this.dialogRef.close({ confirmed: true });
|
||||
}
|
||||
|
||||
onClose(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { FloatFormatPipe } from './float-format.pipe';
|
||||
|
||||
describe('FloatFormatPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new FloatFormatPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'floatFormat',
|
||||
})
|
||||
export class FloatFormatPipe implements PipeTransform {
|
||||
transform(value: number, toFixed: number): unknown {
|
||||
if (!value) return 0;
|
||||
|
||||
return value.toFixed(toFixed);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
// * cards
|
||||
import { SeasonMainCardComponent } from './cards/season-main-card/season-main-card.component';
|
||||
|
||||
// * modals
|
||||
import { SeenModalComponent } from './components/modals/seen-modal/seen-modal.component';
|
||||
import { ConfirmModalComponent } from './components/modals/confirm-modal/confirm-modal.component';
|
||||
|
||||
// * pipes
|
||||
import { DateFormatPipe } from './pipes/date-format/date-format.pipe';
|
||||
@@ -14,6 +13,7 @@ import { DateFormatPipe } from './pipes/date-format/date-format.pipe';
|
||||
import { RatingModule } from 'ngx-bootstrap/rating';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { CollectionEditModalComponent } from '../features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component';
|
||||
import { FloatFormatPipe } from './pipes/float-format/float-format.pipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -27,33 +27,24 @@ import { CollectionEditModalComponent } from '../features/collections/user-colle
|
||||
declarations: [
|
||||
// * pipes
|
||||
DateFormatPipe,
|
||||
FloatFormatPipe,
|
||||
|
||||
// ? components
|
||||
SeasonMainCardComponent,
|
||||
SeenModalComponent,
|
||||
CollectionEditModalComponent
|
||||
CollectionEditModalComponent,
|
||||
ConfirmModalComponent,
|
||||
|
||||
// ? other imported components
|
||||
|
||||
// NotificationPopupComponent,
|
||||
// MainCardComponent,
|
||||
// DynamicEntryListComponent,
|
||||
// NotificationPopupComponent,
|
||||
// ListSelectionModalComponent,
|
||||
|
||||
// ? modules
|
||||
],
|
||||
exports: [
|
||||
// * pipes
|
||||
DateFormatPipe,
|
||||
FloatFormatPipe,
|
||||
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
|
||||
//NotificationPopupComponent,
|
||||
SeasonMainCardComponent,
|
||||
SeenModalComponent,
|
||||
|
||||
ConfirmModalComponent,
|
||||
RatingModule,
|
||||
],
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user