Skip to content

Commit

Permalink
Merge pull request #737 from bounswe/fe/serra-final
Browse files Browse the repository at this point in the history
FE | Completing leaderboard and adding rankings
  • Loading branch information
HaticeSerraHakyemez authored Dec 25, 2023
2 parents b3d6b55 + eb00683 commit d5150e7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/frontend/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const routes: Routes = [
component: PollViewComponent,
},
{
path: 'app-tag-page/:tagName',
path: 'app-tag-page/:tagName/:tagId',
component: TagPageComponent,
},
{
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/app/poll/poll.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
margin-right: 5px;
border: none;
"
(click)="goToTag(tag.name)"
(click)="goToTag(tag.name, tag.id)"
>
{{ tag?.name }}
</button>
Expand Down
6 changes: 3 additions & 3 deletions app/frontend/src/app/poll/poll.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class PollComponent {
this.options = response.options

this.due_date = this.formatDateTime(new Date(response.due_date))
this.vote_count = response.vote_count
this.vote_count = response.voteCount

this.creator = response.creator

Expand Down Expand Up @@ -285,8 +285,8 @@ export class PollComponent {
this.isLikedBy = !this.isLikedBy //change the like status
}

goToTag(tagName: string) {
this.router.navigate(['/app-tag-page', tagName])
goToTag(tagName: string, tagId: string) {
this.router.navigate(['/app-tag-page', tagName, tagId])
}

navigateToProfile(user: string) {
Expand Down
4 changes: 3 additions & 1 deletion app/frontend/src/app/tag-page/tag-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { AuthService } from '../auth.service'
export class TagPageComponent {
polls!: any[]
tagName: string = ''
tagId: string = ''
leaders!: any[]

constructor(
Expand All @@ -33,7 +34,8 @@ export class TagPageComponent {
},
)

this.http.get('http://34.105.66.254:1923/ranking/',this.authService.getHeaders()).subscribe(
this.tagId = params['tagId']
this.http.get('http://34.105.66.254:1923/ranking/'+this.tagId,this.authService.getHeaders()).subscribe(
(response: any) => {
this.leaders = response.ranking
console.log(this.leaders)
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/app/tags-bar/tags-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h2 style="border-bottom: 2px solid #000; margin-bottom: 5px">Tags</h2>
class="button"
*ngFor="let tag of tags; let i = index"
[ngStyle]="{ 'background-color': getColor(i) }"
(click)="goToTag(tag.name)"
(click)="goToTag(tag.name,tag.id)"
>
{{ tag.name }}
</button>
Expand Down
4 changes: 2 additions & 2 deletions app/frontend/src/app/tags-bar/tags-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class TagsBarComponent {
return this.colors[i % this.colors.length]
}

goToTag(tagName: string) {
this.router.navigate(['/app-tag-page', tagName])
goToTag(tagName: string,tagId: string) {
this.router.navigate(['/app-tag-page', tagName, tagId])
}
}

0 comments on commit d5150e7

Please sign in to comment.