Compare commits
2 Commits
22a9199d9d
...
9509f12d73
Author | SHA1 | Date | |
---|---|---|---|
|
9509f12d73 | ||
|
021031ced7 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "journal.pl",
|
"name": "journal.pl",
|
||||||
"version": "3.5.0",
|
"version": "3.5.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "journal.pl",
|
"name": "journal.pl",
|
||||||
"version": "3.5.0",
|
"version": "3.5.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@brojs/cli": "^0.0.4-beta.0",
|
"@brojs/cli": "^0.0.4-beta.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "journal.pl",
|
"name": "journal.pl",
|
||||||
"version": "3.5.0",
|
"version": "3.5.1",
|
||||||
"description": "bro-js platform journal ui repo",
|
"description": "bro-js platform journal ui repo",
|
||||||
"main": "./src/index.tsx",
|
"main": "./src/index.tsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import React, { useMemo } from 'react'
|
import React, { useMemo } from 'react'
|
||||||
import { useParams } from 'react-router-dom'
|
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 { 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()
|
||||||
@ -69,14 +68,22 @@ 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>{lesson.name}</td>
|
<td>{<ShortText text={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 <td style={{
|
return (
|
||||||
textAlign: 'center',
|
<td
|
||||||
backgroundColor: wasThere ? '#8ef78a' : '#e09797',
|
style={{
|
||||||
}} key={st.sub}>{wasThere ? '+' : '-'}</td>
|
textAlign: 'center',
|
||||||
|
backgroundColor: wasThere ? '#8ef78a' : '#e09797',
|
||||||
|
}}
|
||||||
|
key={st.sub}
|
||||||
|
>
|
||||||
|
{wasThere ? '+' : '-'}
|
||||||
|
</td>
|
||||||
|
)
|
||||||
})}
|
})}
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
@ -86,3 +93,17 @@ 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
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user