Compare commits

...

2 Commits

Author SHA1 Message Date
Primakov Alexandr Alexandrovich
9509f12d73 3.5.1
All checks were successful
platform/bro-js/journal.pl/pipeline/head This commit looks good
2024-11-06 13:04:00 +03:00
Primakov Alexandr Alexandrovich
021031ced7 short lesson name 2024-11-06 13:03:55 +03:00
3 changed files with 32 additions and 11 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "journal.pl",
"version": "3.5.0",
"version": "3.5.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "journal.pl",
"version": "3.5.0",
"version": "3.5.1",
"license": "MIT",
"dependencies": {
"@brojs/cli": "^0.0.4-beta.0",

View File

@ -1,6 +1,6 @@
{
"name": "journal.pl",
"version": "3.5.0",
"version": "3.5.1",
"description": "bro-js platform journal ui repo",
"main": "./src/index.tsx",
"scripts": {

View File

@ -1,11 +1,10 @@
import React, { useMemo } from 'react'
import { useParams } from 'react-router-dom'
import styled from '@emotion/styled'
import { Box, Heading, Tooltip, Text } from '@chakra-ui/react'
import dayjs from 'dayjs'
import { api } from '../../__data__/api/api'
import { PageLoader } from '../../components/page-loader/page-loader'
import { Box, Container, Heading } from '@chakra-ui/react'
import dayjs from 'dayjs'
export const Attendance = () => {
const { courseId } = useParams()
@ -69,14 +68,22 @@ export const Attendance = () => {
{attendance.map((lesson, index) => (
<tr key={lesson.name}>
<td>{dayjs(lesson.date).format('DD.MM.YYYY')}</td>
<td>{lesson.name}</td>
<td>{<ShortText text={lesson.name} />}</td>
{data.students.map((st) => {
const wasThere =
lesson.students.findIndex((u) => u.sub === st.sub) !== -1
return <td style={{
textAlign: 'center',
backgroundColor: wasThere ? '#8ef78a' : '#e09797',
}} key={st.sub}>{wasThere ? '+' : '-'}</td>
return (
<td
style={{
textAlign: 'center',
backgroundColor: wasThere ? '#8ef78a' : '#e09797',
}}
key={st.sub}
>
{wasThere ? '+' : '-'}
</td>
)
})}
</tr>
))}
@ -86,3 +93,17 @@ export const Attendance = () => {
</Box>
)
}
const ShortText = ({ text }: { text: string }) => {
const needShortText = text.length > 20
if (needShortText) {
return (
<Tooltip label="На страницу с лекциями" fontSize="12px" top="16px">
<Text>{text.slice(0, 20)}...</Text>
</Tooltip>
)
}
return text
}