Compare commits

..

No commits in common. "9509f12d73917ca3f533ddaf2427fe86def65a87" and "22a9199d9d87bf17109efe4f39e114969df61e7c" have entirely different histories.

3 changed files with 11 additions and 32 deletions

4
package-lock.json generated
View File

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

View File

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

View File

@ -1,10 +1,11 @@
import React, { useMemo } from 'react' import React, { useMemo } from 'react'
import { useParams } from 'react-router-dom' import { useParams } from 'react-router-dom'
import { Box, Heading, Tooltip, Text } from '@chakra-ui/react' import styled from '@emotion/styled'
import dayjs from 'dayjs'
import { api } from '../../__data__/api/api' import { api } from '../../__data__/api/api'
import { PageLoader } from '../../components/page-loader/page-loader' import { PageLoader } from '../../components/page-loader/page-loader'
import { Box, Container, Heading } from '@chakra-ui/react'
import dayjs from 'dayjs'
export const Attendance = () => { export const Attendance = () => {
const { courseId } = useParams() const { courseId } = useParams()
@ -68,22 +69,14 @@ export const Attendance = () => {
{attendance.map((lesson, index) => ( {attendance.map((lesson, index) => (
<tr key={lesson.name}> <tr key={lesson.name}>
<td>{dayjs(lesson.date).format('DD.MM.YYYY')}</td> <td>{dayjs(lesson.date).format('DD.MM.YYYY')}</td>
<td>{<ShortText text={lesson.name} />}</td> <td>{lesson.name}</td>
{data.students.map((st) => { {data.students.map((st) => {
const wasThere = const wasThere =
lesson.students.findIndex((u) => u.sub === st.sub) !== -1 lesson.students.findIndex((u) => u.sub === st.sub) !== -1
return ( return <td style={{
<td textAlign: 'center',
style={{ backgroundColor: wasThere ? '#8ef78a' : '#e09797',
textAlign: 'center', }} key={st.sub}>{wasThere ? '+' : '-'}</td>
backgroundColor: wasThere ? '#8ef78a' : '#e09797',
}}
key={st.sub}
>
{wasThere ? '+' : '-'}
</td>
)
})} })}
</tr> </tr>
))} ))}
@ -93,17 +86,3 @@ export const Attendance = () => {
</Box> </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
}