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",
"version": "3.5.1",
"version": "3.5.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "journal.pl",
"version": "3.5.1",
"version": "3.5.0",
"license": "MIT",
"dependencies": {
"@brojs/cli": "^0.0.4-beta.0",

View File

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

View File

@ -1,10 +1,11 @@
import React, { useMemo } from 'react'
import { useParams } from 'react-router-dom'
import { Box, Heading, Tooltip, Text } from '@chakra-ui/react'
import dayjs from 'dayjs'
import styled from '@emotion/styled'
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()
@ -68,22 +69,14 @@ export const Attendance = () => {
{attendance.map((lesson, index) => (
<tr key={lesson.name}>
<td>{dayjs(lesson.date).format('DD.MM.YYYY')}</td>
<td>{<ShortText text={lesson.name} />}</td>
<td>{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>
))}
@ -93,17 +86,3 @@ 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
}