Files
OpenFrontIO/src/client/components/NotLoggedInWarning.ts
T
VariableVince de92a2721a Fix for v30: do not show "Not logged in" on flag modal on CrazyGames (#3631)
## Description:

Fix for v30 and main.

Do not show "Not logged in" on the FlagInputModal in CrazyGames, since
our own login should not work there. It was added in
https://github.com/openfrontio/OpenFrontIO/pull/3521 in v30 so this fix
is needed for production too.

<img width="1415" height="797" alt="image"
src="https://github.com/user-attachments/assets/ef839e08-827d-4eea-b5aa-8aca6357ad07"
/>

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

tryout33
2026-04-10 12:35:46 -07:00

50 lines
1.3 KiB
TypeScript

import { LitElement, html } from "lit";
import { customElement, state } from "lit/decorators.js";
import { UserMeResponse } from "../../core/ApiSchemas";
import { hasLinkedAccount } from "../Api";
@customElement("not-logged-in-warning")
export class NotLoggedInWarning extends LitElement {
@state() private linked = false;
private _onUserMe = (event: CustomEvent<UserMeResponse | false>) => {
this.linked = hasLinkedAccount(event.detail);
};
createRenderRoot() {
return this;
}
connectedCallback() {
super.connectedCallback();
document.addEventListener(
"userMeResponse",
this._onUserMe as EventListener,
);
}
disconnectedCallback() {
super.disconnectedCallback();
document.removeEventListener(
"userMeResponse",
this._onUserMe as EventListener,
);
}
render() {
if (this.linked) return html``;
return html`<div class="no-crazygames flex items-center">
<button
class="px-4 py-2 text-xs font-bold uppercase tracking-wider transition-colors duration-200 rounded-lg bg-red-500/20 text-red-400 border border-red-500/30 cursor-pointer hover:bg-red-500/30"
data-i18n="common.not_logged_in"
@click=${() => {
window.showPage?.("page-account");
}}
>
Not logged in
</button>
</div>`;
}
}