mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-25 06:05:52 +02:00
Archive commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
.modal-header.d-none.d-sm-block
|
||||
h4.modal-title(labelledBy=".modal")
|
||||
| Invites
|
||||
|
||||
.modal-body
|
||||
p
|
||||
| Using #[b {{invites.length}}] out of #[b {{inviteLimit}}] invites.
|
||||
.list-group
|
||||
.list-group-item(*ngFor="let i of invites" [class.text-muted]="!i.active")
|
||||
.d-flex.justify-content-between
|
||||
.d-flex.align-items-center
|
||||
portrait-box([pony]="i.pony" size="small" [noBorder]="true" style="margin: -5px 10px -5px -10px;")
|
||||
b {{i.name}}
|
||||
span.text-muted.ml-1(*ngIf="!i.active") (inactive)
|
||||
button.btn.btn-xs.btn-outline-danger Cancel
|
||||
|
||||
.alert.alert-danger.mt-3.mb-0(*ngIf="error")
|
||||
| {{error}}
|
||||
|
||||
.modal-footer.justify-content-end
|
||||
button.btn.btn-outline-secondary((click)="close.emit()")
|
||||
| Close
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Component, Output, EventEmitter, OnInit } from '@angular/core';
|
||||
import { toPalette } from '../../../common/ponyInfo';
|
||||
import { decompressPonyString } from '../../../common/compressPony';
|
||||
import { PonyTownGame } from '../../../client/game';
|
||||
import { Action, SupporterInvite, PalettePonyInfo } from '../../../common/interfaces';
|
||||
import { removeItem } from '../../../common/utils';
|
||||
import { Model } from '../../services/model';
|
||||
|
||||
@Component({
|
||||
selector: 'invites-modal',
|
||||
templateUrl: 'invites-modal.pug',
|
||||
})
|
||||
export class InvitesModal implements OnInit {
|
||||
@Output() close = new EventEmitter();
|
||||
invites: (SupporterInvite & { pony: PalettePonyInfo; })[] = [];
|
||||
error?: string;
|
||||
constructor(private model: Model, private game: PonyTownGame) {
|
||||
}
|
||||
get inviteLimit() {
|
||||
return this.model.supporterInviteLimit;
|
||||
}
|
||||
ngOnInit() {
|
||||
this.game.send(server => server.getInvites())!
|
||||
.then(invites => invites.map(i => ({ ...i, pony: toPalette(decompressPonyString(i.info)) })))
|
||||
.then(invites => this.invites = invites);
|
||||
}
|
||||
remove(invite: SupporterInvite) {
|
||||
this.error = undefined;
|
||||
this.game.send(server => server.actionParam(Action.CancelSupporterInvite, invite.id));
|
||||
removeItem(this.invites, invite);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user