mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-12 05:51:34 +08:00
34 lines
972 B
JavaScript
34 lines
972 B
JavaScript
![]() |
import ButtonWidget from "./button_widget.js";
|
||
|
import protectedSessionHolder from "../services/protected_session_holder.js";
|
||
|
|
||
|
export default class ProtectedSessionStatusWidget extends ButtonWidget {
|
||
|
constructor() {
|
||
|
super();
|
||
|
}
|
||
|
|
||
|
doRender() {
|
||
|
this.updateOptions();
|
||
|
|
||
|
super.doRender();
|
||
|
}
|
||
|
|
||
|
updateOptions() {
|
||
|
this.options.icon = protectedSessionHolder.isProtectedSessionAvailable()
|
||
|
? "bx-shield-quarter"
|
||
|
: "bx-log-in";
|
||
|
|
||
|
this.options.title = protectedSessionHolder.isProtectedSessionAvailable()
|
||
|
? "Protected session is active. Click to leave protected session."
|
||
|
: "Click to enter protected session";
|
||
|
|
||
|
this.options.command = protectedSessionHolder.isProtectedSessionAvailable()
|
||
|
? "leaveProtectedSession"
|
||
|
: "enterProtectedSession";
|
||
|
}
|
||
|
|
||
|
protectedSessionStartedEvent() {
|
||
|
this.updateOptions();
|
||
|
this.refreshIcon();
|
||
|
}
|
||
|
}
|