Compare commits
25 Commits
feature/st
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a94acbf7d3 | ||
| 1cd1e26751 | |||
|
|
d7b521c2ec | ||
|
|
a669e2af81 | ||
|
|
f093c0f3ad | ||
| 61cfd689f8 | |||
| 82a54022b2 | |||
| f28c644da5 | |||
| 50bf5b31b6 | |||
| 5670a96696 | |||
| 3a13b68a3d | |||
| fc3366d52a | |||
| 99c95d0706 | |||
| 0bdae7fc23 | |||
| 814e089a67 | |||
| 8f08b5ca52 | |||
| 20aca51375 | |||
| ff58ae2fe1 | |||
| cf843f887d | |||
| 91ea7fddaf | |||
| d084870c49 | |||
| 4d498662f8 | |||
| 1320a50af0 | |||
| 4504961fa0 | |||
| 3e54f0099b |
80
Jenkinsfile
vendored
80
Jenkinsfile
vendored
@@ -1,37 +1,57 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
image 'node:18'
|
image 'node:20'
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
|
||||||
stage('install') {
|
|
||||||
steps {
|
|
||||||
sh 'node -v'
|
|
||||||
sh 'npm -v'
|
|
||||||
sh 'npm ci'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('eslint') {
|
stages {
|
||||||
steps {
|
stage('install') {
|
||||||
sh 'npm run eslint'
|
steps {
|
||||||
}
|
sh 'node -v'
|
||||||
}
|
sh 'npm -v'
|
||||||
|
script {
|
||||||
|
String tag = sh(returnStdout: true, script: 'git tag --contains').trim()
|
||||||
|
String branchName = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
|
||||||
|
String commit = sh(returnStdout: true, script: 'git log -1 --oneline').trim()
|
||||||
|
String commitMsg = commit.substring(commit.indexOf(' ')).trim()
|
||||||
|
|
||||||
stage('build') {
|
if (tag) {
|
||||||
steps {
|
currentBuild.displayName = "#${BUILD_NUMBER}, tag ${tag}"
|
||||||
sh 'npm run build'
|
} else {
|
||||||
}
|
currentBuild.displayName = "#${BUILD_NUMBER}, branch ${branchName}"
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('clean-all') {
|
String author = sh(returnStdout: true, script: "git log -1 --pretty=format:'%an'").trim()
|
||||||
steps {
|
currentBuild.description = "${author}<br />${commitMsg}"
|
||||||
sh 'rm -rf .[!.]*'
|
echo 'starting installing'
|
||||||
sh 'rm -rf ./*'
|
sh 'npm ci'
|
||||||
sh 'ls -a'
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('checks') {
|
||||||
|
parallel {
|
||||||
|
stage('eslint') {
|
||||||
|
steps {
|
||||||
|
sh 'npm run eslint'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('build') {
|
||||||
|
steps {
|
||||||
|
sh 'npm run build'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('clean-all') {
|
||||||
|
steps {
|
||||||
|
sh 'rm -rf .[!.]*'
|
||||||
|
sh 'rm -rf ./*'
|
||||||
|
sh 'ls -a'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ npm install
|
|||||||
пропишите в hosts строку
|
пропишите в hosts строку
|
||||||
|
|
||||||
```
|
```
|
||||||
127.0.0.1 ift-b1.kc.inno-js.test
|
127.0.0.1 journal.test
|
||||||
```
|
```
|
||||||
|
|
||||||
## Запуск
|
## Запуск
|
||||||
@@ -28,4 +28,4 @@ npm install
|
|||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
откройте в браузере [проект](http://ift-b1.kc.inno-js.test)
|
откройте в браузере [проект](http://journal.test)
|
||||||
@@ -1,22 +1,31 @@
|
|||||||
const pkg = require('./package')
|
const pkg = require('./package')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
apiPath: 'stubs/api',
|
apiPath: 'stubs/api',
|
||||||
webpackConfig: {
|
webpackConfig: {
|
||||||
output: {
|
output: {
|
||||||
publicPath: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/`
|
publicPath: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/`,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
navigations: {
|
},
|
||||||
'journal.main': '/journal.pl'
|
navigations: {
|
||||||
|
'journal.main': '/journal.pl',
|
||||||
|
},
|
||||||
|
features: {
|
||||||
|
journal: {
|
||||||
|
'lesson.bar': {
|
||||||
|
on: true,
|
||||||
|
value: '',
|
||||||
|
key: 'lesson.bar',
|
||||||
|
},
|
||||||
|
'group.by.date': {
|
||||||
|
on: true,
|
||||||
|
value: '',
|
||||||
|
key: 'group.by.date',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
features: {
|
},
|
||||||
'journal': {
|
config: {
|
||||||
// add your features here in the format [featureName]: { value: string }
|
'journal.back.url': '/api',
|
||||||
},
|
'journal.polling-interval': '10000',
|
||||||
},
|
},
|
||||||
config: {
|
|
||||||
"journal.back.url": "/api",
|
|
||||||
"journal.polling-interval": "10000"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
5122
package-lock.json
generated
5122
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@@ -1,51 +1,53 @@
|
|||||||
{
|
{
|
||||||
"name": "journal.pl",
|
"name": "journal.pl",
|
||||||
"version": "2.1.1",
|
"version": "2.4.5",
|
||||||
"description": "inno-js platform journal ui repo",
|
"description": "bro-js platform journal ui repo",
|
||||||
"main": "./src/index.tsx",
|
"main": "./src/index.tsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "start chrome http://ift-b1.kc.inno-js.test/journal.pl & ijl-cli server --port=80",
|
"start": "brojs server --port=8099 --with-open-browser",
|
||||||
"build": "npm run clean && ijl-cli build --dev",
|
"build": "npm run clean && brojs build --dev",
|
||||||
"build:prod": "npm run clean && ijl-cli build",
|
"build:prod": "npm run clean && brojs build",
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
"test": "echo ok",
|
"test": "echo ok",
|
||||||
"eslint": "npx eslint ."
|
"eslint": "npx eslint ."
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "ssh://git@85.143.175.152:10022/omni-tech/journal.pl.git"
|
"url": "ssh://git@85.143.175.152:222/bro-js/journal.pl.git"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ijl/cli": "^5.0.3",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
||||||
"@typescript-eslint/parser": "^7.4.0",
|
"@typescript-eslint/parser": "^7.4.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-plugin-react": "^7.34.1"
|
"eslint-plugin-react": "^7.34.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@brojs/cli": "^0.0.4-alpha.9",
|
||||||
"@chakra-ui/icons": "^2.1.1",
|
"@chakra-ui/icons": "^2.1.1",
|
||||||
"@chakra-ui/react": "^2.8.2",
|
"@chakra-ui/react": "^2.8.2",
|
||||||
"@emotion/react": "^11.11.4",
|
"@emotion/react": "^11.11.4",
|
||||||
"@emotion/styled": "^11.11.0",
|
"@emotion/styled": "^11.11.0",
|
||||||
|
"@nivo/bar": "^0.85.1",
|
||||||
"@reduxjs/toolkit": "^2.2.1",
|
"@reduxjs/toolkit": "^2.2.1",
|
||||||
"@types/react": "^18.2.60",
|
"@types/react": "^18.2.60",
|
||||||
"@types/react-dom": "^18.2.19",
|
"@types/react-dom": "^18.2.19",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"express": "^4.18.2",
|
"express": "^4.19.2",
|
||||||
"js-sha256": "^0.11.0",
|
"js-sha256": "^0.11.0",
|
||||||
"keycloak-js": "^23.0.7",
|
"keycloak-js": "^23.0.7",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.3.1",
|
||||||
"react-helmet": "^6.1.0",
|
"react-helmet": "^6.1.0",
|
||||||
"react-hook-form": "^7.51.2",
|
"react-hook-form": "^7.51.2",
|
||||||
"react-redux": "^9.1.0",
|
"react-redux": "^9.1.0",
|
||||||
"react-router-dom": "^6.22.1",
|
"react-router-dom": "^6.22.1",
|
||||||
"redux": "^5.0.1",
|
"redux": "^5.0.1",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3",
|
||||||
|
"webpack-hot-middleware": "^2.26.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
|
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
|
||||||
import { getConfigValue } from '@ijl/cli'
|
import { getConfigValue } from '@brojs/cli'
|
||||||
|
|
||||||
import { keycloak } from '../kc'
|
import { keycloak } from '../kc'
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import Keycloak from 'keycloak-js';
|
import Keycloak from 'keycloak-js';
|
||||||
|
|
||||||
export const keycloak = new Keycloak({
|
export const keycloak = new Keycloak({
|
||||||
url: 'https://kc.inno-js.ru',
|
url: 'https://kc.bro-js.ru',
|
||||||
realm: 'inno-js',
|
realm: 'bro-js',
|
||||||
clientId: 'journal'
|
clientId: 'journal'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, Suspense } from 'react'
|
import React, { useEffect, Suspense } from 'react'
|
||||||
import { Routes, Route, useNavigate } from 'react-router-dom'
|
import { Routes, Route, useNavigate } from 'react-router-dom'
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
import { getNavigationsValue } from '@ijl/cli'
|
import { getNavigationsValue } from '@brojs/cli'
|
||||||
import { Box, Container, Spinner, VStack } from '@chakra-ui/react'
|
import { Box, Container, Spinner, VStack } from '@chakra-ui/react'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { Link as ConnectedLink } from 'react-router-dom'
|
import { Link as ConnectedLink } from 'react-router-dom'
|
||||||
import { getNavigationsValue } from '@ijl/cli'
|
import { getNavigationsValue } from '@brojs/cli'
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useParams, Link } from 'react-router-dom'
|
|||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import QRCode from 'qrcode'
|
import QRCode from 'qrcode'
|
||||||
import { sha256 } from 'js-sha256'
|
import { sha256 } from 'js-sha256'
|
||||||
import { getConfigValue, getNavigationsValue } from '@ijl/cli'
|
import { getConfigValue, getNavigationsValue } from '@brojs/cli'
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
import React, {
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
} from 'react'
|
||||||
|
import { ResponsiveBar } from '@nivo/bar'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { Link, useParams } from 'react-router-dom'
|
import { Link, useParams } from 'react-router-dom'
|
||||||
import { getNavigationsValue } from '@ijl/cli'
|
import { getNavigationsValue, getFeatures } from '@brojs/cli'
|
||||||
import { useForm, Controller } from 'react-hook-form'
|
import { useForm, Controller } from 'react-hook-form'
|
||||||
import {
|
import {
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
@@ -54,6 +60,11 @@ import { Lesson } from '../__data__/model'
|
|||||||
|
|
||||||
import { ErrorSpan, BreadcrumbsWrapper } from './style'
|
import { ErrorSpan, BreadcrumbsWrapper } from './style'
|
||||||
|
|
||||||
|
const features = getFeatures('journal')
|
||||||
|
|
||||||
|
const barFeature = features?.['lesson.bar']
|
||||||
|
const groupByDate = features?.['group.by.date']
|
||||||
|
|
||||||
interface NewLessonForm {
|
interface NewLessonForm {
|
||||||
name: string
|
name: string
|
||||||
date: string
|
date: string
|
||||||
@@ -65,6 +76,8 @@ interface LessonFormProps {
|
|||||||
onCancel: () => void
|
onCancel: () => void
|
||||||
onSubmit: (lesson: Lesson) => void
|
onSubmit: (lesson: Lesson) => void
|
||||||
error?: string
|
error?: string
|
||||||
|
title: string
|
||||||
|
nameButton: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const LessonForm = ({
|
const LessonForm = ({
|
||||||
@@ -73,6 +86,8 @@ const LessonForm = ({
|
|||||||
onCancel,
|
onCancel,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
error,
|
error,
|
||||||
|
title,
|
||||||
|
nameButton,
|
||||||
}: LessonFormProps) => {
|
}: LessonFormProps) => {
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
@@ -90,7 +105,7 @@ const LessonForm = ({
|
|||||||
<Card align="left">
|
<Card align="left">
|
||||||
<CardHeader display="flex">
|
<CardHeader display="flex">
|
||||||
<Heading as="h2" mt="0">
|
<Heading as="h2" mt="0">
|
||||||
Создание лекции
|
{title}
|
||||||
</Heading>
|
</Heading>
|
||||||
<CloseButton
|
<CloseButton
|
||||||
ml="auto"
|
ml="auto"
|
||||||
@@ -153,7 +168,7 @@ const LessonForm = ({
|
|||||||
colorScheme="blue"
|
colorScheme="blue"
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
>
|
>
|
||||||
Создать
|
{nameButton}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</VStack>
|
</VStack>
|
||||||
@@ -168,7 +183,7 @@ const LessonForm = ({
|
|||||||
const LessonList = () => {
|
const LessonList = () => {
|
||||||
const { courseId } = useParams()
|
const { courseId } = useParams()
|
||||||
const user = useAppSelector((s) => s.user)
|
const user = useAppSelector((s) => s.user)
|
||||||
const { data, isLoading, error } = api.useLessonListQuery(courseId)
|
const { data, isLoading, error, isSuccess } = api.useLessonListQuery(courseId)
|
||||||
const [createLesson, crLQuery] = api.useCreateLessonMutation()
|
const [createLesson, crLQuery] = api.useCreateLessonMutation()
|
||||||
const [deleteLesson, deletingRqst] = api.useDeleteLessonMutation()
|
const [deleteLesson, deletingRqst] = api.useDeleteLessonMutation()
|
||||||
const [updateLesson, updateLessonRqst] = api.useUpdateLessonMutation()
|
const [updateLesson, updateLessonRqst] = api.useUpdateLessonMutation()
|
||||||
@@ -179,6 +194,37 @@ const LessonList = () => {
|
|||||||
const toastRef = useRef(null)
|
const toastRef = useRef(null)
|
||||||
const createdLessonRef = useRef(null)
|
const createdLessonRef = useRef(null)
|
||||||
const [editLesson, setEditLesson] = useState<Lesson>(null)
|
const [editLesson, setEditLesson] = useState<Lesson>(null)
|
||||||
|
const sorted = useMemo(() => [...(data?.body || [])]?.sort((a, b) => a.date > b.date ? 1 : -1), [data, data?.body])
|
||||||
|
|
||||||
|
const lessonCalc = useMemo(() => {
|
||||||
|
if (!isSuccess) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!groupByDate) {
|
||||||
|
return [{ date: '', data: sorted }]
|
||||||
|
}
|
||||||
|
|
||||||
|
const lessonsData = []
|
||||||
|
for (let i = 0; i < sorted.length; i++) {
|
||||||
|
const element = sorted[i]
|
||||||
|
const find = lessonsData.find(
|
||||||
|
(item) => dayjs(element.date).diff(dayjs(item.date), 'day') === 0,
|
||||||
|
)
|
||||||
|
|
||||||
|
if (find) {
|
||||||
|
find.data.push(element)
|
||||||
|
} else {
|
||||||
|
lessonsData.push({
|
||||||
|
date: element.date,
|
||||||
|
data: [element],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return lessonsData.sort((a, b) => a.date < b.date? 1 : -1)
|
||||||
|
}, [groupByDate, isSuccess, sorted])
|
||||||
|
|
||||||
const onSubmit = (lessonData) => {
|
const onSubmit = (lessonData) => {
|
||||||
toastRef.current = toast({
|
toastRef.current = toast({
|
||||||
@@ -329,7 +375,7 @@ const LessonList = () => {
|
|||||||
</BreadcrumbItem>
|
</BreadcrumbItem>
|
||||||
</Breadcrumb>
|
</Breadcrumb>
|
||||||
</BreadcrumbsWrapper>
|
</BreadcrumbsWrapper>
|
||||||
<Container maxW="container.xl">
|
<Container maxW="container.xl" position="relative">
|
||||||
{isTeacher(user) && (
|
{isTeacher(user) && (
|
||||||
<Box mt="15" mb="15">
|
<Box mt="15" mb="15">
|
||||||
{showForm ? (
|
{showForm ? (
|
||||||
@@ -343,6 +389,8 @@ const LessonList = () => {
|
|||||||
}}
|
}}
|
||||||
error={(crLQuery.error as any)?.error}
|
error={(crLQuery.error as any)?.error}
|
||||||
lesson={editLesson}
|
lesson={editLesson}
|
||||||
|
title={editLesson ? 'Редактирование лекции' : 'Создание лекции'}
|
||||||
|
nameButton={editLesson ? 'Редактировать' : 'Создать'}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Box p="2" m="2">
|
<Box p="2" m="2">
|
||||||
@@ -357,7 +405,17 @@ const LessonList = () => {
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<TableContainer whiteSpace="wrap">
|
{barFeature && sorted?.length && (
|
||||||
|
<Box height="300">
|
||||||
|
<Bar
|
||||||
|
data={sorted.map((lesson, index) => ({
|
||||||
|
lessonIndex: `#${index + 1}`,
|
||||||
|
count: lesson.students.length,
|
||||||
|
}))}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
<TableContainer whiteSpace="wrap" pb={13}>
|
||||||
<Table variant="striped" colorScheme="cyan">
|
<Table variant="striped" colorScheme="cyan">
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
@@ -370,53 +428,62 @@ const LessonList = () => {
|
|||||||
Дата
|
Дата
|
||||||
</Th>
|
</Th>
|
||||||
<Th>Название</Th>
|
<Th>Название</Th>
|
||||||
<Th>action</Th>
|
{isTeacher(user) && <Th>action</Th>}
|
||||||
<Th isNumeric>Отмечено</Th>
|
<Th isNumeric>Отмечено</Th>
|
||||||
</Tr>
|
</Tr>
|
||||||
</Thead>
|
</Thead>
|
||||||
<Tbody>
|
<Tbody>
|
||||||
{data?.body?.map((lesson) => (
|
{lessonCalc?.map(({ data: lessons, date }) => (
|
||||||
<Tr key={lesson._id}>
|
<React.Fragment key={date}>
|
||||||
{isTeacher(user) && (
|
{date && <Tr><Td colSpan={isTeacher(user) ? 5 : 3}>{dayjs(date).format('DD MMMM YYYY')}</Td></Tr>}
|
||||||
<Td>
|
{lessons.map((lesson) => (
|
||||||
<Link
|
<Tr key={lesson._id}>
|
||||||
to={`${getNavigationsValue('journal.main')}/lesson/${courseId}/${lesson._id}`}
|
{isTeacher(user) && (
|
||||||
style={{ display: 'flex' }}
|
<Td>
|
||||||
>
|
<Link
|
||||||
<img
|
to={`${getNavigationsValue('journal.main')}/lesson/${courseId}/${lesson._id}`}
|
||||||
width={24}
|
style={{ display: 'flex' }}
|
||||||
src={qrCode}
|
>
|
||||||
style={{ margin: '0 auto' }}
|
<img
|
||||||
/>
|
width={24}
|
||||||
</Link>
|
src={qrCode}
|
||||||
</Td>
|
style={{ margin: '0 auto' }}
|
||||||
)}
|
/>
|
||||||
<Td textAlign="center">
|
</Link>
|
||||||
{dayjs(lesson.date).format('H:mm DD.MM.YY')}
|
</Td>
|
||||||
</Td>
|
)}
|
||||||
<Td>{lesson.name}</Td>
|
<Td textAlign="center">
|
||||||
<Td>
|
{dayjs(lesson.date).format(groupByDate ? 'HH:mm' : 'HH:mm DD.MM.YY')}
|
||||||
<Menu>
|
</Td>
|
||||||
<MenuButton as={Button}>
|
<Td>{lesson.name}</Td>
|
||||||
<EditIcon />
|
{isTeacher(user) && (
|
||||||
</MenuButton>
|
<Td>
|
||||||
<MenuList>
|
<Menu>
|
||||||
<MenuItem
|
<MenuButton as={Button}>
|
||||||
onClick={() => {
|
<EditIcon />
|
||||||
setShowForm(true)
|
</MenuButton>
|
||||||
setEditLesson(lesson)
|
<MenuList>
|
||||||
}}
|
<MenuItem
|
||||||
>
|
onClick={() => {
|
||||||
Edit
|
setShowForm(true)
|
||||||
</MenuItem>
|
setEditLesson(lesson)
|
||||||
<MenuItem onClick={() => setlessonToDelete(lesson)}>
|
}}
|
||||||
Delete
|
>
|
||||||
</MenuItem>
|
Edit
|
||||||
</MenuList>
|
</MenuItem>
|
||||||
</Menu>
|
<MenuItem
|
||||||
</Td>
|
onClick={() => setlessonToDelete(lesson)}
|
||||||
<Td isNumeric>{lesson.students.length}</Td>
|
>
|
||||||
</Tr>
|
Delete
|
||||||
|
</MenuItem>
|
||||||
|
</MenuList>
|
||||||
|
</Menu>
|
||||||
|
</Td>
|
||||||
|
)}
|
||||||
|
<Td isNumeric>{lesson.students.length}</Td>
|
||||||
|
</Tr>
|
||||||
|
))}
|
||||||
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</Tbody>
|
</Tbody>
|
||||||
</Table>
|
</Table>
|
||||||
@@ -427,3 +494,29 @@ const LessonList = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default LessonList
|
export default LessonList
|
||||||
|
|
||||||
|
const Bar = ({ data }) => (
|
||||||
|
<ResponsiveBar
|
||||||
|
data={data}
|
||||||
|
keys={['count']}
|
||||||
|
indexBy="lessonIndex"
|
||||||
|
margin={{ top: 50, right: 130, bottom: 50, left: 60 }}
|
||||||
|
padding={0.3}
|
||||||
|
valueScale={{ type: 'linear' }}
|
||||||
|
indexScale={{ type: 'band', round: true }}
|
||||||
|
colors={{ scheme: 'set3' }}
|
||||||
|
axisTop={null}
|
||||||
|
axisRight={null}
|
||||||
|
labelSkipWidth={12}
|
||||||
|
labelSkipHeight={12}
|
||||||
|
labelTextColor={{
|
||||||
|
from: 'color',
|
||||||
|
modifiers: [['brighter', 1.4]],
|
||||||
|
}}
|
||||||
|
role="application"
|
||||||
|
ariaLabel="График посещаемости лекций"
|
||||||
|
barAriaLabel={(e) =>
|
||||||
|
e.id + ': ' + e.formattedValue + ' on lection: ' + e.indexValue
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -22,4 +22,4 @@
|
|||||||
"**/*.test.tsx",
|
"**/*.test.tsx",
|
||||||
"node_modules/@types/jest"
|
"node_modules/@types/jest"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user