-
Notifications
You must be signed in to change notification settings - Fork 1
Add Clock In #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Clock In #8
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add Clock In
- Loading branch information
commit 747e09f2c385ec32b96c63b59bf73f3b2f3cd426
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.content-ClockIn { | ||
padding: 2.1rem 1rem; | ||
} | ||
|
||
.timer { | ||
align-items: center; | ||
display: flex; | ||
height: 100%; | ||
justify-content: center; | ||
} |
25 changes: 20 additions & 5 deletions
25
src/app/components/options-sidebar/time-clock/time-clock.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
<div class="text-center mt-5"> | ||
|
||
<p>time-clock works!</p> | ||
|
||
</div> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col content-ClockIn"> | ||
<h5>PROJECTS</h5> | ||
<app-project-list-hover | ||
[projects]="projects" | ||
(showFields)="setShowFields($event)" | ||
></app-project-list-hover> | ||
<br /> | ||
<div *ngIf="showFields"> | ||
<app-details-fields></app-details-fields> | ||
</div> | ||
</div> | ||
<div class="col content-ClockIn"> | ||
<div class="timer"> | ||
<h5>Timer Here!</h5> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { async, ComponentFixture, TestBed } from "@angular/core/testing"; | ||
|
||
import { TimeClockComponent } from './time-clock.component'; | ||
import { TimeClockComponent } from "./time-clock.component"; | ||
|
||
describe('TimeClockComponent', () => { | ||
describe("TimeClockComponent", () => { | ||
let component: TimeClockComponent; | ||
let fixture: ComponentFixture<TimeClockComponent>; | ||
|
||
|
@@ -15,9 +15,8 @@ describe('TimeClockComponent', () => { | |
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ TimeClockComponent ] | ||
}) | ||
.compileComponents(); | ||
declarations: [TimeClockComponent] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
|
@@ -26,7 +25,7 @@ describe('TimeClockComponent', () => { | |
fixture.detectChanges(); | ||
}); | ||
|
||
it('should be created', () => { | ||
it("should be created", () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
|
@@ -39,4 +38,10 @@ describe('TimeClockComponent', () => { | |
expect(h1tag.textContent).toBe('time-clock works!'); | ||
})); | ||
|
||
it("should set showfileds as true", () => { | ||
const show = true; | ||
component.showFields = show; | ||
component.setShowFields(show); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we setting this field to true twice? |
||
expect(component.showFields).toBe(true); | ||
}); | ||
}); |
24 changes: 17 additions & 7 deletions
24
src/app/components/options-sidebar/time-clock/time-clock.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Component, OnInit } from "@angular/core"; | ||
|
||
@Component({ | ||
selector: 'app-time-clock', | ||
templateUrl: './time-clock.component.html', | ||
styleUrls: ['./time-clock.component.css'] | ||
selector: "app-time-clock", | ||
templateUrl: "./time-clock.component.html", | ||
styleUrls: ["./time-clock.component.css"] | ||
}) | ||
export class TimeClockComponent implements OnInit { | ||
projects = [ | ||
{ id: "P1", name: "Project 1" }, | ||
{ id: "P2", name: "Project 2" }, | ||
{ id: "P3", name: "Project 3" }, | ||
{ id: "P4", name: "Project 4" } | ||
]; | ||
|
||
constructor() { } | ||
showFields: boolean; | ||
|
||
ngOnInit(): void { | ||
} | ||
constructor() {} | ||
|
||
ngOnInit(): void {} | ||
|
||
setShowFields(show: boolean) { | ||
this.showFields = show; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/app/components/shared/details-fields/details-fields.component.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.span-width { | ||
width: 6rem; | ||
} |
44 changes: 44 additions & 0 deletions
44
src/app/components/shared/details-fields/details-fields.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<form> | ||
<div class="input-group input-group-sm mb-3"> | ||
<div class="input-group-prepend"> | ||
<label class="input-group-text span-width" for="inputGroupSelect01">Activity</label> | ||
</div> | ||
<select class="custom-select" id="inputGroupSelect01"> | ||
<option selected>Choose...</option> | ||
<option value="1">One</option> | ||
<option value="2">Two</option> | ||
<option value="3">Three</option> | ||
</select> | ||
</div> | ||
<div class="input-group input-group-sm mb-3"> | ||
<div class="input-group-prepend"> | ||
<span class="input-group-text span-width" id="inputGroup-sizing-sm" | ||
>Jira Ticket</span | ||
> | ||
</div> | ||
<input | ||
type="text" | ||
class="form-control" | ||
aria-label="Small" | ||
aria-describedby="inputGroup-sizing-sm" | ||
/> | ||
</div> | ||
<div class="input-group input-group-sm mb-3"> | ||
<div class="input-group-prepend"> | ||
<span class="input-group-text span-width" id="inputGroup-sizing-sm">Technology</span> | ||
</div> | ||
<input | ||
type="text" | ||
class="form-control" | ||
aria-label="Small" | ||
aria-describedby="inputGroup-sizing-sm" | ||
/> | ||
</div> | ||
<div class="form-group"> | ||
<label for="NotesTextarea">Notes</label> | ||
<textarea class="form-control" id="NotesTextarea" rows="3"></textarea> | ||
</div> | ||
</form> | ||
<button class="btn btn-danger btn-sm"> | ||
Clock Out | ||
</button> |
25 changes: 25 additions & 0 deletions
25
src/app/components/shared/details-fields/details-fields.component.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DetailsFieldsComponent } from './details-fields.component'; | ||
|
||
describe('DetailsFieldsComponent', () => { | ||
let component: DetailsFieldsComponent; | ||
let fixture: ComponentFixture<DetailsFieldsComponent>; | ||
|
||
beforeEach(async(() => { | ||
enriquezrene marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TestBed.configureTestingModule({ | ||
declarations: [ DetailsFieldsComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DetailsFieldsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
src/app/components/shared/details-fields/details-fields.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-details-fields', | ||
templateUrl: './details-fields.component.html', | ||
styleUrls: ['./details-fields.component.css'] | ||
}) | ||
export class DetailsFieldsComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/app/components/shared/project-list-hover/project-list-hover.component.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.content-projects { | ||
max-height: 10rem; | ||
overflow-x: auto; | ||
} | ||
|
||
.content-projects > li { | ||
cursor: pointer; | ||
font-size: 0.8rem; | ||
padding: 0.5rem 0.8rem; | ||
} | ||
|
||
.button-clockIn { | ||
font-size: 0.7rem; | ||
padding: 0 0.3rem; | ||
} |
17 changes: 17 additions & 0 deletions
17
src/app/components/shared/project-list-hover/project-list-hover.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<ul class="list-group content-projects"> | ||
<li | ||
class="list-group-item list-group-item-action d-flex justify-content-between align-items-center" | ||
*ngFor="let item of projects; let i = index" | ||
(mouseenter)="showButton = i" | ||
(mouseleave)="showButton = -1" | ||
(click)="clockIn(item.id)" | ||
[ngClass]="{ active: selectedId === item.id }" | ||
> | ||
{{ item.name }} | ||
<span | ||
*ngIf="showButton === i && selectedId !== item.id" | ||
class="badge badge-light" | ||
>Clock In</span | ||
> | ||
</li> | ||
</ul> |
38 changes: 38 additions & 0 deletions
38
src/app/components/shared/project-list-hover/project-list-hover.component.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { async, ComponentFixture, TestBed } from "@angular/core/testing"; | ||
|
||
import { ProjectListHoverComponent } from "./project-list-hover.component"; | ||
|
||
describe("ProjectListHoverComponent", () => { | ||
let component: ProjectListHoverComponent; | ||
let fixture: ComponentFixture<ProjectListHoverComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ProjectListHoverComponent] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ProjectListHoverComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it("should create", () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it("should set selectedId with Id", () => { | ||
const id: string = "P1"; | ||
component.clockIn(id); | ||
expect(component.selectedId).toBe(id); | ||
}); | ||
|
||
it("should emit showFields event", () => { | ||
const id: string = "P1"; | ||
component.showFields.subscribe((showFields: boolean) => | ||
expect(showFields).toEqual(true) | ||
); | ||
component.clockIn(id); | ||
}); | ||
}); |
25 changes: 25 additions & 0 deletions
25
src/app/components/shared/project-list-hover/project-list-hover.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Component, OnInit, Input, Output, EventEmitter } from "@angular/core"; | ||
|
||
@Component({ | ||
selector: "app-project-list-hover", | ||
templateUrl: "./project-list-hover.component.html", | ||
styleUrls: ["./project-list-hover.component.css"] | ||
}) | ||
export class ProjectListHoverComponent implements OnInit { | ||
@Input() projects: any; | ||
@Output() showFields = new EventEmitter<boolean>(); | ||
|
||
selectedId: string; | ||
showButton: number; | ||
|
||
constructor() { | ||
this.showButton = -1; | ||
} | ||
|
||
ngOnInit(): void {} | ||
|
||
clockIn(id: string) { | ||
this.selectedId = id; | ||
this.showFields.emit(true); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.