2025-11-06 00:45:16 +02:00
|
|
|
import "./read_only_note_info_bar.css";
|
2025-11-05 23:52:38 +02:00
|
|
|
import { t } from "../services/i18n";
|
2025-11-06 00:45:16 +02:00
|
|
|
import { useIsNoteReadOnly, useNoteContext, useTriliumEvent } from "./react/hooks"
|
2025-11-05 23:52:38 +02:00
|
|
|
import Button from "./react/Button";
|
|
|
|
|
|
|
|
|
|
export default function ReadOnlyNoteInfoBar() {
|
2025-11-06 00:45:16 +02:00
|
|
|
const {isReadOnly, enableEditing} = useIsNoteReadOnly();
|
2025-11-05 23:52:38 +02:00
|
|
|
const {note} = useNoteContext();
|
|
|
|
|
|
|
|
|
|
return <div class={`read-only-note-info-bar-widget ${(isReadOnly) ? " visible" : ""}`}>
|
|
|
|
|
{isReadOnly && <>
|
|
|
|
|
{note?.isLabelTruthy("readOnly") ? (
|
|
|
|
|
<div>{t("read-only-info.read-only-note")}</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div>
|
|
|
|
|
{t("read-only-info.auto-read-only-note")}
|
|
|
|
|
|
|
|
|
|
<a class="tn-link"
|
|
|
|
|
href="https://docs.triliumnotes.org/user-guide/concepts/notes/read-only-notes#automatic-read-only-mode">
|
|
|
|
|
|
|
|
|
|
{t("read-only-info.auto-read-only-learn-more")}
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
2025-11-06 00:22:00 +02:00
|
|
|
<Button text={t("read-only-info.edit-note")}
|
|
|
|
|
icon="bx-pencil" onClick={() => enableEditing()} />
|
2025-11-05 23:52:38 +02:00
|
|
|
</>}
|
|
|
|
|
</div>;
|
|
|
|
|
}
|