Add custom class card for professor

This commit is contained in:
Leonardo Murça 2022-11-30 16:03:18 -03:00
parent 2b1302ad3a
commit faf7890efa
5 changed files with 94 additions and 33 deletions

View file

@ -17,6 +17,7 @@ function ClassCard({
title, title,
color, color,
teachers, teachers,
course,
layoutType, layoutType,
onClick, onClick,
}) { }) {
@ -45,6 +46,7 @@ function ClassCard({
> >
{title} {title}
</Typography> </Typography>
{teachers && (
<Stack alignItems="center" direction="row" spacing={1}> <Stack alignItems="center" direction="row" spacing={1}>
<AvatarGroup total={teachers.length}> <AvatarGroup total={teachers.length}>
{teachers.map(t => ( {teachers.map(t => (
@ -57,11 +59,17 @@ function ClassCard({
))} ))}
</AvatarGroup> </AvatarGroup>
<Tooltip title={teachers.map(t => t.name).join(', ')}> <Tooltip title={teachers.map(t => t.name).join(', ')}>
<Typography sx={tooltip} variant="body3" color="text.secondary"> <Typography
sx={tooltip}
variant="body3"
color="text.secondary"
>
{teachers.map(t => t.name).join(', ')} {teachers.map(t => t.name).join(', ')}
</Typography> </Typography>
</Tooltip> </Tooltip>
</Stack> </Stack>
)}
{course && <Typography variant="body2">{course}</Typography>}
</CardContent> </CardContent>
</CardActionArea> </CardActionArea>
</Card> </Card>
@ -82,6 +90,7 @@ function ClassCard({
> >
{title} {title}
</Typography> </Typography>
{teachers && (
<Stack alignItems="center" direction="row" spacing={1}> <Stack alignItems="center" direction="row" spacing={1}>
<AvatarGroup total={teachers.length}> <AvatarGroup total={teachers.length}>
{teachers.map(t => ( {teachers.map(t => (
@ -97,6 +106,8 @@ function ClassCard({
{teachers.map(t => t.name).join(', ')} {teachers.map(t => t.name).join(', ')}
</Typography> </Typography>
</Stack> </Stack>
)}
{course && <Typography variant="body2">{course}</Typography>}
</CardContent> </CardContent>
</CardActionArea> </CardActionArea>
</Card> </Card>

View file

@ -30,6 +30,7 @@ function View({ layoutType, classrooms, onClickClassCard }) {
title={classroom.name} title={classroom.name}
color={classroom.color} color={classroom.color}
teachers={classroom.teachers} teachers={classroom.teachers}
course={classroom.course}
layoutType={layoutType} layoutType={layoutType}
onClick={() => onClickClassCard(classroom.id)} onClick={() => onClickClassCard(classroom.id)}
/> />
@ -92,6 +93,7 @@ function View({ layoutType, classrooms, onClickClassCard }) {
title={classroom.name} title={classroom.name}
color={classroom.color} color={classroom.color}
teachers={classroom.teachers} teachers={classroom.teachers}
course={classroom.course}
layoutType={layoutType} layoutType={layoutType}
onClick={() => onClickClassCard(classroom.id)} onClick={() => onClickClassCard(classroom.id)}
/> />

View file

@ -4,8 +4,13 @@ const desktopContainer = {
margin: 0, margin: 0,
}; };
const desktopDivider = {
borderLeft: '4px solid #CFCFCF',
};
const desktop = { const desktop = {
container: desktopContainer, container: desktopContainer,
divider: desktopDivider,
}; };
// ========== Mobile ========== // ========== Mobile ==========
@ -16,8 +21,14 @@ const mobileContainer = {
margin: 0, margin: 0,
}; };
const mobileDivider = {
borderTop: '2px solid #CFCFCF',
paddingTop: '15px',
};
const mobile = { const mobile = {
container: mobileContainer, container: mobileContainer,
divider: mobileDivider,
}; };
// ========== Unset ========== // ========== Unset ==========

View file

@ -9,6 +9,7 @@ import {
allClassroomAnnouncements, allClassroomAnnouncements,
allUpcomingAssignments, allUpcomingAssignments,
allPeople, allPeople,
professorClassrooms,
} from './responses'; } from './responses';
const CommonApi = { const CommonApi = {
@ -124,7 +125,7 @@ const ProfessorApi = {
sleep(300).then(() => { sleep(300).then(() => {
console.log('Get classrooms ' + userId); console.log('Get classrooms ' + userId);
return { return {
data: allClassrooms, data: professorClassrooms,
}; };
}), }),
}; };

View file

@ -95,6 +95,41 @@ const allClassrooms = [
}, },
]; ];
const professorClassrooms = [
{
id: '321',
name: 'Introdução à Ciência de Dados',
abbreviation: 'ICD',
color: '#006FF2',
course: 'BSI 2020',
appointmentSlots: [
{ weekDay: 'Quarta-feira', start: '10:00', end: '11:40' },
{ weekDay: 'Sexta-feira', start: '10:00', end: '11:40' },
],
},
{
id: '123',
name: 'Teoria dos Grafos',
abbreviation: 'TDG',
color: '#d30000',
course: 'BSI 2018',
appointmentSlots: [
{ weekDay: 'Quarta-feira', start: '11:00', end: '12:00' },
{ weekDay: 'Segunda-feira', start: '10:00', end: '11:40' },
],
},
{
id: '123',
name: 'Matemática Discreta',
abbreviation: 'MD',
color: '#149b00',
course: 'BSI 2020',
appointmentSlots: [
{ weekDay: 'Quarta-feira', start: '9:00', end: '10:00' },
],
},
];
const allAssignments = [ const allAssignments = [
{ {
id: '5435', id: '5435',
@ -582,4 +617,5 @@ export {
professorUser, professorUser,
authFailure, authFailure,
allUpcomingAssignments, allUpcomingAssignments,
professorClassrooms,
}; };