Skip to content

Commit 101f395

Browse files
committed
changed some design choices and made the website uglier
1 parent 002c53b commit 101f395

10 files changed

+172
-55
lines changed

bluenps/src/app/app.module.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import { AppComponent } from './app.component';
77
import { HomePageComponent } from './home-page/home-page.component';
88
import { AppRoutingModule } from './app-routing.module';
99
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
10+
import { SignupsComponent } from './signups/signups.component';
1011

1112

1213
@NgModule({
1314
declarations: [
1415
AppComponent,
15-
DeleteComponent,
16-
HomePageComponent,
16+
//DeleteComponent,
17+
//HomePageComponent,
18+
//SignupsComponent,
1719
],
1820
imports: [
1921
HttpClientModule,

bluenps/src/app/backend.service.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Injectable } from '@angular/core';
22
import { HttpClient, HttpHeaders} from '@angular/common/http';
33
import { environment } from 'src/environments/environment';
4+
import { Observable } from 'rxjs';
45

56
export type signup = {
67
index: number;
@@ -27,10 +28,10 @@ export class BackendService {
2728
getAllData( ){
2829
console.log("test");
2930
return this.http.get<signup[]>(this.url);
30-
31-
3231
}
3332

33+
34+
3435
postSignup(newPlayer:signupPost){
3536
console.log(newPlayer);
3637
var headers = new HttpHeaders().set("Content-Type", "application/json; charset=utf-8");
@@ -44,6 +45,6 @@ export class BackendService {
4445
headers = headers.set("nameQuery", regexString);
4546
console.log(headers);
4647
return this.http.delete(this.url + "delete", {headers: headers});
47-
4848
}
49+
4950
}

bluenps/src/app/delete/delete.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { BackendService } from '../backend.service';
44
@Component({
55
selector: 'app-delete',
66
templateUrl: './delete.component.html',
7-
styleUrls: ['./delete.component.css']
7+
styleUrls: ['./delete.component.css'],
8+
standalone:true,
89
})
910
export class DeleteComponent {
1011
constructor(private backendService: BackendService){}
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,3 @@
11
<html>
2-
3-
<div class="row">
4-
<div class="col border border-danger">
5-
Blue
6-
</div>
7-
<div class="col border border-danger">
8-
NPS
9-
</div>
10-
</div>
11-
<div class="container">
12-
<div class="mt-3 mb-3">
13-
<select class="form-select" aria-label="courtSelection" id="courtSelection">
14-
<option value="nps" selected="selected">NPS</option>
15-
<option value="blue">BLUE</option>
16-
</select>
17-
<label for="nameInput" class="form-label">Name:</label>
18-
<input class="form-control" id="nameInput" placeholder="CuteDaisey">
19-
<button type="button" class="btn btn-success" (click)="submitCourtName()">submit</button>
20-
</div>
21-
</div>
22-
23-
24-
25-
<div class="container">
26-
<div class="row">
27-
<div class="col">
28-
<div class="border border-success" *ngFor="let player of npsdata">
29-
<div class="row">
30-
<div class="col">{{player.name}}</div>
31-
<div class="col">{{player.time}}</div>
32-
<div class="col">{{player.court}}</div>
33-
<div class="col"> <button type="button" class="btn btn-danger" (click) = "deletePlayer(player)">remove</button></div>
34-
</div>
35-
</div>
36-
</div>
37-
<div class="col">
38-
<div class="border border-primary" *ngFor="let player of bluedata">
39-
<div class="row">
40-
<div class="col">{{player.name}}</div>
41-
<div class="col">{{player.time}}</div>
42-
<div class="col">{{player.court}}</div>
43-
<div class="col"> <button type="button" class="btn btn-danger" (click) = "deletePlayer(player)">remove</button> </div>
44-
</div>
45-
</div>
46-
</div>
47-
</div>
48-
</div>
49-
2+
<app-signups></app-signups>
503
</html>

bluenps/src/app/home-page/home-page.component.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ import {formatDate} from '@angular/common';
33
import { HttpClient, HttpResponse } from '@angular/common/http';
44
import {signup, BackendService, signupPost } from '../backend.service';
55
import { RouterModule } from '@angular/router';
6+
import { SignupsComponent } from '../signups/signups.component';
7+
8+
69
@Component({
710
selector: 'app-home-page',
811
templateUrl: './home-page.component.html',
9-
styleUrls: ['./home-page.component.css']
12+
styleUrls: ['./home-page.component.css'],
13+
standalone: true,
14+
imports: [SignupsComponent]
1015
})
1116
export class HomePageComponent implements OnInit {
1217
title = 'bluenps';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.bluecourt{
2+
background-color: rgb(0, 247, 255);
3+
padding-top: 2px;
4+
padding-bottom: 2px;
5+
}
6+
7+
.npscourt{
8+
background-color: rgb(0,255,0);
9+
padding-top: 3px;
10+
padding-bottom: 3px;
11+
}
12+
13+
.tablestyle{
14+
background-color: rgb(255, 165, 0);
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<div class="tablestyle">
2+
3+
4+
<div class="row">
5+
<div class="col border border-danger">
6+
Blue
7+
</div>
8+
<div class="col border border-danger">
9+
NPS
10+
</div>
11+
</div>
12+
13+
<div class="container">
14+
<div class="mt-3 mb-3">
15+
<select class="form-select" aria-label="courtSelection" id="courtSelection">
16+
<option value="nps" selected="selected">NPS</option>
17+
<option value="blue">BLUE</option>
18+
</select>
19+
<label for="nameInput" class="form-label">Name:</label>
20+
<input class="form-control" id="nameInput" placeholder="CuteDaisey">
21+
<button type="button" class="btn btn-success" (click)="submitCourtName()">submit</button>
22+
</div>
23+
</div>
24+
25+
26+
<div class="container pt-3 pb-3">
27+
<div class="row">
28+
<div class="col">
29+
<div class="container npscourt border border-dark" *ngFor="let player of npsdata">
30+
<div class="row ml-0">
31+
<div class="col">{{player.name}}</div>
32+
<div class="col">{{player.time}}</div>
33+
<div class="col">{{player.court}}</div>
34+
<div class="col"> <button type="button" class="btn btn-danger" (click) = "deletePlayer(player)">remove</button></div>
35+
</div>
36+
</div>
37+
</div>
38+
<div class="col">
39+
<div class="container bluecourt border border-dark" *ngFor="let player of bluedata">
40+
<div class="row mr-0">
41+
<div class="col">{{player.name}}</div>
42+
<div class="col">{{player.time}}</div>
43+
<div class="col">{{player.court}}</div>
44+
<div class="col"> <button type="button" class="btn btn-danger" (click) = "deletePlayer(player)">remove</button> </div>
45+
</div>
46+
</div>
47+
</div>
48+
</div>
49+
</div>
50+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { SignupsComponent } from './signups.component';
4+
5+
describe('SignupsComponent', () => {
6+
let component: SignupsComponent;
7+
let fixture: ComponentFixture<SignupsComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [SignupsComponent]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(SignupsComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import {formatDate, NgFor} from '@angular/common';
3+
import { HttpClient, HttpResponse } from '@angular/common/http';
4+
import {signup, BackendService, signupPost } from '../backend.service';
5+
6+
@Component({
7+
selector: 'app-signups',
8+
templateUrl: './signups.component.html',
9+
styleUrl: './signups.component.css',
10+
standalone: true,
11+
imports:[NgFor]
12+
})
13+
14+
export class SignupsComponent {
15+
data: signup[]= [{index: 0, name: "uninitialized", court: "uninitialized", time: "please wait"}];
16+
npsdata: signup[]= [{index: 0,name: "nps", court: "uninitialized", time: "please wait"}];
17+
bluedata: signup[] = [{index: 0,name: "blue", court: "uninitialized", time: "please wait"}];
18+
19+
constructor(private http: HttpClient, private backendService: BackendService){}
20+
21+
ngOnInit(){
22+
this.refreshData();
23+
}
24+
25+
refreshData(){
26+
console.log("refreshing data");
27+
this.backendService.getAllData()
28+
.subscribe( data => this.setData(data));
29+
}
30+
31+
32+
setData(data:signup[]){
33+
this.data = data;
34+
this.npsdata = data.filter((activity) => activity.court === "nps");
35+
this.bluedata = data.filter((activity) => activity.court === "blue");
36+
}
37+
submitCourtName(): void{
38+
var e = (document.getElementById("courtSelection") as HTMLInputElement);
39+
var court = e.value;
40+
var name = (document.getElementById("nameInput") as HTMLInputElement).value;
41+
var date = new Date();
42+
if(name==undefined || date==undefined || court == undefined){
43+
alert("error");
44+
return;
45+
}
46+
var dateString = formatDate(date, "yyyy-MM-dd", 'en')
47+
48+
var newSignup:signupPost = {
49+
"name" : name,
50+
"time" : dateString,
51+
"court" : court
52+
}
53+
this.backendService.postSignup(newSignup).subscribe({
54+
next: (value) =>this.refreshData(),
55+
error:(e)=>{console.log("error",e); this.refreshData()}}
56+
)
57+
this.refreshData();
58+
}
59+
deletePlayer(player: signup): void{
60+
this.backendService.deleteData(player.name).subscribe(
61+
{
62+
next: (value) => {this.refreshData();},
63+
error: (e) => {console.log("errordeleting:", e);this.refreshData();}
64+
}
65+
)
66+
}
67+
}

bluenpsbackend/db.sqlite3

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)