diff --git a/src/routes/chrome.tsx b/src/routes/chrome.tsx new file mode 100644 index 0000000..a7ccb7c --- /dev/null +++ b/src/routes/chrome.tsx @@ -0,0 +1,35 @@ +import { Route, Routes } from "react-router-dom" +import OptionIndex from "./option-index" +import OptionSettings from "./option-settings" +import OptionModal from "./option-settings-model" +import OptionPrompt from "./option-settings-prompt" +import OptionOllamaSettings from "./options-settings-ollama" +import OptionShare from "./option-settings-share" +import OptionKnowledgeBase from "./option-settings-knowledge" +import OptionAbout from "./option-settings-about" +import SidepanelChat from "./sidepanel-chat" +import SidepanelSettings from "./sidepanel-settings" + +export const OptionRoutingChrome = () => { + return ( + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + ) +} + +export const SidepanelRoutingChrome = () => { + return ( + + } /> + } /> + + ) +} diff --git a/src/routes/firefox.tsx b/src/routes/firefox.tsx new file mode 100644 index 0000000..1281a72 --- /dev/null +++ b/src/routes/firefox.tsx @@ -0,0 +1,39 @@ +// this is a temp fix for firefox +// because chunks getting 4mb+ and it's not working on firefox addon store +import { lazy } from "react" +import { Route , Routes} from "react-router-dom" + +const SidepanelChat = lazy(() => import("./sidepanel-chat")) +const SidepanelSettings = lazy(() => import("./sidepanel-settings")) +const OptionIndex = lazy(() => import("./option-index")) +const OptionModal = lazy(() => import("./option-settings-model")) +const OptionPrompt = lazy(() => import("./option-settings-prompt")) +const OptionOllamaSettings = lazy(() => import("./options-settings-ollama")) +const OptionSettings = lazy(() => import("./option-settings")) +const OptionShare = lazy(() => import("./option-settings-share")) +const OptionKnowledgeBase = lazy(() => import("./option-settings-knowledge")) +const OptionAbout = lazy(() => import("./option-settings-about")) + +export const OptionRoutingFirefox = () => { + return ( + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + ) +} + +export const SidepanelRoutingFirefox = () => { + return ( + + } /> + } /> + + ) +} diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 87581f8..4d5459f 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -1,16 +1,9 @@ -import { Route, Routes } from "react-router-dom" -import { SidepanelChat } from "./sidepanel-chat" -import { useDarkMode } from "~/hooks/useDarkmode" -import { SidepanelSettings } from "./sidepanel-settings" -import { OptionIndex } from "./option-index" -import { OptionModal } from "./option-settings-model" -import { OptionPrompt } from "./option-settings-prompt" -import { OptionOllamaSettings } from "./options-settings-ollama" -import { OptionSettings } from "./option-settings" -import { OptionShare } from "./option-settings-share" -import { OptionKnowledgeBase } from "./option-settings-knowledge" -import { OptionAbout } from "./option-settings-about" +import { Suspense } from "react" import { useTranslation } from "react-i18next" +import { useDarkMode } from "~/hooks/useDarkmode" +import { Skeleton } from "antd" +import { OptionRoutingChrome, SidepanelRoutingChrome } from "./chrome" +import { OptionRoutingFirefox, SidepanelRoutingFirefox } from "./firefox" export const OptionRouting = () => { const { mode } = useDarkMode() @@ -21,16 +14,13 @@ export const OptionRouting = () => { className={`${mode === "dark" ? "dark" : "light"} ${ i18n.language === "ru" ? "onest" : "inter" }`}> - - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - + }> + {import.meta.env.BROWSER === "chrome" ? ( + + ) : ( + + )} + ) } @@ -44,10 +34,13 @@ export const SidepanelRouting = () => { className={`${mode === "dark" ? "dark" : "light"} ${ i18n.language === "ru" ? "onest" : "inter" }`}> - - } /> - } /> - + }> + {import.meta.env.BROWSER === "chrome" ? ( + + ) : ( + + )} + ) } diff --git a/src/routes/option-index.tsx b/src/routes/option-index.tsx index 6178d0a..776bcce 100644 --- a/src/routes/option-index.tsx +++ b/src/routes/option-index.tsx @@ -1,10 +1,12 @@ import OptionLayout from "~/components/Layouts/Layout" import { Playground } from "~/components/Option/Playground/Playground" -export const OptionIndex = () => { + const OptionIndex = () => { return ( ) } + +export default OptionIndex \ No newline at end of file diff --git a/src/routes/option-settings-about.tsx b/src/routes/option-settings-about.tsx index 982f1ea..9d00233 100644 --- a/src/routes/option-settings-about.tsx +++ b/src/routes/option-settings-about.tsx @@ -2,7 +2,7 @@ import { SettingsLayout } from "~/components/Layouts/SettingsOptionLayout" import OptionLayout from "~/components/Layouts/Layout" import { AboutApp } from "@/components/Option/Settings/about" -export const OptionAbout = () => { +const OptionAbout = () => { return ( @@ -11,3 +11,5 @@ export const OptionAbout = () => { ) } + +export default OptionAbout diff --git a/src/routes/option-settings-knowledge.tsx b/src/routes/option-settings-knowledge.tsx index aedddd3..504035c 100644 --- a/src/routes/option-settings-knowledge.tsx +++ b/src/routes/option-settings-knowledge.tsx @@ -2,7 +2,7 @@ import { SettingsLayout } from "~/components/Layouts/SettingsOptionLayout" import OptionLayout from "~/components/Layouts/Layout" import { KnowledgeSettings } from "@/components/Option/Knowledge" -export const OptionKnowledgeBase = () => { + const OptionKnowledgeBase = () => { return ( @@ -11,3 +11,5 @@ export const OptionKnowledgeBase = () => { ) } + +export default OptionKnowledgeBase \ No newline at end of file diff --git a/src/routes/option-settings-model.tsx b/src/routes/option-settings-model.tsx index 99264d9..456e1dd 100644 --- a/src/routes/option-settings-model.tsx +++ b/src/routes/option-settings-model.tsx @@ -2,7 +2,7 @@ import { SettingsLayout } from "~/components/Layouts/SettingsOptionLayout" import OptionLayout from "~/components/Layouts/Layout" import { ModelsBody } from "~/components/Option/Models" -export const OptionModal = () => { +const OptionModal = () => { return ( @@ -11,3 +11,5 @@ export const OptionModal = () => { ) } + +export default OptionModal diff --git a/src/routes/option-settings-prompt.tsx b/src/routes/option-settings-prompt.tsx index f7a35cf..f796403 100644 --- a/src/routes/option-settings-prompt.tsx +++ b/src/routes/option-settings-prompt.tsx @@ -2,7 +2,7 @@ import { SettingsLayout } from "~/components/Layouts/SettingsOptionLayout" import OptionLayout from "~/components/Layouts/Layout" import { PromptBody } from "~/components/Option/Prompt" -export const OptionPrompt = () => { + const OptionPrompt = () => { return ( @@ -11,3 +11,5 @@ export const OptionPrompt = () => { ) } + +export default OptionPrompt \ No newline at end of file diff --git a/src/routes/option-settings-share.tsx b/src/routes/option-settings-share.tsx index dcd0da0..3ca7a30 100644 --- a/src/routes/option-settings-share.tsx +++ b/src/routes/option-settings-share.tsx @@ -2,7 +2,7 @@ import { SettingsLayout } from "~/components/Layouts/SettingsOptionLayout" import OptionLayout from "~/components/Layouts/Layout" import { OptionShareBody } from "~/components/Option/Share" -export const OptionShare = () => { + const OptionShare = () => { return ( @@ -11,3 +11,5 @@ export const OptionShare = () => { ) } + +export default OptionShare \ No newline at end of file diff --git a/src/routes/option-settings.tsx b/src/routes/option-settings.tsx index 6849f7f..3bb60c0 100644 --- a/src/routes/option-settings.tsx +++ b/src/routes/option-settings.tsx @@ -2,7 +2,7 @@ import { SettingsLayout } from "~/components/Layouts/SettingsOptionLayout" import OptionLayout from "~/components/Layouts/Layout" import { SettingOther } from "~/components/Option/Settings/other" -export const OptionSettings = () => { + const OptionSettings = () => { return ( @@ -11,3 +11,5 @@ export const OptionSettings = () => { ) } + +export default OptionSettings \ No newline at end of file diff --git a/src/routes/options-settings-ollama.tsx b/src/routes/options-settings-ollama.tsx index cdbbad1..dad6498 100644 --- a/src/routes/options-settings-ollama.tsx +++ b/src/routes/options-settings-ollama.tsx @@ -2,7 +2,7 @@ import { SettingsLayout } from "~/components/Layouts/SettingsOptionLayout" import OptionLayout from "~/components/Layouts/Layout" import { SettingsOllama } from "~/components/Option/Settings/ollama" -export const OptionOllamaSettings = () => { + const OptionOllamaSettings = () => { return ( @@ -11,3 +11,5 @@ export const OptionOllamaSettings = () => { ) } + +export default OptionOllamaSettings \ No newline at end of file diff --git a/src/routes/sidepanel-chat.tsx b/src/routes/sidepanel-chat.tsx index 0e87879..5921a2b 100644 --- a/src/routes/sidepanel-chat.tsx +++ b/src/routes/sidepanel-chat.tsx @@ -4,7 +4,7 @@ import { SidepanelForm } from "~/components/Sidepanel/Chat/form" import { SidepanelHeader } from "~/components/Sidepanel/Chat/header" import { useMessage } from "~/hooks/useMessage" -export const SidepanelChat = () => { + const SidepanelChat = () => { const drop = React.useRef(null) const [dropedFile, setDropedFile] = React.useState() const [dropState, setDropState] = React.useState< @@ -90,3 +90,5 @@ export const SidepanelChat = () => { ) } + +export default SidepanelChat diff --git a/src/routes/sidepanel-settings.tsx b/src/routes/sidepanel-settings.tsx index ad51649..eae0658 100644 --- a/src/routes/sidepanel-settings.tsx +++ b/src/routes/sidepanel-settings.tsx @@ -1,7 +1,7 @@ import { SettingsBody } from "~/components/Sidepanel/Settings/body" import { SidepanelSettingsHeader } from "~/components/Sidepanel/Settings/header" -export const SidepanelSettings = () => { +const SidepanelSettings = () => { return (
@@ -11,3 +11,5 @@ export const SidepanelSettings = () => {
) } + +export default SidepanelSettings