mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-03 11:50:48 +00:00
If user has no linked account, ensure that their skin is set to default
This commit is contained in:
@@ -5,6 +5,7 @@ import { UserMeResponse } from "../core/ApiSchemas";
|
||||
import { ColorPalette, Cosmetics, Pattern } from "../core/CosmeticSchemas";
|
||||
import { UserSettings } from "../core/game/UserSettings";
|
||||
import { PlayerPattern } from "../core/Schemas";
|
||||
import { hasLinkedAccount } from "./Api";
|
||||
import "./components/Difficulties";
|
||||
import "./components/PatternButton";
|
||||
import { renderPatternPreview } from "./components/PatternButton";
|
||||
@@ -55,7 +56,7 @@ export class TerritoryPatternsModal extends LitElement {
|
||||
}
|
||||
|
||||
async onUserMe(userMeResponse: UserMeResponse | false) {
|
||||
if (userMeResponse === false) {
|
||||
if (!hasLinkedAccount(userMeResponse)) {
|
||||
this.userSettings.setSelectedPatternName(undefined);
|
||||
this.selectedPattern = null;
|
||||
this.selectedColor = null;
|
||||
@@ -134,7 +135,7 @@ export class TerritoryPatternsModal extends LitElement {
|
||||
return html`
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="flex justify-center">
|
||||
${this.isLoggedIn()
|
||||
${hasLinkedAccount(this.userMeResponse)
|
||||
? this.renderMySkinsButton()
|
||||
: this.renderNotLoggedInWarning()}
|
||||
</div>
|
||||
@@ -290,14 +291,4 @@ export class TerritoryPatternsModal extends LitElement {
|
||||
render(preview, this.previewButton);
|
||||
this.requestUpdate();
|
||||
}
|
||||
|
||||
private isLoggedIn(): boolean {
|
||||
if (this.userMeResponse === false) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
this.userMeResponse.user.discord !== undefined ||
|
||||
this.userMeResponse.user.email !== undefined
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user