diff --git a/app/components/home.tsx b/app/components/home.tsx
index ffac64fda..99755cc20 100644
--- a/app/components/home.tsx
+++ b/app/components/home.tsx
@@ -1,5 +1,7 @@
"use client";
+import { Sd } from "@/app/components/sd";
+
require("../polyfill");
import { useState, useEffect } from "react";
@@ -159,6 +161,7 @@ function Screen() {
} />
} />
} />
+ } />
} />
diff --git a/app/components/sd-list.module.scss b/app/components/sd-list.module.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/components/sd-list.tsx b/app/components/sd-list.tsx
new file mode 100644
index 000000000..ba42919a5
--- /dev/null
+++ b/app/components/sd-list.tsx
@@ -0,0 +1,3 @@
+export function SdList() {
+ return
sd-list
;
+}
diff --git a/app/components/sd.module.scss b/app/components/sd.module.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/components/sd.tsx b/app/components/sd.tsx
new file mode 100644
index 000000000..5341e5387
--- /dev/null
+++ b/app/components/sd.tsx
@@ -0,0 +1,3 @@
+export function Sd() {
+ return sd
;
+}
diff --git a/app/components/sidebar.tsx b/app/components/sidebar.tsx
index ea4d70dbb..a06262fef 100644
--- a/app/components/sidebar.tsx
+++ b/app/components/sidebar.tsx
@@ -23,18 +23,24 @@ import {
MIN_SIDEBAR_WIDTH,
NARROW_SIDEBAR_WIDTH,
Path,
+ PLUGINS,
REPO_URL,
} from "../constant";
-import { Link, useNavigate } from "react-router-dom";
+import { Link, useLocation, useNavigate } from "react-router-dom";
import { isIOS, useMobileScreen } from "../utils";
import dynamic from "next/dynamic";
import { Selector, showConfirm, showToast } from "./ui-lib";
+import de from "@/app/locales/de";
const ChatList = dynamic(async () => (await import("./chat-list")).ChatList, {
loading: () => null,
});
+const SdList = dynamic(async () => (await import("./sd-list")).SdList, {
+ loading: () => null,
+});
+
function useHotKey() {
const chatStore = useChatStore();
@@ -141,9 +147,20 @@ export function SideBar(props: { className?: string }) {
[isMobileScreen],
);
const [showPluginSelector, setShowPluginSelector] = useState(false);
+ const location = useLocation();
useHotKey();
+ let bodyComponent: React.JSX.Element;
+ let isChat: boolean;
+ switch (location.pathname) {
+ case Path.Sd:
+ bodyComponent = ;
+ break;
+ default:
+ isChat = true;
+ bodyComponent = ;
+ }
return (
{
- if (e.target === e.currentTarget) {
+ if (isChat && e.target === e.currentTarget) {
navigate(Path.Home);
}
}}
>
-
+ {bodyComponent}
@@ -254,11 +271,16 @@ export function SideBar(props: { className?: string }) {
value: "-",
disable: true,
},
- { title: "Stable Diffusion", value: "sd" },
+ ...PLUGINS.map((item) => {
+ return {
+ title: item.name,
+ value: item.path,
+ };
+ }),
]}
onClose={() => setShowPluginSelector(false)}
onSelection={(s) => {
- console.log("go to page: ", s);
+ navigate(s[0], { state: { fromHome: true } });
}}
/>
)}
diff --git a/app/constant.ts b/app/constant.ts
index 411e48150..c56f77cb9 100644
--- a/app/constant.ts
+++ b/app/constant.ts
@@ -21,6 +21,7 @@ export enum Path {
NewChat = "/new-chat",
Masks = "/masks",
Auth = "/auth",
+ Sd = "/sd",
}
export enum ApiPath {
@@ -213,3 +214,5 @@ export const internalAllowedWebDavEndpoints = [
"https://webdav.yandex.com",
"https://app.koofr.net/dav/Koofr",
];
+
+export const PLUGINS = [{ name: "Stable Diffusion", path: Path.Sd }];