From 8df12c0b32fa961f454e463f3f1aed260d8c0b20 Mon Sep 17 00:00:00 2001 From: Larissa Perinoto Date: Mon, 8 Jul 2024 19:57:30 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20adiciona=20tela=20de=20pesagem=20e=20re?= =?UTF-8?q?fei=C3=A7=C3=B5es=20registradas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- app/package-lock.json | 12 - app/src/app/app.component.css | 28 +++ app/src/app/app.component.html | 354 ++------------------------- app/src/app/app.component.spec.ts | 29 --- app/src/app/app.component.ts | 35 ++- app/src/app/meal/meal.component.css | 38 +++ app/src/app/meal/meal.component.html | 8 + app/src/app/meal/meal.component.ts | 19 ++ app/src/index.html | 22 +- app/src/styles.css | 5 + 11 files changed, 161 insertions(+), 391 deletions(-) delete mode 100644 app/src/app/app.component.spec.ts create mode 100644 app/src/app/meal/meal.component.css create mode 100644 app/src/app/meal/meal.component.html create mode 100644 app/src/app/meal/meal.component.ts diff --git a/.gitignore b/.gitignore index 157f34f..6be21d0 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,7 @@ yarn-error.log .history/* # Miscellaneous -/.angular/cache +.angular .sass-cache/ /connect.lock /coverage diff --git a/app/package-lock.json b/app/package-lock.json index 985b722..95cf705 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -6502,9 +6502,6 @@ "@types/node": "*" } }, - "node_modules/@types/eslint": { - "dev": true - }, "node_modules/@types/eslint-scope": { "version": "3.7.7", "dev": true, @@ -6514,9 +6511,6 @@ "@types/estree": "*" } }, - "node_modules/@types/estree": { - "dev": true - }, "node_modules/@types/express": { "version": "4.17.21", "dev": true, @@ -6528,9 +6522,6 @@ "@types/serve-static": "*" } }, - "node_modules/@types/express-serve-static-core": { - "dev": true - }, "node_modules/@types/express/node_modules/@types/express-serve-static-core": { "version": "4.19.5", "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz", @@ -6572,9 +6563,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/node": { - "dev": true - }, "node_modules/@types/qs": { "version": "6.9.15", "dev": true, diff --git a/app/src/app/app.component.css b/app/src/app/app.component.css index e69de29..47c573b 100644 --- a/app/src/app/app.component.css +++ b/app/src/app/app.component.css @@ -0,0 +1,28 @@ +.screen { + display: flex; + background-color: #f5f5f5; + width: 100%; + height: 100%; +} + +.container_1 { + width: 70%; + border-right: 2px solid gray; +} + +.container_2 { + overflow-y: scroll; + padding: 0 2%; + width: 30%; + background-color: #ffffff; +} + +.container_2 h2 { + font-size: 18px; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; +} + +.container_2::-webkit-scrollbar { + width: 2px; +} diff --git a/app/src/app/app.component.html b/app/src/app/app.component.html index 36093e1..360b59c 100644 --- a/app/src/app/app.component.html +++ b/app/src/app/app.component.html @@ -1,336 +1,24 @@ - - - - - - - - - - - -
-
-
- -

Hello, {{ title }}

-

Congratulations! Your app is running. 🎉

-
- -
-
- @for (item of [ - { title: 'Explore the Docs', link: 'https://angular.dev' }, - { title: 'Learn with Tutorials', link: 'https://angular.dev/tutorials' }, - { title: 'CLI Docs', link: 'https://angular.dev/tools/cli' }, - { title: 'Angular Language Service', link: 'https://angular.dev/tools/language-service' }, - { title: 'Angular DevTools', link: 'https://angular.dev/tools/devtools' }, - ]; track item.title) { - - {{ item.title }} - - - - - } -
- -
-
- - - - - - - - - - - + diff --git a/app/src/app/app.component.spec.ts b/app/src/app/app.component.spec.ts deleted file mode 100644 index 44771e7..0000000 --- a/app/src/app/app.component.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { AppComponent } from './app.component'; - -describe('AppComponent', () => { - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [AppComponent], - }).compileComponents(); - }); - - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app).toBeTruthy(); - }); - - it(`should have the 'app' title`, () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app.title).toEqual('app'); - }); - - it('should render title', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.nativeElement as HTMLElement; - expect(compiled.querySelector('h1')?.textContent).toContain('Hello, app'); - }); -}); diff --git a/app/src/app/app.component.ts b/app/src/app/app.component.ts index 11ccfa1..1aac60b 100644 --- a/app/src/app/app.component.ts +++ b/app/src/app/app.component.ts @@ -1,13 +1,38 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { RouterOutlet } from '@angular/router'; +import { WebsocketService } from './socket.service'; +import { MealComponent } from './meal/meal.component'; @Component({ selector: 'app-root', standalone: true, - imports: [RouterOutlet], + imports: [RouterOutlet, MealComponent], templateUrl: './app.component.html', - styleUrl: './app.component.css' + styleUrl: './app.component.css', }) -export class AppComponent { - title = 'app'; +export class AppComponent implements OnInit { + weight: any = 0; + buffetType: any = ''; + total: any = ''; + meals: any[] = []; + + constructor(private socketService: WebsocketService) {} + + ngOnInit(): void { + this.socketService.getWeight().subscribe((data) => { + this.weight = data; + }); + + this.socketService.getBuffetType().subscribe((data) => { + this.buffetType = data; + }); + + this.socketService.getTotal().subscribe((data) => { + this.total = data; + }); + + this.socketService.getOrder().subscribe((data) => { + this.meals.unshift(JSON.parse(data as string)); + }); + } } diff --git a/app/src/app/meal/meal.component.css b/app/src/app/meal/meal.component.css new file mode 100644 index 0000000..134e946 --- /dev/null +++ b/app/src/app/meal/meal.component.css @@ -0,0 +1,38 @@ +.orderCard { + background-color: #ffffff; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; + padding: 1%; + border-bottom: 1px solid gray; + border-top: 1px solid gray; + font-size: 14px; + line-height: 10px; +} + +.cardTitle { + font-size: 14px; + font-weight: 200; +} + +.modal { + width: 50%; + margin: auto; + margin-top: 20%; + padding: 2%; + border: 1px solid gray; + border-radius: 10px; + background-color: #ffffff; + box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.1); + font-size: 26px; +} + +.modalTitle { + font-size: 28px; + font-weight: 400; +} + +.modalWeight { + font-size: 28px; + font-weight: 600; + color: red; +} diff --git a/app/src/app/meal/meal.component.html b/app/src/app/meal/meal.component.html new file mode 100644 index 0000000..f6956a7 --- /dev/null +++ b/app/src/app/meal/meal.component.html @@ -0,0 +1,8 @@ +
+

+ Peso (Kg): {{ weight }} +

+

Categoria: {{ buffetType }}

+

Total: {{ total }}

+

{{ datetime }}

+
diff --git a/app/src/app/meal/meal.component.ts b/app/src/app/meal/meal.component.ts new file mode 100644 index 0000000..4507b06 --- /dev/null +++ b/app/src/app/meal/meal.component.ts @@ -0,0 +1,19 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-meal', + standalone: true, + imports: [], + templateUrl: './meal.component.html', + styleUrl: './meal.component.css', +}) +export class MealComponent { + @Input() weight = ''; + @Input() total = ''; + @Input() buffetType = ''; + @Input() datetime = ''; + + @Input() titleClass = 'cardTitle'; + @Input() weightClass = ''; + @Input() containerClass = 'orderCard'; +} diff --git a/app/src/index.html b/app/src/index.html index f8ef6ac..ce3298a 100644 --- a/app/src/index.html +++ b/app/src/index.html @@ -1,13 +1,13 @@ - + - - - App - - - - - - - + + + Buffet + + + + + + + diff --git a/app/src/styles.css b/app/src/styles.css index 90d4ee0..68b83bf 100644 --- a/app/src/styles.css +++ b/app/src/styles.css @@ -1 +1,6 @@ /* You can add global styles to this file, and also import other style files */ +body { + padding: 0; + margin: 0; + height: 100vh; +}