Skip to content

Commit

Permalink
tmp(front): disable types on map submission so angular will compile
Browse files Browse the repository at this point in the history
Working on this very soon, just need this to pass CI checks for now.
  • Loading branch information
tsa96 committed Nov 1, 2023
1 parent 29bc5fe commit 8d3d5d2
Showing 1 changed file with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,13 @@ import { NbToastrService } from '@nebular/theme';
import { mergeMap } from 'rxjs/operators';
import { forkJoin } from 'rxjs';
import { FileUploadType } from './file-upload/file-upload.component';
import {
MMap,
MapImage,
MapZoneTrigger,
CreateMapTrack,
CreateMapZone
} from '@momentum/constants';
import { LocalUserService, MapsService } from '@momentum/frontend/data';
import {
MapCreditType,
Gamemode,
GamemodeName,
ZoneType
} from '@momentum/constants';
import { PartialDeep } from 'type-fest';
import { GamemodePrefix } from '@momentum/constants';
import { SortedMapCredits } from '../map-credits/sorted-map-credits.class';
import { vdf } from 'fast-vdf';
Expand Down Expand Up @@ -60,11 +52,12 @@ export class MapUploadFormComponent implements OnInit, AfterViewInit {
isUploadingMap: boolean;
credits: SortedMapCredits;
inferredMapType: boolean;
mapPreview: PartialDeep<
{ map: MMap; images: MapImage[] },
{ recurseIntoArrays: true }
>;
tracks: CreateMapTrack[];
mapPreview: any;
// mapPreview: PartialDeep<
// { map: MMap; images: MapImage[] },
// { recurseIntoArrays: true }
// >;
tracks: any; // CreateMapTrack[];

filesForm: FormGroup = this.fb.group({
map: ['', [Validators.required, Validators.pattern(/.+(\.bsp)/)]],
Expand All @@ -76,7 +69,7 @@ export class MapUploadFormComponent implements OnInit, AfterViewInit {
});
infoForm: FormGroup = this.fb.group({
name: ['', [Validators.required, Validators.maxLength(32)]],
type: [Gamemode.UNKNOWN, Validators.required],
type: [Gamemode.AHOP, Validators.required],
description: ['', [Validators.required, Validators.maxLength(1000)]],
creationDate: [
new Date(),
Expand Down Expand Up @@ -149,7 +142,7 @@ export class MapUploadFormComponent implements OnInit, AfterViewInit {
this.name.patchValue(nameVal);

// Infer type from name
let type = Gamemode.UNKNOWN;
let type = Gamemode.AHOP;
for (const [key, prefix] of GamemodePrefix.entries()) {
if (nameVal.startsWith(prefix + '_')) {
type = key;
Expand All @@ -158,7 +151,7 @@ export class MapUploadFormComponent implements OnInit, AfterViewInit {
}

this.type.patchValue(type);
this.inferredMapType = type !== Gamemode.UNKNOWN;
this.inferredMapType = false; // TODO: was this: type !== Gamemode.UNKNOWN;
}

async onAvatarFileSelected(file: File) {
Expand All @@ -175,8 +168,9 @@ export class MapUploadFormComponent implements OnInit, AfterViewInit {
trackNum: number,
// TODO: For 0.10.0 zon files, make types for the parsed kv1/kv3 file
track: object
): CreateMapTrack {
const trackReturn: CreateMapTrack = {
) {
//: CreateMapTrack {
const trackReturn: any /* CreateMapTrack */ = {
trackNum: trackNum,
numZones: 0,
isLinear: false,
Expand All @@ -190,7 +184,7 @@ export class MapUploadFormComponent implements OnInit, AfterViewInit {
const zoneNum = Number(zone);
trackReturn.numZones = Math.max(trackReturn.numZones, zoneNum);

const zoneMdl: CreateMapZone = {
const zoneMdl: any /* CreateMapZone */ = {
zoneNum: zoneNum,
triggers: []
};
Expand All @@ -200,7 +194,7 @@ export class MapUploadFormComponent implements OnInit, AfterViewInit {
if (!trackReturn.isLinear)
trackReturn.isLinear =
triggerObj.type === ZoneType.ZONE_CHECKPOINT;
const zoneMdlTrigger: PartialDeep<MapZoneTrigger> = {
const zoneMdlTrigger: any = {
type: triggerObj.type,
points: triggerObj.points,
pointsZPos: triggerObj.pointsZPos,
Expand All @@ -210,7 +204,7 @@ export class MapUploadFormComponent implements OnInit, AfterViewInit {
zoneMdlTrigger.zoneProps = {
properties: triggerObj.zoneProps.properties
};
zoneMdl.triggers.push(zoneMdlTrigger as MapZoneTrigger);
zoneMdl.triggers.push(zoneMdlTrigger as any);
}
}
// Old code - wtf is this?
Expand Down Expand Up @@ -366,7 +360,7 @@ export class MapUploadFormComponent implements OnInit, AfterViewInit {
map: {
id: 0,
name: this.name.value,
type: this.type.value,
type: this.type.value as any, // TODO
hash: 'not-important-yet',
status: 0,
info: {
Expand Down

0 comments on commit 8d3d5d2

Please sign in to comment.