Files
Trilium/src/public/app/widgets/buttons/protected_session_status.js

28 lines
938 B
JavaScript
Raw Normal View History

import { t } from "../../services/i18n.js";
2021-05-24 22:29:49 +02:00
import protectedSessionHolder from "../../services/protected_session_holder.js";
2022-12-02 16:46:14 +01:00
import CommandButtonWidget from "./command_button.js";
2021-05-18 22:14:35 +02:00
2022-12-02 16:46:14 +01:00
export default class ProtectedSessionStatusWidget extends CommandButtonWidget {
constructor() {
super();
2021-05-18 22:14:35 +02:00
2022-12-11 13:20:37 +01:00
this.class("launcher-button");
2022-12-02 16:46:14 +01:00
this.settings.icon = () => protectedSessionHolder.isProtectedSessionAvailable()
2021-09-29 13:19:21 +02:00
? "bx-check-shield"
: "bx-shield-quarter";
2021-05-18 22:14:35 +02:00
2022-12-02 16:46:14 +01:00
this.settings.title = () => protectedSessionHolder.isProtectedSessionAvailable()
? t("protected_session_status.active")
: t("protected_session_status.inactive");
2021-05-18 22:14:35 +02:00
2022-12-02 16:46:14 +01:00
this.settings.command = () => protectedSessionHolder.isProtectedSessionAvailable()
2021-05-18 22:14:35 +02:00
? "leaveProtectedSession"
: "enterProtectedSession";
}
protectedSessionStartedEvent() {
this.refreshIcon();
}
}