chore(react/type_widgets): bring back launch bar fixed effect

This commit is contained in:
Elian Doran 2025-10-05 16:42:58 +03:00
parent c209a699ea
commit d90043e586
No known key found for this signature in database
2 changed files with 8 additions and 5 deletions

View file

@ -8,6 +8,7 @@ import { TypeWidgetProps } from "./type_widgets/type_widget";
import "./NoteDetail.css"; import "./NoteDetail.css";
import attributes from "../services/attributes"; import attributes from "../services/attributes";
import { ExtendedNoteType, TYPE_MAPPINGS } from "./note_types"; import { ExtendedNoteType, TYPE_MAPPINGS } from "./note_types";
import { isMobile } from "../services/utils";
/** /**
* The note detail is in charge of rendering the content of a note, by determining its type (e.g. text, code) and using the appropriate view widget. * The note detail is in charge of rendering the content of a note, by determining its type (e.g. text, code) and using the appropriate view widget.
@ -95,6 +96,13 @@ export default function NoteDetail() {
} }
}); });
// Fixed tree for launch bar config on mobile.
useEffect(() => {
if (!isMobile) return;
const hasFixedTree = noteContext?.hoistedNoteId === "_lbMobileRoot";
document.body.classList.toggle("force-fixed-tree", hasFixedTree);
}, [ note ]);
return ( return (
<div class={`note-detail ${isFullHeight ? "full-height" : ""}`}> <div class={`note-detail ${isFullHeight ? "full-height" : ""}`}>
{Object.entries(noteTypesToRender.current).map(([ type, Element ]) => { {Object.entries(noteTypesToRender.current).map(([ type, Element ]) => {

View file

@ -120,11 +120,6 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
} }
this.checkFullHeight(); this.checkFullHeight();
if (utils.isMobile()) {
const hasFixedTree = this.noteContext?.hoistedNoteId === "_lbMobileRoot";
$("body").toggleClass("force-fixed-tree", hasFixedTree);
}
} }
/** /**