mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Update to Angular 14
This commit is contained in:
@@ -3,6 +3,7 @@ import { compact } from 'lodash';
|
||||
import { AdminModel } from '../../services/adminModel';
|
||||
import { Account, GeneralSettings } from '../../../common/adminInterfaces';
|
||||
import { Subscription } from '../../../common/interfaces';
|
||||
import { isErrorAlike } from '../../../common/utils';
|
||||
|
||||
interface Field {
|
||||
key: keyof GeneralSettings;
|
||||
@@ -65,7 +66,7 @@ export class AdminOther implements OnInit, OnDestroy {
|
||||
compact(this.suspiciousPonies!.split(/\n/g).map(x => x.trim())).map(x => JSON.parse(x));
|
||||
this.model.updateSettings({ suspiciousPonies: this.suspiciousPonies });
|
||||
} catch (e) {
|
||||
this.suspiciousPoniesError = e.message;
|
||||
this.suspiciousPoniesError = isErrorAlike(e) ? e.message : 'Unknown error';
|
||||
}
|
||||
}
|
||||
resetSuspiciousPonies() {
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
OAuthProvider, EntitiesEditorInfo, FriendData, PalettePonyInfo, HiddenPlayer
|
||||
} from '../../common/interfaces';
|
||||
import { createDefaultPony, syncLockedPonyInfo, mockPaletteManager } from '../../common/ponyInfo';
|
||||
import { removeById, observableToPromise, delay, computeFriendsCRC } from '../../common/utils';
|
||||
import { removeById, observableToPromise, delay, computeFriendsCRC, isErrorAlike } from '../../common/utils';
|
||||
import { isMod, getSupporterInviteLimit, getCharacterLimit } from '../../common/accountUtils';
|
||||
import {
|
||||
NAME_ERROR, ACCESS_ERROR, CHARACTER_SAVING_ERROR, NOT_AUTHENTICATED_ERROR, OFFLINE_ERROR, PROTECTION_ERROR
|
||||
@@ -277,7 +277,7 @@ export class Model {
|
||||
return { ponyInfo, ...pony };
|
||||
} catch (e) {
|
||||
this.errorReporter.reportError(e, { ponyInfo: pony.info });
|
||||
this.errorReporter.reportError('Pony info reading error', { originalError: e.message, ponyInfo: pony.info });
|
||||
this.errorReporter.reportError('Pony info reading error', { originalError: isErrorAlike(e) ? e.message: '', ponyInfo: pony.info });
|
||||
throw new Error('Error while reading pony info');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, Input, ViewChild, ElementRef } from '@angular/core';
|
||||
import { Component, Input, ViewChild, ElementRef, TemplateRef } from '@angular/core';
|
||||
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
|
||||
import { ButtonAction } from '../../../common/interfaces';
|
||||
import { PonyTownGame } from '../../../client/game';
|
||||
@@ -16,7 +16,7 @@ import { faCog } from '../../../client/icons';
|
||||
})
|
||||
export class ActionBar {
|
||||
@ViewChild('scroller', { static: true }) scroller!: ElementRef;
|
||||
@ViewChild('actionsModal', { static: true }) actionsModal!: ElementRef;
|
||||
@ViewChild('actionsModal', { static: true }) actionsModal!: TemplateRef<any>;
|
||||
@Input() blurred = false;
|
||||
readonly cogIcon = faCog;
|
||||
activeAction: ButtonAction | undefined = undefined;
|
||||
@@ -68,7 +68,7 @@ export class ActionBar {
|
||||
const settings = { ...this.settings.account, actions: serializeActions(this.actions) };
|
||||
this.settings.saveAccountSettings(settings);
|
||||
}
|
||||
scroll(e: MouseWheelEvent) {
|
||||
scroll(e: WheelEvent) {
|
||||
if (e.deltaY) {
|
||||
const delta = e.deltaY > 0 ? 1 : -1;
|
||||
this.scroller.nativeElement.scrollLeft += delta * 20;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, Input } from '@angular/core';
|
||||
import { fill } from 'lodash';
|
||||
import { PonyInfo } from '../../../common/interfaces';
|
||||
import { CM_SIZE } from '../../../common/constants';
|
||||
import { faTrash, faEraser, faPaintBrush, faEyeDropper } from '../../../client/icons';
|
||||
import { faTrash, faEraser, faPaintbrush, faEyeDropper } from '../../../client/icons';
|
||||
|
||||
export interface ButtMarkEditorState {
|
||||
brushType: string;
|
||||
@@ -17,7 +17,7 @@ export class ButtMarkEditor {
|
||||
readonly trashIcon = faTrash;
|
||||
readonly eraserIcon = faEraser;
|
||||
readonly eyeDropperIcon = faEyeDropper;
|
||||
readonly paintBrushIcon = faPaintBrush;
|
||||
readonly paintBrushIcon = faPaintbrush;
|
||||
readonly cmSize = CM_SIZE;
|
||||
@Input() info!: PonyInfo;
|
||||
@Input() state = {
|
||||
|
||||
@@ -18,12 +18,12 @@ export interface AgDragOptions {
|
||||
|
||||
export function handleDrag(element: HTMLElement, emit: (event: AgDragEvent) => void, options: AgDragOptions = {}) {
|
||||
// typeof PointerEvent !== 'undefined'
|
||||
const eventSets = window.navigator.pointerEnabled ? [
|
||||
const eventSets = 'pointerEnabled' in window.navigator && (window.navigator as any).pointerEnabled ? [
|
||||
{ down: 'pointerdown', move: 'pointermove', up: 'pointerup' }, // , up2: 'pointercancel' },
|
||||
] : [
|
||||
{ down: 'mousedown', move: 'mousemove', up: 'mouseup' },
|
||||
{ down: 'touchstart', move: 'touchmove', up: 'touchend', up2: 'touchcancel' },
|
||||
];
|
||||
{ down: 'mousedown', move: 'mousemove', up: 'mouseup' },
|
||||
{ down: 'touchstart', move: 'touchmove', up: 'touchend', up2: 'touchcancel' },
|
||||
];
|
||||
const emptyRect = { left: 0, top: 0 };
|
||||
let rect = emptyRect;
|
||||
let scrollLeft = 0;
|
||||
|
||||
@@ -156,7 +156,7 @@ export class PlayBox implements OnInit {
|
||||
this.gameService.leave('Cancelled joining');
|
||||
}
|
||||
reload() {
|
||||
location.reload(true);
|
||||
location.reload();
|
||||
}
|
||||
hardReload() {
|
||||
hardReload();
|
||||
|
||||
Reference in New Issue
Block a user