From b770d2d4beae3b190e009e5730ccb5dab0c6702d Mon Sep 17 00:00:00 2001 From: Manuwai Korber Date: Mon, 29 Jan 2024 03:46:05 +0000 Subject: [PATCH] clean up conditional for HashRouter for private website --- .../react-app/src/app-private.tsx | 62 ------------------- lib/user-interface/react-app/src/app.tsx | 8 ++- .../src/components/app-configured.tsx | 4 +- 3 files changed, 6 insertions(+), 68 deletions(-) delete mode 100644 lib/user-interface/react-app/src/app-private.tsx diff --git a/lib/user-interface/react-app/src/app-private.tsx b/lib/user-interface/react-app/src/app-private.tsx deleted file mode 100644 index c89c6eee9..000000000 --- a/lib/user-interface/react-app/src/app-private.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import { HashRouter, Routes, Route, Outlet } from "react-router-dom"; -import GlobalHeader from "./components/global-header"; -import Dashboard from "./pages/rag/dashboard/dashboard"; -import NotFound from "./pages/not-found"; -import Workspaces from "./pages/rag/workspaces/workspaces"; -import Engines from "./pages/rag/engines/engines"; -import CreateWorkspace from "./pages/rag/create-workspace/create-workspace"; -import Embeddings from "./pages/rag/embeddings/embeddings"; -import CrossEncoders from "./pages/rag/cross-encoders/cross-encoders"; -import Welcome from "./pages/welcome"; -import Playground from "./pages/chatbot/playground/playground"; -import Models from "./pages/chatbot/models/models"; -import WorkspacePane from "./pages/rag/workspace/workspace"; -import SemanticSearch from "./pages/rag/semantic-search/semantic-search"; -import AddData from "./pages/rag/add-data/add-data"; -import "./styles/app.scss"; -import MultiChatPlayground from "./pages/chatbot/playground/multi-chat-playground"; -import RssFeed from "./pages/rag/workspace/rss-feed"; - -function App() { - - return ( -
- - -
 
-
- - } /> - }> - } /> - } /> - } /> - } /> - - }> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } - /> - } - /> - } /> - - } /> - -
-
-
- ); -} - -export default App; diff --git a/lib/user-interface/react-app/src/app.tsx b/lib/user-interface/react-app/src/app.tsx index 5f27f3d39..3933c4081 100644 --- a/lib/user-interface/react-app/src/app.tsx +++ b/lib/user-interface/react-app/src/app.tsx @@ -1,4 +1,4 @@ -import { BrowserRouter, Routes, Route, Outlet } from "react-router-dom"; +import { HashRouter, BrowserRouter, Routes, Route, Outlet } from "react-router-dom"; import GlobalHeader from "./components/global-header"; import Dashboard from "./pages/rag/dashboard/dashboard"; import NotFound from "./pages/not-found"; @@ -16,12 +16,14 @@ import AddData from "./pages/rag/add-data/add-data"; import "./styles/app.scss"; import MultiChatPlayground from "./pages/chatbot/playground/multi-chat-playground"; import RssFeed from "./pages/rag/workspace/rss-feed"; +import * as InfraConfig from '../../../../bin/config.json'; function App() { + const Router = InfraConfig.privateWebsite ? HashRouter : BrowserRouter; return (
- +
 
@@ -54,7 +56,7 @@ function App() { } />
-
+
); } diff --git a/lib/user-interface/react-app/src/components/app-configured.tsx b/lib/user-interface/react-app/src/components/app-configured.tsx index 4429f5985..636819a06 100644 --- a/lib/user-interface/react-app/src/components/app-configured.tsx +++ b/lib/user-interface/react-app/src/components/app-configured.tsx @@ -7,7 +7,6 @@ import { useTheme, } from "@aws-amplify/ui-react"; import App from "../app"; -import AppPrivate from "../app-private"; import { Amplify, Auth } from "aws-amplify"; import { AppConfig } from "../common/types"; import { AppContext } from "../common/app-context"; @@ -16,7 +15,6 @@ import { StorageHelper } from "../common/helpers/storage-helper"; import { Mode } from "@cloudscape-design/global-styles"; import "@aws-amplify/ui-react/styles.css"; import { CHATBOT_NAME } from "../common/constants"; -import * as InfraConfig from '../../../../../bin/config.json'; export default function AppConfigured() { const { tokens } = useTheme(); @@ -158,7 +156,7 @@ export default function AppConfigured() { }, }} > - {InfraConfig.privateWebsite ? : } +