From 835be4c7c82f8317cc07247863f5337a71c360ff Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Sun, 25 Nov 2018 18:59:33 +0100 Subject: [PATCH] feat(reminders): add boilerplate for add reminder dialog --- .../dialog-add-note-reminder.component.html | 27 +++++++++++++++++++ .../dialog-add-note-reminder.component.scss | 0 ...dialog-add-note-reminder.component.spec.ts | 25 +++++++++++++++++ .../dialog-add-note-reminder.component.ts | 21 +++++++++++++++ src/app/note/note.model.ts | 1 + src/app/note/note.module.ts | 12 ++++++++- src/app/note/note/note.component.html | 7 ++--- src/app/note/note/note.component.ts | 15 ++++++++++- src/app/reminder/reminder.module.ts | 4 --- src/app/reminder/reminder.service.ts | 6 +++-- 10 files changed, 107 insertions(+), 11 deletions(-) create mode 100644 src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.html create mode 100644 src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.scss create mode 100644 src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.spec.ts create mode 100644 src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.ts diff --git a/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.html b/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.html new file mode 100644 index 0000000000..815c5cb766 --- /dev/null +++ b/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.html @@ -0,0 +1,27 @@ + +

{{data.note.reminderId ? 'Edit' : 'Add'}} reminder + reminder for note

+ +
+ + +
+ + + + +
+
diff --git a/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.scss b/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.spec.ts b/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.spec.ts new file mode 100644 index 0000000000..41863ff5b6 --- /dev/null +++ b/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DialogAddNoteReminderComponent } from './dialog-add-note-reminder.component'; + +describe('DialogAddNoteReminderComponent', () => { + let component: DialogAddNoteReminderComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DialogAddNoteReminderComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DialogAddNoteReminderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.ts b/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.ts new file mode 100644 index 0000000000..ab85f4a724 --- /dev/null +++ b/src/app/note/dialog-add-note-reminder/dialog-add-note-reminder.component.ts @@ -0,0 +1,21 @@ +import { ChangeDetectionStrategy, Component, Inject } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; +import { Note } from '../note.model'; + +@Component({ + selector: 'dialog-add-note-reminder', + templateUrl: './dialog-add-note-reminder.component.html', + styleUrls: ['./dialog-add-note-reminder.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class DialogAddNoteReminderComponent { + constructor( + private _matDialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: { note: Note }, + ) { + } + + close(isConfirm: boolean) { + this._matDialogRef.close(isConfirm); + } +} diff --git a/src/app/note/note.model.ts b/src/app/note/note.model.ts index c80c46e4a8..4910c39c26 100644 --- a/src/app/note/note.model.ts +++ b/src/app/note/note.model.ts @@ -6,4 +6,5 @@ export interface Note { backgroundColor?: string; created: number; modified: number; + reminderId?: string; } diff --git a/src/app/note/note.module.ts b/src/app/note/note.module.ts index a0cbf3a488..1939980d76 100644 --- a/src/app/note/note.module.ts +++ b/src/app/note/note.module.ts @@ -9,15 +9,25 @@ import { NotesComponent } from './notes/notes.component'; import { NoteComponent } from './note/note.component'; import { UiModule } from '../ui/ui.module'; import { NoteService } from './note.service'; +import { DialogAddNoteReminderComponent } from './dialog-add-note-reminder/dialog-add-note-reminder.component'; +import { ReminderModule } from '../reminder/reminder.module'; @NgModule({ - declarations: [NotesComponent, NoteComponent], + declarations: [ + NotesComponent, + NoteComponent, + DialogAddNoteReminderComponent + ], imports: [ + ReminderModule, CommonModule, UiModule, StoreModule.forFeature(NOTE_FEATURE_NAME, fromNote.reducer), EffectsModule.forFeature([NoteEffects]), ], + entryComponents: [ + DialogAddNoteReminderComponent + ], exports: [NotesComponent], providers: [NoteService] }) diff --git a/src/app/note/note/note.component.html b/src/app/note/note/note.component.html index aa34187e43..66edbcac3a 100644 --- a/src/app/note/note/note.component.html +++ b/src/app/note/note/note.component.html @@ -17,15 +17,16 @@ -