-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from turecross321/contests
Contests
- Loading branch information
Showing
32 changed files
with
1,582 additions
and
92 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {GameVersion} from "../game-version"; | ||
|
||
export interface ContestEditRequest { | ||
contestId: string | undefined; | ||
organizerId: string | undefined; | ||
|
||
startDate: Date | undefined; | ||
endDate: Date | undefined; | ||
|
||
contestTag: string | undefined; | ||
bannerUrl: string | undefined; | ||
|
||
contestTitle: string | undefined; | ||
contestSummary: string | undefined; | ||
contestDetails: string | undefined; | ||
contestTheme: string | undefined; | ||
|
||
templateLevelId: number | undefined; | ||
|
||
allowedGames: GameVersion[] | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {User} from "../user"; | ||
import {GameVersion} from "../game-version"; | ||
import {Level} from "../level"; | ||
|
||
export interface Contest { | ||
contestId: string; | ||
organizer: User; | ||
|
||
creationDate: Date; | ||
startDate: Date; | ||
endDate: Date; | ||
|
||
contestTag: string; | ||
bannerUrl: string; | ||
|
||
contestTitle: string; | ||
contestSummary: string; | ||
contestDetails: string; | ||
contestTheme: string; | ||
|
||
templateLevel: Level | ||
allowedGames: GameVersion[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 17 additions & 6 deletions
23
src/app/components/category-preview/category-preview.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
<page-header class="text-2xl"> | ||
<fa-icon [icon]="Icon" *ngIf="Icon" class="pr-1.5"></fa-icon> | ||
<a [routerLink]="'/levels/' + Route" class="cursor-pointer pr-1">{{Title}}</a> | ||
<span-gentle>({{Total}} total)</span-gentle> | ||
<fa-icon *ngIf="icon" [icon]="icon" class="pr-1.5"></fa-icon> | ||
<a [queryParams]="params" [routerLink]="'/levels/' + route" class="cursor-pointer pr-1">{{ title }}</a> | ||
<span-gentle>({{ total }} total)</span-gentle> | ||
</page-header> | ||
|
||
<carousel> | ||
<level-preview *ngFor="let level of Levels" [level]="level"></level-preview> | ||
</carousel> | ||
<ng-container [ngSwitch]="type"> | ||
<carousel *ngSwitchCase="CategoryPreviewType.Carousel"> | ||
<level-preview *ngFor="let level of levels" [level]="level"></level-preview> | ||
</carousel> | ||
|
||
<div *ngSwitchCase="CategoryPreviewType.List" class="flex flex-col gap-2"> | ||
<container *ngFor="let level of levels"> | ||
<level-preview [level]="level"></level-preview> | ||
</container> | ||
<secondary-button *ngIf="levels && total > levels.length" [queryParams]="params" | ||
[routerLink]="'/levels/' + route" | ||
text="More"></secondary-button> | ||
</div> | ||
</ng-container> |
20 changes: 15 additions & 5 deletions
20
src/app/components/category-preview/category-preview.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
import {Component, Input} from '@angular/core'; | ||
import {Level} from "../../api/types/level"; | ||
import {IconProp} from "@fortawesome/fontawesome-svg-core"; | ||
import {Params} from "@angular/router"; | ||
|
||
@Component({ | ||
selector: 'category-preview', | ||
templateUrl: './category-preview.component.html' | ||
}) | ||
export class CategoryPreviewComponent { | ||
@Input("icon") public Icon: IconProp | undefined; | ||
@Input("category-title") public Title: string = ""; | ||
@Input("route") public Route: string = ""; | ||
@Input("levels") public Levels: Level[] | undefined; | ||
@Input("total") public Total: number = 0; | ||
@Input("icon") public icon: IconProp | undefined; | ||
@Input("category-title") public title: string = ""; | ||
@Input("route") public route: string = ""; | ||
@Input("levels") public levels: Level[] | undefined; | ||
@Input("total") public total: number = 0; | ||
@Input("query") public params: Params = {}; | ||
@Input("type") public type: CategoryPreviewType = CategoryPreviewType.Carousel; | ||
|
||
protected readonly CategoryPreviewType = CategoryPreviewType; | ||
} | ||
|
||
export enum CategoryPreviewType { | ||
Carousel, | ||
List | ||
} |
1 change: 1 addition & 0 deletions
1
src/app/components/contest-banner/contest-banner.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<img [src]="contest.bannerUrl" class="w-full rounded-md"> |
10 changes: 10 additions & 0 deletions
10
src/app/components/contest-banner/contest-banner.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {Component, Input} from '@angular/core'; | ||
import {Contest} from "../../api/types/contests/contest"; | ||
|
||
@Component({ | ||
selector: 'app-contest-banner', | ||
templateUrl: './contest-banner.component.html' | ||
}) | ||
export class ContestBannerComponent { | ||
@Input({required: true}) contest: Contest = null!; | ||
} |
4 changes: 4 additions & 0 deletions
4
src/app/components/contest-label/contest-label.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<p class="text-2xl font-bold">{{ title }}</p> | ||
<div class="h-full w-full items-center flex justify-center"> | ||
<p class="text-xl py-5 px-8 text-center">{{ text }}</p> | ||
</div> |
10 changes: 10 additions & 0 deletions
10
src/app/components/contest-label/contest-label.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {Component, Input} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-contest-label', | ||
templateUrl: './contest-label.component.html', | ||
}) | ||
export class ContestLabelComponent { | ||
@Input() title: string = "Title"; | ||
@Input() text: string = "Text"; | ||
} |
5 changes: 5 additions & 0 deletions
5
src/app/components/contest-preview/contest-preview.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<container *ngIf="_contest"> | ||
<div class="flex items-center gap-x-2 bg p-4"> | ||
<app-contest-banner [contest]="_contest"></app-contest-banner> | ||
</div> | ||
</container> |
15 changes: 15 additions & 0 deletions
15
src/app/components/contest-preview/contest-preview.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Component, Input} from '@angular/core'; | ||
import {Level} from "../../api/types/level"; | ||
import {Contest} from "../../api/types/contests/contest"; | ||
|
||
@Component({ | ||
selector: 'app-contest-preview', | ||
templateUrl: './contest-preview.component.html', | ||
}) | ||
export class ContestPreviewComponent { | ||
_contest: Contest | undefined = undefined; | ||
@Input() | ||
set contest(contest: Contest | undefined) { | ||
this._contest = contest; | ||
} | ||
} |
Oops, something went wrong.