From df1d1cc8a9c378ecf2f353fef1857cad686aca3c Mon Sep 17 00:00:00 2001 From: Tom Wise <79859203+tomwisecodes@users.noreply.github.com> Date: Sun, 1 Sep 2024 13:09:01 +0100 Subject: [PATCH] feat: sidebar on mobile --- .../AppComponents/Chat/chat-history.tsx | 25 +++++++++-- .../AppComponents/Chat/clear-history.tsx | 2 + .../export-buttons/LessonPlanProgressBar.tsx | 2 +- .../components/AppComponents/Chat/header.tsx | 2 +- .../AppComponents/Chat/sidebar-item.tsx | 45 +++---------------- .../AppComponents/Chat/sidebar-list.tsx | 5 ++- .../AppComponents/Chat/sidebar-mobile.tsx | 2 +- .../AppComponents/Chat/ui/sheet.tsx | 8 ++-- 8 files changed, 40 insertions(+), 51 deletions(-) diff --git a/apps/nextjs/src/components/AppComponents/Chat/chat-history.tsx b/apps/nextjs/src/components/AppComponents/Chat/chat-history.tsx index 3a5caac89..bb37b249d 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/chat-history.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/chat-history.tsx @@ -2,16 +2,33 @@ import * as React from "react"; +import { OakIcon } from "@oaknational/oak-components"; + import { SidebarList } from "@/components/AppComponents/Chat/sidebar-list"; import ChatButton from "./ui/chat-button"; export function ChatHistory() { return ( -
-
- - New Lesson +
+
+ + + + + New Lesson + + + + + + Ai experiments page + + + + + + Help
diff --git a/apps/nextjs/src/components/AppComponents/Chat/clear-history.tsx b/apps/nextjs/src/components/AppComponents/Chat/clear-history.tsx index d179f06d3..256e76cf6 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/clear-history.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/clear-history.tsx @@ -45,7 +45,9 @@ export function ClearHistory({ isEnabled = false }: ClearHistoryProps) { diff --git a/apps/nextjs/src/components/AppComponents/Chat/export-buttons/LessonPlanProgressBar.tsx b/apps/nextjs/src/components/AppComponents/Chat/export-buttons/LessonPlanProgressBar.tsx index bfe278f8b..5251f88bd 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/export-buttons/LessonPlanProgressBar.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/export-buttons/LessonPlanProgressBar.tsx @@ -55,7 +55,7 @@ export const LessonPlanProgressBar: React.FC = ({ > )} -
+
diff --git a/apps/nextjs/src/components/AppComponents/Chat/sidebar-item.tsx b/apps/nextjs/src/components/AppComponents/Chat/sidebar-item.tsx index 2fba71aee..8407e0907 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/sidebar-item.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/sidebar-item.tsx @@ -6,6 +6,7 @@ import { usePathname } from "#next/navigation"; import { motion } from "framer-motion"; import Link from "next/link"; +import AiIcon from "@/components/AiIcon"; import { buttonVariants } from "@/components/AppComponents/Chat/ui/button"; import { IconMessage, @@ -33,7 +34,6 @@ export function SidebarItem({ index, chat, children }: SidebarItemProps) { const isActive = pathname.includes(chat.id); const [newChatId, setNewChatId] = useLocalStorage("newChatId", null); - const shouldAnimate = index === 0 && isActive && newChatId; return ( -
+
{chat.isShared ? ( This is a shared chat. ) : ( - + )}
- {shouldAnimate ? ( - chat.title.split("").map((character, index) => ( - { - if (index === chat.title.length - 1) { - setNewChatId(null); - } - }} - > - {character} - - )) - ) : ( - {chat.title} - )} + {chat.title}
diff --git a/apps/nextjs/src/components/AppComponents/Chat/sidebar-list.tsx b/apps/nextjs/src/components/AppComponents/Chat/sidebar-list.tsx index 611f04a6e..77d7599d2 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/sidebar-list.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/sidebar-list.tsx @@ -13,10 +13,13 @@ export async function SidebarList() {
+

+ Lesson history +

{chats?.length ? : null}
-
+
0 : false} />
diff --git a/apps/nextjs/src/components/AppComponents/Chat/sidebar-mobile.tsx b/apps/nextjs/src/components/AppComponents/Chat/sidebar-mobile.tsx index 00d818784..bbac986eb 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/sidebar-mobile.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/sidebar-mobile.tsx @@ -30,7 +30,7 @@ export function SidebarMobile({ children }: Readonly) { Toggle Sidebar - + {children} diff --git a/apps/nextjs/src/components/AppComponents/Chat/ui/sheet.tsx b/apps/nextjs/src/components/AppComponents/Chat/ui/sheet.tsx index 5700e9b0c..22958100e 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/ui/sheet.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/ui/sheet.tsx @@ -22,7 +22,7 @@ const sheetVariants = cva( top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", - left: "w-9/4 inset-y-0 left-0 h-full border-r-2 border-black data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", + left: "w-9/4 inset-y-0 left-0 h-full border-black data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm sm:border-r-2", right: "w-9/4 inset-y-0 right-0 h-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", }, @@ -48,8 +48,10 @@ const SheetContent = React.forwardRef< {...props} > {children} - - + +
+ +
Close