+
+ 1
+
+
+
+
+
2
-
-
-
+
SET UP
-
+
DRAW
-
+
MANAGE
diff --git a/src/app/shared/components/table-draw-state/table-draw-state.component.scss b/src/app/shared/components/table-draw-state/table-draw-state.component.scss
index 880b7bd..76bc15c 100644
--- a/src/app/shared/components/table-draw-state/table-draw-state.component.scss
+++ b/src/app/shared/components/table-draw-state/table-draw-state.component.scss
@@ -24,7 +24,7 @@ div.bullets {
font-size: 18px;
font-weight: bold;
border-radius: 24px;
- background: #ccc;
+ background: #85BB65;
color: white;
display: flex;
justify-content: center;
@@ -32,8 +32,7 @@ div.bullets {
}
.draw-state > div > div.bullet.completed {
- background: #85BB65;
- color: white;
+ background: #ccc;
}
.draw-state > div > div.line {
@@ -45,18 +44,19 @@ div.bullets {
}
.draw-state > div > div.line.completed {
- background: #3f403f;
+ background: #ccc;
}
.draw-state > div > p {
width: 130px;
text-align: center;
- color: #ccc;
+ color: $primary;
}
.draw-state > div > p.completed {
font-weight: bold;
color: $primary;
+ color: #ccc;
}
.texts p {
diff --git a/src/app/shared/services/table-draw.service.ts b/src/app/shared/services/table-draw.service.ts
index 8910ff8..5f78b70 100644
--- a/src/app/shared/services/table-draw.service.ts
+++ b/src/app/shared/services/table-draw.service.ts
@@ -158,6 +158,7 @@ export class TableDrawService {
]
);
+ console.log('set', tableDraw.state);
this.tableDraw.set(tableDraw);
this.tournamentApiService.deleteTableDraw$(tableDraw.tournament.id).pipe(
@@ -279,6 +280,13 @@ export class TableDrawService {
return tableDraw;
});
+ this.tableDraw.update(
+ (tableDraw: TableDraw) => ({
+ ...tableDraw,
+ state: TableDrawState.DRAWN
+ })
+ );
+
this.tournamentApiService.deleteTableDraw$(this.tableDraw().tournament.id).pipe(
take(1),
switchMap(() => this.tournamentApiService.postTableDraw$(this.tableDraw()))
@@ -419,6 +427,13 @@ export class TableDrawService {
}
resetTableDraw(): void {
+ this.tableDraw.update(
+ (tableDraw: TableDraw) => ({
+ ...tableDraw,
+ state: TableDrawState.BLANK
+ })
+ );
+
this.tournamentApiService.deleteTableDraw$(this.tournament().id).pipe(
take(1),
tap(() => this.tableDraw.update((tableDraw: TableDraw) => {
diff --git a/src/app/shared/services/util/formly-field.service.ts b/src/app/shared/services/util/formly-field.service.ts
deleted file mode 100644
index 01faac2..0000000
--- a/src/app/shared/services/util/formly-field.service.ts
+++ /dev/null
@@ -1,111 +0,0 @@
-import { Injectable } from '@angular/core';
-import { FormlyFieldConfig } from '@ngx-formly/core';
-import { Observable } from 'rxjs';
-
-@Injectable({
- providedIn: 'root'
-})
-export class FormlyFieldService {
-
- getDefaultTextField(
- key: string,
- label: string,
- required: boolean,
- maxLength = 200
- ): FormlyFieldConfig {
- return {
- key,
- type: 'input',
- props: {
- label,
- required,
- maxLength
- }
- };
- }
-
- getDefaultDateField(
- key: string,
- label: string,
- required: boolean
- ): FormlyFieldConfig {
- return {
- key,
- type: 'datepicker',
- props: {
- label,
- required
- }
- };
- }
-
- getDefaultNumberField(
- key: string,
- label: string,
- required: boolean,
- disabled = false
- ): FormlyFieldConfig {
- return {
- key,
- type: 'number',
- props: {
- label,
- required,
- disabled: disabled ? true : false
- }
- };
- }
-
- getDefaultSelectField(
- key: string,
- label: string,
- required: boolean,
- options: { label: string, value: any }[] | Observable<{ label: string, value: any }[]>,
- disabled = false,
- ): FormlyFieldConfig {
- return {
- key,
- type: 'select',
- props: {
- label,
- required,
- options,
- disabled: disabled ? true : false
- }
- };
- }
-
- getDefaultMultiSelectField(
- key: string,
- label: string,
- required: boolean,
- options: { label: string, value: any }[]
- ): FormlyFieldConfig {
- return {
- key,
- type: 'select',
- props: {
- label,
- required,
- options,
- multiple: true
- }
- };
- }
-
- getDefaultCheckboxField(
- key: string,
- label: string,
- defaultValue = false
- ): FormlyFieldConfig {
- return {
- key,
- type: 'checkbox',
- defaultValue,
- props: {
- label,
- }
- };
- }
-
-}
diff --git a/src/app/timer/components/tournament/overview/overview.component.html b/src/app/timer/components/tournament/overview/overview.component.html
index d52d65c..aa42334 100644
--- a/src/app/timer/components/tournament/overview/overview.component.html
+++ b/src/app/timer/components/tournament/overview/overview.component.html
@@ -22,6 +22,8 @@
- with Addon
}
+ {{ tableDrawService.tableDraw().state }} /{{ drawState() }}
+
{{ tournament().name }} @ {{ tournament().locationName }}
@@ -51,6 +53,8 @@
@if (tournament().finishes.length > tournament().players.length / 2) {
+ } @else if (drawState()) {
+
} @else {
;
timeForRebuy: Signal;
+ drawState: Signal;
+
countdownConfig: WritableSignal;
firstDonePassed = false;
@@ -105,6 +111,7 @@ export class OverviewComponent implements OnInit, AfterViewInit {
private state: TimerStateService = inject(TimerStateService);
private tournamentApiService: TournamentApiService = inject(TournamentApiService);
private fetchService: FetchService = inject(FetchService);
+ tableDrawService: TableDrawService = inject(TableDrawService);
@HostListener('window:keyup.space', ['$event'])
onKeydownSpaceHandler(event: Event) {
@@ -173,6 +180,10 @@ export class OverviewComponent implements OnInit, AfterViewInit {
return date;
});
+ this.drawState = computed(() =>
+ this.tableDrawService.tableDraw().state
+ );
+
this.initTimeValues();
this.initCountdownConfig();
diff --git a/src/app/timer/components/tournament/overview/tables/tables.component.html b/src/app/timer/components/tournament/overview/tables/tables.component.html
new file mode 100644
index 0000000..c99b0d3
--- /dev/null
+++ b/src/app/timer/components/tournament/overview/tables/tables.component.html
@@ -0,0 +1,45 @@
+
+
+ Tables
+
+
+
+
+
+
+ @for (table of tableDraw().tables; track table; let i = $index) {
+
+
Table {{ i + 1 }}
+
+
+ @for (player of table; track player; let j = $index; ) {
+
+
+
+
+ {{ player.seatNo + 1 }}
+
+
+
+
+
+ {{ player?.player?.name }}
+
+
+ @if (player.isButton) {
+
B
+ }
+
+ }
+
+
+ }
+
+
+
+
+
diff --git a/src/app/timer/components/tournament/overview/tables/tables.component.scss b/src/app/timer/components/tournament/overview/tables/tables.component.scss
new file mode 100644
index 0000000..b7ca8fa
--- /dev/null
+++ b/src/app/timer/components/tournament/overview/tables/tables.component.scss
@@ -0,0 +1,3 @@
+:host {
+ display: contents;
+}
diff --git a/src/app/timer/components/tournament/overview/tables/tables.component.ts b/src/app/timer/components/tournament/overview/tables/tables.component.ts
new file mode 100644
index 0000000..f9dbc49
--- /dev/null
+++ b/src/app/timer/components/tournament/overview/tables/tables.component.ts
@@ -0,0 +1,37 @@
+import { Component, inject, OnInit, Signal } from '@angular/core';
+import { TableDrawService } from '../../../../../shared/services/table-draw.service';
+import { BulletsComponent } from '../../../../../shared/components/bullets/bullets.component';
+import { DecimalPipe } from '@angular/common';
+import { FormulaPointsPipe } from '../../../../../shared/pipes/formula-points.pipe';
+import { UserWithImageComponent } from '../../../../../shared/components/user-with-image/user-with-image.component';
+import { MatFormFieldModule } from '@angular/material/form-field';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { TableDraw } from '../../../../../shared/interfaces/table-draw.interface';
+
+@Component({
+ selector: 'app-tables',
+ templateUrl: './tables.component.html',
+ styleUrl: './tables.component.scss',
+ standalone: true,
+ imports: [
+ BulletsComponent,
+ DecimalPipe,
+ FormulaPointsPipe,
+ UserWithImageComponent,
+ MatFormFieldModule,
+ MatOptionModule,
+ MatSelectModule
+ ],
+})
+export class TablesComponent implements OnInit {
+
+ tableDraw: Signal;
+
+ private tableDrawService: TableDrawService = inject(TableDrawService);
+
+ ngOnInit(): void {
+ this.tableDraw = this.tableDrawService.tableDraw;
+ }
+
+}
diff --git a/src/styles.scss b/src/styles.scss
index b462511..8db6179 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -10,6 +10,7 @@
@import "src/styles/fonts";
@import "src/styles/animations";
@import "src/styles/timer";
+@import "src/styles/table-draw";
html,
body {
diff --git a/src/styles/_material.scss b/src/styles/_material.scss
index 614aee8..00d5a3c 100644
--- a/src/styles/_material.scss
+++ b/src/styles/_material.scss
@@ -34,6 +34,7 @@ mat-dialog-container:not(#draw) {
mat-dialog-container#draw {
width: 80vw;
min-height: 80vh;
+ max-width: 1000px;
}
diff --git a/src/styles/_table-draw.scss b/src/styles/_table-draw.scss
new file mode 100644
index 0000000..1b86419
--- /dev/null
+++ b/src/styles/_table-draw.scss
@@ -0,0 +1,86 @@
+@import 'src/styles/colors_texts';
+
+.draw-dialog,
+app-tables {
+ .tables-wrapper {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ grid-gap: 12px;
+ }
+
+ .table {
+ background: #eee;
+ border-radius: 12px;
+ overflow: hidden;
+ }
+
+ .table h4 {
+ background: $primaryDark;
+ color: white !important;
+ display: block;
+ text-align: center;
+ text-transform: uppercase;
+ -moz-border-radius-topleft: 12px;
+ -moz-border-radius-topright: 12px;
+ width: 100%;
+ padding: 12px;
+ box-sizing: border-box;
+ margin: 0;
+ }
+
+ .table-content {
+ padding: 24px;
+ }
+
+ .seat {
+ display: flex;
+ align-items: center;
+ padding: 4px;
+ color: $primaryDark;
+
+ p {
+ font-size: 24px;
+ color: $primaryDark;
+ margin-top: 0 !important;
+ margin-bottom: 0 !important;
+ }
+ }
+
+ .seat.fixed {
+ background: rgba(lime, 0.2);
+ }
+
+ .seat.eliminated {
+ opacity: 0.3;
+ }
+
+ .seat:hover {
+ opacity: 0.7;
+ cursor: pointer;
+ }
+
+ .seat p {
+ margin-left: 12px;
+ }
+
+ div.button {
+ border: solid 2px black;
+ background: white;
+ border-radius: 100%;
+ width: 20px;
+ height: 20px;
+ font-size: 15px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-weight: bolder;
+ margin-left: 10px;
+ }
+
+ button {
+ margin-right: 12px !important;
+ display: inherit !important;
+ width: fit-content !important;
+ }
+
+}