Skip to content

Commit 8c67588

Browse files
committed
Added the card catalog compoenents
1 parent 0ed63e5 commit 8c67588

File tree

11 files changed

+85
-15
lines changed

11 files changed

+85
-15
lines changed

backend/gamelink/src/main/java/urjc/gamelink/Configuration/Security/WebSecurityConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import org.springframework.beans.factory.annotation.Autowired;
77
import org.springframework.context.annotation.Bean;
88
import org.springframework.context.annotation.Configuration;
9-
import org.springframework.http.HttpStatus;
109
import org.springframework.security.config.Customizer;
1110
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
1211
import org.springframework.security.config.annotation.web.builders.HttpSecurity;

backend/gamelink/src/main/java/urjc/gamelink/Controllers/GamelinkWebController.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
import org.springframework.beans.factory.annotation.Autowired;
1515
import org.springframework.core.io.ClassPathResource;
1616
import org.springframework.core.io.Resource;
17-
import org.springframework.core.io.UrlResource;
1817
import org.springframework.data.domain.Page;
1918
import org.springframework.data.domain.PageRequest;
20-
import org.springframework.http.HttpStatus;
2119
import org.springframework.security.crypto.password.PasswordEncoder;
2220
import org.springframework.stereotype.Controller;
2321
import org.springframework.ui.Model;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package urjc.gamelink.Controllers;
2+
3+
import org.springframework.web.bind.annotation.GetMapping;
4+
5+
public class SPAController {
6+
7+
@GetMapping("/**/{path:[^\\.]*}")
8+
public String redirect() {
9+
return "forward:/";
10+
}
11+
12+
}

frontend/proxy.conf.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"/api/*": {
3+
"target": "https://127.0.0.1:8443/",
4+
"secure": false,
5+
"logLevel": "debug",
6+
"changeOrigin": true
7+
}
8+
}

frontend/src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ import { ShowNewsComponent } from './components/news/showNews.component';
1616
import { HomeComponent } from './components/home/home.component';
1717
import { UserProfile } from './components/user/userProfile.component';
1818
import { VideogameCardComponent } from './components/videogame/videogame-card.component';
19+
import { VideogameCatalogComponent } from './components/videogame/videogame-catalog.component';
20+
1921

2022

2123

2224

2325
@NgModule({
24-
declarations: [AppComponent, LoginComponent, HeadComponent, NewsComponent, NavBarComponent, FooterComponent, NewsTemplateComponent, ShowNewsComponent, HomeComponent, UserProfile,VideogameCardComponent],
26+
declarations: [AppComponent, LoginComponent, HeadComponent, NewsComponent, NavBarComponent, FooterComponent, NewsTemplateComponent,VideogameCatalogComponent, ShowNewsComponent, HomeComponent, UserProfile,VideogameCardComponent],
2527
imports: [BrowserModule, FormsModule, HttpClientModule, routing, FormsModule,RouterModule],
2628
bootstrap: [AppComponent]
2729
})

frontend/src/app/app.routing.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Routes, RouterModule } from '@angular/router';
2+
import { VideogameDetailComponent } from './components/videogame/videogame-detail.component';
3+
import { VideogameCatalogComponent } from './components/videogame/videogame-catalog.component';
24

35
import { HomeComponent } from './components/home/home.component';
46

@@ -7,6 +9,7 @@ import { HomeComponent } from './components/home/home.component';
79

810
const appRoutes = [
911
{ path: 'home', component: HomeComponent },
12+
{ path: 'videogamecatalog', component: VideogameCatalogComponent },
1013
{ path: '', redirectTo: 'home', pathMatch: 'full' }
1114

1215
]

frontend/src/app/components/videogame/videogame-card.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div *ngIf="videogame" class="col-lg-4 mb-5">
1+
<div class="col-lg-4 mb-5">
22
<div class="card h-100 shadow border-0">
33

44

@@ -23,4 +23,5 @@
2323
</div>
2424
</div>
2525
</div>
26-
</div>
26+
</div>
27+
<ng-template #elseBlock><p>Content to render when condition is false</p></ng-template>

frontend/src/app/components/videogame/videogame-card.component.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Component } from '@angular/core';
2-
import { Router,ActivatedRoute } from '@angular/router';
1+
import { Component,Input } from '@angular/core';
2+
import { Router } from '@angular/router';
33
import { Videogame } from 'src/app/models/videogame.model';
44
import { VideogameService } from 'src/app/services/videogame.service';
55

@@ -10,17 +10,22 @@ import { VideogameService } from 'src/app/services/videogame.service';
1010

1111
export class VideogameCardComponent{
1212

13+
@Input() id!:number;
14+
1315
videogame!: Videogame;
1416

15-
constructor(private router: Router, activatedRoute: ActivatedRoute, public videogameService: VideogameService){
17+
constructor(private router: Router, public videogameService: VideogameService){
1618

17-
const id = activatedRoute.snapshot.params['id'];
18-
videogameService.getVideogame(id).subscribe(
19-
videogame => this.videogame = videogame,
19+
20+
}
21+
22+
ngOnInit() {
23+
this.videogameService.getVideogame(this.id).subscribe(
24+
videogame => this.videogame = videogame as Videogame,
2025
error => console.error(error)
26+
2127
)
22-
}
23-
28+
}
2429
gotoVideogame() {
2530
this.router.navigate(['/videogame/'+this.videogame.id]);
2631
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
<section class="py-5">
4+
<div class="container px-5">
5+
<h2 class="fw-bolder fs-5 mb-4">Videojuegos</h2>
6+
<div id="moreImages" class="row gx-5">
7+
<videogame-card [id]='selectid'></videogame-card>
8+
</div>
9+
<div class="text-end mb-5 mb-xl-0">
10+
<a class="text-decoration-none" href="#!">
11+
<!--will show next-->
12+
<!-- puts the variable created in execution ?page and associates it with next page which is getNumber + 1 (that is, we add 1)-->
13+
<!--in request of we put (page, 3) and page will be equal to 1 for what I just explained above, this is how it is done-->
14+
<a id="moreVideogamesButton" class="btn btn-secondary button">
15+
<i class="fa fa-eye"></i> Más contenido
16+
</a>
17+
<div id="loader"></div>
18+
</a>
19+
</div>
20+
</div>
21+
</section>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Component } from '@angular/core';
2+
import { Router,ActivatedRoute } from '@angular/router';
3+
import { VideogameService } from 'src/app/services/videogame.service';
4+
5+
@Component({
6+
selector: 'videogame-catalog',
7+
templateUrl: './videogame-catalog.component.html'
8+
})
9+
10+
export class VideogameCatalogComponent{
11+
12+
selectid:number = 29;
13+
14+
constructor(private router: Router, activatedRoute: ActivatedRoute, public videogameService: VideogameService){
15+
16+
}
17+
18+
19+
20+
21+
}

0 commit comments

Comments
 (0)