From 14795c50c0554265d8f3dea60271185c8ea27dfc Mon Sep 17 00:00:00 2001 From: DirkSchlossmacher <62424946+DirkSchlossmacher@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:09:48 +0100 Subject: [PATCH] sidebar --- app/components/sidebar.tsx | 230 +++++++++++++++++++------------------ 1 file changed, 118 insertions(+), 112 deletions(-) diff --git a/app/components/sidebar.tsx b/app/components/sidebar.tsx index 480a28418..6cd79bceb 100644 --- a/app/components/sidebar.tsx +++ b/app/components/sidebar.tsx @@ -149,138 +149,144 @@ export function SideBar(props: { className?: string }) { [isMobileScreen], ); + const usageStatsComponent = showUsageStats && setShowUsageStats(false)} />; + useHotKey(); return ( -
-
-
- AdExGPT - via API -
-
- secure local UI for - - OpenAI API - -
- - FAQ & Support - -
-
- {/* Replace img with Image component and add an alt attribute */} - AdEx Logo -
-
- -
- } - text={shouldNarrow ? undefined : Locale.Mask.Name} - className={styles["sidebar-bar-button"]} - onClick={() => { - if (config.dontShowMaskSplashScreen !== true) { - navigate(Path.NewChat, { state: { fromHome: true } }); - } else { - navigate(Path.Masks, { state: { fromHome: true } }); - } - }} - shadow - /> - } - text={shouldNarrow ? undefined : Locale.Plugin.Name} - className={styles["sidebar-bar-button"]} - onClick={() => showToast(Locale.WIP)} - shadow - /> -
- + <> + {usageStatsComponent} {/* This is where the UsageStats component gets rendered */}
{ - if (e.target === e.currentTarget) { - navigate(Path.Home); - } + className={`${styles.sidebar} ${props.className} ${ + shouldNarrow && styles["narrow-sidebar"] + }`} + style={{ + // #3016 disable transition on ios mobile screen + transition: isMobileScreen && isIOSMobile ? "none" : undefined, }} > - -
- -
-
-
- } - onClick={async () => { - if (await showConfirm(Locale.Home.DeleteChat)) { - chatStore.deleteSession(chatStore.currentSessionIndex); - } - }} - /> +
+
+ AdExGPT - via API
- -
- - } shadow /> - -
- -
- - } shadow /> + - -
- } - shadow - onClick={() => signOut()} +
+ {/* Replace img with Image component and add an alt attribute */} + AdEx Logo
-
+ +
} - text={shouldNarrow ? undefined : Locale.Home.NewChat} + icon={} + text={shouldNarrow ? undefined : Locale.Mask.Name} + className={styles["sidebar-bar-button"]} onClick={() => { - if (config.dontShowMaskSplashScreen) { - chatStore.newSession(); - navigate(Path.Chat); + if (config.dontShowMaskSplashScreen !== true) { + navigate(Path.NewChat, { state: { fromHome: true } }); } else { - navigate(Path.NewChat); + navigate(Path.Masks, { state: { fromHome: true } }); } }} shadow /> + } + text={shouldNarrow ? undefined : Locale.Plugin.Name} + className={styles["sidebar-bar-button"]} + onClick={() => showToast(Locale.WIP)} + shadow + /> +
+ +
{ + if (e.target === e.currentTarget) { + navigate(Path.Home); + } + }} + > + +
+ +
+
+
+ } + onClick={async () => { + if (await showConfirm(Locale.Home.DeleteChat)) { + chatStore.deleteSession(chatStore.currentSessionIndex); + } + }} + /> +
+ +
+ + } shadow /> + +
+ + + +
+ } + shadow + onClick={() => signOut()} + /> +
+
+
+ } + text={shouldNarrow ? undefined : Locale.Home.NewChat} + onClick={() => { + if (config.dontShowMaskSplashScreen) { + chatStore.newSession(); + navigate(Path.Chat); + } else { + navigate(Path.NewChat); + } + }} + shadow + /> +
+
+ +
onDragStart(e as any)} + > +
- -
onDragStart(e as any)} - > - -
-
+ + ); }