Skip to content
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

New syllabus generator error solved and fixed name styling issue #211

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
29 changes: 16 additions & 13 deletions components/UserAvatar/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,27 @@ const styles = {
width: '100%',
},
name: {
maxWidth: '86px',
width: 'auto',
height: '24px',
fontFamily: 'Satoshi Bold',
fontSize: '16px',
color: '#9E94A5',
textAlign: 'left',
lineHeight: '16px',
maxWidth: "150px",
width: "auto",
height: "24px",
fontFamily: "Satoshi Bold",
fontSize: "16px",
color: "#9E94A5",
textAlign: "left",
lineHeight: "16px",
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
},
nameContainer: {
position: 'relative',
position: "relative",
container: true,
item: true,
mobileSmall: true,
display: 'flex',
width: 'auto',
height: '19px',
whiteSpace: 'nowrap',
display: "flex",
width: "auto",
height: "19px",
whiteSpace: "nowrap",
},
userAvatarCircle: {
width: '45px',
Expand Down
108 changes: 10 additions & 98 deletions functions/seed_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -1156,10 +1156,10 @@
"id": "syllabus-generator",
"inputs": [
{
"defaultValue": "5th grade",
"defaultValue": "Elementary",
"label": "Grade Level",
"name": "grade_level",
"placeholder": "Enter the grade level (e.g., 10th Grade)",
"placeholder": "Select the grade level",
"type": "select",
"values": [
{
Expand All @@ -1171,112 +1171,24 @@
"label": "Kindergarten"
},
{
"key": "1st grade",
"label": "1st grade"
"key": "Elementary",
"label": "Elementary"
},
{
"key": "2nd grade",
"label": "2nd grade"
"key": "Middle",
"label": "Middle"
},
{
"key": "3rd grade",
"label": "3rd grade"
},
{
"key": "4th grade",
"label": "4th grade"
},
{
"key": "5th grade",
"label": "5th grade"
},
{
"key": "6th grade",
"label": "6th grade"
},
{
"key": "7th grade",
"label": "7th grade"
},
{
"key": "8th grade",
"label": "8th grade"
},
{
"key": "9th grade",
"label": "9th grade"
},
{
"key": "10th grade",
"label": "10th grade"
},
{
"key": "11th grade",
"label": "11th grade"
},
{
"key": "12th grade",
"label": "12th grade"
"key": "High",
"label": "High"
},
{
"key": "University",
"label": "University"
},
{
"key": "Professional Staff",
"label": "Professional Staff"
},
{
"key": "Year 1",
"label": "Year 1"
},
{
"key": "Year 2",
"label": "Year 2"
},
{
"key": "Year 3",
"label": "Year 3"
},
{
"key": "Year 4",
"label": "Year 4"
},
{
"key": "Year 5",
"label": "Year 5"
},
{
"key": "Year 6",
"label": "Year 6"
},
{
"key": "Year 7",
"label": "Year 7"
},
{
"key": "Year 8",
"label": "Year 8"
},
{
"key": "Year 9",
"label": "Year 9"
},
{
"key": "Year 10",
"label": "Year 10"
},
{
"key": "Year 11",
"label": "Year 11"
},
{
"key": "Year 12",
"label": "Year 12"
},
{
"key": "Year 13",
"label": "Year 13"
"key": "Professional",
"label": "Professional"
}
]
},
Expand Down
20 changes: 20 additions & 0 deletions libs/utils/ToolUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,26 @@ const getToolData = (props) => {
...item,
};
}
case TOOLS_ID.SYLLABUS_GENERATOR: {
const title = `Syllabus - ${item.response.course_information.course_title}`;
const description =
item.response.course_information.description ||
`Syllabus generated from ${item.response.course_information.course_title}`;
const output = item.response;
const backgroundImgURL =
'https://firebasestorage.googleapis.com/v0/b/kai-ai-f63c8.appspot.com/o/Quizify.png?alt=media&token=d1255f27-b1a1-444e-b96a-4a3ac559237d';
const logo =
'https://firebasestorage.googleapis.com/v0/b/kai-ai-f63c8.appspot.com/o/SyllabusLogo.png?alt=media&token=5ea7b96a-d0c9-444a-823f-4fd5721e7e14';

return {
title,
description,
backgroundImgURL,
logo,
output,
...item,
};
}
default:
return {
title: 'Default Title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import styles from './styles';

import FlashCardsOutput from './toolRenderers/FlashCardsOutput';
import QuizOutput from './toolRenderers/QuizOutput';
import SyllabusOutput from './toolRenderers/SyllabusOutput';

import { convertToUnixTimestamp } from '@/libs/utils/FirebaseUtils';
import { copyToClipboard, exportToCSV } from '@/libs/utils/ToolHistoryUtils';
Expand All @@ -14,6 +15,7 @@ import { TOOLS_ID } from '@/tools/libs/constants/tools';
const DRAWER_RENDERERS = {
[TOOLS_ID.MULTIPLE_CHOICE_QUIZ_GENERATOR]: QuizOutput,
[TOOLS_ID.FLASHCARDS_GENERATOR]: FlashCardsOutput,
[TOOLS_ID.SYLLABUS_GENERATOR]: SyllabusOutput,
};

const DEFAULT_DATA = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
import { Grid, List, ListItem, Typography, Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, ListItemText } from '@mui/material';

const formatContent = (content) =>
content.split("\n").map((item) => item.trim().replace(/^[-*]+\s*/, ""));

const renderSection = (title, content) => (
<Paper elevation={3} sx={{ padding: 3, marginBottom: 4 }}>
<Typography variant="h5" gutterBottom>{title}</Typography>
{content}
</Paper>
);

const renderList = (title, items, icon) => (
<>
<Typography variant="subtitle1" gutterBottom><strong>{title}:</strong></Typography>
<List>
{items.map((item, idx) => (
<ListItem key={idx}>
<ListItemText primary={`${icon} ${item}`} />
</ListItem>
))}
</List>
</>
);

const renderTable = (headers, rows, rowRenderer) => (
<TableContainer component={Paper} sx={{ background: 'none', boxShadow: 'none' }}>
<Table sx={{ background: 'none', borderCollapse: 'separate', borderSpacing: '0 10px' }}>
<TableHead>
<TableRow>
{headers.map((header, idx) => (
<TableCell key={idx} sx={{ fontWeight: 'bold', padding: '12px', fontSize: '16px', color: '#ffffff' }}>
{header}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.map((row, idx) => rowRenderer(row, idx))}
</TableBody>
</Table>
</TableContainer>
);

const SyllabusOutput = ({ data }) => {

const response = data?.response || {};

return (
<Grid container direction="column">
{renderSection(
'📘 Course Information',
<>
<Typography variant="subtitle1"><strong>Title:</strong> {response.course_information.course_title}</Typography>
<Typography variant="subtitle1"><strong>Grade Level:</strong> {response.course_information.grade_level}</Typography>
<Typography variant="body1" sx={{ marginTop: 2 }}>{response.course_information.description}</Typography>
</>
)}

{renderSection(
'🎯 Objectives and Learning Outcomes',
<>
{renderList('Objectives', response.course_description_objectives.objectives, '✔️')}
{renderList('Intended Learning Outcomes', response.course_description_objectives.intended_learning_outcomes, '🎓')}
</>
)}

{renderSection(
'📜 Course Content',
renderTable(
['Week', 'Topic'],
response.course_content,
(content, idx) => (
<TableRow
key={idx}
sx={{ backgroundColor: idx % 2 === 0 ? '#333' : '#3c3c3c', borderBottom: '1px solid #555' }}
>
<TableCell sx={{ padding: '12px', fontSize: '14px', color: '#ffffff', fontWeight: 'bold' }}>
Week {content.unit_time_value}
</TableCell>
<TableCell sx={{ padding: '12px', fontSize: '14px', color: '#dcdcdc' }}>
<Typography variant="body1" sx={{ marginBottom: 1, fontWeight: 'bold', color: '#ffffff' }}>
{content.topic.split("\n")[0]}
</Typography>
<List>
{content.topic.split("\n").slice(1).map((item, index) => (
<ListItem key={index} sx={{ padding: 0 }}>
<ListItemText primary={`• ${formatContent(item.trim())}`} sx={{ color: '#c9c9c9' }} />
</ListItem>
))}
</List>
</TableCell>
</TableRow>
)
)
)}

{renderSection(
'⚖️ Policies and Procedures',
<>
<Typography variant="body1"><strong>Attendance Policy:</strong> {response.policies_procedures.attendance_policy}</Typography>
<Typography variant="body1" sx={{ marginTop: 2 }}>
<strong>Late Submission Policy:</strong> {response.policies_procedures.late_submission_policy}
</Typography>
<Typography variant="body1" sx={{ marginTop: 2 }}>
<strong>Academic Honesty:</strong> {response.policies_procedures.academic_honesty}
</Typography>
</>
)}

{renderSection(
'📈 Assessment and Grading',
<>
{renderTable(
['📊 Type', 'Weight'],
response.assessment_grading_criteria.assessment_methods,
(method, idx) => (
<TableRow
key={idx}
sx={{ backgroundColor: idx % 2 === 0 ? '#333' : '#3c3c3c', borderBottom: '1px solid #555' }}
>
<TableCell sx={{ padding: '12px', fontSize: '14px', color: '#ffffff' }}>{method.type_assessment}</TableCell>
<TableCell sx={{ padding: '12px', fontSize: '14px', color: '#c9c9c9' }}>{method.weight}%</TableCell>
</TableRow>
)
)}
{renderTable(
['📝 Range', 'Grade'],
Object.entries(response.assessment_grading_criteria.grading_scale),
([range, grade], idx) => (
<TableRow
key={idx}
sx={{ backgroundColor: idx % 2 === 0 ? '#333' : '#3c3c3c', borderBottom: '1px solid #555' }}
>
<TableCell sx={{ padding: '12px', fontSize: '14px', color: '#ffffff' }}>{range}</TableCell>
<TableCell sx={{ padding: '12px', fontSize: '14px', color: '#c9c9c9' }}>{grade}</TableCell>
</TableRow>
)
)}
</>
)}

{renderSection(
'📚 Learning Resources',
renderList('Resources', response.learning_resources.map(resource => `${resource.title} by ${resource.author} (${resource.year})`), '📖')
)}

{renderSection(
'🗓️ Course Schedule',
renderTable(
['Week', 'Date', 'Topic', 'Activity'],
response.course_schedule,
(schedule, idx) => (
<TableRow key={idx}>
<TableCell>Week {schedule.unit_time_value}</TableCell>
<TableCell>{schedule.date}</TableCell>
<TableCell>{schedule.topic}</TableCell>
<TableCell>{schedule.activity_desc}</TableCell>
</TableRow>
)
)
)}
</Grid>
)
};

export default SyllabusOutput;
Loading