import { state, property } from "lit/decorators.js";
import { msg, localized, str } from "@lit/localize";
import type { AuthState } from "../../utils/AuthService";
import LiteElement, { html } from "../../utils/LiteElement";
import { Profile } from "./types";
/**
* Usage:
* ```ts
*
* ```
*/
@localized()
export class BrowserProfilesList extends LiteElement {
@property({ type: Object })
authState!: AuthState;
@property({ type: String })
archiveId!: string;
@property({ type: Boolean })
showCreateDialog = false;
@state()
browserProfiles?: Profile[];
@state()
private isCreateFormVisible = false;
@state()
private isSubmitting = false;
/** Profile creation only works in Chromium-based browsers */
private isBrowserCompatible = Boolean((window as any).chrome);
firstUpdated() {
if (this.showCreateDialog) {
this.isCreateFormVisible = true;
}
this.fetchBrowserProfiles();
}
render() {
return html`${msg("New Browser Profile")}
${this.renderTable()}
(this.isCreateFormVisible = true)}
@sl-after-hide=${() => (this.isCreateFormVisible = false)}
>
${this.isBrowserCompatible
? ""
: html`
${msg(
"Browser profile creation is only supported in Chromium-based browsers (such as Chrome) at this time. Please re-open this page in a compatible browser to proceed."
)}