From 4e5c4cddd8df2bbdd803ec72898850d5e5c76b91 Mon Sep 17 00:00:00 2001 From: Fernando Carril Date: Fri, 13 Sep 2024 17:53:05 +0200 Subject: [PATCH 1/2] [OPIK-86] Change layout for get started page --- .../layout/EmptyLayout/EmptyLayout.tsx | 35 +++++++++++++++++ .../layout/WorkspaceGuard/WorkspaceGuard.tsx | 7 ++-- .../src/plugins/comet/GetStartedPage.tsx | 38 +++++++++++-------- apps/opik-frontend/src/router.tsx | 17 ++++++--- 4 files changed, 71 insertions(+), 26 deletions(-) create mode 100644 apps/opik-frontend/src/components/layout/EmptyLayout/EmptyLayout.tsx diff --git a/apps/opik-frontend/src/components/layout/EmptyLayout/EmptyLayout.tsx b/apps/opik-frontend/src/components/layout/EmptyLayout/EmptyLayout.tsx new file mode 100644 index 0000000000..465d409817 --- /dev/null +++ b/apps/opik-frontend/src/components/layout/EmptyLayout/EmptyLayout.tsx @@ -0,0 +1,35 @@ +import useAppStore from "@/store/AppStore"; +import usePluginsStore from "@/store/PluginsStore"; +import { Link, Outlet } from "@tanstack/react-router"; +import imageLogoUrl from "/images/logo_and_text.png"; + +const PageLayout = () => { + const UserMenu = usePluginsStore((state) => state.UserMenu); + const workspaceName = useAppStore((state) => state.activeWorkspaceName); + + return ( +
+
+ + +
+ +
+
+
+ ); +}; + +export default PageLayout; diff --git a/apps/opik-frontend/src/components/layout/WorkspaceGuard/WorkspaceGuard.tsx b/apps/opik-frontend/src/components/layout/WorkspaceGuard/WorkspaceGuard.tsx index 6873283c2d..0cf2b52687 100644 --- a/apps/opik-frontend/src/components/layout/WorkspaceGuard/WorkspaceGuard.tsx +++ b/apps/opik-frontend/src/components/layout/WorkspaceGuard/WorkspaceGuard.tsx @@ -1,9 +1,8 @@ -import React from "react"; -import usePluginStore from "@/store/PluginsStore"; import PageLayout from "@/components/layout/PageLayout/PageLayout"; import Loader from "@/components/shared/Loader/Loader"; +import usePluginStore from "@/store/PluginsStore"; -const WorkspaceGuard = () => { +const WorkspaceGuard = ({ Layout = PageLayout }) => { const WorkspacePreloader = usePluginStore( (state) => state.WorkspacePreloader, ); @@ -14,7 +13,7 @@ const WorkspaceGuard = () => { return ( - + ); }; diff --git a/apps/opik-frontend/src/plugins/comet/GetStartedPage.tsx b/apps/opik-frontend/src/plugins/comet/GetStartedPage.tsx index 40d9ffa316..5e6a94ab7e 100644 --- a/apps/opik-frontend/src/plugins/comet/GetStartedPage.tsx +++ b/apps/opik-frontend/src/plugins/comet/GetStartedPage.tsx @@ -30,7 +30,7 @@ const GetStartedPage = () => { const apiKey = user.apiKeys[0]; return ( -
+
@@ -119,24 +119,30 @@ const GetStartedPage = () => {
Explore demo project
- -
- -
-
-
- SQL query generation -
-
- Perform a text to SQL query generation using LangChain. - The example uses the Chinook database of a music store, - with both employee, customer and invoice data. -
+ + +
+
+
+ SQL query generation
-
- Explore project +
+ Perform a text to SQL query generation using LangChain. The + example uses the Chinook database of a music store, with + both employee, customer and invoice data.
+
+ Explore project +
diff --git a/apps/opik-frontend/src/router.tsx b/apps/opik-frontend/src/router.tsx index 5a7525c718..625520dfaf 100644 --- a/apps/opik-frontend/src/router.tsx +++ b/apps/opik-frontend/src/router.tsx @@ -20,6 +20,8 @@ import ProjectPage from "@/components/pages/ProjectPage/ProjectPage"; import ProjectsPage from "@/components/pages/ProjectsPage/ProjectsPage"; import TracesPage from "@/components/pages/TracesPage/TracesPage"; import WorkspacePage from "@/components/pages/WorkspacePage/WorkspacePage"; +import PageLayout from "./components/layout/PageLayout/PageLayout"; +import EmptyLayout from "./components/layout/EmptyLayout/EmptyLayout"; const TanStackRouterDevtools = process.env.NODE_ENV === "production" @@ -47,6 +49,12 @@ const workspaceGuardRoute = createRoute({ component: WorkspaceGuard, }); +const workspaceGuardEmptyLayoutRoute = createRoute({ + id: "workspaceGuardEmptyLayout", + getParentRoute: () => rootRoute, + component: () => , +}); + const homeRoute = createRoute({ path: "/", getParentRoute: () => workspaceGuardRoute, @@ -61,12 +69,9 @@ const workspaceRoute = createRoute({ // ----------- get started const getStartedRoute = createRoute({ - path: "/get-started", - getParentRoute: () => workspaceRoute, + path: "/$workspaceName/get-started", + getParentRoute: () => workspaceGuardEmptyLayoutRoute, component: GetStartedPage, - staticData: { - title: "Get Started", - }, }); // ----------- projects @@ -173,10 +178,10 @@ const datasetItemsRoute = createRoute({ }); const routeTree = rootRoute.addChildren([ + workspaceGuardEmptyLayoutRoute.addChildren([getStartedRoute]), workspaceGuardRoute.addChildren([ homeRoute, workspaceRoute.addChildren([ - getStartedRoute, projectsRoute.addChildren([ projectsListRoute, projectRoute.addChildren([tracesRoute]), From e9d190686511917d9c2bc74bec28859927ac56a9 Mon Sep 17 00:00:00 2001 From: Fernando Carril Date: Fri, 13 Sep 2024 18:06:53 +0200 Subject: [PATCH 2/2] Fix ESLint --- apps/opik-frontend/src/router.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/opik-frontend/src/router.tsx b/apps/opik-frontend/src/router.tsx index 625520dfaf..7c17dbf414 100644 --- a/apps/opik-frontend/src/router.tsx +++ b/apps/opik-frontend/src/router.tsx @@ -20,7 +20,6 @@ import ProjectPage from "@/components/pages/ProjectPage/ProjectPage"; import ProjectsPage from "@/components/pages/ProjectsPage/ProjectsPage"; import TracesPage from "@/components/pages/TracesPage/TracesPage"; import WorkspacePage from "@/components/pages/WorkspacePage/WorkspacePage"; -import PageLayout from "./components/layout/PageLayout/PageLayout"; import EmptyLayout from "./components/layout/EmptyLayout/EmptyLayout"; const TanStackRouterDevtools =