Compare commits
12 Commits
master
...
563116331f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
563116331f | ||
|
|
1946c599be | ||
|
|
7c7762515b | ||
|
|
aaa0ab0638 | ||
|
|
4082932095 | ||
|
|
b6d34ce262 | ||
|
|
764ce43138 | ||
|
|
1bc97df0da | ||
|
|
5408a8d9b6 | ||
|
|
665cb25d34 | ||
|
|
3b8e5145c3 | ||
|
|
51414f5a99 |
@@ -2,15 +2,9 @@
|
|||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
</main>
|
</main>
|
||||||
<nav>
|
<nav>
|
||||||
<ul ngbNav [activeId]="activeId" class="nav-tabs custom-navbar bg-body-secondary">
|
<ul ngbNav [activeId]="route.fragment | async" class="nav-tabs custom-navbar bg-body-secondary">
|
||||||
<li ngbNavItem="/" class="custom-navitem"><a ngbNavLink routerLink="" routerLinkActive="active">
|
<li ngbNavItem="/edit" class="custom-navitem"><a ngbNavLink routerLink="/edit" routerLinkActive="active"><i class="bi bi-pencil-square"></i>{{ data.getPlayers().length }}</a></li>
|
||||||
<i class="bi bi-pencil-square"></i>{{ data.getPlayers().length }}</a>
|
<li ngbNavItem="/basic" class="custom-navitem"><a ngbNavLink routerLink="/basic" routerLinkActive="active"><i class="bi bi-shuffle"></i></a></li>
|
||||||
</li>
|
<li ngbNavItem="/rotations" class="custom-navitem"><a ngbNavLink routerLink="/rotations" routerLinkActive="active"><i class="bi bi-arrow-repeat"></i></a></li>
|
||||||
<li ngbNavItem="/basic.t" class="custom-navitem"><a ngbNavLink routerLink="/basic.t" routerLinkActive="active">
|
|
||||||
<i class="bi bi-shuffle"></i></a>
|
|
||||||
</li>
|
|
||||||
<li ngbNavItem="/rotations.t" class="custom-navitem"><a ngbNavLink routerLink="/rotations.t" routerLinkActive="active">
|
|
||||||
<i class="bi bi-arrow-repeat"></i></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -22,6 +22,7 @@ tr{
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
.custom-navbar{
|
.custom-navbar{
|
||||||
|
height: 3rem;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@@ -33,3 +34,5 @@ tr{
|
|||||||
text-align: center; /* Center the content of each item */
|
text-align: center; /* Center the content of each item */
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
.nav-link.active{
|
||||||
|
}
|
||||||
@@ -1,39 +1,31 @@
|
|||||||
import { Component, inject, OnInit} from '@angular/core';
|
import { Component, inject, OnInit} from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { RouterOutlet, ActivatedRoute, RouterLink, Router, NavigationEnd } from '@angular/router';
|
import { RouterOutlet, ActivatedRoute, RouterLink } from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { filter, take } from 'rxjs';
|
import { filter, take } from 'rxjs';
|
||||||
|
import { ScreenBasicComponent } from "./screen-basic/screen-basic.component";
|
||||||
|
import { ScreenRotationsComponent } from './screen-rotations/screen-rotations.component';
|
||||||
import { Player } from './model';
|
import { Player } from './model';
|
||||||
|
import { ScreenEditComponent } from './screen-edit/screen-edit.component';
|
||||||
import { DataService } from './data.service';
|
import { DataService } from './data.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
imports: [NgbModule, RouterOutlet, CommonModule, FormsModule, RouterLink],
|
imports: [NgbModule, RouterOutlet, CommonModule, FormsModule, ScreenBasicComponent, ScreenRotationsComponent, ScreenEditComponent, RouterLink],
|
||||||
templateUrl: './app.component.html',
|
templateUrl: './app.component.html',
|
||||||
styleUrl: './app.component.less'
|
styleUrl: './app.component.less'
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
export class AppComponent implements OnInit {
|
||||||
title = 'vb';
|
title = 'vb';
|
||||||
data = inject(DataService);
|
data = inject(DataService);
|
||||||
activeId = '/';
|
|
||||||
|
|
||||||
constructor(
|
constructor(public route: ActivatedRoute){}
|
||||||
private route: ActivatedRoute,
|
|
||||||
private router: Router
|
|
||||||
){}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.router.events
|
|
||||||
.pipe(filter(event => event instanceof NavigationEnd))
|
|
||||||
.subscribe(() => {
|
|
||||||
this.activeId = this.router.url;
|
|
||||||
});
|
|
||||||
// process query params
|
|
||||||
this.route.queryParams.pipe(
|
this.route.queryParams.pipe(
|
||||||
// Only proceed if params are not empty
|
filter(params => Object.keys(params).length > 0), // Only proceed if params are not empty
|
||||||
filter(params => Object.keys(params).length > 0),
|
|
||||||
take(1)
|
take(1)
|
||||||
).subscribe(params => {
|
).subscribe(params => {
|
||||||
if (params['names']){
|
if (params['names']){
|
||||||
|
|||||||
@@ -2,18 +2,16 @@ import { Routes } from '@angular/router';
|
|||||||
import { ScreenBasicComponent } from './screen-basic/screen-basic.component';
|
import { ScreenBasicComponent } from './screen-basic/screen-basic.component';
|
||||||
import { ScreenEditComponent } from './screen-edit/screen-edit.component';
|
import { ScreenEditComponent } from './screen-edit/screen-edit.component';
|
||||||
import { ScreenRotationsComponent } from './screen-rotations/screen-rotations.component';
|
import { ScreenRotationsComponent } from './screen-rotations/screen-rotations.component';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
children: [
|
children: [
|
||||||
{ path: '', component: ScreenEditComponent },
|
{ path: '', redirectTo: 'edit', pathMatch: 'full' },
|
||||||
/* IMPORTANT: all routes have to include a `.` (dot)
|
{ path: 'edit', component: ScreenEditComponent },
|
||||||
this is a workaround used in `sw.js`
|
{ path: 'basic', component: ScreenBasicComponent },
|
||||||
to allow hosting services on the same subdomain as this PWA
|
{ path: 'rotations', component: ScreenRotationsComponent }
|
||||||
*/
|
|
||||||
{ path: 'basic.t', component: ScreenBasicComponent },
|
|
||||||
{ path: 'rotations.t', component: ScreenRotationsComponent }
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { Player } from './model';
|
|||||||
})
|
})
|
||||||
export class DataService {
|
export class DataService {
|
||||||
private players: Player[] = [];
|
private players: Player[] = [];
|
||||||
teams: Player[][] = [];
|
|
||||||
|
|
||||||
setPlayers(players: Player[]){
|
setPlayers(players: Player[]){
|
||||||
for (let player of players){
|
for (let player of players){
|
||||||
|
|||||||
@@ -21,17 +21,12 @@ export class Player{
|
|||||||
this.setter = setter;
|
this.setter = setter;
|
||||||
this.libero = libero;
|
this.libero = libero;
|
||||||
}
|
}
|
||||||
getRoles(): string[] {
|
serialize(): string[] {
|
||||||
const roles = [];
|
const values = 'OOOO'
|
||||||
if (this.outside){roles.push('OH')}
|
return [this.name, values];
|
||||||
if (this.middle){roles.push('M')}
|
|
||||||
if (this.opposite){roles.push('OPP')}
|
|
||||||
if (this.setter){roles.push('S')}
|
|
||||||
if (this.libero){roles.push('L')}
|
|
||||||
return roles;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(): string{
|
valueOf(): string{
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
static deSerialize(name: string, values: string): Player{
|
static deSerialize(name: string, values: string): Player{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@for (team of data.teams; track $index) {
|
@for (team of teamsArray; track $index) {
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-wrap: wrap;">{{ team.length | number }}</td>
|
<td style="text-wrap: wrap;">{{ team.length | number }}</td>
|
||||||
<td class="wrap-cell">{{ team }}</td>
|
<td class="wrap-cell">{{ team }}</td>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Original Team Generation Screen for arbitrary size and number of teams
|
// Original Team Generation Screen for arbitrary size and number of teams
|
||||||
import { Component, inject} from '@angular/core';
|
import { Component, inject} from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { RouterOutlet, ActivatedRoute } from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { Player } from '../model';
|
import { Player } from '../model';
|
||||||
@@ -9,7 +10,7 @@ import { DataService } from '../data.service';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-screen-basic',
|
selector: 'app-screen-basic',
|
||||||
imports: [NgbModule, CommonModule, FormsModule],
|
imports: [NgbModule, RouterOutlet, CommonModule, FormsModule],
|
||||||
templateUrl: './screen-basic.component.html',
|
templateUrl: './screen-basic.component.html',
|
||||||
styleUrl: './screen-basic.component.less'
|
styleUrl: './screen-basic.component.less'
|
||||||
})
|
})
|
||||||
@@ -18,6 +19,7 @@ export class ScreenBasicComponent {
|
|||||||
numTeamsSelectorValue = "2";
|
numTeamsSelectorValue = "2";
|
||||||
numTeamsSelected = 2;
|
numTeamsSelected = 2;
|
||||||
nTeamsValue = "4";
|
nTeamsValue = "4";
|
||||||
|
teamsArray: string[][] = [];
|
||||||
|
|
||||||
onButtonGenerate(): void{
|
onButtonGenerate(): void{
|
||||||
if(this.numTeamsSelectorValue === 'n'){
|
if(this.numTeamsSelectorValue === 'n'){
|
||||||
@@ -38,10 +40,10 @@ export class ScreenBasicComponent {
|
|||||||
let n = localPlayers[index];
|
let n = localPlayers[index];
|
||||||
localPlayers.splice(index,1);
|
localPlayers.splice(index,1);
|
||||||
let team = iterator.next().value;
|
let team = iterator.next().value;
|
||||||
team.push(n);
|
team.push(n.name);
|
||||||
|
|
||||||
}
|
}
|
||||||
this.data.teams = teams;
|
this.teamsArray = teams;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
placeholder="Enter a name..."
|
placeholder="Enter a name..."
|
||||||
(keyup.enter)="addItem()"
|
(keyup.enter)="addItem()"
|
||||||
autocapitalize="words"
|
|
||||||
/>
|
/>
|
||||||
<button class="btn btn-primary" type="button" (click)="addItem()" >
|
<button class="btn btn-primary" type="button" (click)="addItem()" >
|
||||||
<i class="bi bi-plus-lg"></i> Add
|
<i class="bi bi-plus-lg"></i> Add
|
||||||
@@ -20,10 +19,7 @@
|
|||||||
<ul class="list-group mb-3">
|
<ul class="list-group mb-3">
|
||||||
@for (player of data.getPlayers(); track $index) {
|
@for (player of data.getPlayers(); track $index) {
|
||||||
<li class="list-group-item d-flex justify-content-between">
|
<li class="list-group-item d-flex justify-content-between">
|
||||||
<div (click)="openPlayerModal(player)" class="player-content">
|
<a (click)="openPlayerModal(player)" style="display: block; cursor: pointer; flex-grow: 1; text-align: left;">{{ player.name }}</a>
|
||||||
<div class="text-start">{{ player.name }}</div>
|
|
||||||
<div class="text-end text-muted">{{ player.getRoles() }}</div>
|
|
||||||
</div>
|
|
||||||
<button (click)="removeItem(player)" class="btn btn-secondary btn-sm p-0 ms-2" style="width: 24px; height: 24px" >
|
<button (click)="removeItem(player)" class="btn btn-secondary btn-sm p-0 ms-2" style="width: 24px; height: 24px" >
|
||||||
<i class="bi bi-x"></i>
|
<i class="bi bi-x"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
.player-content{
|
|
||||||
cursor: pointer;
|
|
||||||
flex-grow: 1;
|
|
||||||
text-align: left;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// Team Generation Screen respecting volleyball roles as defined by `../model/Player`
|
// Team Generation Screen respecting volleyball roles as defined by `../model/Player`
|
||||||
import { Component, inject, OnInit } from '@angular/core';
|
import { Component, inject, Input } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { Player } from '../model';
|
import { Player } from '../model';
|
||||||
import { NgbAccordionBody, NgbAccordionCollapse, NgbAccordionHeader, NgbAccordionItem, NgbAccordionButton, NgbAccordionDirective, NgbAccordionToggle } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbAccordionBody, NgbAccordionCollapse, NgbAccordionHeader, NgbAccordionItem, NgbAccordionButton, NgbAccordionDirective, NgbAccordionToggle } from '@ng-bootstrap/ng-bootstrap';
|
||||||
@@ -11,13 +11,8 @@ import { DataService } from '../data.service';
|
|||||||
templateUrl: './screen-rotations.component.html',
|
templateUrl: './screen-rotations.component.html',
|
||||||
styleUrl: './screen-rotations.component.less'
|
styleUrl: './screen-rotations.component.less'
|
||||||
})
|
})
|
||||||
export class ScreenRotationsComponent implements OnInit{
|
export class ScreenRotationsComponent {
|
||||||
data = inject(DataService);
|
data = inject(DataService);
|
||||||
ngOnInit(): void {
|
|
||||||
|
|
||||||
}
|
|
||||||
// https://de.wikipedia.org/wiki/Volleyball#Spielpositionen
|
|
||||||
// we want 2 outside, 1 opp, 1 set and either 2*middle or middle + libero
|
|
||||||
|
|
||||||
get OutsidePlayers(): Player[] {
|
get OutsidePlayers(): Player[] {
|
||||||
return this.data.getPlayers().filter(player => player.outside);
|
return this.data.getPlayers().filter(player => player.outside);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ html, body {
|
|||||||
body {
|
body {
|
||||||
margin:3em auto;
|
margin:3em auto;
|
||||||
font-family: Roboto, "Helvetica Neue", sans-serif;
|
font-family: Roboto, "Helvetica Neue", sans-serif;
|
||||||
padding:.5em auto;
|
padding:0 .5em;
|
||||||
}
|
}
|
||||||
h1,h2,h3{
|
h1,h2,h3{
|
||||||
line-height:1.2;
|
line-height:1.2;
|
||||||
|
|||||||
Reference in New Issue
Block a user