调整环境变量参数,支持项目切换
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import type { Metadata } from "next";
|
||||
import { cookies } from "next/headers";
|
||||
import React, { Suspense } from "react";
|
||||
import { RefineContext } from "../_refine_context";
|
||||
|
||||
import authOptions from "@app/api/auth/[...nextauth]/options";
|
||||
import { Header } from "@components/header";
|
||||
@@ -33,22 +32,20 @@ export default async function MainLayout({
|
||||
}
|
||||
|
||||
return (
|
||||
<RefineContext defaultMode={defaultMode}>
|
||||
<ThemedLayout
|
||||
Header={Header}
|
||||
Title={Title}
|
||||
childrenBoxProps={{
|
||||
sx: { height: "100vh", p: 0 },
|
||||
}}
|
||||
containerBoxProps={{
|
||||
sx: { height: "100%" },
|
||||
}}
|
||||
>
|
||||
<Suspense fallback={<MapSkeleton />}>
|
||||
{children}
|
||||
</Suspense>
|
||||
</ThemedLayout>
|
||||
</RefineContext>
|
||||
<ThemedLayout
|
||||
Header={Header}
|
||||
Title={Title}
|
||||
childrenBoxProps={{
|
||||
sx: { height: "100vh", p: 0 },
|
||||
}}
|
||||
containerBoxProps={{
|
||||
sx: { height: "100%" },
|
||||
}}
|
||||
>
|
||||
<Suspense fallback={<MapSkeleton />}>
|
||||
{children}
|
||||
</Suspense>
|
||||
</ThemedLayout>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
import { config } from "@/config/config";
|
||||
import { useProject } from "@/contexts/ProjectContext";
|
||||
import React, {
|
||||
createContext,
|
||||
useContext,
|
||||
@@ -97,7 +98,10 @@ export const useData = () => {
|
||||
const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
|
||||
const MAP_EXTENT = config.MAP_EXTENT as [number, number, number, number];
|
||||
const MAP_URL = config.MAP_URL;
|
||||
const MAP_WORKSPACE = config.MAP_WORKSPACE;
|
||||
|
||||
// Subscribe to project context for workspace changes
|
||||
const project = useProject();
|
||||
const MAP_WORKSPACE = project?.workspace || config.MAP_WORKSPACE;
|
||||
const MAP_VIEW_STORAGE_KEY = `${MAP_WORKSPACE}_map_view`; // 持久化 key
|
||||
|
||||
const mapRef = useRef<HTMLDivElement | null>(null);
|
||||
@@ -763,7 +767,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
|
||||
map.dispose();
|
||||
deck.finalize();
|
||||
};
|
||||
}, []);
|
||||
}, [MAP_WORKSPACE, MAP_EXTENT]);
|
||||
|
||||
// 当数据变化时,更新 deck.gl 图层
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user