Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map info page #906

Merged
merged 56 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1cbdcc5
feat(utils): mapHttpError rxjs operator
tsa96 Jan 18, 2024
2635c00
build(deps): remove ng-gallery component
tsa96 Feb 8, 2024
4c6a071
chore(front): update nx generator options for angular components
tsa96 Feb 8, 2024
b1b6e06
refactor(front): replace PrimeNG tab component with custom thing
tsa96 Jan 1, 2024
b2341cc
refactor(front): rename SortedMapCredits to GroupedMapCredits and mov…
tsa96 Feb 8, 2024
bd3fdcb
feat(front): grouped map leaderboard and suggestions util classes
tsa96 Feb 8, 2024
a84ad4f
refactor(front): use GroupedMapLeaderboards in MapListItem
tsa96 Feb 8, 2024
a2e26e9
fix(front): default values in GroupedMapCredits fields
tsa96 Feb 8, 2024
4d5bb03
refactor(front): support passing initial values to GroupedMapCredits …
tsa96 Feb 8, 2024
958e299
feat(front): RangePipe
tsa96 Jan 4, 2024
e220626
refactor(front): fix types on unsortedKeyvalue pipe
tsa96 Jan 4, 2024
1a2f48a
chore(front): remove run-info page
tsa96 Jan 23, 2024
68955f2
feat(front): use shared color vars in tailwind config
tsa96 Jan 11, 2024
f9c432d
chore(front): remove nonexistent vendorChunks property from frontend …
tsa96 Jan 17, 2024
1e9cd63
refactor(front): fix types on unsortedKeyvalue pipe AGAIN
tsa96 Jan 22, 2024
4bb845e
refactor(front): m-card styling and separate header
tsa96 Feb 8, 2024
88e411b
chore(front): move role-badges component directory from roles to role…
tsa96 Feb 3, 2024
c4a9fd5
style(front): remove newlines between function overloads in HttpService
tsa96 Feb 3, 2024
0f0f34c
feat(front): add primeng confirmdialog module
tsa96 Feb 3, 2024
bceaba1
refactor(front): rework outer layout so scrollbar is contained to mai…
tsa96 Feb 7, 2024
f595ecc
refactor(front): simplify styling of m-avatar
tsa96 Feb 8, 2024
1cb2b38
chore(front): remove deleted endpoints from LeaderboardsService
tsa96 Feb 8, 2024
014d1a3
refactor(front): general styling improvements
tsa96 Feb 8, 2024
584fecf
feat(front): paste from clipboard in file upload component, restyling
tsa96 Feb 8, 2024
c3f6609
fix(front): filter out empty string comments in MapLeaderboardSelection
tsa96 Feb 8, 2024
f7a567f
refactor(front): pull some tooltips out to dedicated components
tsa96 Feb 8, 2024
236e236
feat(front): m-user component
tsa96 Feb 8, 2024
3affaf1
chore(front): delete old map info/leaderboards stuff
tsa96 Feb 8, 2024
3de0be0
refactor(front): rework map-info and map-leaderboard pages
tsa96 Feb 8, 2024
aa2052a
feat(front): custom background switcher system
tsa96 Feb 8, 2024
814e227
feat(front): map submission map info sub-page
tsa96 Feb 8, 2024
3ca0a64
feat(front): map review components
tsa96 Feb 8, 2024
f9771b7
fix(back): don't allow setting needsResolving on an already resolved …
tsa96 Feb 9, 2024
bef980e
feat(front): add gamemode icons back
tsa96 Feb 8, 2024
f8383ce
refactor(front): beefier image validation in map sub form
tsa96 Feb 8, 2024
4e5782f
feat(front): dedicated file for PrimeNG styling tweaks
tsa96 Feb 8, 2024
bac7a93
feat(front): better textinput styling
tsa96 Feb 8, 2024
72208d5
feat(front): tailwind util classes
tsa96 Feb 8, 2024
a18a65b
refactor(front): new button and hyperlink styling
tsa96 Feb 8, 2024
7aac2bb
feat(tools): generate reviews in seed script
tsa96 Feb 8, 2024
57b56f5
refactor(tools): misc seed script fixes/improvements
tsa96 Feb 8, 2024
de22513
refactor(tools): don't support s3 script without minio stuff
tsa96 Feb 8, 2024
e11cf1c
refactor(tools): dont reset db by default in seed script
tsa96 Feb 8, 2024
9d58b7a
fix(tools): ignore some harmless errors in db seed script
tsa96 Feb 8, 2024
da9b08d
feat(front): split prefix from map name on map info page for fancy st…
tsa96 Feb 8, 2024
543948b
ci(meta): make lint job pull submods
tsa96 Feb 8, 2024
a833df2
refactor(front): hide review form on map info page if submitter
tsa96 Feb 8, 2024
42b642f
refactor(front): restyle map sub form for new styling system
tsa96 Jan 20, 2024
83fcea4
chore(front): bump styling submodule
tsa96 Feb 8, 2024
9a9cbe8
chore(front): remove map preview crap from submission form
tsa96 Feb 9, 2024
b84448d
feat(front): m-alert component
tsa96 Feb 9, 2024
4ecdd54
refactor(back): min length validator on placeholder suggestions
tsa96 Feb 9, 2024
5e28035
refactor(front): simplify sidenav width switcher
tsa96 Feb 9, 2024
02f7b1e
refactor(front): increase opacity of tailwind shadows
tsa96 Feb 9, 2024
e959199
fix(front): show add button instantly upon enter valid name into map …
tsa96 Feb 9, 2024
f1293b2
feat(front): change main background based on map submission form input
tsa96 Feb 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
submodules: 'true'
- uses: actions/cache@v3
with:
path: node_modules
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiProperty, PickType } from '@nestjs/swagger';
import { MapSubmissionPlaceholder } from '@momentum/constants';
import { JsonValue } from 'type-fest';
import { IsString, MaxLength } from 'class-validator';
import { IsString, MaxLength, MinLength } from 'class-validator';
import { MapCreditDto } from './map-credit.dto';

export class MapSubmissionPlaceholderDto
Expand All @@ -12,6 +12,7 @@ export class MapSubmissionPlaceholderDto

@ApiProperty()
@IsString()
@MinLength(3)
@MaxLength(32)
readonly alias: string;
}
4 changes: 4 additions & 0 deletions apps/backend/src/app/modules/map-review/map-review.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ export class MapReviewService {
throw new ForbiddenException();
}

if (review.resolved && body.needsResolving === false) {
throw new BadRequestException();
}

return DtoFactory(
MapReviewDto,
await this.db.mapReview.update({
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
Expand Down
57 changes: 39 additions & 18 deletions apps/frontend/src/app/app.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,50 @@
position: fixed;
z-index: -10;

background: url('/assets/images/BGDarkGray.png') no-repeat center center fixed;
background-size: cover;
}
& * {
position: absolute;
overflow: hidden;
width: 100%;
height: 100%;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
scrollbar-gutter: stable;
}

& .default {
background-image: url('/assets/images/BGDarkGray.png');
z-index: 0;
}

:root {
/* These vars need to be global so are set in styles.css.
layout.service.ts handles flipping between the underlying vars. */
--sidenav-width: var(--sidenav-width-wide);
& .custom {
z-index: 1;

filter: blur(4px) contrast(0.7) brightness(0.7);
transition-property: opacity;
transition-duration: 0.2s;
transition-timing-function: ease-in-out;
}
}

.chungus {
height: 100%;
width: 100%;
height: 100vh;
width: 100vw;

display: grid;
grid-template-areas:
'head head'
'side main';
grid-template-rows: 5rem 1fr;
grid-template-columns: var(--sidenav-width) 1fr;
/* Remember, 1fr is equiv to minmax(auto, 1fr), so anything that can't fit on
main will expand out to the right. Looks bad if this happens, but site is
still usable, and better that clip/squishing etc. */
grid-template-columns: auto 1fr;
}

m-header {
grid-area: head;
position: fixed;

display: block;
height: 5rem;
Expand All @@ -49,20 +68,22 @@ m-header {

m-sidenav {
grid-area: side;
position: sticky;
display: block;

height: 100%;
}

main {
grid-area: main;
display: block;

width: 100%;
max-width: 1800px;
margin: 3rem auto;
scroll-behavior: smooth;
overflow-y: scroll;

padding: 48px;
}

.scroll-container {
display: flex;
flex-direction: column;
padding: 0 64px;
margin: 0 auto;
max-width: 1800px;
}
19 changes: 17 additions & 2 deletions apps/frontend/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
<p-toast />
<div class="bg-image"></div>
<p-confirmDialog />
<div class="bg-image">
<!-- Two backgrounds are needed so we can smoothly transition between between
them - some browsers support it (not FF), but transitioning
background-image is not officially in the W3 spec. -->
<div
class="custom"
[ngStyle]="{
'background-image': customBackgroundImage,
opacity: customBackgroundOpacity
}"
></div>
<div class="default"></div>
</div>
<div class="chungus">
<m-header />
<m-sidenav />
<main>
<router-outlet />
<div class="scroll-container">
<router-outlet />
</div>
</main>
</div>
36 changes: 27 additions & 9 deletions apps/frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { ToastModule } from 'primeng/toast';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { NotificationsService } from './services/notifications.service';
import { IconComponent } from './icons';
import { HeaderComponent, SidenavComponent } from './components';
import { LayoutService, SidenavState } from './services/layout.service';
import { ConfirmDialogModule } from 'primeng/confirmdialog';
import { NgStyle } from '@angular/common';

@Component({
selector: 'm-app',
Expand All @@ -18,22 +18,40 @@ import { LayoutService, SidenavState } from './services/layout.service';
IconComponent,
RouterOutlet,
SidenavComponent,
ToastModule
ToastModule,
ConfirmDialogModule,
NgStyle
]
})
export class AppComponent {
protected state: SidenavState;

private readonly ngUnsub = new Subject<void>();
protected sideNavState: SidenavState;
protected customBackgroundImage = '';
protected customBackgroundOpacity = 0;

constructor(
private readonly notificationService: NotificationsService,
private readonly layoutService: LayoutService
) {
this.notificationService.inject();

this.layoutService.sidenavToggled
.pipe(takeUntil(this.ngUnsub))
.subscribe((state) => (this.state = state));
this.layoutService.sidenavToggled.subscribe(
(state) => (this.sideNavState = state)
);

this.layoutService.backgroundChange.subscribe((url: string | null) => {
if (url != null) {
this.customBackgroundImage = `url(${url})`;
if (this.layoutService.backgroundEnable.value) {
this.customBackgroundOpacity = 1;
}
} else {
// Don't unset the custom background, so we get a smooth transition
this.customBackgroundOpacity = 0;
}
});

this.layoutService.backgroundEnable.subscribe((enable: boolean) => {
this.customBackgroundOpacity = enable ? 1 : 0;
});
}
}
5 changes: 0 additions & 5 deletions apps/frontend/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ export const APP_ROUTES: Route[] = [
canActivate: [AuthGuard, RoleGuard],
data: { roles: [Role.ADMIN, Role.MODERATOR] }
},
{
path: 'runs',
loadChildren: () => import('./pages/runs/routes'),
canActivate: [AuthGuard]
},
{
path: '**',
component: NotFoundComponent
Expand Down
30 changes: 30 additions & 0 deletions apps/frontend/src/app/components/alert/alert.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Component, HostBinding } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IconComponent } from '../../icons';

@Component({
selector: 'm-alert',
standalone: true,
imports: [CommonModule, IconComponent],
template: ` <div class="prose max-w-none">
<ng-content />
</div>
<button
type="button"
class="absolute right-0 top-0 m-4 opacity-75 transition-opacity hover:opacity-100"
(click)="dismiss()"
>
<m-icon icon="close-thick" />
</button>`
})
export class AlertComponent {
@HostBinding('style.display')
protected display = 'block';

@HostBinding('class')
private readonly class = 'm-alert';

dismiss() {
this.display = 'none';
}
}
8 changes: 6 additions & 2 deletions apps/frontend/src/app/components/avatar/avatar.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { Component, Input } from '@angular/core';
import { STEAM_MISSING_AVATAR_URL } from '@momentum/constants';

/**
* Simple user avatar component.
* This has no height by default, you need to give it a specific value via
* CSS/Tailwind.
*/
@Component({
selector: 'm-avatar',
standalone: true,
template: `
<img [src]="url" class="aspect-square h-full rounded shadow-md" />
`,
styles: ':host { height: 1.5rem; }'
`
})
export class AvatarComponent {
@Input() url: string = STEAM_MISSING_AVATAR_URL;
Expand Down
11 changes: 11 additions & 0 deletions apps/frontend/src/app/components/card/card-body.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component, HostBinding } from '@angular/core';

@Component({
selector: 'm-card-body',
standalone: true,
styles: [':host {display: block;}'],
template: '<ng-content></ng-content>'
})
export class CardBodyComponent {
@HostBinding('class') class = 'm-card';
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NgClass } from '@angular/common';
<div class="flex items-end gap-2 mb-2" [ngClass]="{ 'items-end': !!title }">
@if (title) {
<p
class="flex-grow font-display font-bold opacity-80 leading-none ml-2"
class="flex-grow m-card-title"
[style]="'font-size: ' + titleSize + 'rem;'"
>
{{ title }}
Expand Down
7 changes: 4 additions & 3 deletions apps/frontend/src/app/components/card/card.component.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { Component, Input } from '@angular/core';
import { NgClass } from '@angular/common';
import { CardHeaderComponent } from './card-header.component';
import { CardBodyComponent } from './card-body.component';

@Component({
selector: 'm-card',
standalone: true,
imports: [CardHeaderComponent, NgClass],
imports: [CardHeaderComponent, NgClass, CardBodyComponent],
template: `
<m-card-header [title]="title" [titleSize]="titleSize">
<ng-content select="[header]"></ng-content>
</m-card-header>
<div class="m-card" [ngClass]="cardClass">
<m-card-body [ngClass]="cardClass">
<ng-content></ng-content>
</div>
</m-card-body>
`
})
export class CardComponent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Directive,
ElementRef,
HostBinding,
HostListener,
Input,
ViewChild
Expand Down Expand Up @@ -32,7 +33,16 @@ export abstract class AbstractFileUploadComponent<T extends File | File[]>
* Extensions that file select dialog will accept
* (use comma separation for multiple)
*/
@Input({ required: true }) accept = '';
@Input({ required: true }) acceptExtensions = '';

/**
* Mimetypes that the addFromClipboard feature will accept.
*
* 'Add from clipboard' button will be disabled if this is not provided.
*/
@Input() acceptMimeTypes: string[];

@Input() enableClipboard = false;

/**
* Name of the file type to use in "select a <type> string"
Expand All @@ -54,6 +64,16 @@ export abstract class AbstractFileUploadComponent<T extends File | File[]>
*/
@Input() icon: Icon = 'file-upload';

@HostBinding('class.dragging')
private get isDragging() {
return this.dragOverCounter > 0;
}

@HostBinding('class.hasSelection')
get getHasSelection() {
return this.hasSelection();
}

@ViewChild('fileInput') private input: ElementRef<HTMLInputElement>;

abstract onDrop(event: DragEvent): void;
Expand Down Expand Up @@ -92,6 +112,8 @@ export abstract class AbstractFileUploadComponent<T extends File | File[]>
this.dragOverCounter--;
}

abstract addFromClipboard(event: Event): Promise<void>;

removeDragData(event: DragEvent) {
this.dragOverCounter = 0;

Expand Down
Loading
Loading