Skip to content

Commit

Permalink
Add frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHerve-Descours-Cabaud committed Apr 6, 2024
1 parent 5a882cd commit f7da538
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@media screen and (max-width: 1200px) {
.button-container {
display: flex;
justify-content: center;
align-items: center;
width: 80%;
flex-direction: column;
}

.button {
width: calc(20vh - 20px); /* Largeur égale à la hauteur pour faire un bouton carré */
height: calc(20vh - 20px); /* Hauteur égale à la largeur pour faire un bouton carré */
transform: translate(3vh);
background-color: #1a237e; /* Légèrement plus clair que le fond */
border: 10px solid #3949ab; /* Bordure */
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
cursor: pointer;
margin: 10px; /* Espacement entre les boutons */
font-size: 8vh;
}
}

@media screen and (min-width: 1200px) {
.button-container {
display: flex;
justify-content: center;
align-items: center;
width: 80%;
}

.button {
width: calc(20vw - 20px); /* Largeur égale à la hauteur pour faire un bouton carré */
height: calc(20vw - 20px); /* Hauteur égale à la largeur pour faire un bouton carré */
transform: translate(10vw, 0);
background-color: #1a237e; /* Légèrement plus clair que le fond */
border: 10px solid #3949ab; /* Bordure */
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
cursor: pointer;
margin: 10px; /* Espacement entre les boutons */
font-size: 8vw;
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<!--
<div>
<input type="text" [(ngModel)]="value">
<input type="button" value="send" (click)="click()">
</div>
<input type="button" value="send" (click)="click()">
</div>
-->
<div class="button-container">
<div class="button" (click)="click('0')">💡</div>
<div class="button" (click)="click('1')">🫀</div>
<div class="button" (click)="click('2')">👻</div>
<div class="button" (click)="click('3')">🪟</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { UrlService } from '../url.service';
})
export class AsymetricUnityTemplateComponent implements OnInit {

value: string | undefined;
variable: string | undefined;

constructor(private route: ActivatedRoute, private urlService: UrlService) {
Expand All @@ -21,12 +20,8 @@ export class AsymetricUnityTemplateComponent implements OnInit {
});
}

onInputChange(event: Event) {
// Accéder à la valeur du champ de texte à partir de l'événement
this.value = (event.target as HTMLInputElement).value;
}

click() {
this.urlService.publish(this.variable, this.value).subscribe((x)=>console.log)
click(value: string) {
this.urlService.publish(this.variable, value).subscribe((x)=>console.log)
}
}
5 changes: 3 additions & 2 deletions frontend/src/app/url.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { HttpClient } from '@angular/common/http';
})
export class UrlService {

url:string = "https://asyncunitycore.multiplayertournamentonline.fr/"
url:string = "https://sgj2024.multiplayertournamentonline.fr/"
constructor(private http: HttpClient) { }

public publish(id: string |undefined, value: string|undefined) {
return this.http.post(this.url+id+"/publish", {message: value})
//return this.http.post(this.url+id+"/publish", {message: value})
return this.http.post(this.url+"publish", {message: value})
}
}
10 changes: 10 additions & 0 deletions frontend/src/styles.css
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
/* You can add global styles to this file, and also import other style files */
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #1a237e; /* Fond sobre */
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

0 comments on commit f7da538

Please sign in to comment.