versie 1.4.0 - the 'Me 'n U' update

This commit is contained in:
Mel M. van Veen
2024-12-03 16:05:22 +01:00
parent 198b433ceb
commit 1afb06beed
16 changed files with 458 additions and 12 deletions

View File

@@ -2,6 +2,11 @@
## Changelog ## Changelog
### - versie 1.4.0 - the 'Me 'n U' update:
- Menu in spelscherm toegevoegd
- Instellingen toegevoegd
- Mogelijkheid naam aanpassen toegevoegd
### - versie 1.3.1 - bug fixes ### - versie 1.3.1 - bug fixes
- tussenstand scherm fix - tussenstand scherm fix

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "wiv", "name": "wiv",
"version": "1.3.1", "version": "1.4.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "wiv", "name": "wiv",
"version": "1.3.1", "version": "1.4.0",
"dependencies": { "dependencies": {
"@angular/animations": "^19.0.1", "@angular/animations": "^19.0.1",
"@angular/cdk": "^19.0.0", "@angular/cdk": "^19.0.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "wiv", "name": "wiv",
"version": "1.3.1", "version": "1.4.0",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",

View File

@@ -1,13 +1,13 @@
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import {GameComponent} from './game/game.component';
import {WelcomeComponent} from './welcome/welcome.component'; import {WelcomeComponent} from './welcome/welcome.component';
import {FinalComponent} from './final/final.component'; import {FinalComponent} from './final/final.component';
import {CurrentScoreComponent} from './current-score/current-score.component'; import {CurrentScoreComponent} from './current-score/current-score.component';
import {GameMenuComponent} from './game-menu/game-menu.component';
export const routes: Routes = [ export const routes: Routes = [
{ path: '', component: WelcomeComponent }, { path: '', component: WelcomeComponent },
{ path: 'start', component: GameComponent }, { path: 'start', component: GameMenuComponent },
{ path: 'final', component: FinalComponent }, { path: 'final', component: FinalComponent },
{ path: 'currentScore', component: CurrentScoreComponent }, { path: 'currentScore', component: CurrentScoreComponent },
]; ];

View File

@@ -0,0 +1,79 @@
.tabs {
position: fixed;
bottom: 0;
display: flex;
left: 50%;
transform: translateX(-50%);
background-color: #fff;
box-shadow: 0 0 1px 0 rgba(24, 94, 224, 0.15), 0 6px 12px 0 rgba(24, 94, 224, 0.15);
padding: 0.75rem;
border-radius: 99px;
margin-bottom: 24px;
}
.tabs * {
z-index: 2;
}
.container input[type="radio"] {
display: none;
}
.tab {
display: flex;
align-items: center;
justify-content: center;
height: 30px;
width: 150px;
font-size: .8rem;
color: black;
font-weight: bold;
border-radius: 99px;
cursor: pointer;
transition: color 0.15s ease-in;
}
.notification {
display: flex;
align-items: center;
justify-content: center;
width: .8rem;
height: .8rem;
position: absolute;
top: 10px;
left: 30%;
border-radius: 50%;
background-color: #e6eef9;
transition: 0.15s ease-in;
}
.container input[type="radio"]:checked + label {
color: #ff561e;
}
.container input[type="radio"]:checked + label > .notification {
background-color: #ff561e;
color: #fff;
margin: 0
}
.container input[id="radio-1"]:checked ~ .glider {
transform: translateX(0);
}
.container input[id="radio-2"]:checked ~ .glider {
transform: translateX(100%);
}
.glider {
position: absolute;
display: flex;
height: 30px;
width: 150px;
background-color: #e6eef9;
opacity: 30%;
z-index: 1;
border-radius: 99px;
transition: 0.25s ease-out;
}

View File

@@ -0,0 +1,16 @@
<app-menu></app-menu>
<div class="container">
<div *ngIf="tab == 1">
<app-game></app-game>
</div>
<div *ngIf="tab == 2">
<app-settings></app-settings>
</div>
<div class="tabs">
<input type="radio" id="radio-1" name="tabs" checked="" (click)="setTab(1)">
<label class="tab" for="radio-1">Spel</label>
<input type="radio" id="radio-2" name="tabs" (click)="setTab(2)">
<label class="tab" for="radio-2">Instellingen</label>
<span class="glider"></span>
</div>
</div>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GameMenuComponent } from './game-menu.component';
describe('GameMenuComponent', () => {
let component: GameMenuComponent;
let fixture: ComponentFixture<GameMenuComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [GameMenuComponent]
})
.compileComponents();
fixture = TestBed.createComponent(GameMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,24 @@
import { Component } from '@angular/core';
import {GameComponent} from '../game/game.component';
import {NgIf} from '@angular/common';
import {SettingsComponent} from '../settings/settings.component';
import {MenuComponent} from '../menu/menu.component';
@Component({
selector: 'app-game-menu',
imports: [
GameComponent,
NgIf,
SettingsComponent,
MenuComponent
],
templateUrl: './game-menu.component.html',
styleUrl: './game-menu.component.css'
})
export class GameMenuComponent {
tab = 1
setTab(number: number) {
this.tab = number
}
}

View File

@@ -91,6 +91,7 @@
border-radius: 5px; border-radius: 5px;
cursor: grab; cursor: grab;
text-align: center; text-align: center;
font-weight: bold;
width: 100%; width: 100%;
margin: 5px; margin: 5px;
color: white; color: white;
@@ -98,11 +99,12 @@
.draggable-button:active { .draggable-button:active {
cursor: grabbing; cursor: grabbing;
background-color: #eb4f1b;
} }
.draggable-button.dragging { .draggable-button.dragging {
background-color: #c0e4ff; background-color: #eb4f1b;
} }
a{ a{

View File

@@ -1,5 +1,3 @@
<app-menu></app-menu>
<div> <div>
<div class="game-container" *ngIf="currentQuestion.type == 0 && !confirmed"> <div class="game-container" *ngIf="currentQuestion.type == 0 && !confirmed">
<div class="question"> <div class="question">

View File

@@ -1,5 +1,4 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {MenuComponent} from '../menu/menu.component';
import {CommonModule, NgIf} from '@angular/common'; import {CommonModule, NgIf} from '@angular/common';
import {CdkDrag, CdkDragDrop, CdkDropList} from '@angular/cdk/drag-drop'; import {CdkDrag, CdkDragDrop, CdkDropList} from '@angular/cdk/drag-drop';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
@@ -8,11 +7,10 @@ import {Router} from '@angular/router';
@Component({ @Component({
selector: 'app-game', selector: 'app-game',
imports: [ imports: [
MenuComponent,
NgIf, NgIf,
CdkDrag, CdkDrag,
CdkDropList, CdkDropList,
CommonModule CommonModule,
], ],
templateUrl: './game.component.html', templateUrl: './game.component.html',
styleUrl: './game.component.css' styleUrl: './game.component.css'
@@ -95,7 +93,6 @@ export class GameComponent implements OnInit {
let question = +localStorage.getItem('question') let question = +localStorage.getItem('question')
if (question < 50){ if (question < 50){
console.log('AAAAAHHH')
if (question % 10 == 0){ if (question % 10 == 0){
this.router.navigate(['currentScore']) this.router.navigate(['currentScore'])
} }

View File

@@ -0,0 +1,153 @@
.buttons {
display: flex;
flex-direction: column;
gap: 10px;
margin-top: 24px;
}
.buttons button {
padding: 10px;
font-size: 1.2rem;
background-color: white;
color: #ff561e;
border: none;
border-radius: 5px;
cursor: pointer;
box-shadow: 0 0 1px 0 rgba(24, 94, 224, 0.15), 0 6px 12px 0 rgba(24, 94, 224, 0.15);
margin-top: 8px;
}
.card {
width: 300px;
height: fit-content;
background: rgb(255, 255, 255);
border-radius: 20px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20px;
padding: 30px;
position: relative;
box-shadow: 20px 20px 30px rgba(0, 0, 0, 0.068);
}
.card-content {
width: 100%;
height: fit-content;
display: flex;
flex-direction: column;
gap: 5px;
}
.card-heading {
font-size: 20px;
font-weight: 700;
color: rgb(27, 27, 27);
}
.card-description {
font-weight: 100;
color: rgb(102, 102, 102);
}
.card-button-wrapper {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.card-button {
width: 50%;
height: 35px;
border-radius: 10px;
border: none;
cursor: pointer;
font-weight: 600;
}
.primary {
background-color: #ff561e;
color: white;
}
.primary:hover {
background-color: rgb(255, 73, 66);
}
.secondary {
background-color: #ddd;
}
.secondary:hover {
background-color: rgb(197, 197, 197);
}
.exit-button {
display: flex;
align-items: center;
justify-content: center;
border: none;
background-color: transparent;
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
.exit-button:hover svg {
fill: black;
}
.exit-button svg {
fill: rgb(175, 175, 175);
}
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.input-container {
position: relative;
margin: 50px auto;
width: auto;
}
.input-container input[type="text"] {
font-size: 20px;
width: 100%;
border: none;
border-bottom: 2px solid #ccc;
padding: 5px 0;
background-color: transparent;
outline: none;
}
.input-container .label {
position: absolute;
top: 0;
left: 0;
color: #ccc;
transition: all 0.3s ease;
pointer-events: none;
}
.input-container input[type="text"]:focus ~ .label,
.input-container input[type="text"]:valid ~ .label {
top: -20px;
font-size: 16px;
color: #333;
}
.input-container .underline {
position: absolute;
bottom: 0;
left: 0;
height: 2px;
width: 100%;
background-color: #333;
transform: scaleX(0);
transition: all 0.3s ease;
}
.input-container input[type="text"]:focus ~ .underline,
.input-container input[type="text"]:valid ~ .underline {
transform: scaleX(1);
}

View File

@@ -0,0 +1,52 @@
<div class="container">
<h3>Instellingen</h3>
<div class="buttons">
<button (click)="openModalChange()">Naam aanpassen</button>
<button (click)="openModal()">Spel afsluiten</button>
</div>
</div>
<div *ngIf="showModalClose" class="modal-overlay" (click)="closeModalClose()">
<div class="card" (click)="$event.stopPropagation()">
<div class="card-content">
<p class="card-heading">Spel afsluiten</p>
<p class="card-description">Weet je het zeker? Je zal je score kwijt raken.</p>
</div>
<div class="card-button-wrapper">
<button class="card-button secondary" (click)="closeModalClose()">Annuleren</button>
<button class="card-button primary" (click)="closeGame()">Afsluiten</button>
</div>
<button class="exit-button" (click)="closeModalClose()">
<svg height="20px" viewBox="0 0 384 512">
<path
d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
></path>
</svg>
</button>
</div>
</div>
<div *ngIf="showModalChange" class="modal-overlay" (click)="closeModalChange()">
<div class="card" (click)="$event.stopPropagation()" [formGroup]="nameForm">
<div class="card-content">
<p class="card-heading">Naam aanpassen</p>
<div class="input-container">
<input type="text" id="naam" formControlName="naam" required="">
<label for="naam" class="label">Naam</label>
<div class="underline"></div>
</div>
</div>
<div class="card-button-wrapper">
<button class="card-button secondary" (click)="closeModalChange()">Annuleren</button>
<button class="card-button primary" (click)="changeName()">Aanpassen</button>
</div>
<button class="exit-button" (click)="closeModalChange()">
<svg height="20px" viewBox="0 0 384 512">
<path
d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
></path>
</svg>
</button>
</div>
</div>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingsComponent } from './settings.component';
describe('SettingsComponent', () => {
let component: SettingsComponent;
let fixture: ComponentFixture<SettingsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SettingsComponent]
})
.compileComponents();
fixture = TestBed.createComponent(SettingsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,56 @@
import {Component, OnInit} from '@angular/core';
import {NgIf} from '@angular/common';
import {Router} from '@angular/router';
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms';
@Component({
selector: 'app-settings',
imports: [
NgIf,
FormsModule,
ReactiveFormsModule
],
templateUrl: './settings.component.html',
styleUrl: './settings.component.css'
})
export class SettingsComponent implements OnInit{
constructor(private router: Router) {
}
showModalClose: boolean = false;
showModalChange: boolean = false;
nameForm: FormGroup
ngOnInit(): void {
this.nameForm = new FormGroup({
naam: new FormControl(localStorage.getItem('name'))
})
}
openModal() {
this.showModalClose = true;
}
closeModalClose() {
this.showModalClose = false;
}
closeGame() {
this.router.navigate([''])
localStorage.clear()
}
openModalChange() {
this.showModalChange = true;
}
closeModalChange() {
this.showModalChange = false;
}
changeName() {
localStorage.setItem('name', this.nameForm.get('naam').value)
this.closeModalChange()
}
}

View File

@@ -70,3 +70,21 @@ h1, h2, h3, h4{
background-size: 30px 30px; background-size: 30px 30px;
background-position: -5px -5px; background-position: -5px -5px;
} }
button{
font-weight: bold;
}
button:active{
background-color: #eb4f1b;
}
.container {
display: flex;
flex-direction: column;
justify-content: center; /* Verticaal centreren */
align-items: center; /* Horizontaal centreren */
height: 100vh; /* Volledige hoogte van het scherm */
padding: 20px;
max-width: 600px; /* Maximaliseer de breedte van de container */
margin: 0 auto;
}