feat: add hasAnyBottomPanel prop to PreviewMapShell to allow custom bottom panel positioning

This commit is contained in:
taDuc
2026-06-10 13:03:53 +07:00
parent 82eca6ee1a
commit 32dabcff9c
2 changed files with 5 additions and 1 deletions
@@ -61,6 +61,7 @@ type Props = {
sidebarHeight?: number; sidebarHeight?: number;
onSidebarHeightChange?: (height: number) => void; onSidebarHeightChange?: (height: number) => void;
showViewportControls?: boolean; showViewportControls?: boolean;
hasAnyBottomPanel?: boolean;
}; };
export default function PreviewMapShell({ export default function PreviewMapShell({
@@ -109,6 +110,7 @@ export default function PreviewMapShell({
sidebarHeight, sidebarHeight,
onSidebarHeightChange, onSidebarHeightChange,
showViewportControls = true, showViewportControls = true,
hasAnyBottomPanel = false,
}: Props) { }: Props) {
const [isMenuOpen, setIsMenuOpen] = useState(false); const [isMenuOpen, setIsMenuOpen] = useState(false);
const [avatarUrl, setAvatarUrl] = useState<string | null>(null); const [avatarUrl, setAvatarUrl] = useState<string | null>(null);
@@ -138,6 +140,7 @@ export default function PreviewMapShell({
}, []); }, []);
const hasWikiSidebar = Boolean(activeEntity || activeWiki || isWikiLoading || wikiError); const hasWikiSidebar = Boolean(activeEntity || activeWiki || isWikiLoading || wikiError);
const hasBottomPanel = hasWikiSidebar || hasAnyBottomPanel;
const menuOptionStyle: CSSProperties = { const menuOptionStyle: CSSProperties = {
width: 46, width: 46,
@@ -213,7 +216,7 @@ export default function PreviewMapShell({
style={{ style={{
position: "absolute", position: "absolute",
top: 10, top: 10,
bottom: (hasWikiSidebar && isMobileOrTablet) ? `${(sidebarHeight || 400) + 20}px` : 20, bottom: (hasBottomPanel && isMobileOrTablet) ? `${(sidebarHeight || 400) + 20}px` : 20,
left: 18, left: 18,
zIndex: 18, zIndex: 18,
display: "flex", display: "flex",
@@ -840,6 +840,7 @@ export default function PublicPreviewClientPage({
showViewportControls={false} showViewportControls={false}
onPlayPreviewReplay={activeReplay && replayMode === "idle" ? handlePlayPreviewReplay : undefined} onPlayPreviewReplay={activeReplay && replayMode === "idle" ? handlePlayPreviewReplay : undefined}
timelineDisabled={replayMode !== "idle"} timelineDisabled={replayMode !== "idle"}
hasAnyBottomPanel={isWikiChooserOpen || isGeometryChooserOpen}
overlay={ overlay={
replayMode !== "idle" ? ( replayMode !== "idle" ? (
<ReplayPreviewOverlay <ReplayPreviewOverlay