Skip to content

Commit 1e23ec0

Browse files
committed
Merge branch 'main' into handleSend-when-enter-is-pressed
2 parents 62db538 + 5aa7554 commit 1e23ec0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1013
-857
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"Chatrooms",
55
"pipelinerun",
66
"Ragflow",
7+
"Sonner",
78
"supabase",
89
"taskrun",
910
"tekton",

app/chatrooms/[chatroomId]/components/message-area.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import { ChatClientWithSession } from "@shared/lib/ragflow/chat/chat-client";
44
import { UserContext } from "@shared/lib/userContext/userContext";
55
import { Skeleton } from "@shared/components/ui/skeleton";
6-
import { toast } from "@shared/hooks/use-toast";
76
import { createClient } from "@shared/utils/supabase/client";
87
import { Database, Tables } from "@shared/utils/supabase/database.types";
98
// import { revalidatePath } from "next/cache";
109
import Image from "next/image";
1110
import { useContext, useEffect, useState } from "react";
1211
import { askLLM } from "../../actions";
1312
import { createBrowserClient } from "@supabase/ssr";
13+
import { toast } from "sonner";
1414

1515
interface Message extends Tables<"Messages"> {
1616
user_id: string;
@@ -186,9 +186,7 @@ const MessageArea = ({
186186
},
187187
]);
188188
if (messageError) {
189-
toast({
190-
variant: "destructive",
191-
title: "Error sending message to chatroom",
189+
toast.error("Error sending message to chatroom", {
192190
description: "Please refresh and try again",
193191
});
194192
setMessageBoxValue("");
@@ -201,9 +199,7 @@ const MessageArea = ({
201199
if (!askResult.clientCreationSuccess) {
202200
if (!askResult.failedBecauseEmptyDataset) {
203201
// TODO: ask result has more detailed error differntiations if we want to tell the user
204-
toast({
205-
variant: "destructive",
206-
title: "Error sending communicating with LLM",
202+
toast.error("Error sending communicating with LLM", {
207203
description: "Please refresh and try again",
208204
});
209205
setChatClient(null); // In case client is bad, clear it out

app/classroom/page.tsx

Lines changed: 0 additions & 33 deletions
This file was deleted.

app/classroom/[classroomId]/chat/MessageBox.tsx renamed to app/classrooms/[classroomId]/chat/MessageBox.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
RagFlowMessages,
1616
sendMessage,
1717
} from "@shared/lib/ragflow/chat/chat-client";
18-
import { toast } from "@shared/hooks/use-toast";
18+
import { toast } from "sonner";
1919
import Logo from "@/shared/components/Logo";
2020
import { SendIcon } from "lucide-react";
2121
import ReactMarkdown from "react-markdown";
@@ -51,11 +51,9 @@ export default function MessageBox({
5151
setIsLoading(false);
5252

5353
if (!response.ragflowCallSuccess) {
54-
toast({
55-
title: "Error sending message",
56-
description: "Please try refreshing the page",
54+
toast.error("Error sending message", {
55+
description: `Please try refreshing the page`,
5756
duration: 10000,
58-
variant: "destructive",
5957
});
6058
return;
6159
}

app/classroom/[classroomId]/chat/page.tsx renamed to app/classrooms/[classroomId]/chat/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export default async function ChatPage({
139139

140140
// // console.log("chatAssistant", chatAssistant);
141141
return (
142-
<div className="p-4 text-gray-800 dark:text-white">
142+
<div className="p-4">
143143
{/* <p>
144144
<strong>Classroom ID: </strong>
145145
{classroomId}

app/classroom/[classroomId]/manage/_components/inviteMember.tsx renamed to app/classrooms/[classroomId]/manage/_components/inviteMember.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
"use client";
22
import { useState } from "react";
33
import { inviteMemberToClassroom } from "../../../actions";
4-
import { toast } from "@shared/hooks/use-toast";
4+
import { toast } from "sonner";
55

66
export default function InviteMember({ classroomId }: { classroomId: number }) {
77
const [email, setEmail] = useState("");
88
const handleInvite = async () => {
99
try {
1010
await inviteMemberToClassroom(email, classroomId);
1111
setEmail("");
12-
toast({
13-
title: "Added Member Successfully",
12+
toast.success("Added Member Successfully", {
1413
description: `${email} was added to the class.`,
1514
});
1615
} catch (error: unknown) {
1716
//type unknown for typescript lint
1817
if (error instanceof Error) {
19-
toast({
20-
variant: "destructive",
21-
title: "The user is already part of the classroom.",
18+
toast.error(
19+
"The user is already part of the classroom."
2220
// description: { email } + "was added to the class.",
23-
});
21+
);
2422
// console.error(error.message);
2523
} else {
2624
console.error("Error Occured");

app/classroom/[classroomId]/manage/buttons.tsx renamed to app/classrooms/[classroomId]/manage/buttons.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
UserWithClassroomsData,
1919
} from "@shared/lib/userContext/contextFetcher";
2020
import { useRouter } from "next/navigation";
21-
import { toast } from "@shared/hooks/use-toast";
2221
import {
2322
AlertDialog,
2423
AlertDialogAction,
@@ -34,9 +33,10 @@ import { Dispatch, SetStateAction, useTransition } from "react";
3433
import { User } from "@supabase/supabase-js";
3534
import SaveClassroomDialog from "../../_components/saveClassroomDialog";
3635
import { Skeleton } from "@shared/components/ui/skeleton";
37-
import MemberList from "../../memberList";
36+
import MemberList from "../../_components/memberList";
3837
import InviteMember from "./_components/inviteMember";
3938
import { Loader2 } from "lucide-react";
39+
import { toast } from "sonner";
4040

4141
export default function ClassroomManagementButtons({
4242
userData,
@@ -76,13 +76,11 @@ export default function ClassroomManagementButtons({
7676
};
7777

7878
const deleteClassroomFunction = async () => {
79-
router.push(`/classroom`);
79+
router.push(`/classrooms`);
8080
startTransition(async () => {
8181
await deleteClassroom(classroomData.id);
8282
});
83-
toast({
84-
title: "Successfully deleted classroom",
85-
});
83+
toast.success("Successfully deleted classroom");
8684
// const confirmation = window.confirm(
8785
// "Are you sure? This action can't be undone."
8886
// );
@@ -107,10 +105,8 @@ export default function ClassroomManagementButtons({
107105
// refreshClassrooms
108106
// );
109107
setArchiveStatusClassroom(classroomData.id, true);
110-
toast({
111-
title: "Successfully archived classroom",
112-
});
113-
router.push(`/classroom`);
108+
toast.success("Successfully archived classroom");
109+
router.push(`/classrooms`);
114110
// router.push(`/classroom?archive_success=${classroomData.id.toString()}`);
115111
refreshClassrooms();
116112
};

app/classroom/[classroomId]/manage/page.tsx renamed to app/classrooms/[classroomId]/manage/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default function ClassroomManagementPage() {
7070
setUserAndClassCallback={setUserAndClassData}
7171
userData={userAndClassData.userData}
7272
/>
73-
<Link href={`/classroom`} passHref>
73+
<Link href={`/classrooms`} passHref>
7474
<button
7575
type="button"
7676
className="me-2 rounded-lg border border-green-700 px-5 py-2.5 text-center text-sm font-medium text-green-700 hover:bg-green-800 hover:text-white focus:outline-none focus:ring-4 focus:ring-green-300 dark:border-green-500 dark:text-green-500 dark:hover:bg-green-600 dark:hover:text-white dark:focus:ring-green-900"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)