Skip to content

Commit

Permalink
reformatage du code
Browse files Browse the repository at this point in the history
  • Loading branch information
abarhub committed Jun 19, 2022
1 parent 7755127 commit 4347f26
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 55 deletions.
7 changes: 4 additions & 3 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';

const routes: Routes = [];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
export class AppRoutingModule {
}
4 changes: 0 additions & 4 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,4 @@ <h1>Tic Tac Toe</h1>
</div>






</div>
6 changes: 3 additions & 3 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import {TestBed} from '@angular/core/testing';
import {RouterTestingModule} from '@angular/router/testing';
import {AppComponent} from './app.component';
import {Store, StoreModule} from '@ngrx/store';

describe('AppComponent', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import {nouveauJeaux, selectionneCase} from './store/jeux.actions';
import {Observable} from 'rxjs';
import {AppState} from './store/app.state';
import {CaseModel} from './model/case.model';
import {FormBuilder, FormGroup} from '@angular/forms';
import {ThemeModel} from './model/theme.model';

@Component({
selector: 'app-root',
Expand Down
35 changes: 18 additions & 17 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { StoreModule } from '@ngrx/store';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {StoreModule} from '@ngrx/store';
import {jeuxReducer} from './store/jeux.reducer';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { GridComponent } from './grid/grid.component';
import { GameStateComponent } from './game-state/game-state.component';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {GridComponent} from './grid/grid.component';
import {GameStateComponent} from './game-state/game-state.component';
import {ReactiveFormsModule} from '@angular/forms';
import { ThemeManagerComponent } from './theme-manager/theme-manager.component';
import {ThemeManagerComponent} from './theme-manager/theme-manager.component';

@NgModule({
declarations: [
Expand All @@ -18,14 +18,15 @@ import { ThemeManagerComponent } from './theme-manager/theme-manager.component';
GameStateComponent,
ThemeManagerComponent
],
imports: [
BrowserModule,
AppRoutingModule,
StoreModule.forRoot({jeux: jeuxReducer}, {}),
NgbModule,
ReactiveFormsModule
],
imports: [
BrowserModule,
AppRoutingModule,
StoreModule.forRoot({jeux: jeuxReducer}, {}),
NgbModule,
ReactiveFormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
export class AppModule {
}
11 changes: 8 additions & 3 deletions src/app/game-state/game-state.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@

<div class="m-2">
<div [ngClass]="{'joueurSelectionne': joueurCourant===joueurEnum.JOUEUR1&&!jeuxTermine, 'joueurGagnant': joueurGagnant===joueurEnum.JOUEUR1&&jeuxTermine}" class="joueur m-2 p-2 border rounded">Joueur 1 ({{joueursConstantes.JOUEUR1_AFFICHAGE}})</div>
<div [ngClass]="{'joueurSelectionne': joueurCourant===joueurEnum.JOUEUR2&&!jeuxTermine, 'joueurGagnant': joueurGagnant===joueurEnum.JOUEUR2&&jeuxTermine}" class="joueur m-2 p-2 border rounded">Joueur 2 ({{joueursConstantes.JOUEUR2_AFFICHAGE}})</div>
<div
[ngClass]="{'joueurSelectionne': joueurCourant===joueurEnum.JOUEUR1&&!jeuxTermine, 'joueurGagnant': joueurGagnant===joueurEnum.JOUEUR1&&jeuxTermine}"
class="joueur m-2 p-2 border rounded">Joueur 1 ({{joueursConstantes.JOUEUR1_AFFICHAGE}})
</div>
<div
[ngClass]="{'joueurSelectionne': joueurCourant===joueurEnum.JOUEUR2&&!jeuxTermine, 'joueurGagnant': joueurGagnant===joueurEnum.JOUEUR2&&jeuxTermine}"
class="joueur m-2 p-2 border rounded">Joueur 2 ({{joueursConstantes.JOUEUR2_AFFICHAGE}})
</div>
</div>

<div *ngIf="jeuxTermine" class="border border-success rounded mp-2 m-3">
Expand Down
4 changes: 1 addition & 3 deletions src/app/game-state/game-state.component.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


$couleur-formes2: var(--secondary-color);

.joueurSelectionne {
Expand All @@ -13,6 +11,6 @@ $couleur-formes2: var(--secondary-color);
}

.joueur {
border: 1px ;
border: 1px;
border-color: black;
}
8 changes: 4 additions & 4 deletions src/app/game-state/game-state.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';

import { GameStateComponent } from './game-state.component';
import {GameStateComponent} from './game-state.component';
import {Store, StoreModule} from '@ngrx/store';

describe('GameStateComponent', () => {
Expand All @@ -10,10 +10,10 @@ describe('GameStateComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GameStateComponent ],
declarations: [GameStateComponent],
imports: [StoreModule.forRoot({})]
})
.compileComponents();
.compileComponents();
store = TestBed.inject(Store);
});

Expand Down
19 changes: 9 additions & 10 deletions src/app/grid/grid.component.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

<table>
<tr>
<td (click)="selection(1,1)" class="border">{{get(0,0)}}</td>
<td (click)="selection(1,2)" class="border">{{get(0,1)}}</td>
<td (click)="selection(1,3)" class="border">{{get(0,2)}}</td>
<td (click)="selection(1,1)" class="border">{{get(0, 0)}}</td>
<td (click)="selection(1,2)" class="border">{{get(0, 1)}}</td>
<td (click)="selection(1,3)" class="border">{{get(0, 2)}}</td>
</tr>
<tr>
<td (click)="selection(2,1)" class="border">{{get(1,0)}}</td>
<td (click)="selection(2,2)" class="border">{{get(1,1)}}</td>
<td (click)="selection(2,3)" class="border">{{get(1,2)}}</td>
<td (click)="selection(2,1)" class="border">{{get(1, 0)}}</td>
<td (click)="selection(2,2)" class="border">{{get(1, 1)}}</td>
<td (click)="selection(2,3)" class="border">{{get(1, 2)}}</td>
</tr>
<tr>
<td (click)="selection(3,1)" class="border">{{get(2,0)}}</td>
<td (click)="selection(3,2)" class="border">{{get(2,1)}}</td>
<td (click)="selection(3,3)" class="border">{{get(2,2)}}</td>
<td (click)="selection(3,1)" class="border">{{get(2, 0)}}</td>
<td (click)="selection(3,2)" class="border">{{get(2, 1)}}</td>
<td (click)="selection(3,3)" class="border">{{get(2, 2)}}</td>
</tr>
</table>
1 change: 1 addition & 0 deletions src/app/grid/grid.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
table {
width: 12.75rem;
height: 12.75rem;

td {
width: 1.25rem;
height: 1.25rem;
Expand Down
8 changes: 4 additions & 4 deletions src/app/grid/grid.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';

import { GridComponent } from './grid.component';
import {GridComponent} from './grid.component';
import {Store, StoreModule} from '@ngrx/store';

describe('GridComponent', () => {
Expand All @@ -10,10 +10,10 @@ describe('GridComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GridComponent ],
declarations: [GridComponent],
imports: [StoreModule.forRoot({})]
})
.compileComponents();
.compileComponents();
store = TestBed.inject(Store);
});

Expand Down
2 changes: 1 addition & 1 deletion src/app/theme-manager/theme-manager.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {ComponentFixture, TestBed} from '@angular/core/testing';

import {ThemeManagerComponent} from './theme-manager.component';
import {Store, StoreModule} from '@ngrx/store';
import {FormsModule, ReactiveFormsModule, UntypedFormBuilder} from '@angular/forms';
import {ReactiveFormsModule, UntypedFormBuilder} from '@angular/forms';

describe('ThemeManagerComponent', () => {
let component: ThemeManagerComponent;
Expand Down
1 change: 0 additions & 1 deletion src/app/theme-manager/theme-manager.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {UntypedFormBuilder, UntypedFormGroup} from '@angular/forms';
import {ThemeModel} from '../model/theme.model';
import {Store} from '@ngrx/store';

@Component({
selector: 'app-theme-manager',
Expand Down

0 comments on commit 4347f26

Please sign in to comment.