Skip to content

++Refactor Course Dashboard and Lesson Components #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
5449c9d
replaced
guillermoscript Sep 30, 2024
fa1b617
Add CourseDashboard component
guillermoscript Sep 30, 2024
e69456e
Refactor continueTaskAiConversation function in TaskAiActions.tsx
guillermoscript Sep 30, 2024
63b5b2c
Refactor studentResetAiTaskConversation function in lessonsAction.ts
guillermoscript Sep 30, 2024
902ed6c
Fix null reference error in LessonNavigationButtons.tsx
guillermoscript Sep 30, 2024
527bf7b
Refactor course dashboard component
guillermoscript Sep 30, 2024
ccf2171
Refactor localization strings in components.ts
guillermoscript Sep 30, 2024
c429752
Refactor localization strings in components.ts
guillermoscript Sep 30, 2024
60acce0
Refactor user chats section in CoursesStudentPage component
guillermoscript Sep 30, 2024
c18f981
Refactor lesson page component and add progress bar
guillermoscript Sep 30, 2024
39576c1
Refactor CourseDashboard component to accept any type for the course …
guillermoscript Sep 30, 2024
b845252
Refactor CourseSectionComponent to use CourseDashboard in CoursesStud…
guillermoscript Sep 30, 2024
4db5c87
lint change
guillermoscript Sep 30, 2024
9325e7c
Refactor localization strings for StudentDashboard component
guillermoscript Oct 1, 2024
08d2150
Refactor CourseDashboard component to use flex-wrap for CardFooter
guillermoscript Oct 1, 2024
bf5cf28
Refactor StudentDashboard component to use flex-wrap for CardFooter
guillermoscript Oct 1, 2024
bc6eaea
Refactor CourseSectionComponent to use CourseDashboard in CoursesStud…
guillermoscript Oct 1, 2024
cd61320
Refactor CourseSectionComponent to use CourseDashboard in CoursesStud…
guillermoscript Oct 1, 2024
7ae7161
Refactor ViewMarkdown component to improve table responsiveness
guillermoscript Oct 1, 2024
c9e5f4c
Refactor ViewMarkdown component to improve table responsiveness
guillermoscript Oct 2, 2024
3a342ed
Refactor CourseDashboard component to use a responsive container and …
guillermoscript Oct 2, 2024
68252dc
Refactor LessonCard component to improve button styling and add link …
guillermoscript Oct 2, 2024
828b3ab
Refactor CourseSectionComponent to optimize course data retrieval
guillermoscript Oct 2, 2024
2481a01
Refactor student dashboard page to remove unused code
guillermoscript Oct 2, 2024
45e8011
Refactor DashboardHeaderSheet component to add DarkThemeToggle
guillermoscript Oct 2, 2024
cb1f04c
Refactor DashboardHeader component to optimize layout and add DarkThe…
guillermoscript Oct 2, 2024
adf2cfd
Refactor CourseDashboard component to update completed lesson count l…
guillermoscript Oct 3, 2024
f200e6b
Refactor CourseStudentPage component to optimize course data retrieval
guillermoscript Oct 3, 2024
cbcb157
Optimize course data retrieval in CourseStudentPage component
guillermoscript Oct 3, 2024
31e77c3
Optimize course data retrieval in CourseDashboard component
guillermoscript Oct 3, 2024
3bae4ea
Optimize course data retrieval in CourseStudentPage component
guillermoscript Oct 3, 2024
869e3f0
Optimize course data retrieval in CourseStudentPage component
guillermoscript Oct 3, 2024
a5a147e
lint change
guillermoscript Oct 3, 2024
9660c1a
Optimize localization for ExamReview component
guillermoscript Oct 4, 2024
aa8c4dc
new exam page desing for the students
guillermoscript Oct 4, 2024
43fb081
Optimize layout in ExamReview component
guillermoscript Oct 4, 2024
95aa7cd
refacto of exam page
guillermoscript Oct 4, 2024
07c4d87
Refactor breadcrumb component in StudentExamCoursePage
guillermoscript Oct 4, 2024
374d0be
Refactor layout in CourseStudentPage component
guillermoscript Oct 4, 2024
db0b02a
Refactor language translations for exam options
guillermoscript Oct 5, 2024
116456d
lint change
guillermoscript Oct 5, 2024
455b22a
Refactor language translations for comment options
guillermoscript Oct 5, 2024
23670b8
Refactor language translations for comment and exam options and total…
guillermoscript Oct 5, 2024
4228ca6
Refactor language translations for comment editor component
guillermoscript Oct 5, 2024
ab618cb
Refactor language translations for comment options and update UI styling
guillermoscript Oct 5, 2024
4e7a5ea
Refactor language translations for comment options and update UI styling
guillermoscript Oct 5, 2024
aa83e4e
lint change
guillermoscript Oct 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 43 additions & 23 deletions actions/dashboard/AI/TaskAiActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ export async function continueTaskAiConversation(
.messages.find((message) => message.role === 'system')

const result = await streamUI({
model: google('models/gemini-1.5-pro-latest'),
model: google('gemini-1.5-pro-002'),
messages: [
...aiState.get().messages.map((message: any) => ({
role: message.role,
content: message.content,
name: message.name,
})),
],
temperature: 0.9,
temperature: 0.6,
initial: (
<Message
sender={'assistant'}
Expand Down Expand Up @@ -135,15 +135,11 @@ export async function continueTaskAiConversation(
tools: {
makeUserAssigmentCompleted: {
description:
'Function to mark the assignment as completed, you must only call it when the student code is correct and working properly satisfying the requirements of the assignment.',
'Function to mark the assignment as completed, you must only call it when the student code is correct and working properly satisfying the requirements of the assignment. Respond using the language of the student.',
parameters: z.object({
assignmentId: z
.string()
.describe(
'The ID of the assignment to mark as completed.'
),
feedback: z.string().describe('Feedback for the student. Tell them what they did right and what they can improve, if needed.'),
}),
generate: async function ({ assignmentId }) {
generate: async function ({ feedback }) {
const toolCallId = generateId()

aiState.done({
Expand All @@ -161,7 +157,7 @@ export async function continueTaskAiConversation(
args: {
status: 'success',
message:
'Assignment marked as completed.',
feedback,
},
},
],
Expand All @@ -176,15 +172,24 @@ export async function continueTaskAiConversation(
toolCallId,
result: {
status: 'success',
message:
'Assignment marked as completed.',
message: feedback
},
},
],
},
],
})

const message = await supabase
.from('lessons_ai_task_messages')
.insert({
lesson_id: +aiState.get().lessonId,
message: feedback,
sender: 'assistant',
user_id: aiState.get().userId,
created_at: new Date().toISOString(),
})

const task = await supabase
.from('lesson_completions')
.insert({
Expand All @@ -193,17 +198,32 @@ export async function continueTaskAiConversation(
})

return (
<Message
sender={'assistant'}
time={dayjs().format('dddd, MMMM D, YYYY h:mm A')}
isUser={false}
>
<SuccessMessage
status="success"
message="Assignment marked as completed."
fire
/>
</Message>
<>
<Message
sender={'assistant'}
time={dayjs().format('dddd, MMMM D, YYYY h:mm A')}
isUser={false}
>
<MessageContentWrapper
role="assistant"
view={<ViewMarkdown markdown={feedback} />}
edit={<></>}

regenerate={<></>}
/>
</Message>
<Message
sender={'assistant'}
time={dayjs().format('dddd, MMMM D, YYYY h:mm A')}
isUser={false}
>
<SuccessMessage
status="success"
message="Assignment marked as completed."
fire
/>
</Message>
</>
)
},
},
Expand Down
1 change: 0 additions & 1 deletion actions/dashboard/lessonsAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,5 @@ export async function studentResetAiTaskConversation({
if (deleteCompletionData.error) return createResponse('error', 'Error deleting lesson completion', null, 'Error deleting lesson completion')
}

revalidatePath('/dashboard/student/courses/[courseId]/lessons/[lessonId]')
return createResponse('success', 'Message updated successfully', null, null)
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,27 @@ export default async function StudentExamCoursePage ({

return (
<>
<BreadcrumbComponent
links={[
{ href: '/dashboard', label: t('BreadcrumbComponent.dashboard') },
{ href: '/dashboard/student', label: t('BreadcrumbComponent.student') },
{ href: '/dashboard/student/courses/', label: t('BreadcrumbComponent.course') },
{
href: `/dashboard/student/courses/${exams.data?.course_id}`,
label: exams.data?.courses?.title
},
{
href: `/dashboard/student/courses/${exams.data?.course_id}/exams`,
label: t('BreadcrumbComponent.exam')
},
{
href: `/dashboard/student/courses/${exams.data?.course_id}/exams/${exams.data?.exam_id}`,
label: exams.data?.title
}
]}
/>
<div className='container'>
<BreadcrumbComponent
links={[
{ href: '/dashboard', label: t('BreadcrumbComponent.dashboard') },
{ href: '/dashboard/student', label: t('BreadcrumbComponent.student') },
{ href: '/dashboard/student/courses/', label: t('BreadcrumbComponent.course') },
{
href: `/dashboard/student/courses/${exams.data?.course_id}`,
label: exams.data?.courses?.title
},
{
href: `/dashboard/student/courses/${exams.data?.course_id}/exams`,
label: t('BreadcrumbComponent.exam')
},
{
href: `/dashboard/student/courses/${exams.data?.course_id}/exams/${exams.data?.exam_id}`,
label: exams.data?.title
}
]}
/>
</div>
<div className="grid gap-8 container">
<div>
<h1 className="text-3xl font-bold">
Expand Down
Loading
Loading