From c1f1286c86a47b87abcca55cbd0177d2a9c92fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Mur=C3=A7a?= Date: Wed, 25 Jan 2023 12:15:17 -0300 Subject: [PATCH] Add people tab for professor --- .../professor/Classroom/PeopleTab/index.js | 217 +++++++++++++++++- .../professor/Classroom/PeopleTab/styles.js | 116 ++++++++++ 2 files changed, 329 insertions(+), 4 deletions(-) diff --git a/src/screens/professor/Classroom/PeopleTab/index.js b/src/screens/professor/Classroom/PeopleTab/index.js index 3d54f36..9dfde7b 100644 --- a/src/screens/professor/Classroom/PeopleTab/index.js +++ b/src/screens/professor/Classroom/PeopleTab/index.js @@ -1,11 +1,122 @@ +import { Avatar, Container, Skeleton, Stack, Typography } from '@mui/material'; +import { createArrayFrom1ToN } from '../../../../utils/createArrayFrom1ToN'; +import styles from './styles'; + function PeopleTab({ layoutType, peopleTabData }) { const layoutResolver = (state, people, layoutType) => { + const { + externalContainer, + sectionContainer, + sectionTitle, + personContainer, + personAvatar, + personName, + emptyStateContainer, + } = styles[layoutType]; if (layoutType === 'desktop') { switch (state) { case 'loading': - return

Loading...

; + return ( + + + + + + + + + + + + {createArrayFrom1ToN(5).map(i => ( + + + + + ))} + + + ); case 'idle': - return

People Tab

; + const professors = people.filter(p => p.role === 'PROFESSOR'); + const students = people.filter(p => p.role === 'STUDENT'); + + return ( + + + + Docentes + + + {professors.length !== 0 ? ( + professors.map(p => ( + + + + {p.name} + + + )) + ) : ( + +

Nenhum professor encontrado!

+
+ )} +
+
+ + + + Discentes + + + {students.length !== 0 ? ( + students.map(p => ( + + + + {p.name} + + + )) + ) : ( + +

Nenhum estudante encontrado!

+
+ )} +
+
+
+ ); case 'gone': return null; default: @@ -14,9 +125,107 @@ function PeopleTab({ layoutType, peopleTabData }) { } else if (layoutType === 'mobile') { switch (state) { case 'loading': - return

Loading...

; + return ( + + + + + + + + + + + + {createArrayFrom1ToN(5).map(i => ( + + + + + ))} + + + ); case 'idle': - return

People Tab

; + const professors = people.filter(p => p.role === 'PROFESSOR'); + const students = people.filter(p => p.role === 'STUDENT'); + + return ( + + + + Docentes + + + {professors.length !== 0 ? ( + professors.map(p => ( + + + + {p.name} + + + )) + ) : ( + +

Nenhum professor encontrado!

+
+ )} +
+
+ + + + Discentes + + + {students.length !== 0 ? ( + students.map(p => ( + + + + {p.name} + + + )) + ) : ( + +

Nenhum estudante encontrado!

+
+ )} +
+
+
+ ); case 'gone': return null; default: diff --git a/src/screens/professor/Classroom/PeopleTab/styles.js b/src/screens/professor/Classroom/PeopleTab/styles.js index e69de29..30668db 100644 --- a/src/screens/professor/Classroom/PeopleTab/styles.js +++ b/src/screens/professor/Classroom/PeopleTab/styles.js @@ -0,0 +1,116 @@ +// ========== Desktop ========== +const desktopExternalContainer = { + marginTop: '50px', + height: '100vh', +}; + +const desktopSectionContainer = { + width: '90%', + marginBottom: '30px', +}; + +const desktopSectionTitle = { + padding: '10px', + borderBottom: '2px solid #00420D', + color: '#00420D', +}; + +const desktopPersonContainer = { + width: '95%', + padding: '20px', + borderBottom: '2px solid #BCBCBC', + display: 'flex', + alignItems: 'center', +}; + +const desktopPersonAvatar = { + width: '60px', + height: '60px', + marginRight: '15px', +}; + +const desktopPersonName = {}; + +const desktopEmptyStateContainer = { + display: 'flex', + justifyContent: 'center', + marginTop: '30px', +}; + +const desktop = { + externalContainer: desktopExternalContainer, + sectionContainer: desktopSectionContainer, + sectionTitle: desktopSectionTitle, + personContainer: desktopPersonContainer, + personAvatar: desktopPersonAvatar, + personName: desktopPersonName, + emptyStateContainer: desktopEmptyStateContainer, +}; + +// ========== Mobile ========== +const mobileExternalContainer = { + marginTop: '50px', + height: '100vh', +}; + +const mobileSectionContainer = { + width: '90%', + marginBottom: '30px', +}; + +const mobileSectionTitle = { + padding: '10px', + borderBottom: '2px solid #00420D', + color: '#00420D', +}; + +const mobilePersonContainer = { + width: '95%', + padding: '20px', + borderBottom: '2px solid #BCBCBC', + display: 'flex', + alignItems: 'center', +}; + +const mobilePersonAvatar = { + width: '40px', + height: '40px', + marginRight: '15px', +}; + +const mobilePersonName = { + overflow: 'hidden', + textOverflow: 'ellipsis', + display: '-webkit-box', + WebkitLineClamp: 1, + WebkitBoxOrient: 'vertical', +}; + +const mobileEmptyStateContainer = { + display: 'flex', + justifyContent: 'center', + marginTop: '30px', +}; + +const mobile = { + externalContainer: mobileExternalContainer, + sectionContainer: mobileSectionContainer, + sectionTitle: mobileSectionTitle, + personContainer: mobilePersonContainer, + personAvatar: mobilePersonAvatar, + personName: mobilePersonName, + emptyStateContainer: mobileEmptyStateContainer, +}; + +// ========== Unset ========== +const unset = { + externalContainer: null, + sectionContainer: null, + sectionTitle: null, + personContainer: null, + personAvatar: null, + personName: null, +}; + +const styles = { desktop, mobile, unset }; +export default styles;