-
-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: students details section (#2506)
* fix: MentorInfo component to render filledContacts correctly * feat: add student detail section * fix: update layout course card * fix: update column width
- Loading branch information
1 parent
0d0b8f9
commit 1f4be2d
Showing
11 changed files
with
403 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
client/src/modules/Students/components/CourseItem/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Flex, List, Space, Typography } from 'antd'; | ||
import { SafetyCertificateTwoTone } from '@ant-design/icons'; | ||
import { UserStudentCourseDto } from 'api'; | ||
|
||
const { Text, Paragraph, Link } = Typography; | ||
|
||
type Props = { | ||
course: UserStudentCourseDto; | ||
}; | ||
|
||
export const CourseItem = ({ course }: Props) => { | ||
const { name, certificateId, mentorGithubId, mentorFullName, rank, totalScore } = course; | ||
|
||
return ( | ||
<List.Item> | ||
<Flex vertical gap={4}> | ||
<Text strong>{name}</Text> | ||
{certificateId && ( | ||
<Paragraph> | ||
<SafetyCertificateTwoTone twoToneColor="#52c41a" />{' '} | ||
<Link target="__blank" href={`/certificate/${certificateId}`}> | ||
Certificate | ||
</Link> | ||
</Paragraph> | ||
)} | ||
{mentorGithubId && ( | ||
<Paragraph> | ||
Mentor: <Link href={`/profile?githubId=${mentorGithubId}`}>{mentorFullName}</Link> | ||
</Paragraph> | ||
)} | ||
<Space wrap> | ||
{rank && <Paragraph>Position: {rank}</Paragraph>} | ||
<Paragraph>Score: {totalScore}</Paragraph> | ||
</Space> | ||
</Flex> | ||
</List.Item> | ||
); | ||
}; |
94 changes: 94 additions & 0 deletions
94
client/src/modules/Students/components/StudentInfo/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { Avatar, Col, Collapse, List, Row, Space, Typography } from 'antd'; | ||
import GithubFilled from '@ant-design/icons/GithubFilled'; | ||
import MailOutlined from '@ant-design/icons/MailOutlined'; | ||
import LinkedinOutlined from '@ant-design/icons/LinkedinOutlined'; | ||
import SkypeOutlined from '@ant-design/icons/SkypeOutlined'; | ||
import PhoneOutlined from '@ant-design/icons/PhoneOutlined'; | ||
import SendOutlined from '@ant-design/icons/SendOutlined'; | ||
import { DiscordOutlined } from 'components/Icons/DiscordOutlined'; | ||
import { GithubAvatar } from 'components/GithubAvatar'; | ||
import { UserStudentDto } from 'api'; | ||
import { CourseItem } from '../CourseItem'; | ||
|
||
type Props = { | ||
student: UserStudentDto; | ||
}; | ||
|
||
const { Panel } = Collapse; | ||
|
||
const { Text } = Typography; | ||
|
||
export function StudentInfo(props: Props) { | ||
const { student } = props; | ||
const { githubId, fullName } = student; | ||
const hasName = fullName && fullName !== '(Empty)'; | ||
const location = [student.city, student.country].filter(Boolean).join(', '); | ||
|
||
const UserContacts = (student: UserStudentDto) => { | ||
const contacts = [ | ||
{ type: 'Email', value: student.contactsEmail, icon: <MailOutlined /> }, | ||
{ type: 'Telegram', value: student.contactsTelegram, icon: <SendOutlined rotate={-45} /> }, | ||
{ type: 'LinkedIn', value: student.contactsLinkedIn, icon: <LinkedinOutlined /> }, | ||
{ type: 'Skype', value: student.contactsSkype, icon: <SkypeOutlined /> }, | ||
{ type: 'Phone', value: student.contactsPhone, icon: <PhoneOutlined /> }, | ||
{ type: 'Discord', value: student.discord?.username, icon: <DiscordOutlined /> }, | ||
]; | ||
return contacts.filter(contact => contact.value); | ||
}; | ||
|
||
return ( | ||
<Space direction="vertical" style={{ width: '100%' }}> | ||
<Row align="middle" gutter={24}> | ||
<Col> | ||
<GithubAvatar githubId={githubId} size={48} /> | ||
</Col> | ||
<Col> | ||
{hasName && ( | ||
<Row> | ||
<Typography.Link target="_blank" href={`/profile?githubId=${githubId}`} strong> | ||
{fullName} | ||
</Typography.Link> | ||
</Row> | ||
)} | ||
<Row> | ||
<Typography.Link target="_blank" href={`https://github.com/${githubId}`}> | ||
<GithubFilled /> {githubId} | ||
</Typography.Link> | ||
</Row> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col span={24}> | ||
<Row> | ||
<Text type="secondary">Location</Text> | ||
</Row> | ||
<Row> | ||
<Text>{location}</Text> | ||
</Row> | ||
</Col> | ||
</Row> | ||
<Collapse defaultActiveKey={['courses']}> | ||
<Panel header="Contacts" key="contacts"> | ||
<List | ||
itemLayout="horizontal" | ||
dataSource={UserContacts(student)} | ||
renderItem={item => ( | ||
<List.Item> | ||
<List.Item.Meta avatar={<Avatar icon={item.icon} />} title={item.type} description={item.value} /> | ||
</List.Item> | ||
)} | ||
/> | ||
</Panel> | ||
<Panel header="Courses" key="courses"> | ||
<List | ||
itemLayout="horizontal" | ||
dataSource={[...student.previousCourses, ...student.onGoingCourses].sort(course => | ||
course.hasCertificate ? -1 : 1, | ||
)} | ||
renderItem={course => <CourseItem course={course} />} | ||
/> | ||
</Panel> | ||
</Collapse> | ||
</Space> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.